fix delete callback
This commit is contained in:
parent
7ebe22a45f
commit
45e3426969
|
@ -199,7 +199,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
refreshOnNavigateToData(id?: Guid): void {
|
||||
this.formGroup.markAsPristine();
|
||||
let route = [];
|
||||
|
||||
|
||||
if (id === null) {
|
||||
route.push('../..');
|
||||
} else if (this.isNew) {
|
||||
|
@ -222,7 +222,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
);
|
||||
} else if (this.isNewVersion== true && this.isNew == false && this.isClone == false) {
|
||||
const formData = this.formService.getValue(this.formGroup.value) as NewVersionDescriptionTemplatePersist;
|
||||
|
||||
|
||||
this.descriptionTemplateService.newVersion(formData)
|
||||
.pipe(takeUntil(this._destroyed)).subscribe(
|
||||
complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete),
|
||||
|
@ -267,7 +267,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
if (result) {
|
||||
this.descriptionTemplateService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
|||
if (result) {
|
||||
this.descriptionTemplateTypeService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
if (result) {
|
||||
this.dmpBlueprintService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.cancel(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ export class LanguageEditorComponent extends BaseEditor<LanguageEditorModel, Lan
|
|||
if (result) {
|
||||
this.languageHttpService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
|||
if (result) {
|
||||
this.notificationTemplateService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
@ -285,24 +285,24 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
|||
if (value) values.push(value)
|
||||
event.chipInput!.clear();
|
||||
return values;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
remove(field: string, values: string[]) {
|
||||
const index = values.indexOf(field);
|
||||
|
||||
|
||||
if (index >= 0) values.splice(index, 1);
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
edit(field: string, values: string[], event: MatChipEditedEvent) {
|
||||
const value = event.value.trim();
|
||||
|
||||
|
||||
if (!value) {
|
||||
values = this.remove(field, values);
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
const index = values.indexOf(field);
|
||||
if (index >= 0) values[index] = value
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
|||
if (result) {
|
||||
this.prefillingSourceService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
|
|||
if (result) {
|
||||
this.referenceTypeService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
|
|||
if (result) {
|
||||
this.referenceService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ export class TenantEditorComponent extends BaseEditor<TenantEditorModel, Tenant>
|
|||
if (result) {
|
||||
this.tenantService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -663,7 +663,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
if (result) {
|
||||
this.descriptionService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -181,9 +181,9 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
}
|
||||
}
|
||||
if(data.dmpDescriptionTemplates){
|
||||
data.dmpDescriptionTemplates = data.dmpDescriptionTemplates.filter(x => x.isActive === IsActive.Active);
|
||||
data.dmpDescriptionTemplates = data.dmpDescriptionTemplates.filter(x => x.isActive === IsActive.Active);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.item = data;
|
||||
|
||||
|
@ -290,7 +290,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
if (result) {
|
||||
this.dmpService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
this.selectedBlueprint = data;
|
||||
this.formGroup.get('blueprint').setValue(this.selectedBlueprint.id);
|
||||
|
||||
const goToNextStep: boolean = this.formGroup.get('label').valid && this.formGroup.get('description').valid;
|
||||
const goToNextStep: boolean = this.formGroup.get('label').valid && this.formGroup.get('description').valid;
|
||||
this.buildFormAfterBlueprintSelection(goToNextStep);
|
||||
});
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
blueprint: this.selectedBlueprint,
|
||||
status: DmpStatus.Draft
|
||||
}
|
||||
|
||||
|
||||
this.prepareForm(dmp);
|
||||
this.goToNextStep = true; //reset
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
multiplicityValidResults.push(true);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if(multiplicityValidResults.includes(true)) return true
|
||||
else return false;
|
||||
}else{
|
||||
|
|
|
@ -108,7 +108,7 @@ export class InAppNotificationEditorComponent extends BaseComponent implements O
|
|||
if (result) {
|
||||
this.inappNotificationService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.cancel(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMate
|
|||
if (result) {
|
||||
this.supportiveMaterialService.delete(value.id).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
complete => this.onCallbackDeleteSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMate
|
|||
}
|
||||
|
||||
private getSupportiveMaterialData(){
|
||||
|
||||
|
||||
if(this.formGroup.get('type').value >= 0 && this.formGroup.get('languageCode').value){
|
||||
const lookup = SupportiveMaterialService.DefaultSupportiveMaterialLookup();
|
||||
lookup.types = [this.formGroup.get('type').value];
|
||||
|
@ -197,7 +197,7 @@ export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMate
|
|||
}else{
|
||||
this.formGroup.get('id').patchValue(null);
|
||||
this.formGroup.get('payload').patchValue('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,14 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
|
|||
this.refreshOnNavigateToData(data ? data.id : null);
|
||||
}
|
||||
|
||||
onCallbackDeleteSuccess(data?: any): void {
|
||||
|
||||
console.log("Success Delete:", data);
|
||||
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
onCallbackError(errorResponse: HttpErrorResponse) {
|
||||
|
||||
console.log("Error:", errorResponse);
|
||||
|
|
Loading…
Reference in New Issue