From b660176534b61cd1cbe41ee9b6d27c10df876404 Mon Sep 17 00:00:00 2001 From: Ioannis Kalyvas Date: Mon, 15 Oct 2018 11:16:04 +0300 Subject: [PATCH] Fixed some issues with actions on Datasets on different Dataset States --- .../dataset-wizard/dataset-wizard.component.html | 11 ++++++----- .../dataset-wizard/dataset-wizard.component.ts | 5 +++++ .../dynamic-form-field.component.html | 2 +- .../auto-complete/auto-complete.component.ts | 16 +++++++++------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.html index 610b20aba..3052a0cb5 100644 --- a/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.html @@ -2,9 +2,10 @@

{{ 'DATASET-WIZARD.TITLE.NEW' | translate }}

-

{{datasetWizardModel?.label}} {{ 'GENERAL.NAMES.DATASET' | translate }}

+

{{datasetWizardModel?.label}} {{ 'GENERAL.NAMES.DATASET' | translate }}

- {{ 'GENERAL.STATUSES.EDIT' | translate }}

-

- {{ 'GENERAL.STATUSES.FINALISED' | translate }}

+

- {{ + 'GENERAL.STATUSES.FINALISED' | translate }}

-
- - diff --git a/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.ts index dd3f44e68..f7b626c8f 100644 --- a/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/datasets/dataset-wizard/dataset-wizard.component.ts @@ -57,6 +57,7 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum //autocomplete Display Functions; //autocomplete Configurations; + DatasetStatus = DatasetStatus; externalDatasetAutoCompleteConfiguration: AutoCompleteConfiguration; registriesAutoCompleteConfiguration: AutoCompleteConfiguration; dataRepositoriesAutoCompleteConfiguration: AutoCompleteConfiguration; @@ -472,10 +473,14 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum public enableForm() { if (this.formGroup.get('status').value !== DatasetStatus.Finalised) { this.editMode = true; + this.viewOnly = false; this.formGroup.enable(); } else { this.datasetWizardService.unlock(this.formGroup.get('id').value).subscribe(x => { this.editMode = true; + this.viewOnly = false; + this.datasetWizardModel.status = DatasetStatus.Draft; + this.formGroup.get('status').patchValue(DatasetStatus.Draft); this.formGroup.enable(); }); } diff --git a/dmp-frontend/src/app/form/dynamic-fields/dynamic-form-field.component.html b/dmp-frontend/src/app/form/dynamic-fields/dynamic-form-field.component.html index 0c07d6226..29044d937 100644 --- a/dmp-frontend/src/app/form/dynamic-fields/dynamic-form-field.component.html +++ b/dmp-frontend/src/app/form/dynamic-fields/dynamic-form-field.component.html @@ -35,7 +35,7 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/shared/components/auto-complete/auto-complete.component.ts b/dmp-frontend/src/app/shared/components/auto-complete/auto-complete.component.ts index a2f062fe8..5723bf9f6 100644 --- a/dmp-frontend/src/app/shared/components/auto-complete/auto-complete.component.ts +++ b/dmp-frontend/src/app/shared/components/auto-complete/auto-complete.component.ts @@ -39,13 +39,15 @@ export class AutoCompleteComponent implements OnInit, ErrorStateMatcher { } ngOnInit() { - this.inputData.refreshEvent.subscribe(x => { - if (x) { - this.formCtrl.patchValue(null); - this.textFormCtrl.patchValue(null); - this.options = []; - } - }); + if (this.inputData.refreshEvent) { + this.inputData.refreshEvent.subscribe(x => { + if (x) { + this.formCtrl.patchValue(null); + this.textFormCtrl.patchValue(null); + this.options = []; + } + }); + } this.textFormCtrl = new FormControl(); if (this.disabled) { this.textFormCtrl.disable(); } this.formCtrl.registerOnDisabledChange(isDisabled => {