Commit 450dbb51 authored by Kristian Ntavidi's avatar Kristian Ntavidi
Browse files

Dataset profile editor. Fix: final preview in step does not affect individual previews in step 2.

parent 9cab64b6
......@@ -53,6 +53,7 @@ import {DragulaModule} from 'ng2-dragula';
//matrial
import {MatBadgeModule} from '@angular/material/badge';
import { DatasetProfileEditorSectionFieldSetComponent } from './editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component';
import { FinalPreviewComponent } from './editor/components/final-preview/final-preview.component';
@NgModule({
imports: [
......@@ -106,12 +107,12 @@ import { DatasetProfileEditorSectionFieldSetComponent } from './editor/component
DatasetProfileEditorValidatorFieldComponent,
DatasetProfileTableOfContents,
DatasetProfileTableOfContentsInternalSection,
DatasetProfileEditorSectionFieldSetComponent
DatasetProfileEditorSectionFieldSetComponent,
FinalPreviewComponent
],
entryComponents: [
DialogConfirmationUploadDatasetProfiles
],
providers:[VisibilityRulesService]
]
})
export class DatasetProfileModule { }
<app-dataset-description [form]="formGroup" [visibilityRules]="visibilityRules" *ngIf="formGroup">
</app-dataset-description>
\ No newline at end of file
import { Component, Input, OnInit} from '@angular/core';
import { Rule } from '@app/core/model/dataset-profile-definition/rule';
import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service';
@Component({
selector: 'app-final-preview-component',
templateUrl: './final-preview.component.html',
styleUrls: ['./final-preview.component.scss'],
providers:[VisibilityRulesService]
})
export class FinalPreviewComponent implements OnInit {
@Input() formGroup = null;
@Input() visibilityRules:Rule[] = [];
constructor(private visibilityRulesService: VisibilityRulesService){
}
ngOnInit(): void {
this.visibilityRulesService.buildVisibilityRules(this.visibilityRules, this.formGroup);
}
}
......@@ -395,9 +395,16 @@
<!-- {{'DATASET-PROFILE-EDITOR.ACTIONS.PREVIEW-AND-FINALIZE' | translate}} -->
<!-- <button (click)="generatePreviewForm()">foo</button> -->
<ng-container *ngIf="formGroup">
<app-final-preview-component [formGroup]="formGroup" [visibilityRules]="visibilityRules">
</app-final-preview-component>
<!--
<app-dataset-description [form]="formGroup" [visibilityRules]="visibilityRules" *ngIf="formGroup">
</app-dataset-description>
</app-dataset-description> -->
</ng-container>
</mat-step>
......
......@@ -53,7 +53,8 @@ const skipDisable: any[] = require('../../../../../assets/resources/skipDisable.
selector: 'app-dataset-profile-editor-component',
templateUrl: './dataset-profile-editor.component.html',
styleUrls: ['./dataset-profile-editor.component.scss'],
animations:[...STEPPER_ANIMATIONS]
animations:[...STEPPER_ANIMATIONS],
providers:[VisibilityRulesService]
})
export class DatasetProfileEditorComponent extends BaseComponent implements OnInit {
......@@ -200,7 +201,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
}
// this.addSection();
// this.addPage();
// this.visibilityRulesService.buildVisibilityRules([],this.form);
this.visibilityRulesService.buildVisibilityRules([],this.form);
setTimeout(() => {
this.steps = this.stepper.steps;
});
......@@ -227,7 +228,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
prepareForm() {
// this.visibilityRulesService.buildVisibilityRules([],this.form);
this.visibilityRulesService.buildVisibilityRules([],this.form);
// this.form.setValidators([EditorCustomValidators.atLeastOneElementListValidator('pages'),EditorCustomValidators.pagesHaveAtLeastOneSection('pages', 'sections')]);
// this.form.updateValueAndValidity();
this.form.valueChanges
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment