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 --- .../select-directives.component.html | 15 +++++ .../select-directives.component.less | 15 +++++ .../select-directives.component.ts | 64 ++++++++++++++++++++++ .../select-directives/select-directives.module.ts | 31 +++++++++++ 4 files changed, 125 insertions(+) create mode 100644 catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.html create mode 100644 catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.less create mode 100644 catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.ts create mode 100644 catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.module.ts (limited to 'catalog-ui/src/app/ng2/components/logic/select-directives') diff --git a/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.html b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.html new file mode 100644 index 0000000000..4a831caa3d --- /dev/null +++ b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.html @@ -0,0 +1,15 @@ +
+ +
+ + + + +
+
\ No newline at end of file diff --git a/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.less b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.less new file mode 100644 index 0000000000..e168532549 --- /dev/null +++ b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.less @@ -0,0 +1,15 @@ +@import "~@ng-select/ng-select/themes/default.theme.css"; +@import './../../../../../assets/styles/variables.less'; + +.select-directives { + .multi-select-dropdown-box { + padding: 15px 12px; + position: relative; + height: 200px; + color: @main_color_a; + } + + .apply-btn { + margin: 15px; + } +} \ No newline at end of file diff --git a/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.ts b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.ts new file mode 100644 index 0000000000..ad367763de --- /dev/null +++ b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.component.ts @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +import {Component, EventEmitter, Input, Output, ViewEncapsulation} from "@angular/core"; +import {TopologyTemplateService} from "../../../services/component-services/topology-template.service"; +import {NgSelectModule} from "@ng-select/ng-select"; + +@Component({ + selector: 'select-directives', + templateUrl: './select-directives.component.html', + styleUrls: ['select-directives.component.less'], + providers: [NgSelectModule], + encapsulation: ViewEncapsulation.None +}) + +export class SelectDirectivesComponent { + isDependent: boolean; + isLoading: boolean; + selectedDirectiveOptions: string[]; + directiveOptions: string[]; + + @Output() onAddClick = new EventEmitter(); + @Input() updateDirectives: string[]; + + constructor(private topologyTemplateService: TopologyTemplateService) { + } + + ngOnInit() { + this.loadDirectives(); + if (this.updateDirectives) { + this.selectedDirectiveOptions = this.updateDirectives; + } + } + + onAddDirectives() { + this.onAddClick.emit(this.selectedDirectiveOptions); + } + + loadDirectives() { + this.topologyTemplateService.getDirectiveList().subscribe((data: string[]) => { + this.directiveOptions = data; + }) + } + + onClearDirectives() { + this.selectedDirectiveOptions = []; + } +} \ No newline at end of file diff --git a/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.module.ts b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.module.ts new file mode 100644 index 0000000000..bb2fc2066e --- /dev/null +++ b/catalog-ui/src/app/ng2/components/logic/select-directives/select-directives.module.ts @@ -0,0 +1,31 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {UiElementsModule} from "../../ui/ui-elements.module"; +import {TranslateModule} from "../../../shared/translator/translate.module"; +import {AccordionModule} from "onap-ui-angular/dist/accordion/accordion.module"; +import {NgSelectModule} from "@ng-select/ng-select"; +import {FormsModule} from "@angular/forms"; +import {SelectDirectivesComponent} from "./select-directives.component"; + +@NgModule({ + declarations: [ + SelectDirectivesComponent + ], + imports: [ + CommonModule, + UiElementsModule, + TranslateModule, + AccordionModule, + NgSelectModule, + FormsModule + ], + exports: [ + SelectDirectivesComponent + ], + entryComponents: [ + SelectDirectivesComponent + ], + providers: [] +}) +export class SelectDirectivesModule { +} \ No newline at end of file -- cgit 1.2.3-korg