summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/componentsInstances/componentInstance.ts
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-05-13 13:49:31 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-06-14 14:49:56 +0000
commit71d758215e0ae619968d46b85427f60bc3b1736e (patch)
treede450a3c2d105da9537a1faa8af1b88da4c2f05d /catalog-ui/src/app/models/componentsInstances/componentInstance.ts
parent8d72481341ac6be40c380352a2a7ef5cc536692d (diff)
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 <anderson.ribeiro@est.tech>
Diffstat (limited to 'catalog-ui/src/app/models/componentsInstances/componentInstance.ts')
-rw-r--r--catalog-ui/src/app/models/componentsInstances/componentInstance.ts25
1 files changed, 16 insertions, 9 deletions
diff --git a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts
index d3a99e5390..e311589637 100644
--- a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts
+++ b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts
@@ -34,6 +34,7 @@ import {
import {ResourceType, ComponentType} from "../../utils/constants";
import {Capability} from "../capability";
import {Requirement} from "../requirement";
+import {DirectivesEnum} from "../../ng2/components/logic/service-dependencies/directive-option";
export interface IComponentInstance {
@@ -104,10 +105,6 @@ export class ComponentInstance implements IComponentInstance{
public originArchived:boolean;
public directives: string[];
- DIRECTIVES_TYPES = {
- SELECTABLE: 'selectable'
- };
-
constructor(componentInstance?:ComponentInstance) {
if (componentInstance) {
@@ -161,6 +158,10 @@ export class ComponentInstance implements IComponentInstance{
return this.originType === ComponentType.SERVICE_PROXY;
}
+ public isVFC = ():boolean => {
+ return this.originType === ResourceType.VFC;
+ }
+
public getComponentUid = ():string => {
return this.isServiceProxy()? this.sourceModelUid : this.componentUid;
}
@@ -229,17 +230,23 @@ export class ComponentInstance implements IComponentInstance{
return this.iconSprite + ' ' + this.icon;
}
public isDependent = () : boolean => {
- return this.directives && this.directives.indexOf(this.DIRECTIVES_TYPES.SELECTABLE) !== -1;
+ return Array.isArray(this.directives) && this.directives.length > 0;
+ }
+
+ public markAsSelect = () : void => {
+ this.directives.push(DirectivesEnum.SELECT);
}
- public markAsDependent = () : void => {
- this.directives.push(this.DIRECTIVES_TYPES.SELECTABLE);
+ public markAsSubstitute = () : void => {
+ this.directives.push(DirectivesEnum.SUBSTITUTE);
}
- public unmarkAsDependent = () : void => {
- let index = this.directives.indexOf(this.DIRECTIVES_TYPES.SELECTABLE);
+ public unmarkAsDependent = (actualDirectiveValue: string) : void => {
+ console.info("[START] this.directives: ", this.directives)
+ let index = this.directives.indexOf(actualDirectiveValue);
if(index >= 0) {
this.directives.splice(index, 1);
}
+ console.info("[STOP] this.directives: ", this.directives)
}
}