From b8c498013e57b993dff7a53dacd1a2cdf8e483c0 Mon Sep 17 00:00:00 2001 From: apapachristou Date: Wed, 26 Jun 2019 18:34:43 +0300 Subject: [PATCH] Disables project input on /plans/edit/:finalized_id, fixes Breadcrumb translate, fixes message on dialog of finalizing dmp with no datasets --- .../app/ui/dmp/editor/dmp-editor.component.ts | 29 +++++++++-------- .../dmp-finalize-dialog.component.html | 32 +++++++++++-------- .../dmp-finalize-dialog.component.scss | 11 +++++-- .../project-tab/project-tab.component.ts | 12 +++---- dmp-frontend/src/assets/i18n/en.json | 1 + 5 files changed, 49 insertions(+), 36 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts index dc24a2108..7f51d7fdb 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts @@ -179,19 +179,20 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.formGroup = this.dmp.buildForm(); this.registerFormEventsForNewItem(); if (this.isAuthenticated) { - const breadCrumbs = []; - breadCrumbs.push({ - parentComponentName: null, - label: this.language.instant('NAV-BAR.MY-DMPS'), - url: "/plans" - }); - breadCrumbs.push({ - parentComponentName: null, - label: "CREATE NEW DMP", - url: "/plans/new" - } - ); - this.breadCrumbs = Observable.of(breadCrumbs); + this.language.get('NAV-BAR.MY-DMPS').pipe(takeUntil(this._destroyed)).subscribe(x => { + this.breadCrumbs = Observable.of([ + { + parentComponentName: null, + label: x, + url: '/plans' + }, + { + parentComponentName: null, + label: "CREATE NEW DMP", + url: "/plans/new" + } + ]); + }) } } }); @@ -450,6 +451,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC } } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {}); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { }); } } diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html index a5f3d017d..fdea7a529 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html @@ -25,14 +25,17 @@ -
- bookmark - bookmark -

- {{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}: - {{ dataset.label }}

-

{{ dataset.label }}

+
+
+ bookmark + bookmark +

+ {{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}: + {{ dataset.label }}

+

{{ dataset.label }}

+
+
{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }}
@@ -70,18 +73,21 @@ -
- bookmark -

{{ label }}

+
+
+ bookmark +

{{ label }}

+
+
{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }}
-
- +
+
{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }} - +
{{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION' | translate }}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.scss b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.scss index 566534101..8fdc4177f 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.scss +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.scss @@ -60,10 +60,15 @@ } .close-btn { - margin-left: auto; - cursor: pointer; + margin-left: auto; + cursor: pointer; } .datasets span { - color: #4687f0; + color: #4687f0; +} + +.emptyList { + font-style: italic; + color:rgba(0, 0, 0, 0.26); } diff --git a/dmp-frontend/src/app/ui/dmp/editor/project-tab/project-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/project-tab/project-tab.component.ts index 877dad01e..b020d101a 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/project-tab/project-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/project-tab/project-tab.component.ts @@ -39,11 +39,6 @@ export class ProjectTabComponent implements OnInit { titleFn: (item) => item['label'] }; - if (!this.formGroup) { - this.project = new ProjectTabModel(); - this.formGroup = this.project.buildForm(); - } - this.isCreateNew = (this.formGroup.get('label').value != null && this.formGroup.get('label').value.length > 0); this.setValidators(); } @@ -65,7 +60,12 @@ export class ProjectTabComponent implements OnInit { this.formGroup.get('existProject').disable(); this.formGroup.get('label').enable(); this.formGroup.get('description').enable(); - } else { + } else if (this.isFinalized) { + this.formGroup.get('existProject').disable(); + this.formGroup.get('label').disable(); + this.formGroup.get('description').disable(); + } + else { this.formGroup.get('existProject').enable(); this.formGroup.get('label').disable(); this.formGroup.get('label').reset(); diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 7e80922ef..c114e1779 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -848,6 +848,7 @@ "DMP-FINALISE-DIALOG": { "DMP": "DMP", "DATASETS": "Datasets", + "EMPTY": "No Datasets for this DMP so far", "SUBMIT": "Submit", "FINALISE-TITLE": "Do you want to finalise any of the following Draft Datasets?", "ALREADY-FINALISED-DATASETS": "Already Finalized Datasets",