diff --git a/src/app/components/revision/revision.component.ts b/src/app/components/revision/revision.component.ts index 7c69c39c..92293194 100644 --- a/src/app/components/revision/revision.component.ts +++ b/src/app/components/revision/revision.component.ts @@ -78,7 +78,7 @@ export class RevisionComponent implements OnChanges { private getChildrenSize(): number { if (this.isResponseDomain(this.current)) { - return this.current._embedded?.managedRepresentation.children.length; + return this.current.managedRepresentation.children.length; } return 0; } diff --git a/src/app/components/table/table.column.config.ts b/src/app/components/table/table.column.config.ts index da74a9ea..5253e310 100644 --- a/src/app/components/table/table.column.config.ts +++ b/src/app/components/table/table.column.config.ts @@ -25,6 +25,7 @@ const SEQUENCE_CONSTRUCT_COLUMNS = [ ]; const CONDITION_CONSTRUCT_COLUMNS = [ + new Column({ label: 'Label', name: 'label', sortable: true }), new Column({ label: 'Name', name: 'name', sortable: true }), new Column({ label: 'Condition', name: 'condition', sortable: true }) ]; @@ -47,7 +48,7 @@ const PUBLICATION_COLUMNS = [ const CATEGORY_COLUMNS = [ new Column({ name: 'label', label: 'Label', sortable: true }), new Column({ name: 'name', label: 'Name', sortable: true }), - new Column({ name: 'description', label: 'Description', sortable: true }), + // new Column({ name: 'description', label: 'Description', sortable: true }), new Column({ name: 'xmlLang', label: 'Language', sortable: true }) ]; diff --git a/src/app/components/table/table.component.ts b/src/app/components/table/table.component.ts index ebe5684f..f811b824 100644 --- a/src/app/components/table/table.component.ts +++ b/src/app/components/table/table.component.ts @@ -1,6 +1,5 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; import { Subject } from 'rxjs'; -// import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, Inject, LOCALE_ID } from '@angular/core'; import { Component,OnInit, OnChanges, OnDestroy, Input, Output, EventEmitter, Inject, LOCALE_ID, SimpleChanges } from '@angular/core'; import { formatDate } from '@angular/common'; import { Column } from './table.column'; diff --git a/src/app/components/template/template-detail.component.html b/src/app/components/template/template-detail.component.html index 28a4f4ae..1812bced 100644 --- a/src/app/components/template/template-detail.component.html +++ b/src/app/components/template/template-detail.component.html @@ -1,4 +1,4 @@ -
+
menu @@ -48,7 +48,7 @@ - +
-
+ diff --git a/src/app/components/template/template-list.component.ts b/src/app/components/template/template-list.component.ts index 0ea10626..2de2893f 100644 --- a/src/app/components/template/template-list.component.ts +++ b/src/app/components/template/template-list.component.ts @@ -89,7 +89,7 @@ export class TemplateListComponent implements OnInit, OnDestroy { this.pageSearch.page = new Page(result.page); let resourceName = getQueryInfo(this.pageSearch.kind).halName; if (result._embedded) { - this.items = result._embedded[resourceName] as HalResource[]; + this.items = result._embedded[resourceName] as HalResource[] ||[]; }else{ this.items = [] } diff --git a/src/app/lib/classes/category.classes.ts b/src/app/lib/classes/category.classes.ts index d9b29f74..dcb8090b 100644 --- a/src/app/lib/classes/category.classes.ts +++ b/src/app/lib/classes/category.classes.ts @@ -73,7 +73,7 @@ export class Category implements IEntityEditAudit { basedOn?: IRevId; changeComment?: string; - modified: number =0; + modified?: number; modifiedBy?: User|string; version?: IVersion; agency?: Agency; @@ -82,15 +82,6 @@ export class Category implements IEntityEditAudit { xmlLang: string; // = 'en-GB'; comments?: IComment[]; children?: Category[] - // get children(): Category[] { - // if (!this._embedded.children) - // this._embedded.children = [] - // return this._embedded.children; - // } - // set children(value: Category[]) { - // this._embedded.children = value; - // } - _embedded?: { [rel: string]: any; } = {} @@ -101,12 +92,28 @@ export class Category implements IEntityEditAudit { } else if (this.label && !this.name) { this.name = this.label.toLocaleUpperCase(); } - this.code = (init) ? new Code(init.code) : new Code(); - if (!this._embedded) + this.code = ((init) && (init.code)) ? new Code(init.code) : null + if (!this._embedded) { this._embedded = {} + } + console.group(this.name) + console.debug(this.anchors) + console.groupEnd() + this.anchors?.forEach(value => new Category(value)); + } - this.children = ((init) && (init.children)) ? init.children.map(value => new Category(value)) : []; +get anchors() : Category[]{ + return this.children || this._embedded.children as Category[] || [] +} +set anchors(category:Category[]) { + if (this.children){ + this.children = category + } else { + this._embedded.children = category } +} + + public setKind(kind: CategoryKind): Category { this.hierarchyLevel = HierarchyLevel[CATEGORY_INFO[kind].level]; @@ -120,8 +127,5 @@ export class Category implements IEntityEditAudit { return this; } - public setChildren(children: Category[]): Category { - this._embedded.children = children - return this - } + } diff --git a/src/app/lib/classes/questionitem.classes.ts b/src/app/lib/classes/questionitem.classes.ts index 9d301852..75bfe21f 100644 --- a/src/app/lib/classes/questionitem.classes.ts +++ b/src/app/lib/classes/questionitem.classes.ts @@ -8,7 +8,7 @@ export class QuestionItem implements IEntityEditAudit { agency: Agency; name = ''; modified: number; - version: IVersion = { major: 0, minor: 0 }; + version: IVersion = { major: 1, minor: 0 }; classKind = ElementKind[ElementKind.QUESTION_ITEM]; basedOn?: IRevId; changeComment?: string; diff --git a/src/app/lib/classes/responsedomain.classes.ts b/src/app/lib/classes/responsedomain.classes.ts index 4857c73c..abcf06ab 100644 --- a/src/app/lib/classes/responsedomain.classes.ts +++ b/src/app/lib/classes/responsedomain.classes.ts @@ -68,7 +68,7 @@ export class ResponseDomain implements IEntityEditAudit { basedOn?: IRevId; modified?: number; - version?: IVersion = { major: 0, minor: 0 }; + version?: IVersion = { major: 1, minor: 0 }; xmlLang?: string; _links?: { [rel: string]: HalLink; @@ -77,31 +77,34 @@ export class ResponseDomain implements IEntityEditAudit { [rel: string]: any; }; - get managedRep(): Category { - return this.managedRepresentation || this._embedded.managedRepresentation - } - set managedRep(category:Category) { - if (this.managedRepresentation){ - this.managedRepresentation = category - } else { - this._embedded.managedRepresentation = category + public constructor(init?: Partial) { + if (init?._embedded?.managedRepresentation) { + init.managedRepresentation = init?._embedded?.managedRepresentation + init._embedded.managedRepresentation = null } - } - public constructor(init?: Partial) { Object.assign(this, init); if (init && init.xmlLang) { - if (!this._embedded) + if (!this._embedded) { this._embedded = {}; + } + if(!this.managedRepresentation) { + console.debug("ingen managedRepresentation?") + this.managedRepresentation = new Category({xmlLang: init.xmlLang, name: init.name}) + } else { + console.debug("init managedRepresentation") + this.managedRepresentation = new Category(this.managedRepresentation) + this.managedRepresentation.name = this.name + } } } + public get isMixed() { return (this.responseKind === 'MIXED'); } -public get getChildren() { return this.managedRepresentation._embedded?.children || this.managedRepresentation.children; } public get missing(): Category { - return this.getChildren.find(e => e.categoryKind === 'MISSING_GROUP'); + return this.managedRepresentation.anchors.find(e => e.categoryKind === 'MISSING_GROUP'); } public setResponseKind(kind: DomainKind): ResponseDomain { @@ -121,17 +124,17 @@ public get missing(): Category { this.managedRepresentation = new Category({ name: 'Mixed [ renamed in service ]', xmlLang: this.xmlLang, - }).setChildren([this.managedRepresentation]); + children:[this.managedRepresentation] + }) this.id = null; this.setResponseKind(DomainKind.MIXED); } - const filtered = this.getChildren.filter(e => e.categoryKind !== rep.categoryKind); + const filtered = this.managedRepresentation.anchors.filter(e => e.categoryKind !== rep.categoryKind); filtered.push(rep); // there is no other children or this is a mixed responseDomain.... - this.managedRepresentation.children = filtered; + this.managedRepresentation.anchors = filtered; this.name = this.managedRepresentation.label = - 'Mixed (' + this.managedRepresentation.children.map(c => c.label).join(' + ') + ')'; + 'Mixed (' + this.managedRepresentation.anchors.map(c => c.label).join(' + ') + ')'; } - } diff --git a/src/app/lib/consts/query-info.config.ts b/src/app/lib/consts/query-info.config.ts index 8d76d010..b3425c5d 100644 --- a/src/app/lib/consts/query-info.config.ts +++ b/src/app/lib/consts/query-info.config.ts @@ -41,7 +41,7 @@ export const QDDT_QUERY_INFOS: QueryInfo[] = [ ElementKind.CONDITION_CONSTRUCT, 'Condition', 'controlconstruct', - 'controlConstructs', + 'conditionConstructs', ['label', 'name', 'description'], '&constructKind=CONDITION_CONSTRUCT' ), @@ -65,7 +65,7 @@ export const QDDT_QUERY_INFOS: QueryInfo[] = [ ElementKind.STATEMENT_CONSTRUCT, 'Statement', 'controlconstruct', - 'controlConstructs', + 'statementItems', ['label', 'name', 'description'], '&constructKind=STATEMENT_CONSTRUCT' ), diff --git a/src/app/modules/home/concept/concept-tree-node.component.html b/src/app/modules/home/concept/concept-tree-node.component.html index 9a146b0e..1897f9dd 100644 --- a/src/app/modules/home/concept/concept-tree-node.component.html +++ b/src/app/modules/home/concept/concept-tree-node.component.html @@ -4,7 +4,7 @@
  • -
    +