diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2020-10-05 10:45:11 +0100 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2020-11-16 12:08:35 +0000 |
commit | 1ae28c3a8b33e286331608e1c4a1e3cc483699eb (patch) | |
tree | e0862ec700300fd5a55e2cab01d5add631b3da1d /catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs | |
parent | 126df1ea8430799f1fd2db2ea5227543df17d699 (diff) |
Fix node filter capability filters
Issue-ID: SDC-3335
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: I6ffc1e0fb079ac0e33262f16a62deefda97f7616
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs')
2 files changed, 25 insertions, 2 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.html b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.html index 508584d486..588ac8359b 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.html +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.html @@ -6,6 +6,7 @@ [compositeService]="metaData" [currentServiceInstance]="component" [selectedInstanceProperties]="selectedInstanceProperties" + [componentInstanceCapabilitiesMap]="componentInstanceCapabilitiesMap" [selectedInstanceSiblings]="selectedInstanceSiblings" [selectedInstanceConstraints]="selectedInstanceConstraints" [readonly]="isViewOnly" 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 43c38b58b0..f844dfae4c 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 @@ -1,10 +1,11 @@ import {Component, Input} from '@angular/core'; import {Store} from '@ngxs/store'; import { + CapabilitiesGroup, Capability, Component as TopologyTemplate, FullComponentInstance, PropertiesGroup, - PropertyBEModel, + PropertyBEModel, PropertyModel, } from 'app/models'; import {DEPENDENCY_EVENTS} from 'app/utils/constants'; import {ComponentMetadata} from '../../../../../../models/component-metadata'; @@ -16,6 +17,7 @@ import {ComponentGenericResponse} from '../../../../../services/responses/compon import {WorkspaceService} from '../../../../workspace/workspace.service'; import {SelectedComponentType} from '../../../common/store/graph.actions'; import {CompositionService} from '../../../composition.service'; +import {CapabilitiesConstraintObject} from "../../../../../components/logic/capabilities-constraint/capabilities-constraint.component"; @Component({ selector: 'service-dependencies-tab', @@ -30,7 +32,10 @@ export class ServiceDependenciesTabComponent { selectedInstanceConstraints: ConstraintObject[]; selectedInstanceProperties: PropertyBEModel[]; componentInstanceProperties: PropertiesGroup; + componentInstanceCapabilityProperties: CapabilitiesGroup; metaData: ComponentMetadata; + componentInstanceCapabilitiesMap : Map<string, PropertyModel[]> = new Map(); + componentInstanceCapabilitiesNames: string[]; @Input() isViewOnly: boolean; @Input() componentType: SelectedComponentType; @@ -50,6 +55,7 @@ export class ServiceDependenciesTabComponent { this.initInstancesWithProperties(); this.loadConstraints(); this.initInstancesWithProperties(); + this.initInstancesWithCapabilityProperties() } public loadConstraints = (): void => { @@ -67,7 +73,7 @@ export class ServiceDependenciesTabComponent { this.selectedInstanceConstraints = this.componentInstancesConstraints[this.component.uniqueId].properties; } - public updateSelectedInstanceCapabilitiesConstraints = (constraintsList:Array<ConstraintObject>):void => { + public updateSelectedInstanceCapabilitiesConstraints = (constraintsList:Array<CapabilitiesConstraintObject>):void => { this.componentInstancesConstraints[this.component.uniqueId].capabilities = constraintsList; this.selectedInstanceConstraints = this.componentInstancesConstraints[this.component.uniqueId].capabilities; } @@ -90,4 +96,20 @@ export class ServiceDependenciesTabComponent { this.selectedInstanceSiblings = instancesMappedList.filter((coInstance) => coInstance.id !== this.component.uniqueId); } } + + private initInstancesWithCapabilityProperties = (): void => { + this.componentInstanceCapabilityProperties = this.component.capabilities; + this.updateComponentInstanceCapabilities(); + } + + private updateComponentInstanceCapabilities = (): void => { + if (this.isComponentInstanceSelected && this.componentInstanceCapabilityProperties) { + _.forEach(_.flatten(_.values(this.componentInstanceCapabilityProperties)), (capability: Capability) => { + if (capability.properties) { + this.componentInstanceCapabilitiesMap.set(capability.name, capability.properties); + } + }); + } + } + } |