From da800b33b520c5e47ae580974b906beef07d840c Mon Sep 17 00:00:00 2001 From: dashawiki Date: Mon, 25 Oct 2021 14:18:57 +0200 Subject: [PATCH 1/5] attribute html restructured to accept backend attribute structure instead of mock data. TODO: fix for mock data --- .eslintrc.json | 3 ++- src/main/webapp/app/app.constants.ts | 2 +- .../common/models/attribute.model.ts | 22 +++++++++---------- .../starter/start-up/start-up.component.html | 8 +++---- .../starter/start-up/start-up.component.ts | 7 +++++- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2e22599..020814a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,6 +19,7 @@ "ignoreRestSiblings": false } ], - "@typescript-eslint/no-non-null-assertion": "off" + "@typescript-eslint/no-non-null-assertion": "off", + "no-console": "off" } } diff --git a/src/main/webapp/app/app.constants.ts b/src/main/webapp/app/app.constants.ts index 6fe657c..f16ef1c 100644 --- a/src/main/webapp/app/app.constants.ts +++ b/src/main/webapp/app/app.constants.ts @@ -6,4 +6,4 @@ export const VERSION = process.env.VERSION; export const DEBUG_INFO_ENABLED = Boolean(process.env.DEBUG_INFO_ENABLED); export const SERVER_API_URL = process.env.SERVER_API_URL; export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP; -export const MOCK_DATA = true; +export const MOCK_DATA = false; diff --git a/src/main/webapp/app/case-management/common/models/attribute.model.ts b/src/main/webapp/app/case-management/common/models/attribute.model.ts index 677c79e..60453c6 100644 --- a/src/main/webapp/app/case-management/common/models/attribute.model.ts +++ b/src/main/webapp/app/case-management/common/models/attribute.model.ts @@ -1,15 +1,15 @@ import { BaseDomain } from '../'; export class CMAttribute implements BaseDomain { - constructor( - public id: number, - public name: string, - public showOrder: number, - public keyId?: number, - public description?: string, - public children?: CMAttribute[], - public selected?: boolean - ) { - this.selected = false; - } + constructor( + public id: number, + public name: string, + public showOrder: number, + public values?: CMAttribute[], + public description?: string, + public children?: CMAttribute[], + public selected?: boolean + ) { + this.selected = false; + } } diff --git a/src/main/webapp/app/case-management/starter/start-up/start-up.component.html b/src/main/webapp/app/case-management/starter/start-up/start-up.component.html index 294d6f5..76ed6b9 100644 --- a/src/main/webapp/app/case-management/starter/start-up/start-up.component.html +++ b/src/main/webapp/app/case-management/starter/start-up/start-up.component.html @@ -12,7 +12,7 @@ No requirement set were found. + *ngIf="requirementSets.length === 0">No requirement set was found.
-
+
- @@ -89,4 +89,4 @@

-

\ No newline at end of file +
diff --git a/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts b/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts index 2bd6de9..67599e4 100644 --- a/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts +++ b/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts @@ -105,6 +105,8 @@ export class StartUpComponent implements OnInit { .findAttributes(this.selectedRequirementSet.id, CMAttributeType.PARAMETER) .subscribe((res: HttpResponse) => { this.onSuccess(res.body, this.attributes); + console.log(this.attributes); + console.log(this.changeSelectionProperties); if (this.changeSelectionProperties.selectedAttributes !== undefined && this.attributes) { this.util.updatePropertyInArray(this.attributes, { selected: true }, this.changeSelectionProperties.selectedAttributes); } @@ -120,8 +122,11 @@ export class StartUpComponent implements OnInit { .query(CMAttribute, ATTRIBUTES_URI, { requirementSet: this.selectedRequirementSet.id, type: CMAttributeType.PARAMETER }) .subscribe((res: HttpResponse) => { this.onSuccess(res.body, this.attributes); - if (this.changeSelectionProperties.selectedAttributes !== undefined && this.attributes) { + console.log(this.changeSelectionProperties); + if (this.attributes) { + //this.changeSelectionProperties.selectedAttributes !== undefined && this.util.updatePropertyInArray(this.attributes, { selected: true }, this.changeSelectionProperties.selectedAttributes); + console.log(this.attributes); this.attributes = [...this.attributes]; } }); From aebf98e05ff4204e6180108e747b9c174e1c6d34 Mon Sep 17 00:00:00 2001 From: dashawiki Date: Wed, 27 Oct 2021 10:20:45 +0200 Subject: [PATCH 2/5] ATTRIBUTE_URI merged with ATTRIBUTES_URI --- .../case-management/common/constants/backend-uri.constants.ts | 1 - .../requirement-editor/editor/editor.component.ts | 3 +-- .../app/case-management/starter/start-up/start-up.component.ts | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts b/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts index 62b2e96..8e12721 100644 --- a/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts +++ b/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts @@ -9,7 +9,6 @@ export const REQUIREMENTSETS_URI = '/requirementSets'; export const REQUIREMENTSET_URI = '/requirementSet'; export const REQUIREMENTS_URI = '/requirements'; export const ATTRIBUTES_URI = '/attributes'; -export const ATTRIBUTE_URI = '/attribute'; export const ATTRIBUTEKEYS_URI = '/attributeKeys'; export const ATTRIBUTEKEY_URI = '/attributeKey'; export const ENHANCEMENTS_URI = '/enhancements'; diff --git a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts index ad3cc31..6ab1322 100644 --- a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts +++ b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts @@ -21,7 +21,6 @@ import { ENHANCEMENTS_URI, STATUS_URI, REQUIREMENTS_URI, - ATTRIBUTE_URI, REQUIREMENTSET_URI, ATTRIBUTEKEY_URI } from '../../common/'; @@ -258,7 +257,7 @@ export class EditorComponent implements OnInit, OnDestroy { } else { /* Backend load Attribute with ids */ this._backendService - .query(CMAttribute, ATTRIBUTE_URI, { ids: this.artifactSettings.parameterAttributes.ids }) + .query(CMAttribute, ATTRIBUTES_URI, { ids: this.artifactSettings.parameterAttributes.ids }) .subscribe((res: HttpResponse) => { this.onSuccess(res.body, this.artifactSettings.parameterAttributes.content); }); diff --git a/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts b/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts index 67599e4..dae3dc5 100644 --- a/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts +++ b/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts @@ -124,7 +124,7 @@ export class StartUpComponent implements OnInit { this.onSuccess(res.body, this.attributes); console.log(this.changeSelectionProperties); if (this.attributes) { - //this.changeSelectionProperties.selectedAttributes !== undefined && + // this.changeSelectionProperties.selectedAttributes !== undefined && this.util.updatePropertyInArray(this.attributes, { selected: true }, this.changeSelectionProperties.selectedAttributes); console.log(this.attributes); this.attributes = [...this.attributes]; From e058443a999a5342c89f51210be22da937df60e1 Mon Sep 17 00:00:00 2001 From: dashawiki Date: Wed, 27 Oct 2021 11:11:28 +0200 Subject: [PATCH 3/5] ATTRIBUTEKEY_URI merged into ATTRIBUTEKEYS_URI --- .../common/constants/backend-uri.constants.ts | 1 - .../requirement-editor/editor/editor.component.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts b/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts index 8e12721..e688f9b 100644 --- a/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts +++ b/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts @@ -10,7 +10,6 @@ export const REQUIREMENTSET_URI = '/requirementSet'; export const REQUIREMENTS_URI = '/requirements'; export const ATTRIBUTES_URI = '/attributes'; export const ATTRIBUTEKEYS_URI = '/attributeKeys'; -export const ATTRIBUTEKEY_URI = '/attributeKey'; export const ENHANCEMENTS_URI = '/enhancements'; export const STATUS_URI = '/status'; diff --git a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts index 6ab1322..4c683ba 100644 --- a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts +++ b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts @@ -21,8 +21,7 @@ import { ENHANCEMENTS_URI, STATUS_URI, REQUIREMENTS_URI, - REQUIREMENTSET_URI, - ATTRIBUTEKEY_URI + REQUIREMENTSET_URI } from '../../common/'; import { ArtifactInfo } from '../../common/models/yaml.model'; import { ActivatedRoute, Router } from '@angular/router'; @@ -264,7 +263,7 @@ export class EditorComponent implements OnInit, OnDestroy { /* Backend load Attribute keys and requirement sets */ this._backendService - .query(CMAttributeKey, ATTRIBUTEKEY_URI, { ids: this.artifactSettings.parameterAttributeKeys.ids }) + .query(CMAttributeKey, ATTRIBUTEKEYS_URI, { ids: this.artifactSettings.parameterAttributeKeys.ids }) .subscribe((res: HttpResponse) => { this.onSuccess(res.body, this.artifactSettings.parameterAttributeKeys.content); }); From ba77e9fb458e89f4e449ad20ab3a95cea800aa86 Mon Sep 17 00:00:00 2001 From: dashawiki Date: Wed, 27 Oct 2021 11:49:32 +0200 Subject: [PATCH 4/5] REQUIREMENTSET_URI merged into REQUIREMENTSETS_URI --- .../common/constants/backend-uri.constants.ts | 1 - .../services/case-management-backend.service.ts | 17 +---------------- .../editor/editor.component.ts | 6 +++--- .../starter/start-up/start-up.component.ts | 3 +-- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts b/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts index e688f9b..beace5d 100644 --- a/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts +++ b/src/main/webapp/app/case-management/common/constants/backend-uri.constants.ts @@ -6,7 +6,6 @@ export const ARTIFACTNAME_PARAM = 'name'; // case management backend URIs export const REQUIREMENTSETS_URI = '/requirementSets'; -export const REQUIREMENTSET_URI = '/requirementSet'; export const REQUIREMENTS_URI = '/requirements'; export const ATTRIBUTES_URI = '/attributes'; export const ATTRIBUTEKEYS_URI = '/attributeKeys'; diff --git a/src/main/webapp/app/case-management/common/services/case-management-backend.service.ts b/src/main/webapp/app/case-management/common/services/case-management-backend.service.ts index 3f0e5d9..a149700 100644 --- a/src/main/webapp/app/case-management/common/services/case-management-backend.service.ts +++ b/src/main/webapp/app/case-management/common/services/case-management-backend.service.ts @@ -5,16 +5,7 @@ import { Observable, of } from 'rxjs'; import { map } from 'rxjs/operators'; import { SERVER_API_URL } from '../../../app.constants'; import { createRequestOption } from '../../../shared'; -import { - CMRequirementSet, - CMAttributeKey, - CMAttribute, - CMAttributeType, - CMRequirement, - CMExtensionKey, - REQUIREMENTSET_URI, - REQUIREMENTSETS_URI -} from '../'; // this references to the index.ts Barrel +import { CMRequirementSet, CMAttributeKey, CMAttribute, CMAttributeType, CMRequirement, CMExtensionKey, REQUIREMENTSETS_URI } from '../'; // this references to the index.ts Barrel import * as attributeKeys from '../../attributes-keys.mock.json'; import * as attributes from '../../attributes.mock.json'; import * as requirements from '../../requirements.mock.json'; @@ -49,12 +40,6 @@ export class CaseManagementBackendService { let uri = REQUIREMENTSETS_URI; let options; - if (ids) { - uri = REQUIREMENTSET_URI; - options = { - ids - }; - } return this.query(CMRequirementSet, uri, options); } diff --git a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts index 4c683ba..91683e1 100644 --- a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts +++ b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts @@ -5,6 +5,7 @@ import { // matrix param constants ARTIFACTNAME_PARAM, REQUIREMENTSET_PARAM, + REQUIREMENTSETS_URI, ATTRIBUTE_PARAM, ATTRIBUTEKEYS_PARAM, CMAttributeKey, @@ -20,8 +21,7 @@ import { ATTRIBUTEKEYS_URI, ENHANCEMENTS_URI, STATUS_URI, - REQUIREMENTS_URI, - REQUIREMENTSET_URI + REQUIREMENTS_URI } from '../../common/'; import { ArtifactInfo } from '../../common/models/yaml.model'; import { ActivatedRoute, Router } from '@angular/router'; @@ -268,7 +268,7 @@ export class EditorComponent implements OnInit, OnDestroy { this.onSuccess(res.body, this.artifactSettings.parameterAttributeKeys.content); }); this._backendService - .query(CMRequirementSet, REQUIREMENTSET_URI, { ids: this.artifactSettings.requirementSet.id }) + .query(CMRequirementSet, REQUIREMENTSETS_URI, { ids: this.artifactSettings.requirementSet.id }) .subscribe((res: HttpResponse) => { this.artifactSettings.requirementSet.content = res.body[0]; }); diff --git a/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts b/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts index dae3dc5..144dfb5 100644 --- a/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts +++ b/src/main/webapp/app/case-management/starter/start-up/start-up.component.ts @@ -15,7 +15,6 @@ import { ATTRIBUTES_URI, REQUIREMENTSETS_URI, ARTIFACTNAME_PARAM, - REQUIREMENTSET_URI, REQUIREMENTSET_PARAM, ATTRIBUTE_PARAM } from '../../common'; @@ -253,7 +252,7 @@ export class ChangeSelectionComponent implements OnInit { parameters[ATTRIBUTE_PARAM].length > 0 ? this._cmUtilService.convertStringToNumberArray(parameters[ATTRIBUTE_PARAM], true) : []; } else { this._cmBackendService - .query(CMRequirementSet, REQUIREMENTSET_URI, { ids: [requirementSetId] }) + .query(CMRequirementSet, REQUIREMENTSETS_URI, { ids: [requirementSetId] }) .subscribe((res: HttpResponse) => { /* Backend load */ this.ngbModalRef.componentInstance.selectedRequirementSet = res.body[0]; From 034ad9dfa5fc5a9b994569672fb7a2aa7494fd82 Mon Sep 17 00:00:00 2001 From: dashawiki Date: Tue, 2 Nov 2021 15:53:34 +0100 Subject: [PATCH 5/5] attributekey w/ ids empty string debug --- .../requirement-editor/editor/editor.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts index 91683e1..33b7327 100644 --- a/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts +++ b/src/main/webapp/app/case-management/requirement-editor/editor/editor.component.ts @@ -254,6 +254,8 @@ export class EditorComponent implements OnInit, OnDestroy { this.artifactSettings.requirementSet.content = new CMRequirementSet(1, 'Test requirement set', 10); } else { + console.log('Attribute IDs: ', this.artifactSettings.parameterAttributes.ids); + /* Backend load Attribute with ids */ this._backendService .query(CMAttribute, ATTRIBUTES_URI, { ids: this.artifactSettings.parameterAttributes.ids }) @@ -261,12 +263,14 @@ export class EditorComponent implements OnInit, OnDestroy { this.onSuccess(res.body, this.artifactSettings.parameterAttributes.content); }); - /* Backend load Attribute keys and requirement sets */ + /* console.log("Attribute key IDs: ", this.artifactSettings.parameterAttributeKeys.ids); + + /!* Backend load Attribute keys and requirement sets *!/ this._backendService .query(CMAttributeKey, ATTRIBUTEKEYS_URI, { ids: this.artifactSettings.parameterAttributeKeys.ids }) .subscribe((res: HttpResponse) => { this.onSuccess(res.body, this.artifactSettings.parameterAttributeKeys.content); - }); + });*/ this._backendService .query(CMRequirementSet, REQUIREMENTSETS_URI, { ids: this.artifactSettings.requirementSet.id }) .subscribe((res: HttpResponse) => {