add loading when editing/creating stakeholder profiles
This commit is contained in:
parent
48467c7172
commit
bcbbefc277
|
@ -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 <b>successfully created</b>');
|
||||
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 <b>successfully saved</b>');
|
||||
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;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,10 @@
|
|||
id="edit_modal" [large]="true" classTitle="uk-background-primary uk-light"
|
||||
(alertOutput)="editStakeholderComponent.save(callback)"
|
||||
[okDisabled]="editStakeholderComponent.disabled">
|
||||
<div class="uk-padding">
|
||||
<div class="uk-height-large uk-position-relative" *ngIf="editStakeholderComponent.loading">
|
||||
<loading class="uk-position-center"></loading>
|
||||
</div>
|
||||
<div class="uk-padding" [class.uk-hidden]="editStakeholderComponent.loading">
|
||||
<edit-stakeholder #editStakeholderComponent></edit-stakeholder>
|
||||
</div>
|
||||
</modal-alert>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d55b1819de86b435ad5533949720cba322ae089a
|
||||
Subproject commit fd9794ec3aa5fd031a3642febf4c2a4d20425cd7
|
|
@ -1 +1 @@
|
|||
Subproject commit ff0dadc5dd278b9b6fcc86502541c1f9dc39945c
|
||||
Subproject commit ee5eeb0ccc7e8a1b7086730fbce597faa9b25b13
|
Loading…
Reference in New Issue