Fixed some issues with actions on Datasets on different Dataset States

This commit is contained in:
Ioannis Kalyvas 2018-10-15 11:16:04 +03:00
parent ae618c3e29
commit b660176534
4 changed files with 21 additions and 13 deletions

View File

@ -2,9 +2,10 @@
<h3 *ngIf="isNew">{{ 'DATASET-WIZARD.TITLE.NEW' | translate }}</h3>
<div fxLayout="row" fxLayoutAlign="space-between center">
<div>
<h3 *ngIf="!isNew">{{datasetWizardModel?.label}} {{ 'GENERAL.NAMES.DATASET' | translate }}</h3>
<h3 *ngIf="!isNew ">{{datasetWizardModel?.label}} {{ 'GENERAL.NAMES.DATASET' | translate }}</h3>
<h3 *ngIf="this.formGroup && this.formGroup.dirty"> - {{ 'GENERAL.STATUSES.EDIT' | translate }}</h3>
<h3 *ngIf="this.formGroup && viewOnly"> - {{ 'GENERAL.STATUSES.FINALISED' | translate }}</h3>
<h3 *ngIf="this.formGroup && this.formGroup.get('status').value == DatasetStatus.Finalised && viewOnly"> - {{
'GENERAL.STATUSES.FINALISED' | translate }}</h3>
</div>
<button *ngIf="!editMode" mat-icon-button (click)="enableForm()">
<mat-icon class="mat-24">edit</mat-icon>
@ -13,10 +14,10 @@
<mat-icon class="mat-24">lock</mat-icon>
</button>
</div>
<div *ngIf="this.datasetProfileDefinitionModel">
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
<div *ngIf="this.datasetProfileDefinitionModel || this.datasetWizardModel?.datasetProfileDefinition">
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="saveFinalize();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-FINALISE' | translate }}</button>
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="downloadPDF();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-PDF' | translate }}</button>

View File

@ -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();
});
}

View File

@ -35,7 +35,7 @@
<mat-form-field>
<textarea matInput formControlName="value" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10" [required]="field.validationRequired">
</textarea>
<button mat-button *ngIf="form.get('value').value" matSuffix mat-icon-button aria-label="Clear" (click)="this.form.patchValue({'value': ''})">
<button mat-button *ngIf="!form.get('value').disabled && form.get('value').value" matSuffix mat-icon-button aria-label="Clear" (click)="this.form.patchValue({'value': ''})">
<mat-icon>close</mat-icon>
</button>
<mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>

View File

@ -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 => {