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[] = []; const result:OptionItem[] = [];
parentIds.push(form.get('id').value); // parentIds.push(form.get('id').value);
result.push({ const currentOptionItem:OptionItem = {
id: form.get('id').value, id: form.get('id').value,
type: type, type: type,
label: type ===ToCEntryType.Field? form.get('data').get('label').value :form.get('title').value, label: type ===ToCEntryType.Field? form.get('data').get('label').value :form.get('title').value,
// parentsIds: [form.get('id').value] // parentsIds: [form.get('id').value]
parentsIds: [...parentIds] parentsIds: [...parentIds, form.get('id').value]
}); }
result.push(currentOptionItem);
if(sections){ if(sections){
sections.controls.forEach(section=>{ 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){ if(fieldSets){
fieldSets.controls.forEach(fieldset=>{ 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){ if(fields){
fields.controls.forEach(field=>{ 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"> <mat-step label="Preview and Finalize">
Preview and finalize Preview and finalize
<!-- <button (click)="generatePreviewForm()">foo</button> --> <!-- <button (click)="generatePreviewForm()">foo</button> -->
<app-dataset-description [form]="previewForm" [visibilityRules]="visibilityRules" *ngIf="previewForm"> <ng-container *ngIf="form.get('sections')?.length">
<app-dataset-description [form]="previewForm" [visibilityRules]="visibilityRules" *ngIf="previewForm">
</app-dataset-description> </app-dataset-description>
</ng-container>
</mat-step> </mat-step>
</mat-horizontal-stepper> </mat-horizontal-stepper>

View File

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

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled" "UNTITLED": "Untitled"
}, },
"PAGE-INFO":{ "PAGE-INFO":{
"PAGE-NAME": "Page Name", "PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.", "PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description", "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":{ "ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page", "CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.", "NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ", "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-INFO":{
"SECTION-NAME": "Section Name", "SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the section.", "SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description", "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": { "PAGES": {
"TITLE": "Page Description", "TITLE": "Page Description",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled" "UNTITLED": "Untitled"
}, },
"PAGE-INFO":{ "PAGE-INFO":{
"PAGE-NAME": "Page Name", "PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.", "PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description", "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":{ "ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page", "CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.", "NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ", "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-INFO":{
"SECTION-NAME": "Section Name", "SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the section.", "SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description", "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": { "PAGES": {
"TITLE": "Page Description", "TITLE": "Page Description",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled" "UNTITLED": "Untitled"
}, },
"PAGE-INFO":{ "PAGE-INFO":{
"PAGE-NAME": "Page Name", "PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.", "PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description", "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":{ "ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page", "CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.", "NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ", "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-INFO":{
"SECTION-NAME": "Section Name", "SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the section.", "SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description", "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": { "PAGES": {
"TITLE": "Descripición de la página", "TITLE": "Descripición de la página",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled" "UNTITLED": "Untitled"
}, },
"PAGE-INFO":{ "PAGE-INFO":{
"PAGE-NAME": "Page Name", "PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.", "PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description", "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":{ "ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page", "CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.", "NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ", "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-INFO":{
"SECTION-NAME": "Section Name", "SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the section.", "SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description", "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": { "PAGES": {
"TITLE": "Περιγραφή Σελίδας", "TITLE": "Περιγραφή Σελίδας",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled" "UNTITLED": "Untitled"
}, },
"PAGE-INFO":{ "PAGE-INFO":{
"PAGE-NAME": "Page Name", "PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.", "PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description", "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":{ "ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page", "CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.", "NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ", "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-INFO":{
"SECTION-NAME": "Section Name", "SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the section.", "SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description", "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": { "PAGES": {
"TITLE": "Descrição da Página", "TITLE": "Descrição da Página",

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled" "UNTITLED": "Untitled"
}, },
"PAGE-INFO":{ "PAGE-INFO":{
"PAGE-NAME": "Page Name", "PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.", "PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description", "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":{ "ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page", "CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.", "NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ", "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-INFO":{
"SECTION-NAME": "Section Name", "SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the section.", "SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description", "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": { "PAGES": {
"TITLE": "Opis stránky", "TITLE": "Opis stránky",

View File

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

View File

@ -290,22 +290,24 @@
"UNTITLED": "Untitled" "UNTITLED": "Untitled"
}, },
"PAGE-INFO":{ "PAGE-INFO":{
"PAGE-NAME": "Page Name", "PAGE-NAME": "Section Name",
"PAGE-NAME-HINT": "Set a name for the dataset page.", "PAGE-NAME-HINT": "Set a name for the dataset section.",
"PAGE-DESCRIPTION": "Description", "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":{ "ACTIONS":{
"CREATE-FIRST-PAGE": "Create the first page", "CREATE-FIRST-PAGE": "Create the first Section",
"NOTHING-HERE-HINT": "Nothing here yet.", "NOTHING-HERE-HINT": "Nothing here yet.",
"START-CREATING-PAGE-START": "Start by ", "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-INFO":{
"SECTION-NAME": "Section Name", "SECTION-NAME": "Subsection Name",
"SECTION-NAME-HINT": "Set a name for the section.", "SECTION-NAME-HINT": "Set a name for the subsection.",
"SECTION-DESCRIPTION": "Description", "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": { "PAGES": {
"TITLE": "Sayfa Tanımı", "TITLE": "Sayfa Tanımı",