diff options
author | KrupaNagabhushan <krupa.nagabhushan@est.tech> | 2022-01-23 12:40:06 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-03-02 11:44:48 +0000 |
commit | c4a8271d664deb39e69fbba329b11ff57b9b276b (patch) | |
tree | 3f070217dd738d0d0ab4231ff1bd06b903e7cb19 /catalog-ui/src/app/models/componentsInstances/componentInstance.ts | |
parent | 7f07f514eacacfb54d851201c49b24acd9b5e343 (diff) |
Support for multiple directives
Issue-ID: SDC-3861
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: Ie63c4879c28567b2d87e5fb08975b46014cf3660
Diffstat (limited to 'catalog-ui/src/app/models/componentsInstances/componentInstance.ts')
-rw-r--r-- | catalog-ui/src/app/models/componentsInstances/componentInstance.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts index a55cd4f0d1..c3188baa47 100644 --- a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts +++ b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts @@ -238,16 +238,18 @@ export class ComponentInstance implements IComponentInstance{ return Array.isArray(this.directives) && this.directives.length > 0; } - public setDirectiveValue = (selectedDirective: string) : void => { - this.directives.push(selectedDirective); + public setDirectiveValue = (selectedDirectives: string[]) : void => { + this.directives = selectedDirectives; } - public unmarkAsDependent = (actualDirectiveValue: string) : void => { + public unmarkAsDependent = (directiveValues: string[]) : void => { console.info("[START] this.directives: ", this.directives) - let index = this.directives.indexOf(actualDirectiveValue); - if(index >= 0) { - this.directives.splice(index, 1); - } + directiveValues.forEach(directive => { + let index = this.directives.indexOf(directive); + if(index >= 0) { + this.directives.splice(index, directiveValues.length); + } + }); console.info("[STOP] this.directives: ", this.directives) } } |