Fixed some issues with actions on Datasets on different Dataset States
This commit is contained in:
parent
ae618c3e29
commit
b660176534
|
@ -2,9 +2,10 @@
|
||||||
<h3 *ngIf="isNew">{{ 'DATASET-WIZARD.TITLE.NEW' | translate }}</h3>
|
<h3 *ngIf="isNew">{{ 'DATASET-WIZARD.TITLE.NEW' | translate }}</h3>
|
||||||
<div fxLayout="row" fxLayoutAlign="space-between center">
|
<div fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
<div>
|
<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 && 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>
|
</div>
|
||||||
<button *ngIf="!editMode" mat-icon-button (click)="enableForm()">
|
<button *ngIf="!editMode" mat-icon-button (click)="enableForm()">
|
||||||
<mat-icon class="mat-24">edit</mat-icon>
|
<mat-icon class="mat-24">edit</mat-icon>
|
||||||
|
@ -13,10 +14,10 @@
|
||||||
<mat-icon class="mat-24">lock</mat-icon>
|
<mat-icon class="mat-24">lock</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="this.datasetProfileDefinitionModel">
|
<div *ngIf="this.datasetProfileDefinitionModel || this.datasetWizardModel?.datasetProfileDefinition">
|
||||||
<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)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
|
(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>
|
(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;"
|
<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>
|
(click)="downloadPDF();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-PDF' | translate }}</button>
|
||||||
|
|
|
@ -57,6 +57,7 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum
|
||||||
|
|
||||||
//autocomplete Display Functions;
|
//autocomplete Display Functions;
|
||||||
//autocomplete Configurations;
|
//autocomplete Configurations;
|
||||||
|
DatasetStatus = DatasetStatus;
|
||||||
externalDatasetAutoCompleteConfiguration: AutoCompleteConfiguration;
|
externalDatasetAutoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
registriesAutoCompleteConfiguration: AutoCompleteConfiguration;
|
registriesAutoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
dataRepositoriesAutoCompleteConfiguration: AutoCompleteConfiguration;
|
dataRepositoriesAutoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
|
@ -472,10 +473,14 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum
|
||||||
public enableForm() {
|
public enableForm() {
|
||||||
if (this.formGroup.get('status').value !== DatasetStatus.Finalised) {
|
if (this.formGroup.get('status').value !== DatasetStatus.Finalised) {
|
||||||
this.editMode = true;
|
this.editMode = true;
|
||||||
|
this.viewOnly = false;
|
||||||
this.formGroup.enable();
|
this.formGroup.enable();
|
||||||
} else {
|
} else {
|
||||||
this.datasetWizardService.unlock(this.formGroup.get('id').value).subscribe(x => {
|
this.datasetWizardService.unlock(this.formGroup.get('id').value).subscribe(x => {
|
||||||
this.editMode = true;
|
this.editMode = true;
|
||||||
|
this.viewOnly = false;
|
||||||
|
this.datasetWizardModel.status = DatasetStatus.Draft;
|
||||||
|
this.formGroup.get('status').patchValue(DatasetStatus.Draft);
|
||||||
this.formGroup.enable();
|
this.formGroup.enable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<textarea matInput formControlName="value" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10" [required]="field.validationRequired">
|
<textarea matInput formControlName="value" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10" [required]="field.validationRequired">
|
||||||
</textarea>
|
</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>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
|
|
|
@ -39,13 +39,15 @@ export class AutoCompleteComponent implements OnInit, ErrorStateMatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.inputData.refreshEvent.subscribe(x => {
|
if (this.inputData.refreshEvent) {
|
||||||
if (x) {
|
this.inputData.refreshEvent.subscribe(x => {
|
||||||
this.formCtrl.patchValue(null);
|
if (x) {
|
||||||
this.textFormCtrl.patchValue(null);
|
this.formCtrl.patchValue(null);
|
||||||
this.options = [];
|
this.textFormCtrl.patchValue(null);
|
||||||
}
|
this.options = [];
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.textFormCtrl = new FormControl();
|
this.textFormCtrl = new FormControl();
|
||||||
if (this.disabled) { this.textFormCtrl.disable(); }
|
if (this.disabled) { this.textFormCtrl.disable(); }
|
||||||
this.formCtrl.registerOnDisabledChange(isDisabled => {
|
this.formCtrl.registerOnDisabledChange(isDisabled => {
|
||||||
|
|
Loading…
Reference in New Issue