dmp discard fix
This commit is contained in:
parent
1961973971
commit
d6e447eb53
|
@ -11,8 +11,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-auto d-flex flex-row">
|
<div class="ml-auto d-flex flex-row">
|
||||||
<div class="col-auto d-flex align-items-center">
|
<div class="col-auto d-flex align-items-center">
|
||||||
<button [disabled]="saving" *ngIf="isDirty()" type="button" mat-raised-button class="discard-btn mr-3" (click)="discard()">
|
<button [disabled]="saving" *ngIf="isDirty()" type="button" mat-raised-button class="discard-btn mr-3" (click)="discardChanges()">
|
||||||
{{'DMP-EDITOR.ACTIONS.DISCARD' | translate}}
|
{{'DMP-EDITOR.ACTIONS.DISCARD.DISCARD' | translate}}
|
||||||
</button>
|
</button>
|
||||||
<button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="formSubmit()" class="save-btn">
|
<button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="formSubmit()" class="save-btn">
|
||||||
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
|
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
|
||||||
|
|
|
@ -271,6 +271,47 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
discardChanges() {
|
||||||
|
let messageText = "";
|
||||||
|
let confirmButtonText = "";
|
||||||
|
let cancelButtonText = "";
|
||||||
|
let isDeleteConfirmation = false;
|
||||||
|
|
||||||
|
if (this.isNew) {
|
||||||
|
|
||||||
|
messageText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-MESSAGE');
|
||||||
|
confirmButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-CONFIRM');
|
||||||
|
cancelButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-DENY');
|
||||||
|
isDeleteConfirmation = true;
|
||||||
|
} else {
|
||||||
|
messageText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-MESSAGE');
|
||||||
|
confirmButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-CONFIRM');
|
||||||
|
cancelButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-DENY');
|
||||||
|
isDeleteConfirmation = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||||
|
restoreFocus: false,
|
||||||
|
data: {
|
||||||
|
message: messageText,
|
||||||
|
confirmButton: confirmButtonText,
|
||||||
|
cancelButton: cancelButtonText,
|
||||||
|
isDeleteConfirmation: true
|
||||||
|
},
|
||||||
|
maxWidth: '40em'
|
||||||
|
});
|
||||||
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
|
if (result) {
|
||||||
|
setTimeout(x => {
|
||||||
|
this.step = this.step > 0 ? this.step - 1 : 0;
|
||||||
|
this.ngOnInit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public delete() {
|
public delete() {
|
||||||
const value = this.formGroup.value;
|
const value = this.formGroup.value;
|
||||||
if (value.id) {
|
if (value.id) {
|
||||||
|
|
|
@ -1412,7 +1412,15 @@
|
||||||
"DMP-BLUEPRINT-VERSION": "Version"
|
"DMP-BLUEPRINT-VERSION": "Version"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
"DISCARD": {
|
||||||
"DISCARD": "Discard",
|
"DISCARD": "Discard",
|
||||||
|
"DISCARD-NEW-MESSAGE": "All unsaved changes will be lost. Would you like to proceed?",
|
||||||
|
"DISCARD-NEW-CONFIRM": "Yes, revert changes.",
|
||||||
|
"DISCARD-NEW-DENY": "No.",
|
||||||
|
"DISCARD-EDITED-MESSAGE": "All unsaved changes will be lost. Would you like to proceed?",
|
||||||
|
"DISCARD-EDITED-CONFIRM": "Yes, revert changes.",
|
||||||
|
"DISCARD-EDITED-DENY": "No."
|
||||||
|
},
|
||||||
"SAVE": "Save",
|
"SAVE": "Save",
|
||||||
"DELETE": "Delete",
|
"DELETE": "Delete",
|
||||||
"ADD-DESCRIPTION-IN-SECTION": "Add Description",
|
"ADD-DESCRIPTION-IN-SECTION": "Add Description",
|
||||||
|
|
Loading…
Reference in New Issue