Dataset profile editor. Minor ui fixes. Languages fixes and visibilities

This commit is contained in:
Kristian Ntavidi 2021-02-17 19:44:50 +02:00
parent dd2db4ce1f
commit a8074f6239
11 changed files with 124 additions and 100 deletions

View File

@ -90,28 +90,29 @@ export class DatasetProfileEditorRuleComponent implements OnInit{
const result:OptionItem[] = [];
parentIds.push(form.get('id').value);
result.push({
// parentIds.push(form.get('id').value);
const currentOptionItem:OptionItem = {
id: form.get('id').value,
type: type,
label: type ===ToCEntryType.Field? form.get('data').get('label').value :form.get('title').value,
// parentsIds: [form.get('id').value]
parentsIds: [...parentIds]
});
parentsIds: [...parentIds, form.get('id').value]
}
result.push(currentOptionItem);
if(sections){
sections.controls.forEach(section=>{
result.push( ...this.buildOptions(section as FormGroup, ToCEntryType.Section,parentIds) );
result.push( ...this.buildOptions(section as FormGroup, ToCEntryType.Section, currentOptionItem.parentsIds) );
});
}
if(fieldSets){
fieldSets.controls.forEach(fieldset=>{
result.push( ...this.buildOptions(fieldset as FormGroup, ToCEntryType.FieldSet, parentIds) );
result.push( ...this.buildOptions(fieldset as FormGroup, ToCEntryType.FieldSet, currentOptionItem.parentsIds) );
});
}
if(fields){
fields.controls.forEach(field=>{
result.push( ...this.buildOptions(field as FormGroup, ToCEntryType.Field, parentIds) ); //TODO NA TO DOUME
result.push( ...this.buildOptions(field as FormGroup, ToCEntryType.Field, currentOptionItem.parentsIds) ); //TODO NA TO DOUME
});
}

View File

@ -248,9 +248,11 @@
<mat-step label="Preview and Finalize">
Preview and finalize
<!-- <button (click)="generatePreviewForm()">foo</button> -->
<app-dataset-description [form]="previewForm" [visibilityRules]="visibilityRules" *ngIf="previewForm">
</app-dataset-description>
<ng-container *ngIf="form.get('sections')?.length">
<app-dataset-description [form]="previewForm" [visibilityRules]="visibilityRules" *ngIf="previewForm">
</app-dataset-description>
</ng-container>
</mat-step>
</mat-horizontal-stepper>

View File

@ -1,10 +1,10 @@
import { of as observableOf, Observable } from 'rxjs';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { AfterViewInit, Component, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { AfterViewInit, Component, OnChanges, OnInit, QueryList, SimpleChanges, ViewChild } from '@angular/core';
import { Form, FormArray, FormControl, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { MatHorizontalStepper } from '@angular/material/stepper';
import { MatHorizontalStepper, MatStep } from '@angular/material/stepper';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators';
@ -35,7 +35,7 @@ import { FieldSetEditorModel } from '../admin/field-set-editor-model';
import { Guid } from '@common/types/guid';
import { FieldEditorModel } from '../admin/field-editor-model';
import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service';
import { StepperSelectionEvent } from '@angular/cdk/stepper';
import { CdkStep, StepperSelectionEvent } from '@angular/cdk/stepper';
import { DatasetDescriptionCompositeFieldEditorModel, DatasetDescriptionFieldEditorModel, DatasetDescriptionFormEditorModel, DatasetDescriptionPageEditorModel, DatasetDescriptionSectionEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
import { Rule } from '@app/core/model/dataset-profile-definition/rule';
@ -180,6 +180,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.visibilityRulesService.buildVisibilityRules([],this.form);
}
});
setTimeout(() => {
this.steps = this.stepper.steps;
});
}
prepareForm() {
@ -981,7 +985,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
}
get barPercentage(){
if(!this.stepper){
if(!this.stepper || !this.steps){
return -110;
}
const selectedIndex = this.stepper.selectedIndex + 1;
@ -993,13 +997,14 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
return {'transform': 'translateX('+this.barPercentage+'%) skewX(-25deg)'}
}
get steps(){
if(!this.stepper){
return [];
}
steps:QueryList<CdkStep>;
// get steps(){
// if(!this.stepper){
// return [];
// }
return this.stepper.steps;
}
// return this.stepper.steps;
// }
generatePreviewForm(){

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Page Description",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Page Description",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Descripición de la página",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Περιγραφή Σελίδας",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Descrição da Página",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Opis stránky",

View File

@ -290,23 +290,25 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
},
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Opis stranice",
"PAGE-PREFIX": "Stranica",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled"
},
"PAGE-INFO":{
"PAGE-NAME": "Page Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.",
"PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the page is about.",
"PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the section is about.",
"ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page",
"CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ",
"START-CREATING-PAGE-END": "creating the first page."
}
"START-CREATING-PAGE-END": "creating the first Section."
},
"PAGE":"Section"
},
"SECTION-INFO":{
"SECTION-NAME": "Section Name",
"SECTION-NAME-HINT": "Set a name for the section.",
"SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description",
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the section is about."
"SECTION-DESCRIPTION-HINT": "Write a brief desciption of what the subsection is about.",
"SECTION": "Subsection"
},
"PAGES": {
"TITLE": "Sayfa Tanımı",