Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign

This commit is contained in:
apapachristou 2020-09-10 11:35:18 +03:00
commit b33c49ce4c
2 changed files with 7 additions and 3 deletions

View File

@ -66,8 +66,7 @@
</div>
<!-- Template Form -->
<div *ngIf="hasProfileId() && formGroup.get('datasetProfileDefinition') !== null">
<app-dataset-description [form]="formGroup.get('datasetProfileDefinition')" [datasetProfileId]="getProfileId()" (formChanged)="onFormChanged($event)"></app-dataset-description>
<!-- <app-dataset-description [form]="formGroup.get('datasetProfileDefinition')" [visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules')" [datasetProfileId]="formGroup.get('profile').value"></app-dataset-description> -->
<app-dataset-description [form]="formGroup.get('datasetProfileDefinition')" [visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules').value" [datasetProfileId]="getProfileId()" (formChanged)="onFormChanged($event)"></app-dataset-description>
</div>
<!-- Tags field -->

View File

@ -11,12 +11,15 @@ import { Page } from "../../../core/model/dataset-profile-definition/page";
import { Rule } from "../../../core/model/dataset-profile-definition/rule";
import { Section } from "../../../core/model/dataset-profile-definition/section";
import { ViewStyle } from "../../../core/model/dataset-profile-definition/view-style";
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
export class DatasetDescriptionFormEditorModel extends BaseFormModel {
public status: number;
public pages: Array<DatasetDescriptionPageEditorModel> = [];
public rules: Rule[] = [];
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
fromModel(item: DatasetProfileDefinitionModel): DatasetDescriptionFormEditorModel {
this.status = item.status;
@ -26,7 +29,9 @@ export class DatasetDescriptionFormEditorModel extends BaseFormModel {
}
buildForm(): FormGroup {
const formGroup: FormGroup = new FormBuilder().group({});
const formGroup: FormGroup = new FormBuilder().group({
rules: [{ value: this.rules, disabled: false }, BackendErrorValidator(this.validationErrorModel, 'rules')]
});
const pagesFormArray = new Array<FormGroup>();
this.pages.forEach(item => {