diff options
Diffstat (limited to 'catalog-ui/src/app/models/componentsInstances')
-rw-r--r-- | catalog-ui/src/app/models/componentsInstances/componentInstance.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts index fcc3298249..f95d6553cd 100644 --- a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts +++ b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts @@ -61,6 +61,11 @@ export class ComponentInstance { public groupInstances:Array<Module>; public invariantName:string; public originArchived:boolean; + public directives: Array<string>; + + DIRECTIVES_TYPES = { + SELECTABLE: 'selectable' + }; constructor(componentInstance?:ComponentInstance) { @@ -92,6 +97,7 @@ export class ComponentInstance { this.sourceModelUid = componentInstance.sourceModelUid; this.sourceModelUuid = componentInstance.sourceModelUuid; this.originArchived = componentInstance.originArchived; + this.directives = componentInstance.directives; } } @@ -177,4 +183,19 @@ export class ComponentInstance { public get iconClass() { return this.iconSprite + ' ' + this.icon; } + + 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 => { + let index = this.directives.indexOf(this.DIRECTIVES_TYPES.SELECTABLE); + if(index >= 0) { + this.directives.splice(index, 1); + } + } } |