From 71d758215e0ae619968d46b85427f60bc3b1736e Mon Sep 17 00:00:00 2001 From: aribeiro Date: Wed, 13 May 2020 13:49:31 +0100 Subject: Add support for directives on VFC This change also updates the directives values according to Tosca 1.3 spec Issue-ID: SDC-3074 Change-Id: Ia6a68c9a23a71a2c17ba2c006990342811aa7b4e Signed-off-by: aribeiro --- .../composition-ci-node-vfc.ts | 45 +++++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts') diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts index 4c16661548..ce95486ce3 100644 --- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts +++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts @@ -17,19 +17,44 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -import {CompositionCiNodeBase} from "./composition-ci-node-base"; +import {ImagesUrl, GraphUIObjects} from "../../../../utils/constants"; +import {ComponentInstance, CompositionCiNodeBase} from "../../../../models"; import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service"; -import {ComponentInstance} from "../../../componentsInstances/componentInstance"; -import {ImagesUrl} from "../../../../utils/constants"; export class CompositionCiNodeVfc extends CompositionCiNodeBase { - constructor(instance:ComponentInstance, imageCreator:ImageCreatorService) { - super(instance, imageCreator); - this.initVfc(); - } + private isDependent: boolean; + private originalImg: string; + + constructor(instance: ComponentInstance, imageCreator: ImageCreatorService) { + super(instance, imageCreator); + this.isDependent = instance.isDependent(); + this.initVfc(); + } - private initVfc():void { - this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; - this.img = this.imagesPath + this.componentInstance.icon + '.png'; + private initVfc(): void { + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; + this.img = this.imagesPath + this.componentInstance.icon + '.png'; + this.originalImg = this.img; + this.imgWidth = GraphUIObjects.DEFAULT_RESOURCE_WIDTH; + this.classes = 'vfc-node'; + if (this.archived) { + this.classes = this.classes + ' archived'; + return; + } + if (this.isDependent) { + this.classes += ' dependent'; + } + if (!this.certified) { + this.classes = this.classes + ' not-certified'; } + } + + public initUncertifiedDependentImage(node:Cy.Collection, nodeMinSize:number):string { + return this.enhanceImage(node, nodeMinSize, this.imagesPath + 'uncertified_dependent.png'); + } + + public initDependentImage(node:Cy.Collection, nodeMinSize:number):string { + return this.enhanceImage(node, nodeMinSize, this.imagesPath + 'dependent.png'); + } + } -- cgit 1.2.3-korg