From dd2e1700187449a017b75589aeb0c2dfb989dec7 Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Thu, 15 Jul 2021 15:29:02 +0100 Subject: Consider component model when retrieving capability types Issue-ID: SDC-3642 Signed-off-by: KrupaNagabhushan Change-Id: Ie09b5f8d64b95fc2db14f19d3857a9935075b2fe --- .../req-and-capabilities/req-and-capabilities.service.ts | 2 +- catalog-ui/src/app/ng2/services/tosca-types.service.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'catalog-ui/src') 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 f9b98c6b96..f999c2e627 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 @@ -44,7 +44,7 @@ export class ReqAndCapabilitiesService { if (!this.capabilitiesListUpdated){ // -- COMMON for both -- this.capabilityTypesList = []; - let capabilityTypesResult = await this.toscaTypesServiceNg2.fetchCapabilityTypes(); + let capabilityTypesResult = await this.toscaTypesServiceNg2.fetchCapabilityTypes(this.workspaceService.metadata.model); Object.keys(capabilityTypesResult).forEach(key => {this.capabilityTypesList.push(capabilityTypesResult[key])}) this.capabilitiesListUpdated = true; } 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 2fc2e7a089..fc728111bd 100644 --- a/catalog-ui/src/app/ng2/services/tosca-types.service.ts +++ b/catalog-ui/src/app/ng2/services/tosca-types.service.ts @@ -40,15 +40,21 @@ export class ToscaTypesServiceNg2 { } async fetchRelationshipTypes(modelName: string): Promise { - return this.http.get(this.baseUrl + 'relationshipTypes', {params: {model: modelName}}).toPromise(); + if(modelName) { + return this.http.get(this.baseUrl + 'relationshipTypes', {params: {model: modelName}}).toPromise(); + } + return this.http.get(this.baseUrl + 'relationshipTypes').toPromise(); } async fetchNodeTypes(): Promise { return this.http.get(this.baseUrl + 'nodeTypes').toPromise(); } - async fetchCapabilityTypes(): Promise { + async fetchCapabilityTypes(modelName: string): Promise { + if(modelName) { + return this.http.get(this.baseUrl + 'capabilityTypes', {params: {model: modelName}}).toPromise(); + } return this.http.get(this.baseUrl + 'capabilityTypes').toPromise(); - } + } } -- cgit 1.2.3-korg