diff --git a/src/app/core/services/private-catalogs.service.ts b/src/app/core/services/private-catalogs.service.ts index 2b38f8f187c2a68db7e67a358920ee225216fff2..3c4e88c6fa497e0832ef3d3078d43d1254034e58 100644 --- a/src/app/core/services/private-catalogs.service.ts +++ b/src/app/core/services/private-catalogs.service.ts @@ -4,12 +4,14 @@ import { Observable, catchError, map, tap } from 'rxjs'; import { HttpSharedService } from '../http-shared/http-shared.service'; import { HttpClient, HttpEvent, HttpRequest } from '@angular/common/http'; import { + AuthorPublisherModel, CommentModel, PublicSolution, ThreadModel, UserDetails, } from 'src/app/shared/models'; import { CreateRatingRequestPayload } from 'src/app/shared/models/request-payloads'; +import { MessageStatusModel } from 'src/app/shared/models/message-status.model'; @Injectable({ providedIn: 'root', @@ -122,7 +124,7 @@ export class PrivateCatalogsService { ); } - uploadFileToUrl( + uploadExistingModelLicenseProfile( loginUserID: string, solutionId: string, revisionId: string, @@ -140,8 +142,6 @@ export class PrivateCatalogsService { revisionId + '/' + versionId; - const uploadUrl = - 'https://dev02.ki-lab.nrw/api/license/upload/9b36ce33-ec9c-48e3-964f-5fd7e75ede6c/620ec698-4027-414a-8b9f-8d6503cbf35b/86e0f4fd-694a-4ba2-ba9f-bb3db1dc850f/1.0.0'; const formData = new FormData(); formData.append('file', file); @@ -154,6 +154,24 @@ export class PrivateCatalogsService { return this.http.request(req); } + uploadNewModelLicenseProfile(userId: string, file: File) { + const url = + apiConfig.apiBackendURL + + '/api/model/upload/' + + userId + + '/?licUploadFlag=' + + true; + const formData = new FormData(); + formData.append('file', file); + + const req = new HttpRequest('POST', url, formData, { + reportProgress: true, + responseType: 'json', + }); + + return this.http.request(req); + } + createUpdateLicenseProfile( loginUserID: string, solutionId: string, @@ -377,4 +395,136 @@ export class PrivateCatalogsService { }), ); } + + getAuthors( + solutionId: string, + revisionId: string, + ): Observable<AuthorPublisherModel[]> { + const url = `${apiConfig.apiBackendURL}/api/solution/${solutionId}/revision/${revisionId}/authors`; + return this._httpSharedService.get(url, undefined).pipe( + map((res) => res.response_body), + catchError((error) => { + throw error; + }), + ); + } + + addAuthor( + solutionId: string, + revisionId: string, + author: AuthorPublisherModel, + ): Observable<AuthorPublisherModel[]> { + const url = `${apiConfig.apiBackendURL}/api/solution/${solutionId}/revision/${revisionId}/authors`; + const obj = { + request_body: author, + }; + + return this._httpSharedService.put(url, undefined, obj).pipe( + map((res) => res.response_body), + catchError((error) => { + throw error; + }), + ); + } + + removeAuthor( + solutionId: string, + revisionId: string, + author: AuthorPublisherModel, + ): Observable<AuthorPublisherModel[]> { + const url = `${apiConfig.apiBackendURL}/api/solution/${solutionId}/revision/${revisionId}/removeAuthor`; + const obj = { + request_body: author, + }; + + return this._httpSharedService.put(url, undefined, obj).pipe( + map((res) => res.response_body), + catchError((error) => { + throw error; + }), + ); + } + + getPublisher(solutionId: string, revisionId: string): Observable<string> { + const url = `${apiConfig.apiBackendURL}/api/solution/${solutionId}/revision/${revisionId}/publisher`; + return this._httpSharedService.get(url, undefined).pipe( + map((res) => res.response_body), + catchError((error) => { + throw error; + }), + ); + } + + updatePublisher( + solutionId: string, + revisionId: string, + publisherName: string, + ) { + const url = `${apiConfig.apiBackendURL}/api/solution/${solutionId}/revision/${revisionId}/publisher`; + const obj = publisherName; + + return this._httpSharedService.put(url, undefined, obj).pipe( + catchError((error) => { + throw error; + }), + ); + } + + addCatalog( + userId: string, + solutionName: string, + dockerUrl: string, + ): Observable<string> { + const urlCreateFavorite = + apiConfig.apiBackendURL + apiConfig.urlAddToCatalog + '/' + userId; + + const addToReqObj = { + request_body: { + name: solutionName, + dockerfileURI: dockerUrl, + }, + }; + + return this._httpSharedService + .post(urlCreateFavorite, undefined, addToReqObj) + .pipe( + map((res) => res.response_detail), + catchError((error) => { + throw error; + }), + ); + } + uploadProtoBufFile(file: File) { + const url = + apiConfig.apiBackendURL + '/api/proto/upload/' + '?protoUploadFlag=true'; + + const formData = new FormData(); + formData.append('file', file); + + const req = new HttpRequest('POST', url, formData, { + reportProgress: true, + responseType: 'json', + }); + + return this.http.request(req); + } + + getMessagingStatus( + userId: string, + trackId: string, + ): Observable<MessageStatusModel[]> { + const url = + apiConfig.apiBackendURL + + apiConfig.urlMessagingStatus + + '/' + + userId + + '/' + + trackId; + return this._httpSharedService.post(url, undefined).pipe( + map((res) => res.response_body), + catchError((error) => { + throw error; + }), + ); + } } diff --git a/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.html b/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.html index 6d7855c75085eda98037d1b057ea38b6bdb73a58..de2757cd2b6a10a83742a2e3e192c7cc43e6216e 100644 --- a/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.html +++ b/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.html @@ -1,6 +1,6 @@ <mat-toolbar class="dialog-header"> <div style="display: flex; align-items: center; padding: 0; flex: 1 1 auto"> - <h2>Delete Shared Member</h2> + <h2>{{ title }}</h2> </div> <button type="button" @@ -15,8 +15,7 @@ <mat-dialog-content> <div class="star-rating-container"> <p> - Would you like to delete '{{ user.firstName }} {{ user.lastName }}' from - the shared list? + {{ content }} </p> </div></mat-dialog-content > diff --git a/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.ts b/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.ts index 64dcefb259fcb47873718893ec6a718d72587c21..fbfaa3af718d861ffb25f27fb703fa7dcbcc482a 100644 --- a/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.ts +++ b/src/app/shared/components/delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component.ts @@ -27,34 +27,38 @@ import { AlertService } from 'src/app/core/services/alert.service'; styleUrl: './delete-user-dialog-confirmation-action.component.scss', }) export class DeleteUserDialogConfirmationActionComponent implements OnInit { - user!: UserDetails; + title!: string; + content!: string; + alertMessage!: string; constructor( public dialogRef: MatDialogRef<DeleteUserDialogConfirmationActionComponent>, - private privateCatalogsService: PrivateCatalogsService, @Inject(MAT_DIALOG_DATA) public data: any, private alertService: AlertService, ) {} ngOnInit(): void { - this.user = this.data.dataKey.user; + this.title = this.data.dataKey.title; + this.content = this.data.dataKey.content; + this.alertMessage = this.data.dataKey.alertMessage; } confirm() { - this.privateCatalogsService - .deleteShareWithTeam(this.user.userId ?? '', this.data.dataKey.solutionId) - .subscribe((res) => { - const alert: Alert = { - message: '', - type: AlertType.Success, - }; - - if (res.error_code === '100') { - alert.message = 'Deleted successfully. '; - } - - this.alertService.notify(alert, 3000); - this.dialogRef.close(); - }); + this.data.dataKey.action().subscribe({ + next: (res: any) => { + this.alertService.notify( + { message: this.alertMessage, type: AlertType.Success }, + 3000, + ); + this.dialogRef.close(true); + }, + error: (err: any) => { + this.alertService.notify( + { message: 'Operation failed', type: AlertType.Error }, + 3000, + ); + this.dialogRef.close(false); + }, + }); } } diff --git a/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.html b/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.html index 245dc49bd4dc3307fe9bc97d01ef1a883976e467..03d0f1520003d6f184819ad84962e6711e2c066e 100644 --- a/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.html +++ b/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.html @@ -1 +1,196 @@ <div class="workflow-right-header workflow-header">Manage Authors</div> +<div style="display: flex; width: 100%; height: 60%; padding: 20px"> + <div + style=" + display: flex; + flex-direction: column; + padding: 10px; + width: 100%; + gap: 20px; + " + > + <span>PUBLISHER</span> + <mat-divider></mat-divider> + <form + style="display: flex; flex-direction: column; height: 100%" + [formGroup]="publisherForm" + > + <div + style="display: flex; flex-direction: column; flex-grow: 1; gap: 20px" + > + <mat-label>Publisher Name </mat-label> + <div style="display: flex; flex-direction: column"> + <mat-form-field> + <input class="example-full-width" matInput formControlName="name" /> + @if (publisherForm.value.name) { + <button + matSuffix + mat-icon-button + aria-label="Clear" + (click)="publisherForm.setValue({ name: '' })" + > + <mat-icon>close</mat-icon> + </button> + } + @if ( + publisherForm.controls["name"].hasError("required") && + publisherForm.controls["name"].touched + ) { + <mat-error class="modal-error" + >Publisher name is required</mat-error + > + } + + @if ( + publisherForm.controls["name"].errors?.["minlength"] && + publisherForm.controls["name"].touched + ) { + <mat-error class="modal-error" + >Publisher name should contain at least 2 characters.</mat-error + > + } + @if ( + publisherForm.controls["name"].errors?.["pattern"] && + publisherForm.controls["name"].touched + ) { + <mat-error class="modal-error" + >Publisher name must contain only alphanumeric + letters.</mat-error + > + } + @if (publisherForm.get("name")?.hasError("sameAsPublisher")) { + <mat-error class="modal-error" + >Please type in a new publisher name to save changes.</mat-error + > + } + </mat-form-field> + </div> + </div> + + <div style="display: flex; justify-content: space-between"> + <button + style="margin-right: 20px; width: 135px" + mat-raised-button + (click)="onCancelClick()" + > + Discard changes + </button> + <button + style="margin-right: 20px; width: 100px" + color="primary" + mat-raised-button + (click)="OnEditPublisherClick()" + [disabled]="!publisherForm.controls['name'].value" + > + Save + </button> + </div> + </form> + </div> + <mat-divider vertical style="height: auto"></mat-divider> + <div + style=" + display: flex; + flex-direction: column; + padding: 10px; + width: 100%; + height: 100%; + " + > + <div style="display: flex; flex-direction: column; gap: 20px; height: 100%"> + <span>AUTHORS</span> + <mat-divider></mat-divider> + <mat-chip-set #chipGrid> + @for (author of authorsList; track author) { + <mat-chip-row (removed)="onRemoveAuthorClick(author)"> + {{ author.name }} + <button matChipRemove [attr.aria-label]="'remove ' + author.name"> + <mat-icon>cancel</mat-icon> + </button> + </mat-chip-row> + } @empty { + <span>No authors listed.</span> + } + </mat-chip-set> + Please add additional names of one or more author of this model. + <form + style=" + display: flex; + flex-direction: column; + + height: 100%; + " + [formGroup]="authorForm" + #formDirective="ngForm" + > + <div style="display: flex; flex-direction: column; flex-grow: 1"> + <div style="display: flex; flex-direction: column"> + <mat-label class="asterisk--after">Name </mat-label> + <mat-form-field> + <input + class="example-full-width" + matInput + formControlName="name" + /> + @if (authorForm.value.name) { + <button + matSuffix + mat-icon-button + aria-label="Clear" + (click)="authorForm.controls['name'].setValue('')" + > + <mat-icon>close</mat-icon> + </button> + } + @if (authorForm.controls["contact"].hasError("required")) { + <mat-error class="modal-error">Name is required</mat-error> + } + </mat-form-field> + </div> + <div style="display: flex; flex-direction: column"> + <mat-label class="asterisk--after"> Contact Info</mat-label> + <div style="display: flex; flex-direction: column"> + <mat-form-field> + <input + class="example-full-width" + matInput + formControlName="contact" + /> + @if (authorForm.value.contact) { + <button + matSuffix + mat-icon-button + aria-label="Clear" + (click)="authorForm.controls['contact'].setValue('')" + > + <mat-icon>close</mat-icon> + </button> + } + <mat-hint align="start" class="modal-note example-full-width" + >You can mention Email Address,URL and Phone Number + </mat-hint> + </mat-form-field> + @if ( + authorForm.controls["contact"].hasError("required") && + authorForm.controls["contact"].touched + ) { + <mat-error class="modal-error" + >Contact info is required</mat-error + > + } + </div> + </div> + </div> + <button + color="primary" + style="align-self: end; margin-right: 20px; width: 100px" + mat-raised-button + (click)="onAddAuthorClick(formDirective)" + [disabled]="!authorForm.valid" + > + Add author + </button> + </form> + </div> + </div> +</div> diff --git a/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.scss b/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.scss index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b57625fed110a371378d43cffe51e4419db52553 100644 --- a/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.scss +++ b/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.scss @@ -0,0 +1,42 @@ +.example-full-width { + width: 100%; +} +.purple { + color: #671c9d; +} + +.mat-divider.mat-divider-vertical { + border-right-style: solid; + border-right-color: rgb(246, 243, 250); + border-right-width: 2px; +} + +.modal-note { + color: #888; + font-size: 12px; + font-family: "Open Sans", sans-serif !important; +} + +::ng-deep.mat-mdc-form-field-hint-wrapper, +::ng-deep.mat-mdc-form-field-error-wrapper { + padding: 0px !important; +} + +.asterisk--after:after { + content: "*"; + color: red; +} + +.modal-error { + color: red; + font-size: 12px; + font-family: "Open Sans", sans-serif !important; +} + +.btn-comments-edit { + background: #f1f1f1 url("../../../../assets/images/Comment_edit.png") + no-repeat 3px center; + width: 60px; + margin-left: 4px; + cursor: pointer; +} diff --git a/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.ts b/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.ts index 4fcaff893bf56e986d42627ddcad3c823a3288da..ac48c024f9f3f5db31d308b50b5c97c3ba2c369b 100644 --- a/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.ts +++ b/src/app/shared/components/manage-publisher-authors-page/manage-publisher-authors-page.component.ts @@ -1,13 +1,334 @@ -import { Component } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { CommonModule } from '@angular/common'; +import { MatButtonModule } from '@angular/material/button'; +import { MatDividerModule } from '@angular/material/divider'; +import { + AbstractControl, + AsyncValidatorFn, + FormBuilder, + FormControl, + FormGroup, + FormGroupDirective, + FormsModule, + ReactiveFormsModule, + ValidatorFn, + Validators, +} from '@angular/forms'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { ActivatedRoute, Router } from '@angular/router'; +import { SharedDataService } from 'src/app/core/services/shared-data/shared-data.service'; +import { PublicSolutionsService } from 'src/app/core/services/public-solutions.service'; +import { PrivateCatalogsService } from 'src/app/core/services/private-catalogs.service'; +import { Alert, AlertType, AuthorPublisherModel } from '../../models'; +import { MatChipsModule } from '@angular/material/chips'; +import { MatIconModule } from '@angular/material/icon'; +import { LiveAnnouncer } from '@angular/cdk/a11y'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { DeleteUserDialogConfirmationActionComponent } from '../delete-user-dialog-confirmation-action/delete-user-dialog-confirmation-action.component'; +import { Observable, map, of } from 'rxjs'; +import { AlertService } from 'src/app/core/services/alert.service'; @Component({ selector: 'gp-manage-publisher-authors-page', standalone: true, - imports: [CommonModule], + imports: [ + CommonModule, + MatButtonModule, + MatDividerModule, + FormsModule, + MatFormFieldModule, + MatInputModule, + ReactiveFormsModule, + MatChipsModule, + MatIconModule, + ], templateUrl: './manage-publisher-authors-page.component.html', - styleUrl: './manage-publisher-authors-page.component.scss' + styleUrl: './manage-publisher-authors-page.component.scss', }) -export class ManagePublisherAuthorsPageComponent { +export class ManagePublisherAuthorsPageComponent implements OnInit { + solutionId!: string; + revisionId!: string; + authorsList!: AuthorPublisherModel[]; + publisherName!: string; + authorForm!: FormGroup; + publisherForm!: FormGroup; + editPublisher: boolean = false; + constructor( + private activatedRoute: ActivatedRoute, + private formBuilder: FormBuilder, + private privateCatalogsService: PrivateCatalogsService, + public dialog: MatDialog, + private alertService: AlertService, + ) { + this.authorForm = this.formBuilder.group({ + name: ['', Validators.required], + contact: ['', Validators.required], + }); + + this.publisherForm = this.formBuilder.group({ + name: [ + '', + [ + Validators.required, + Validators.minLength(2), + Validators.pattern('^[A-Z|a-z|0-9 ]*$'), + // this.notSameAsPublisher(this.publisherName), + ], + // [], + ], + }); + } + + ngOnInit(): void { + this.activatedRoute.parent?.params.subscribe((params) => { + this.solutionId = params['solutionId']; + this.revisionId = params['revisionId']; + this.loadAuthorList(this.solutionId, this.revisionId); + this.loadPublisher(this.solutionId, this.revisionId); + }); + } + + loadAuthorList(solutionId: string, revisionId: string) { + this.privateCatalogsService.getAuthors(solutionId, revisionId).subscribe({ + next: (res) => { + this.authorsList = res; + }, + error: (error) => { + console.error('Error fetching users:', error); + }, + }); + } + + loadPublisher(solutionId: string, revisionId: string) { + this.privateCatalogsService.getPublisher(solutionId, revisionId).subscribe({ + next: (res) => { + if (res) { + this.publisherName = res; + this.publisherNameControlValue = res; + this.updateValidators(); + } + }, + error: (error) => { + console.error('Error fetching users:', error); + }, + }); + } + + updatePublisherData(solutionId: string, revisionId: string) { + this.privateCatalogsService.getPublisher(solutionId, revisionId).subscribe({ + next: (res) => { + this.publisherName = res; + this.publisherNameControlValue = res; + }, + error: (error) => { + console.error('Error fetching users:', error); + }, + }); + } + + onAddAuthorClick(formDirective: FormGroupDirective) { + const author = this.authorForm.value; + + this.privateCatalogsService + .addAuthor(this.solutionId, this.revisionId, author) + .subscribe({ + next: (res) => { + this.authorsList = res; + const alert: Alert = { + message: '', + type: AlertType.Success, + }; + + alert.message = 'Author added successfully. '; + this.alertService.notify(alert, 3000); + this.authorForm.reset(); + formDirective.resetForm(); + }, + error: (error) => { + const alert: Alert = { + message: '', + type: AlertType.Error, + }; + + alert.message = + 'Error while adding Author : ' + error.error.response_detail; + this.alertService.notify(alert, 3000); + }, + }); + } + + onRemoveAuthorClick(author: AuthorPublisherModel) { + const dialogRef: MatDialogRef<DeleteUserDialogConfirmationActionComponent> = + this.dialog.open(DeleteUserDialogConfirmationActionComponent, { + data: { + dataKey: { + title: 'Delete Author', + content: `Would you like to delete author '${author.name}' `, + alertMessage: 'Author deleted successfully. ', + + action: () => this.removeAuthor(author), + }, + }, + autoFocus: false, + }); + + dialogRef.afterClosed().subscribe((result) => { + this.loadAuthorList(this.solutionId, this.revisionId); + }); + } + + OnEditPublisherClick() { + if (this.publisherNameControl) + this.changeAsyncValidationRules( + [this.notSameAsPublisher()], + this.publisherNameControl, + ); + if (this.publisherForm.valid) + this.privateCatalogsService + .updatePublisher( + this.solutionId, + this.revisionId, + this.publisherForm.value.name, + ) + .subscribe({ + next: (res) => { + const alert: Alert = { + message: '', + type: AlertType.Success, + }; + + alert.message = 'Publisher updated successfully. '; + this.alertService.notify(alert, 3000); + + this.updatePublisherData(this.solutionId, this.revisionId); + if (this.publisherNameControl) { + this.clearPublisherNameValidation(this.publisherNameControl); + this.changeSyncValidationRules( + [ + Validators.required, + Validators.minLength(2), + Validators.pattern('^[A-Za-z0-9 ]+$'), + ], + this.publisherNameControl, + ); + } + // this.updatePublisherNameControlValidators(); + /* this.publisherForm.reset(); + formDirective.resetForm(); */ + }, + error: (error) => { + console.log({ error }); + }, + }); + } + + removeAuthor(author: AuthorPublisherModel): Observable<any> { + return this.privateCatalogsService.removeAuthor( + this.solutionId, + this.revisionId, + author ?? null, + ); + } + + onClickEditPublisher() { + this.editPublisher = true; + } + + onCancelClick() { + this.editPublisher = false; + this.publisherForm.setValue({ name: this.publisherName }); + } + + /* notSameAsPublisher(publisherName: string): ValidatorFn { + return (control: AbstractControl): { [key: string]: any } | null => { + console.log('publisher name validation', this.publisherName); + console.log('control.value validation', control.value); + + const isSame = + control.value.trim().toLowerCase() === + publisherName.trim().toLowerCase(); + console.log({ isSame }); + return isSame ? { sameAsPublisher: true } : null; + }; + } + */ + /* notSameAsPublisher(publisherName: string): AsyncValidatorFn { + return ( + control: AbstractControl, + ): Observable<{ [key: string]: any } | null> => { + if (!control.value) { + console.log('inside if'); + return of(null); // If no value, return null immediately + } + + const isSame = + control.value.trim().toLowerCase() === + publisherName.trim().toLowerCase(); + console.log({ isSame }); + + return of(isSame ? { sameAsPublisher: true } : null); + }; + } + */ + notSameAsPublisher(): AsyncValidatorFn { + return ( + control: AbstractControl, + ): Observable<{ [key: string]: any } | null> => { + return of(control.value).pipe( + map((value) => { + const isSame = + value.trim().toLowerCase() === + this.publisherName.trim().toLowerCase(); + return isSame ? { sameAsPublisher: true } : null; + }), + ); + }; + } + + get publisherNameControl() { + return this.publisherForm.get('name'); + } + + get publisherNameControlValue() { + return this.publisherNameControl?.value; + } + + set publisherNameControlValue(value) { + this.publisherNameControl?.setValue(value, { emitEvent: false }); + } + + updateValidators(): void { + const nameControl = this.publisherNameControl; + if (nameControl) { + nameControl.setValidators([ + Validators.required, + Validators.minLength(2), + Validators.pattern('^[A-Za-z0-9 ]+$'), + ]); + nameControl.setAsyncValidators(this.notSameAsPublisher()); + nameControl.updateValueAndValidity({ emitEvent: false }); + } + } + + changeSyncValidationRules( + validators: ValidatorFn | ValidatorFn[] | null, + control: AbstractControl<any, any>, + ): void { + control.setValidators(validators); + } + + changeAsyncValidationRules( + validators: AsyncValidatorFn | AsyncValidatorFn[] | null, + control: AbstractControl<any, any>, + ): void { + control.setAsyncValidators(validators); + // control.addAsyncValidators(validators); + control.updateValueAndValidity(); + } + + clearPublisherNameValidation(control: AbstractControl<any, any>) { + control.clearAsyncValidators(); + } } diff --git a/src/app/shared/components/rate-model-details/rate-model-details.component.scss b/src/app/shared/components/rate-model-details/rate-model-details.component.scss index 16612d5286d93d63ec6f024fcc7ea50ff96a4d75..351dc2a9eb7bcb8d592c0705c18794a1882b84ad 100644 --- a/src/app/shared/components/rate-model-details/rate-model-details.component.scss +++ b/src/app/shared/components/rate-model-details/rate-model-details.component.scss @@ -396,7 +396,6 @@ .mdl-button.btn-primary, .mdl-button.btn-secondary { box-shadow: none; - webkit-box-shadow: none; line-height: 27px; text-transform: capitalize; } diff --git a/src/app/shared/components/share-with-team-page/share-with-team-page.component.ts b/src/app/shared/components/share-with-team-page/share-with-team-page.component.ts index ebb19a4ecdbc1dce3cfc65c04f6bab2a2b62ea47..c55ad3a922b5d8552b5074d75bf7290e4916cd34 100644 --- a/src/app/shared/components/share-with-team-page/share-with-team-page.component.ts +++ b/src/app/shared/components/share-with-team-page/share-with-team-page.component.ts @@ -256,8 +256,11 @@ export class ShareWithTeamPageComponent implements OnInit { this.dialog.open(DeleteUserDialogConfirmationActionComponent, { data: { dataKey: { - solutionId: this.solutionId, - user: user, + title: 'Delete Shared Member', + content: `Would you like to delete '${user.firstName} ${user.lastName}' from + the shared list?`, + alertMessage: 'Deleted successfully. ', + action: () => this.deleteUser(user), }, }, autoFocus: false, @@ -267,4 +270,11 @@ export class ShareWithTeamPageComponent implements OnInit { this.getShareWithTeam(this.solutionId); }); } + + deleteUser(user: UserDetails): Observable<any> { + return this.privateCatalogsService.deleteShareWithTeam( + user.userId ?? '', + this.solutionId, + ); + } }