Disables project input on /plans/edit/:finalized_id, fixes Breadcrumb translate, fixes message on dialog of finalizing dmp with no datasets

This commit is contained in:
apapachristou 2019-06-26 18:34:43 +03:00
parent 6607714e4c
commit b8c498013e
5 changed files with 49 additions and 36 deletions

View File

@ -179,19 +179,20 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
this.formGroup = this.dmp.buildForm(); this.formGroup = this.dmp.buildForm();
this.registerFormEventsForNewItem(); this.registerFormEventsForNewItem();
if (this.isAuthenticated) { if (this.isAuthenticated) {
const breadCrumbs = []; this.language.get('NAV-BAR.MY-DMPS').pipe(takeUntil(this._destroyed)).subscribe(x => {
breadCrumbs.push({ this.breadCrumbs = Observable.of([
parentComponentName: null, {
label: this.language.instant('NAV-BAR.MY-DMPS'), parentComponentName: null,
url: "/plans" label: x,
}); url: '/plans'
breadCrumbs.push({ },
parentComponentName: null, {
label: "CREATE NEW DMP", parentComponentName: null,
url: "/plans/new" label: "CREATE NEW DMP",
} url: "/plans/new"
); }
this.breadCrumbs = Observable.of(breadCrumbs); ]);
})
} }
} }
}); });
@ -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 => { });
} }
} }

View File

@ -25,14 +25,17 @@
</mat-panel-title> </mat-panel-title>
<mat-panel-description></mat-panel-description> <mat-panel-description></mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div *ngFor="let dataset of allDatasets" class="row pl-3 datasets"> <div *ngIf="allDatasets.length > 0">
<mat-icon *ngIf="isDraft(dataset)" class="col-1 draft-bookmark">bookmark</mat-icon> <div *ngFor="let dataset of allDatasets" class="row pl-3 datasets">
<mat-icon *ngIf="!isDraft(dataset)" class="col-1 finalized-bookmark">bookmark</mat-icon> <mat-icon *ngIf="isDraft(dataset)" class="col-1 draft-bookmark">bookmark</mat-icon>
<h4 *ngIf="isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4"> <mat-icon *ngIf="!isDraft(dataset)" class="col-1 finalized-bookmark">bookmark</mat-icon>
<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}:</span> <h4 *ngIf="isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4">
{{ dataset.label }}</h4> <span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}:</span>
<h4 *ngIf="!isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4">{{ dataset.label }}</h4> {{ dataset.label }}</h4>
<h4 *ngIf="!isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4">{{ dataset.label }}</h4>
</div>
</div> </div>
<div *ngIf="allDatasets.length === 0" class="emptyList">{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }} </div>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
@ -70,18 +73,21 @@
</mat-panel-title> </mat-panel-title>
<mat-panel-description></mat-panel-description> <mat-panel-description></mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div *ngFor="let label of allDatasetLabels" class="row pl-3 datasets"> <div *ngIf="allDatasetLabels.length > 0">
<mat-icon class="col-1 finalized-bookmark">bookmark</mat-icon> <div *ngFor="let label of allDatasetLabels" class="row pl-3 datasets">
<h4 class="col-11 ml-auto mt-1 mb-4">{{ label }}</h4> <mat-icon class="col-1 finalized-bookmark">bookmark</mat-icon>
<h4 class="col-11 ml-auto mt-1 mb-4">{{ label }}</h4>
</div>
</div> </div>
<div *ngIf="allDatasetLabels.length === 0" class="emptyList"> {{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }} </div>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
</div> </div>
<div> <div *ngIf="datasetsFinalized && datasetsFinalized.length != 0">
<mat-error class="row pt-2 pb-2 pl-4 pr-4"> <div class="row pt-2 pb-2 pl-4 pr-4">
{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }} {{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
</mat-error> </div>
<div class="row pl-4 pr-4"> <div class="row pl-4 pr-4">
{{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION' | translate }} {{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION' | translate }}
</div> </div>

View File

@ -60,10 +60,15 @@
} }
.close-btn { .close-btn {
margin-left: auto; margin-left: auto;
cursor: pointer; cursor: pointer;
} }
.datasets span { .datasets span {
color: #4687f0; color: #4687f0;
}
.emptyList {
font-style: italic;
color:rgba(0, 0, 0, 0.26);
} }

View File

@ -39,11 +39,6 @@ export class ProjectTabComponent implements OnInit {
titleFn: (item) => item['label'] 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.isCreateNew = (this.formGroup.get('label').value != null && this.formGroup.get('label').value.length > 0);
this.setValidators(); this.setValidators();
} }
@ -65,7 +60,12 @@ export class ProjectTabComponent implements OnInit {
this.formGroup.get('existProject').disable(); this.formGroup.get('existProject').disable();
this.formGroup.get('label').enable(); this.formGroup.get('label').enable();
this.formGroup.get('description').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('existProject').enable();
this.formGroup.get('label').disable(); this.formGroup.get('label').disable();
this.formGroup.get('label').reset(); this.formGroup.get('label').reset();

View File

@ -848,6 +848,7 @@
"DMP-FINALISE-DIALOG": { "DMP-FINALISE-DIALOG": {
"DMP": "DMP", "DMP": "DMP",
"DATASETS": "Datasets", "DATASETS": "Datasets",
"EMPTY": "No Datasets for this DMP so far",
"SUBMIT": "Submit", "SUBMIT": "Submit",
"FINALISE-TITLE": "Do you want to finalise any of the following Draft Datasets?", "FINALISE-TITLE": "Do you want to finalise any of the following Draft Datasets?",
"ALREADY-FINALISED-DATASETS": "Already Finalized Datasets", "ALREADY-FINALISED-DATASETS": "Already Finalized Datasets",