<ng-template #updateFailedStrTmpl i18n>Update of {{idlClassDef.label}} failed</ng-template>
<eg-string #updateFailedString [template]="updateFailedStrTmpl"></eg-string>
+<ng-template #deleteFailedStrTmpl i18n>Delete of {{idlClassDef.label}} failed or was not allowed</ng-template>
+<eg-string #deleteFailedString [template]="deleteFailedStrTmpl"></eg-string>
+
+<ng-template #deleteSuccessStrTmpl i18n>{{idlClassDef.label}} Successfully Deleted</ng-template>
+<eg-string #deleteSuccessString [template]="deleteSuccessStrTmpl"></eg-string>
<ng-template #createStrTmpl i18n>{{idlClassDef.label}} Succeessfully Created</ng-template>
<eg-string #createString [template]="createStrTmpl"></eg-string>
@ViewChild('createString') createString: StringComponent;
@ViewChild('createErrString') createErrString: StringComponent;
@ViewChild('updateFailedString') updateFailedString: StringComponent;
+ @ViewChild('deleteFailedString') deleteFailedString: StringComponent;
+ @ViewChild('deleteSuccessString') deleteSuccessString: StringComponent;
@ViewChild('translator') translator: TranslateComponent;
idlClassDef: any;
constructor(
private route: ActivatedRoute,
- private idl: IdlService,
+ public idl: IdlService,
private org: OrgService,
- private auth: AuthService,
- private pcrud: PcrudService,
+ public auth: AuthService,
+ public pcrud: PcrudService,
private perm: PermService,
- private toast: ToastService
+ public toast: ToastService
) {
this.translatableFields = [];
}
deleteSelected(idlThings: IdlObject[]) {
idlThings.forEach(idlThing => idlThing.isdeleted(true));
this.pcrud.autoApply(idlThings).subscribe(
- val => console.debug('deleted: ' + val),
- err => {},
+ val => {
+ console.debug('deleted: ' + val);
+ this.deleteSuccessString.current()
+ .then(str => this.toast.success(str));
+ },
+ err => {
+ this.deleteFailedString.current()
+ .then(str => this.toast.danger(str));
+ },
() => this.grid.reload()
);
}