Ticket 8389: Fix undo finalazation appears even finalized wasn't successful. Also fix issue where the buttons are remaining disabled when user press No in the dialog of finalization. On undo finalization do a save in order to be sync with the backend.
This commit is contained in:
parent
4c7dee3ece
commit
180e02c829
|
@ -63,12 +63,15 @@
|
||||||
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly" mat-raised-button
|
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly" mat-raised-button
|
||||||
class="dataset-save-btn mr-2" type="button">
|
class="dataset-save-btn mr-2" type="button">
|
||||||
<span class="d-flex flex-row row">
|
<span class="d-flex flex-row row">
|
||||||
<span (click)="save()" class="col">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</span>
|
<span (click)="!saving?save():null" class="col">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</span>
|
||||||
<mat-divider [vertical]="true"></mat-divider>
|
<mat-divider [vertical]="true"></mat-divider>
|
||||||
<span class="align-items-center justify-content-center col-4 d-flex"
|
<span *ngIf="!saving" class="align-items-center justify-content-center col-4 d-flex"
|
||||||
(click)="$event.stopPropagation();" [matMenuTriggerFor]="menu">
|
(click)="$event.stopPropagation();" [matMenuTriggerFor]="menu">
|
||||||
<mat-icon >expand_more</mat-icon>
|
<mat-icon >expand_more</mat-icon>
|
||||||
</span>
|
</span>
|
||||||
|
<span *ngIf="saving" class="align-items-center justify-content-center col-4 d-flex">
|
||||||
|
<mat-icon >expand_more</mat-icon>
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<mat-menu #menu="matMenu">
|
<mat-menu #menu="matMenu">
|
||||||
|
|
|
@ -659,7 +659,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
submit(saveType?: SaveType) {
|
submit(saveType?: SaveType, onSuccess: Function = null, onError: Function = null) {
|
||||||
this.scrollTop = document.getElementById('dataset-editor-form').scrollTop;
|
this.scrollTop = document.getElementById('dataset-editor-form').scrollTop;
|
||||||
this.tocScrollTop = document.getElementById('stepper-options').scrollTop;
|
this.tocScrollTop = document.getElementById('stepper-options').scrollTop;
|
||||||
this.datasetWizardService.createDataset(this.formGroup.getRawValue())
|
this.datasetWizardService.createDataset(this.formGroup.getRawValue())
|
||||||
|
@ -669,8 +669,16 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
this.hasChanges = false;
|
this.hasChanges = false;
|
||||||
this.datasetIsOnceSaved = true;
|
this.datasetIsOnceSaved = true;
|
||||||
this.onCallbackSuccess(data, saveType);
|
this.onCallbackSuccess(data, saveType);
|
||||||
|
if(onSuccess) {
|
||||||
|
onSuccess();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error => this.onCallbackError(error));
|
error => {
|
||||||
|
if(onError) {
|
||||||
|
onError();
|
||||||
|
}
|
||||||
|
this.onCallbackError(error)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -840,16 +848,27 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(x => x),
|
filter(x => x),
|
||||||
takeUntil(this._destroyed)
|
takeUntil(this._destroyed)
|
||||||
).subscribe(_ => {
|
).subscribe(result => {
|
||||||
this.viewOnly = false;
|
if (result) {
|
||||||
this.datasetWizardModel.status = DatasetStatus.Draft;
|
// if (!this.isFormValid()) { return; }
|
||||||
setTimeout(x => {
|
this.formGroup.get('status').setValue(DatasetStatus.Draft);
|
||||||
this.formGroup = null;
|
this.submit(SaveType.finalize, () => {
|
||||||
});
|
this.viewOnly = false;
|
||||||
setTimeout(x => {
|
this.datasetWizardModel.status = DatasetStatus.Draft;
|
||||||
this.formGroup = this.datasetWizardModel.buildForm();
|
setTimeout(x => {
|
||||||
this.registerFormListeners();
|
this.formGroup = null;
|
||||||
});
|
});
|
||||||
|
setTimeout(x => {
|
||||||
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
|
this.registerFormListeners();
|
||||||
|
});
|
||||||
|
}, () => {
|
||||||
|
this.formGroup.get('status').setValue(DatasetStatus.Finalized);
|
||||||
|
this.viewOnly = true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.saving = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -885,7 +904,11 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
if (result) {
|
if (result) {
|
||||||
// if (!this.isFormValid()) { return; }
|
// if (!this.isFormValid()) { return; }
|
||||||
this.formGroup.get('status').setValue(DatasetStatus.Finalized);
|
this.formGroup.get('status').setValue(DatasetStatus.Finalized);
|
||||||
this.submit(SaveType.finalize);
|
this.submit(SaveType.finalize, null, () => {
|
||||||
|
this.formGroup.get('status').setValue(DatasetStatus.Draft);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.saving = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue