From 5faa44c015cca503e412fa969e5914cb1e90e4b8 Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Fri, 1 Apr 2022 13:51:53 +0300 Subject: [PATCH] On a new Dataset when save is pressed it will reload the editor in order to reflect better the state of the Dataset --- .../dataset-wizard.component.ts | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts index 899f868ed..125e7a9c8 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts @@ -895,38 +895,39 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', this.formGroup.get('dmp').value.id]); }); - } else if (saveType === SaveType.finalize) { + } else { this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', data.id]); }); - } else { - this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); - this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; - // setTimeout(() => { this.formGroup = null; }); - setTimeout(() => { - this.formGroup.get('id').patchValue(data.id); - this.formGroup.get('modified').patchValue(data.modified); - this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); - this.hasChanges = false; - - // this.formGroup = this.datasetWizardModel.buildForm(); - // if (this.formGroup.get('datasetProfileDefinition')) { - // this.formGroup.removeControl('datasetProfileDefinition'); - // this.getDefinition(data.profile.id); - // this.maxStep = 1; - // } else { - // this.getDefinition(data.profile.id); - // this.maxStep = 1; - // } - }); - - setTimeout(() => { - document.getElementById('dataset-editor-form').scrollTop = this.scrollTop; - document.getElementById('stepper-options').scrollTop = this.tocScrollTop; - }, 500); - - // this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', data.id]); }); } + // } else { + // this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); + // this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; + // // setTimeout(() => { this.formGroup = null; }); + // setTimeout(() => { + // this.formGroup.get('id').patchValue(data.id); + // this.formGroup.get('modified').patchValue(data.modified); + // this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); + // this.hasChanges = false; + + // // this.formGroup = this.datasetWizardModel.buildForm(); + // // if (this.formGroup.get('datasetProfileDefinition')) { + // // this.formGroup.removeControl('datasetProfileDefinition'); + // // this.getDefinition(data.profile.id); + // // this.maxStep = 1; + // // } else { + // // this.getDefinition(data.profile.id); + // // this.maxStep = 1; + // // } + // }); + + // setTimeout(() => { + // document.getElementById('dataset-editor-form').scrollTop = this.scrollTop; + // document.getElementById('stepper-options').scrollTop = this.tocScrollTop; + // }, 500); + + // // this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', data.id]); }); + // } } else { this.router.navigate(['/datasets']); }