diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2023-07-04 14:45:53 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-10-11 14:22:03 +0000 |
commit | 0d9d05e705a6fbc9c4370fdd3a8ad543d04f8210 (patch) | |
tree | 92031d3d2bd92288686fb4c156cbbe02e64389ab /catalog-ui/src | |
parent | 98513d2be1f1c5f0fba48a972dea297b784aec68 (diff) |
No properties found when trying to add a node filter to a VF
Issue-ID: SDC-4607
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I5df11e156f4bc20ff1d4f19b7af8dfe798631077
Diffstat (limited to 'catalog-ui/src')
4 files changed, 41 insertions, 7 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts index 7ca4604004..ace5a18f22 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts @@ -26,13 +26,15 @@ import { Component as TopologyTemplate, FullComponentInstance, PropertiesGroup, - PropertyBEModel, PropertyModel, + PropertyBEModel, PropertyModel, ComponentInstance, } from 'app/models'; +import {ResourceType} from "app/utils"; import {DEPENDENCY_EVENTS} from 'app/utils/constants'; import {ComponentMetadata} from '../../../../../../models/component-metadata'; import {ServiceInstanceObject} from '../../../../../../models/service-instance-properties-and-interfaces'; import {EventListenerService} from '../../../../../../services/event-listener-service'; import {TopologyTemplateService} from '../../../../../services/component-services/topology-template.service'; +import {ComponentInstanceServiceNg2} from '../../../../../services/component-instance-services/component-instance.service'; import {ComponentGenericResponse} from '../../../../../services/responses/component-generic-response'; import {WorkspaceService} from '../../../../workspace/workspace.service'; import {SelectedComponentType} from '../../../common/store/graph.actions'; @@ -63,6 +65,7 @@ export class ServiceDependenciesTabComponent implements OnInit { constructor(private store: Store, private topologyTemplateService: TopologyTemplateService, + private componentInstanceServiceNg2: ComponentInstanceServiceNg2, private workspaceService: WorkspaceService, private compositionService: CompositionService, private eventListenerService: EventListenerService) { @@ -98,10 +101,22 @@ export class ServiceDependenciesTabComponent implements OnInit { } private initInstancesWithProperties = (): void => { - this.topologyTemplateService.getComponentInstanceProperties(this.metaData.componentType, this.metaData.uniqueId).subscribe((genericResponse: ComponentGenericResponse) => { - this.componentInstanceProperties = genericResponse.componentInstancesProperties; - this.updateInstanceAttributes(); - }); + if (this.component instanceof FullComponentInstance && this.isInput(this.component.resourceType)) { + this.componentInstanceServiceNg2 + .getComponentInstanceInputsByIdAndType(this.metaData.uniqueId, this.metaData.componentType, this.component as ComponentInstance) + .subscribe(response => { + this.selectedInstanceProperties = response; + }); + } else { + this.topologyTemplateService.getComponentInstanceProperties(this.metaData.componentType, this.metaData.uniqueId).subscribe((genericResponse: ComponentGenericResponse) => { + this.componentInstanceProperties = genericResponse.componentInstancesProperties; + this.updateInstanceAttributes(); + }); + } + } + + private isInput = (instanceType:string):boolean =>{ + return instanceType === ResourceType.VF || instanceType === ResourceType.PNF || instanceType === ResourceType.CVFC || instanceType === ResourceType.CR; } private updateInstanceAttributes = (): void => { diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts index 67df3e46e1..8c84c0e1a8 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts @@ -33,6 +33,7 @@ import {InstanceFeDetails} from "../../../../../models/instance-fe-details"; import {ToscaGetFunction} from "../../../../../models/tosca-get-function"; import {FormControl, FormGroup, Validators} from "@angular/forms"; import {ToscaGetFunctionTypeConverter} from "../../../../../models/tosca-get-function-type-converter"; +import {ResourceType} from "app/utils"; @Component({ selector: 'app-tosca-get-function', @@ -367,6 +368,10 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges { if (this.isPropertySourceSelf()) { return componentGenericResponse.properties; } + let componentInstanceInput = componentGenericResponse.componentInstances.find(compInst => this.isInput(compInst.originType) && compInst.uniqueId === instanceId); + if ( componentInstanceInput) { + return this.removeSelectedProperty(componentGenericResponse.componentInstancesInputs[instanceId]); + } return this.removeSelectedProperty(componentGenericResponse.componentInstancesProperties[instanceId]); } if (this.isPropertySourceSelf()) { @@ -376,6 +381,10 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges { ...(componentGenericResponse.componentInstancesProperties[instanceId] || [])]; } + private isInput (instanceType:string): boolean { + return instanceType === ResourceType.VF || instanceType === ResourceType.PNF || instanceType === ResourceType.CVFC || instanceType === ResourceType.CR; + } + private isPropertySourceSelf() { return this.propertySource.value === PropertySource.SELF; } @@ -388,7 +397,8 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges { if (this.isPropertySourceSelf()) { return this.topologyTemplateService.findAllComponentProperties(this.componentMetadata.componentType, this.componentMetadata.uniqueId); } - return this.topologyTemplateService.getComponentInstanceProperties(this.componentMetadata.componentType, this.componentMetadata.uniqueId); + return this.topologyTemplateService.getComponentInstancesAndInputsAndProperties(this.componentMetadata.componentType, this.componentMetadata.uniqueId); + // return this.topologyTemplateService.getComponentInstanceInputsAndProperties(this.componentMetadata.componentType, this.componentMetadata.uniqueId); } if (this.isGetAttribute()) { if (this.isPropertySourceSelf()) { diff --git a/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts b/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts index 1e4ddda9c0..c2258fd01e 100644 --- a/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts +++ b/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts @@ -72,7 +72,12 @@ export class ComponentInstanceServiceNg2 { } getComponentInstanceInputs(component: Component, componentInstance: ComponentInstance): Observable<Array<PropertyBEModel>> { - return this.http.get<Array<InputBEModel>>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/componentInstances/' + componentInstance.uniqueId + '/' + componentInstance.componentUid + '/inputs') + return this.getComponentInstanceInputsByIdAndType(component.uniqueId, component.componentType, componentInstance); + } + + + getComponentInstanceInputsByIdAndType(componentId: string, componentType:string, componentInstance: ComponentInstance): Observable<Array<PropertyBEModel>> { + return this.http.get<Array<InputBEModel>>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/componentInstances/' + componentInstance.uniqueId + '/' + componentInstance.componentUid + '/inputs') .map(res => { return CommonUtils.initInputs(res); }) diff --git a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts index 405d2bb8af..fce785e9e6 100644 --- a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts +++ b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts @@ -480,6 +480,10 @@ export class TopologyTemplateService { return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES]); } + getComponentInstancesAndInputsAndProperties(componentType: string, componentId: string): Observable<ComponentGenericResponse> { + return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES ,COMPONENT_FIELDS.COMPONENT_INSTANCES_INPUTS, COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES]); + } + findAllComponentInstanceAttributes(componentType: string, componentId: string): Observable<ComponentGenericResponse> { return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_ATTRIBUTES]); } |