Adds finalize functionality on Dataset Profiles and refactors frontend and backend to suit that change.

This commit is contained in:
Diamantis Tziotzios 2019-02-11 14:04:45 +02:00
parent 35d85f5f6e
commit 22592cfe75
21 changed files with 136 additions and 95 deletions

View File

@ -18,7 +18,7 @@ import java.util.UUID;
public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
public enum Status {
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
private short value;
@ -33,9 +33,9 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
public static Status fromInteger(int value) {
switch (value) {
case 0:
return INACTIVE;
return SAVED;
case 1:
return ACTIVE;
return FINALIZED;
case 99:
return DELETED;
default:

View File

@ -55,6 +55,7 @@ public class Admin extends BaseController {
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
eu.eudat.data.entities.DatasetProfile datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
datasetprofile.setDefinition(modelDefinition.getDefinition());
datasetprofile.setStatus(modelDefinition.getStatus());
this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
}
@ -64,6 +65,7 @@ public class Admin extends BaseController {
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel());
datasetprofile.setStatus(profile.getStatus());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(datasetprofile));
}

View File

@ -26,7 +26,7 @@ public class AdminManager {
String xml = XmlBuilder.generateXml(viewStyleDoc);
eu.eudat.data.entities.DatasetProfile datasetProfile = apiContext.getOperationsContext().getBuilderFactory().getBuilder(DatasetProfileBuilder.class).definition(xml).label(profile.getLabel())
.status((short) 1).created(new Date())
.status(profile.getStatus()).created(new Date())
.build();
return datasetProfile;

View File

@ -10,6 +10,7 @@ public class DatasetProfile {
private String label;
private List<Section> sections;
private List<Page> pages;
private Short status;
public List<Section> getSections() {
return sections;
@ -35,6 +36,14 @@ public class DatasetProfile {
this.pages = pages;
}
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public void buildProfile(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle) {
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class);

View File

@ -0,0 +1,5 @@
export enum DatasetProfileEnum {
SAVED = 0,
FINALIZED = 1,
DELETED = 99
}

View File

@ -4,6 +4,7 @@ export interface DatasetProfile {
label: string;
sections: Section[];
pages: Page[];
status: number;
}
export interface Page {

View File

@ -3,11 +3,11 @@
| translate}}</h4>
<h4 *ngIf="!isComposite" style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.SIMPLE-FIELD-TITLE'
| translate}}</h4>
<mat-checkbox class="col-auto" [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMPOSITE-CHECKBOX'
<mat-checkbox class="col-auto" [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMPOSITE-CHECKBOX'
| translate}}</mat-checkbox>
<mat-checkbox class="col-auto" [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-CHECKBOX'
<mat-checkbox class="col-auto" [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-CHECKBOX'
| translate}}</mat-checkbox>
<mat-checkbox class="col" [formControl]="this.form.get('hasCommentField')">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-CHECKBOX'
<mat-checkbox class="col" [formControl]="this.form.get('hasCommentField')" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-CHECKBOX'
| translate}}</mat-checkbox>
</div>
<div class="row">
@ -51,7 +51,7 @@
[formControl]="this.form.get('extendedDescription')"></textarea>
</mat-form-field>
<app-dataset-profile-editor-field-component class="col-12" *ngIf="!isComposite" [form]="form.get('fields').get(''+0)"
[showOrdinal]="false" [indexPath]="indexPath + 'f' + 0"></app-dataset-profile-editor-field-component>
[showOrdinal]="false" [indexPath]="indexPath + 'f' + 0" [viewOnly]="viewOnly"></app-dataset-profile-editor-field-component>
</div>
<div *ngIf="isComposite" class="row">
<h4 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.SUB-FIELDS-TITLE' |
@ -61,16 +61,16 @@
<mat-expansion-panel-header>
<mat-panel-title>{{i + 1}}. {{getFieldTile(field, i)}}</mat-panel-title>
<div class="row">
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="DeleteField(i);">
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="DeleteField(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 'f' + i}}" *ngIf="panel.expanded">
<app-dataset-profile-editor-field-component [form]="form.get('fields').get(''+i)" [indexPath]="indexPath + 'f' + i"></app-dataset-profile-editor-field-component>
<app-dataset-profile-editor-field-component [form]="form.get('fields').get(''+i)" [indexPath]="indexPath + 'f' + i" [viewOnly]="viewOnly"></app-dataset-profile-editor-field-component>
</div>
</mat-expansion-panel>
</div>
<div class="col-12"><button mat-button class="full-width" (click)="addNewField()">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.ACTIONS.ADD-CHILD-FIELD'
<div class="col-12"><button mat-button class="full-width" (click)="addNewField()" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.ACTIONS.ADD-CHILD-FIELD'
| translate}}</button></div>
</div>

View File

@ -11,6 +11,7 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit {
@Input() form: FormGroup;
@Input() indexPath: string;
@Input() viewOnly: boolean;
isComposite = false;
isMultiplicityEnabled = false;

View File

@ -1,7 +1,7 @@
<div class="row">
<mat-form-field class="col">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.ID' | translate}}" type="text"
[formControl]="this.form.get('id')" required>
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.ID' | translate}}" type="text" [formControl]="this.form.get('id')"
required>
<mat-error *ngIf="this.form.get('id').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="this.form.get('id').hasError('pattern')">{{'GENERAL.VALIDATION.PATTERN-_' | translate}}</mat-error>
</mat-form-field>
@ -16,18 +16,16 @@
<mat-option [value]="viewStyleEnum.RadioBox">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.RadioBox)}}</mat-option>
<mat-option [value]="viewStyleEnum.TextArea">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.TextArea)}}</mat-option>
</mat-select>
<mat-error *ngIf="this.form.get('viewStyle').get('renderStyle').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED'
| translate}}</mat-error>
<mat-error *ngIf="this.form.get('viewStyle').get('renderStyle').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field *ngIf="showOrdinal" class="col">
<input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.ORDER' | translate}}"
[formControl]="this.form.get('ordinal')">
<input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.ORDER' | translate}}" [formControl]="this.form.get('ordinal')">
</mat-form-field>
<!-- Default Value -->
<app-component-profile-editor-default-value-component *ngIf="form.get('viewStyle').get('renderStyle').value" class="col"
[viewStyle]="form.get('viewStyle').get('renderStyle').value" [form]="this.form.get('defaultValue').get('value')"
[formArrayOptions]="form.get('data')?.get('options')" [comboBoxType]="this.form.get('data')?.get('type')?.value"
placeHolder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.DEFAULT-VALUE' | translate}}" [required]="defaulValueRequired(form.get('viewStyle').get('renderStyle').value)"></app-component-profile-editor-default-value-component>
[viewStyle]="form.get('viewStyle').get('renderStyle').value" [form]="this.form.get('defaultValue').get('value')" [formArrayOptions]="form.get('data')?.get('options')"
[comboBoxType]="this.form.get('data')?.get('type')?.value" placeHolder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.DEFAULT-VALUE' | translate}}"
[required]="defaulValueRequired(form.get('viewStyle').get('renderStyle').value)"></app-component-profile-editor-default-value-component>
<mat-form-field class="col" *ngIf="!(defaulValueRequired(form.get('viewStyle').get('renderStyle').value))">
@ -48,11 +46,12 @@
<app-dataset-profile-editor-checkbox-field-component *ngSwitchCase="viewStyleEnum.CheckBox" class="col-12" [form]="form"></app-dataset-profile-editor-checkbox-field-component>
</div>
<div class="row">
<h4 class="col-12" style="font-weight: bold">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.RULES-TITLE' |
translate}}</h4>
<app-dataset-profile-editor-rule-component class="col-12" [form]="form.get('visible').get('rules')"
[viewStyleForCheck]="form.get('viewStyle').get('renderStyle').value" [formArrayOptionsForCheck]="this.form.get('data')?.get('options')"
[comboBoxTypeForCheck]="this.form.get('data')?.get('type')?.value"></app-dataset-profile-editor-rule-component>
<div class="col-12"><button mat-button class="full-width" (click)="addNewRule()" [disabled]="!form.get('viewStyle').get('renderStyle').value">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.ACTIONS.ADD-RULE'
| translate}}</button></div>
<h4 class="col-12" style="font-weight: bold">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.RULES-TITLE' | translate}}
</h4>
<app-dataset-profile-editor-rule-component class="col-12" [form]="form.get('visible').get('rules')" [viewStyleForCheck]="form.get('viewStyle').get('renderStyle').value"
[formArrayOptionsForCheck]="this.form.get('data')?.get('options')" [comboBoxTypeForCheck]="this.form.get('data')?.get('type')?.value"
[viewOnly]="viewOnly"></app-dataset-profile-editor-rule-component>
<div class="col-12" *ngIf="!viewOnly">
<button mat-button class="full-width" (click)="addNewRule()" [disabled]="!form.get('viewStyle').get('renderStyle').value">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.ACTIONS.ADD-RULE' | translate}}</button>
</div>
</div>

View File

@ -20,7 +20,7 @@ import { RuleEditorModel } from '../../../admin/rule-editor-model';
styleUrls: ['./dataset-profile-editor-field.component.scss']
})
export class DatasetProfileEditorFieldComponent extends BaseComponent implements OnInit {
@Input() viewOnly: boolean;
@Input() form: FormGroup;
@Input() showOrdinal = true;
@Input() indexPath: string;

View File

@ -6,7 +6,7 @@
[formControl]="pageControl.get('title')" required>
<mat-error *ngIf="pageControl.get('title').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<button mat-icon-button type="button" class="col-auto" (click)="removePage(i)">
<button mat-icon-button type="button" class="col-auto" (click)="removePage(i)" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</button>
</div>

View File

@ -9,6 +9,7 @@ import { FormArray } from '@angular/forms';
export class DatasetProfileEditorPageComponent {
@Input() form: FormArray;
@Input() viewOnly: boolean;
removePage(index) {
(<FormArray>this.form).removeAt(index);

View File

@ -17,7 +17,7 @@
</mat-form-field>
<div class="col-auto"><button mat-icon-button type="button" (click)="deleteRule(i);">
<div class="col-auto"><button mat-icon-button type="button" (click)="deleteRule(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</button>
</div>

View File

@ -17,7 +17,7 @@ export class DatasetProfileEditorRuleComponent {
@Input() formControlForCheck: FormControl;
@Input() formArrayOptionsForCheck: FormArray;
@Input() comboBoxTypeForCheck: DatasetProfileComboBoxType;
@Input() viewOnly: boolean;
targetValidation() {
//TODO

View File

@ -35,14 +35,14 @@
<mat-card class="field-card" *ngFor="let fieldControl of form.get('fieldSets')['controls'] let i=index;">
<div class="row">
<mat-card-title class="col">{{i + 1}}. {{getFieldTile(fieldControl, i)}}</mat-card-title>
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="deleteFieldSet(i);">
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="deleteFieldSet(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</button>
<app-dataset-profile-editor-composite-field-component class="col-12" [form]="fieldControl" [indexPath]="indexPath + 'cf' + i"></app-dataset-profile-editor-composite-field-component>
<app-dataset-profile-editor-composite-field-component class="col-12" [form]="fieldControl" [indexPath]="indexPath + 'cf' + i" [viewOnly]="viewOnly"></app-dataset-profile-editor-composite-field-component>
</div>
</mat-card>
</div>
<div class="col-12"><button mat-button class="full-width" (click)="addField()">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.SECTION.ACTIONS.ADD-FIELD'
<div class="col-12"><button mat-button class="full-width" (click)="addField()" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.SECTION.ACTIONS.ADD-FIELD'
| translate}}</button></div>
<h4 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.SECTION.FIELDS.SUB-SECTIONS-TITLE' |
translate}}</h4>
@ -52,18 +52,18 @@
<mat-panel-title>{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<div class="row">
<!-- <span class="col">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</span> -->
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="DeleteSectionInSection(i);">
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="DeleteSectionInSection(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 's' + i}}" *ngIf="panel.expanded" class="row">
<app-dataset-profile-editor-section-component class="col-12" [form]="form.get('sections').get(''+i)" [dataModel]="section"
[indexPath]="indexPath + 's' + i"></app-dataset-profile-editor-section-component>
[indexPath]="indexPath + 's' + i" [viewOnly]="viewOnly"></app-dataset-profile-editor-section-component>
</div>
</mat-expansion-panel>
</div>
<div class="col-12"><button mat-button class="full-width" (click)="addSectioninSection()">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.SECTION.ACTIONS.ADD-SUB-SECTION'
<div class="col-12"><button mat-button class="full-width" (click)="addSectioninSection()" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.SECTION.ACTIONS.ADD-SUB-SECTION'
| translate}}</button></div>
</div>

View File

@ -17,6 +17,7 @@ export class DatasetProfileEditorSectionComponent extends BaseComponent implemen
@Input() form: FormGroup;
@Input() dataModel: SectionEditorModel;
@Input() indexPath: string;
@Input() viewOnly: boolean;
constructor() { super(); }

View File

@ -10,11 +10,13 @@ export class DatasetProfileEditorModel extends BaseFormModel {
public sections: Array<SectionEditorModel> = new Array<SectionEditorModel>();
public pages: Array<PageEditorModel> = new Array<PageEditorModel>();
public label: string;
public status: number;
fromModel(item: DatasetProfile): DatasetProfileEditorModel {
if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); }
if (item.pages) { this.pages = item.pages.map(x => new PageEditorModel().fromModel(x)); }
this.label = item.label;
this.status = item.status;
return this;
}
@ -34,8 +36,8 @@ export class DatasetProfileEditorModel extends BaseFormModel {
pagesFormArray.push(form);
});
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
formGroup.addControl('label', new FormControl(this.label, Validators.required));
formGroup.addControl('status', new FormControl(this.status));
return formGroup;
}
}

View File

@ -1,7 +1,6 @@
<div class="container" *ngIf="form" [formGroup]='form' class="dataset-profile-editor">
<mat-form-field class="full-width">
<input matInput formControlName="label" placeholder="{{'DATASET-PROFILE-EDITOR.FIELDS.DATASET-TITLE' | translate}}"
required>
<input matInput formControlName="label" placeholder="{{'DATASET-PROFILE-EDITOR.FIELDS.DATASET-TITLE' | translate}}" required>
<mat-error *ngIf="form.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
@ -9,9 +8,10 @@
<mat-step>
<ng-template matStepLabel>{{'DATASET-PROFILE-EDITOR.STEPS.PAGES.TITLE' | translate}}</ng-template>
<div class="row">
<app-dataset-profile-editor-page-component class="col-12" [form]="form.get('pages')"></app-dataset-profile-editor-page-component>
<div class="col-12"><button mat-button class="full-width" (click)="addPage()">{{'DATASET-PROFILE-EDITOR.ACTIONS.ADD-PAGE'
| translate}}</button></div>
<app-dataset-profile-editor-page-component class="col-12" [form]="form.get('pages')" [viewOnly]="viewOnly"></app-dataset-profile-editor-page-component>
<div class="col-12">
<button mat-button class="full-width" (click)="addPage()" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.ACTIONS.ADD-PAGE' | translate}}</button>
</div>
</div>
</mat-step>
<mat-step>
@ -21,18 +21,19 @@
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel>
<mat-expansion-panel-header>
<mat-panel-title>{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<button mat-icon-button type="button" (click)="DeleteSection(i);">
<button mat-icon-button type="button" (click)="DeleteSection(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</button>
</mat-expansion-panel-header>
<div id="{{'s' + i}}" class="row" *ngIf="panel.expanded">
<app-dataset-profile-editor-section-component class="col-12" [form]="form.get('sections').get(''+i)" [dataModel]="section"
[indexPath]="'s' + i"></app-dataset-profile-editor-section-component>
[indexPath]="'s' + i" [viewOnly]="viewOnly"></app-dataset-profile-editor-section-component>
</div>
</mat-expansion-panel>
</mat-accordion>
<div class="col-12"><button mat-button (click)="addSection()" class="full-width">{{'DATASET-PROFILE-EDITOR.ACTIONS.ADD-SECTION'
| translate}}</button></div>
<div class="col-12">
<button mat-button (click)="addSection()" class="full-width" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.ACTIONS.ADD-SECTION' | translate}}</button>
</div>
</div>
</mat-step>
<!-- <mat-step>
@ -44,11 +45,17 @@
</mat-horizontal-stepper>
<div class="row">
<!-- SAVE BUTTON -->
<div class="col-auto" *ngIf="!viewOnly">
<div class="row">
<button mat-raised-button color="primary" type="button col-auto" (click)='onSubmit()' [disabled]="!form.valid">Save</button>
<div class="col-1"></div>
<button mat-raised-button color="primary" type="button col-auto" (click)='finalize()' [disabled]="!form.valid">Finalize</button>
</div>
</div>
<div class="col"></div>
<!-- DELETE BUTTON -->
<div class="col-auto" *ngIf="!isNew">
<button mat-raised-button (click)="delete()">
<button mat-raised-button color="primary" (click)="delete()">
<mat-icon>delete</mat-icon>{{'DATASET-PROFILE-EDITOR.ACTIONS.DELETE' | translate}}
</button>
</div>

View File

@ -15,6 +15,7 @@ import { PageEditorModel } from '../admin/page-editor-model';
import { SectionEditorModel } from '../admin/section-editor-model';
import { DatasetProfileEditorModel } from './dataset-profile-editor-model';
import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component';
import { DatasetProfileEnum } from '../../../../core/common/enum/dataset-profile';
@Component({
selector: 'app-dataset-profile-editor-component',
@ -31,7 +32,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
private datasetProfileId: string;
dataWizardModel: DatasetWizardModel;
@ViewChild('stepper') stepper: MatHorizontalStepper;
viewOnly = false;
constructor(
private datasetProfileService: DatasetProfileService,
@ -48,7 +49,6 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
}
ngOnInit() {
this.route.paramMap.pipe(takeUntil(this._destroyed)).subscribe((paramMap: ParamMap) => {
this.datasetProfileId = paramMap.get('id');
const cloneId = paramMap.get('cloneid');
@ -63,6 +63,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
this.form = this.dataModel.buildForm();
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
this.form.disable();
this.viewOnly = true;
}
this.prepareForm();
} catch {
this.logger.error('Could not parse MasterItem: ' + data);
@ -79,6 +83,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
try {
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
this.dataModel.status = DatasetProfileEnum.SAVED;
this.form = this.dataModel.buildForm();
this.prepareForm();
} catch {
@ -91,6 +96,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
} else {
this.dataModel = new DatasetProfileEditorModel();
this.form = this.dataModel.buildForm();
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
this.form.disable();
this.viewOnly = true;
}
this.addSection();
this.addPage();
}
@ -155,6 +164,13 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
}
}
finalize() {
//const data = this.form.value;
this.form.get('status').setValue(DatasetProfileEnum.FINALIZED);
this.onSubmit();
}
isStepActive(step: number) {
return this.stepper && this.stepper.selectedIndex === step;
}
@ -174,7 +190,6 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
// }
}
// DELETE Function
public delete(): void {
if (this.datasetProfileId && !this.isNew) {

View File

@ -71,7 +71,6 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
getDefaultCriteria(dmpId: String): DatasetProfileCriteria {
const defaultCriteria = new DatasetProfileCriteria();
return defaultCriteria;
}
@ -83,7 +82,6 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
// debugger;
// this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe();
// }
}
export class DatasetDataSource extends DataSource<DatasetListingModel> {

View File

@ -146,7 +146,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.formGroup.disable();
this.viewOnly = true;
}
if (this.viewOnly) { this.formGroup.disable(); }
// if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
this.loadDatasetProfiles();
});
} else if (dmpId != null) {
@ -191,7 +191,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.formGroup.disable();
this.viewOnly = true;
}
if (this.viewOnly) { this.formGroup.disable(); }
//if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
this.formGroup.get('dmp').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => {