Fixes for modal error messages when adding/removing repository admins

This commit is contained in:
TheQuaker 2023-02-17 17:36:14 +02:00
parent e452c5205b
commit 94b99f8e51
4 changed files with 17458 additions and 61 deletions

17497
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
</div> </div>
<confirmation-dialog #deleteRepositoryAdminModal [title]="'Remove datasource admin'" [isModalShown]="isDeleteModalShown" <confirmation-dialog #deleteRepositoryAdminModal [title]="'Remove datasource admin'" [isModalShown]="isDeleteModalShown"
[confirmButNotCloseButton]="'Remove'" (emitObject)="deleteRepoAdmin($event)"> [confirmButNotCloseButton]="'Remove'" (emitObject)="deleteRepoAdmin($event)" (clearAll)="clearModal()">
<div *ngIf="modalErrorMessage" class="uk-alert uk-alert-danger">{{modalErrorMessage}}</div> <div *ngIf="modalErrorMessage" class="uk-alert uk-alert-danger">{{modalErrorMessage}}</div>
@ -54,13 +54,6 @@
</div> </div>
<div class="whiteFilm"></div> <div class="whiteFilm"></div>
</div> </div>
<!--<div *ngIf="!modalLoadingMessage && !modalErrorMessage">-->
<!--<div *ngIf="selectedAdminForDelete">-->
<!--<h6>Are you sure you want to delete {{ selectedAdminForDelete.email }} from the list of repository admins?</h6>-->
<!--</div>-->
<!--</div>-->
<div *ngIf="selectedAdminForDelete"> <div *ngIf="selectedAdminForDelete">
<h6>Are you sure you want to remove this user admin?</h6> <h6>Are you sure you want to remove this user admin?</h6>
<pre> <pre>
@ -75,7 +68,7 @@
<confirmation-dialog #addRepositoryAdminModal [title]="'Add new datasource admin'" [isModalShown]="isAddModalShown" <confirmation-dialog #addRepositoryAdminModal [title]="'Add new datasource admin'" [isModalShown]="isAddModalShown"
[confirmButNotCloseButton]="'Submit'" (emitObject)="addRepositoryAdmin()"> [confirmButNotCloseButton]="'Submit'" (emitObject)="addRepositoryAdmin()" (clearAll)="clearModal()">
<div *ngIf="modalErrorMessage" class="uk-alert uk-alert-danger">{{modalErrorMessage}}</div> <div *ngIf="modalErrorMessage" class="uk-alert uk-alert-danger">{{modalErrorMessage}}</div>

View File

@ -73,10 +73,9 @@ export class UpdateRepoAdminsComponent implements OnChanges {
} }
} }
closeDeletionModal() { clearModal() {
this.selectedAdminForDelete = null; this.selectedAdminForDelete = null;
this.deleteRepositoryAdminModal.hideModal(); this.modalErrorMessage = null;
// UIkit.modal('#deletionModal').hide();
} }
deleteRepoAdmin(event: any) { deleteRepoAdmin(event: any) {
@ -128,11 +127,11 @@ export class UpdateRepoAdminsComponent implements OnChanges {
}, error => { }, error => {
console.log('Error adding repository admin', error); console.log('Error adding repository admin', error);
this.modalLoadingMessage = ''; this.modalLoadingMessage = '';
if(error.status === 404) { if (error.status === 404) {
this.modalErrorMessage = 'This email address is not associated with an OpenAIRE user account.\n' + this.modalErrorMessage = 'This email address is not associated with an OpenAIRE user account.\n' +
'Please make sure the user has an OpenAIRE account and then try again.'; 'Please make sure the user has an OpenAIRE account and then try again.';
} else { } else {
this.modalErrorMessage = 'Error deleting the user admin, please try again. If the error persists, ' + this.modalErrorMessage = 'Error adding the new admin, please try again. If the error persists, ' +
'please contact helpdesk@openaire.eu'; 'please contact helpdesk@openaire.eu';
} }
}, },

View File

@ -24,6 +24,7 @@ export class ConfirmationDialogComponent {
@Input() public hideModalButton: string = 'Cancel'; @Input() public hideModalButton: string = 'Cancel';
@Output() emitObject: EventEmitter<any> = new EventEmitter(); @Output() emitObject: EventEmitter<any> = new EventEmitter();
@Output() clearAll: EventEmitter<any> = new EventEmitter();
private _ids: string[] = []; private _ids: string[] = [];
@ -37,6 +38,7 @@ export class ConfirmationDialogComponent {
public hideModal(): void { public hideModal(): void {
this.isModalShown = false; this.isModalShown = false;
this.clearAll.emit();
// this.autoShownModal.hide(); // this.autoShownModal.hide();
} }