From c4a8271d664deb39e69fbba329b11ff57b9b276b Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Sun, 23 Jan 2022 12:40:06 +0000 Subject: Support for multiple directives Issue-ID: SDC-3861 Signed-off-by: KrupaNagabhushan Change-Id: Ie63c4879c28567b2d87e5fb08975b46014cf3660 --- .../app/models/componentsInstances/componentInstance.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'catalog-ui/src/app/models') 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) } } -- cgit 1.2.3-korg