aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-09-15 14:20:35 +0100
committerMichael Morris <michael.morris@est.tech>2022-09-16 08:41:58 +0000
commit70c17bb345b6ed957290eec776c026d3a25f48a1 (patch)
tree17773429de2c965a275ff53aa6938837206d0146 /catalog-ui/src
parent38d98f8852f3e1e15300946aef95c65d3fca70b4 (diff)
Fix types not refreshing after model change
Loads the capability, requirement and node types based on the current VFC model. Removes the frontend cache that was being hold by the ReqAndCapabilitiesService. Issue-ID: SDC-4175 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: I6ab9d1781c6d65e0d78ff69baf468fb9d24f9afd
Diffstat (limited to 'catalog-ui/src')
-rw-r--r--catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts32
-rw-r--r--catalog-ui/src/app/ng2/services/tosca-types.service.ts5
2 files changed, 14 insertions, 23 deletions
diff --git a/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts b/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts
index f999c2e627..e7b39c0a84 100644
--- a/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts
+++ b/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts
@@ -16,9 +16,6 @@ export class ReqAndCapabilitiesService {
private capabilityTypesList: CapabilityTypeModel[];
private relationshipTypesList: RelationshipTypeModel[];
private nodeTypesList: NodeTypeModel[];
- private capabilitiesListUpdated: boolean = false;
- private requirementsListUpdated: boolean = false;
- private nodeTypeListUpdated: boolean = false;
readonly INPUTS_FOR_REQUIREMENTS: string = 'INPUTS_FOR_REQUIREMENTS';
readonly INPUTS_FOR_CAPABILITIES: string = 'INPUTS_FOR_CAPABILITIES';
@@ -41,28 +38,19 @@ export class ReqAndCapabilitiesService {
public async initInputs(initInputsFor: string) {
- if (!this.capabilitiesListUpdated){
- // -- COMMON for both --
- this.capabilityTypesList = [];
- let capabilityTypesResult = await this.toscaTypesServiceNg2.fetchCapabilityTypes(this.workspaceService.metadata.model);
- Object.keys(capabilityTypesResult).forEach(key => {this.capabilityTypesList.push(capabilityTypesResult[key])})
- this.capabilitiesListUpdated = true;
- }
+ // -- COMMON for both --
+ this.capabilityTypesList = [];
+ let capabilityTypesResult = await this.toscaTypesServiceNg2.fetchCapabilityTypes(this.workspaceService.metadata.model);
+ Object.keys(capabilityTypesResult).forEach(key => {this.capabilityTypesList.push(capabilityTypesResult[key])})
if (initInputsFor === 'INPUTS_FOR_REQUIREMENTS') {
- if (!this.requirementsListUpdated){
- this.relationshipTypesList = [];
- let relationshipTypesResult = await this.toscaTypesServiceNg2.fetchRelationshipTypes(this.workspaceService.metadata.model);
- Object.keys(relationshipTypesResult).forEach(key => {this.relationshipTypesList.push(relationshipTypesResult[key])});
- this.requirementsListUpdated = true;
- }
+ this.relationshipTypesList = [];
+ let relationshipTypesResult = await this.toscaTypesServiceNg2.fetchRelationshipTypes(this.workspaceService.metadata.model);
+ Object.keys(relationshipTypesResult).forEach(key => {this.relationshipTypesList.push(relationshipTypesResult[key])});
- if (!this.nodeTypeListUpdated){
- this.nodeTypesList = [];
- let nodeTypesResult = await this.toscaTypesServiceNg2.fetchNodeTypes();
- Object.keys(nodeTypesResult).forEach(key => {this.nodeTypesList.push(nodeTypesResult[key])})
- this.nodeTypeListUpdated = true;
- }
+ this.nodeTypesList = [];
+ let nodeTypesResult = await this.toscaTypesServiceNg2.fetchNodeTypes(this.workspaceService.metadata.model);
+ Object.keys(nodeTypesResult).forEach(key => {this.nodeTypesList.push(nodeTypesResult[key])})
}
}
diff --git a/catalog-ui/src/app/ng2/services/tosca-types.service.ts b/catalog-ui/src/app/ng2/services/tosca-types.service.ts
index fc728111bd..151e975f23 100644
--- a/catalog-ui/src/app/ng2/services/tosca-types.service.ts
+++ b/catalog-ui/src/app/ng2/services/tosca-types.service.ts
@@ -46,7 +46,10 @@ export class ToscaTypesServiceNg2 {
return this.http.get<RelationshipTypesMap>(this.baseUrl + 'relationshipTypes').toPromise();
}
- async fetchNodeTypes(): Promise<NodeTypesMap> {
+ async fetchNodeTypes(modelName: string): Promise<NodeTypesMap> {
+ if(modelName) {
+ return this.http.get<NodeTypesMap>(this.baseUrl + 'nodeTypes', {params: {model: modelName}}).toPromise();
+ }
return this.http.get<NodeTypesMap>(this.baseUrl + 'nodeTypes').toPromise();
}