diff options
Diffstat (limited to 'catalog-ui/src/app/models/componentsInstances')
-rw-r--r-- | catalog-ui/src/app/models/componentsInstances/componentInstance.ts | 25 | ||||
-rw-r--r-- | catalog-ui/src/app/models/componentsInstances/fullComponentInstance.ts | 18 |
2 files changed, 16 insertions, 27 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) } } diff --git a/catalog-ui/src/app/models/componentsInstances/fullComponentInstance.ts b/catalog-ui/src/app/models/componentsInstances/fullComponentInstance.ts index ce5aa1dae9..ab9015d949 100644 --- a/catalog-ui/src/app/models/componentsInstances/fullComponentInstance.ts +++ b/catalog-ui/src/app/models/componentsInstances/fullComponentInstance.ts @@ -25,10 +25,6 @@ export class FullComponentInstance extends ComponentInstance { public isResourceInstance: boolean; public directives: string[]; - DIRECTIVES_TYPES = { - SELECTABLE: 'selectable' - }; - //service public serviceApiArtifacts:ArtifactGroupModel; public serviceType:string; @@ -92,19 +88,5 @@ export class FullComponentInstance extends ComponentInstance { public isService = ():boolean => { return this.isServiceInstance; } - public isDependent = () : boolean => { - return this.directives && this.directives.indexOf(this.DIRECTIVES_TYPES.SELECTABLE) !== -1; - } - - public markAsDependent = () : void => { - this.directives.push(this.DIRECTIVES_TYPES.SELECTABLE); - } - - public unmarkAsDependent = () : void => { - const index = this.directives.indexOf(this.DIRECTIVES_TYPES.SELECTABLE); - if(index >= 0) { - this.directives.splice(index, 1); - } - } }
\ No newline at end of file |