Adds "Update" button on finalized "Dataset Template".

This commit is contained in:
gkolokythas 2019-11-22 17:06:47 +02:00
parent c8358f22dd
commit 1a160edece
4 changed files with 24 additions and 5 deletions

View File

@ -70,12 +70,17 @@
<!-- SAVE BUTTON -->
<div class="col-6 d-flex" *ngIf="!viewOnly">
<div class="row mt-4">
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto" (click)='onSubmit()' [disabled]="!form.valid">Save</button>
<button mat-raised-button class="col-auto" color="primary" type="button col-auto" (click)='finalize()' [disabled]="!form.valid">Finalize</button>
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto" (click)='onSubmit()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.SAVE' | translate}}</button>
<button mat-raised-button class="col-auto" color="primary" type="button col-auto" (click)='finalize()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.FINALIZE' | translate}}</button>
</div>
</div>
<!-- SAVE BUTTON WHEN FINALIZED-->
<div class="col-6 d-flex" *ngIf="showUpdateButton()">
<div class="row mt-4">
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto" (click)='updateFinalized()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.UPDATE' | translate}}</button>
</div>
</div>
<!-- DELETE BUTTON -->
<div class="col-6" *ngIf="viewOnly"></div>
<div class="col-6 d-flex justify-content-end" *ngIf="!isNew">
<div class="row mt-4">
<button mat-raised-button color="primary" (click)="delete()">

View File

@ -222,6 +222,18 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.onSubmit();
}
updateFinalized() {
this.datasetProfileService.updateForm(this.datasetProfileId, this.form.getRawValue())
.pipe(takeUntil(this._destroyed))
.subscribe(() => {
this.router.navigate(['/dataset-profiles']);
});
}
showUpdateButton() {
return !this.isNew && this.dataModel.status === DatasetProfileEnum.FINALIZED;
}
isStepActive(step: number) {
return this.stepper && this.stepper.selectedIndex === step;
}

View File

@ -136,7 +136,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
// this.availableProfiles = this.datasetWizardModel.dmp.profiles;
},
error => {
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.MESSAGES.DATAESET-NOT-FOUND'), SnackBarNotificationLevel.Error);
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.MESSAGES.DATASET-NOT-FOUND'), SnackBarNotificationLevel.Error);
this.router.navigate(['/datasets/edit/' + this.itemId]);
return observableOf(null);
});

View File

@ -330,6 +330,8 @@
},
"ACTIONS": {
"SAVE": "Save",
"FINALIZE": "Finalize",
"UPDATE": "Update",
"CANCEL": "Cancel",
"DELETE": "Delete",
"ADD-PAGE": "Add Page +",
@ -453,7 +455,7 @@
"UPDATE-DATASET-PROFILE": "Update Template"
},
"MESSAGES": {
"DATAESET-NOT-FOUND": "Dataset Description does not exist",
"DATASET-NOT-FOUND": "Dataset Description does not exist",
"SUCCESS-UPDATE-DATASET-PROFILE": "Dataset Description Template updated successfully"
},
"UPLOAD": {