diff --git a/src/app/general/edit-stakeholder/edit-stakeholder.component.ts b/src/app/general/edit-stakeholder/edit-stakeholder.component.ts index 8a99fa7..5cc6476 100644 --- a/src/app/general/edit-stakeholder/edit-stakeholder.component.ts +++ b/src/app/general/edit-stakeholder/edit-stakeholder.component.ts @@ -117,6 +117,7 @@ export class EditStakeholderComponent implements OnDestroy { public stakeholder: Stakeholder; public isDefault: boolean; public isNew: boolean; + public loading: boolean = false; public types: Option[]; public properties: EnvProperties = properties; private subscriptions: any[] = []; @@ -275,6 +276,7 @@ export class EditStakeholderComponent implements OnDestroy { } public save(callback: Function, errorCallback: Function = null) { + this.loading = true; if (this.file) { this.subscriptions.push(this.utilsService.uploadPhoto(this.properties.utilsService + "/upload/" + encodeURIComponent(this.stakeholderFb.getRawValue().type) + "/" + encodeURIComponent(this.stakeholderFb.getRawValue().alias), this.file).subscribe(res => { this.deletePhoto(); @@ -310,11 +312,13 @@ export class EditStakeholderComponent implements OnDestroy { this.notify.sendNotification(this.notification); NotificationHandler.rise(stakeholder.name + ' has been successfully created'); callback(stakeholder); + this.loading = false; }, error => { NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); if (errorCallback) { errorCallback(error) } + this.loading = false; })); } else { this.subscriptions.push(this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.stakeholderFb.getRawValue()).subscribe(stakeholder => { @@ -324,10 +328,14 @@ export class EditStakeholderComponent implements OnDestroy { this.notification.groups = [Role.curator(stakeholder.type), Role.manager(stakeholder.type, stakeholder.alias)]; this.notify.sendNotification(this.notification); NotificationHandler.rise(stakeholder.name + ' has been successfully saved'); - callback(stakeholder); + callback(stakeholder); + this.loading = false; }, error => { NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); - console.error(error); + if (errorCallback) { + errorCallback(error) + } + this.loading = false; })); } } diff --git a/src/app/manageStakeholders/manageStakeholders.component.html b/src/app/manageStakeholders/manageStakeholders.component.html index 08ff4be..9fb9893 100644 --- a/src/app/manageStakeholders/manageStakeholders.component.html +++ b/src/app/manageStakeholders/manageStakeholders.component.html @@ -123,7 +123,10 @@ id="edit_modal" [large]="true" classTitle="uk-background-primary uk-light" (alertOutput)="editStakeholderComponent.save(callback)" [okDisabled]="editStakeholderComponent.disabled"> -
+
+ +
+
diff --git a/src/app/manageStakeholders/manageStakeholders.component.ts b/src/app/manageStakeholders/manageStakeholders.component.ts index 845aa6b..0138f78 100644 --- a/src/app/manageStakeholders/manageStakeholders.component.ts +++ b/src/app/manageStakeholders/manageStakeholders.component.ts @@ -178,6 +178,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { if(index != -1) { this.alias[index] = stakeholder.alias; } + this.editStakeholderModal.cancel(); }; this.editStakeholderModal.alertTitle = 'Edit ' + this.stakeholder.name; this.editStakeholderModal.okButtonText = 'Save Changes'; @@ -189,6 +190,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { this.stakeholders.push(stakeholder); } this.alias.push(stakeholder.alias); + this.editStakeholderModal.cancel(); }; this.editStakeholderModal.alertTitle = 'Create a new ' + (isDefault?'Default ':'') + 'Profile'; this.editStakeholderModal.okButtonText = 'Create'; @@ -196,6 +198,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { this.editStakeholderModal.cancelButtonText = 'Cancel'; this.editStakeholderModal.okButtonLeft = false; this.editStakeholderModal.alertMessage = false; + this.editStakeholderModal.stayOpen = true; this.editStakeholderModal.open(); } diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index d55b181..fd9794e 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit d55b1819de86b435ad5533949720cba322ae089a +Subproject commit fd9794ec3aa5fd031a3642febf4c2a4d20425cd7 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index ff0dadc..ee5eeb0 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit ff0dadc5dd278b9b6fcc86502541c1f9dc39945c +Subproject commit ee5eeb0ccc7e8a1b7086730fbce597faa9b25b13