diff options
author | ShaabanEltanany <shaaban.eltanany.ext@orange.com> | 2020-08-24 11:41:27 +0200 |
---|---|---|
committer | Shaaban Ebrahim <shaaban.eltanany.ext@orange.com> | 2020-08-25 11:10:06 +0000 |
commit | 14791b79e4cad6aab49880607009883ee94fc1d2 (patch) | |
tree | ab0c87abada5d0a81c452e85274ce1623c827c27 /cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts | |
parent | 6bf663a71fb034ff0961bd21404b23bd71de6289 (diff) |
reset tags filter
Issue-ID: CCSDK-2432
Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I70fa2f743d0e87987fe786046c6774a1cc691f7d
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts index 228b6d6ab..0555fd5ab 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts @@ -19,9 +19,9 @@ limitations under the License. ============LICENSE_END============================================ */ -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { PackagesStore } from '../../packages.store'; -import { BlueprintModel, BluePrintPage } from '../../model/BluePrint.model'; +import {Component, ElementRef, OnInit, QueryList, ViewChildren} from '@angular/core'; +import {PackagesStore} from '../../packages.store'; +import {BlueprintModel, BluePrintPage} from '../../model/BluePrint.model'; @Component({ selector: 'app-filter-by-tags', @@ -38,9 +38,14 @@ export class TagsFilteringComponent implements OnInit { viewedPackages: BlueprintModel[] = []; checkBoxTages = ''; currentPage = 0; + @ViewChildren('checkboxes') checkboxes: QueryList<ElementRef>; constructor(private packagesStore: PackagesStore, ) { + this.refreshTags(); + } + + private refreshTags() { this.packagesStore.state$.subscribe(state => { console.log(state); if (state.page) { @@ -55,7 +60,7 @@ export class TagsFilteringComponent implements OnInit { this.tags.push(tag.trim()); }); this.tags.push('All'); - this.tags = this.tags.filter((value, index, self) => self.indexOf(value) === index); + this.tags = this.tags.filter((value, index, self) => self.indexOf(value) === index && value); this.assignTags(); }); } @@ -82,6 +87,8 @@ export class TagsFilteringComponent implements OnInit { this.viewedTags = this.tags.filter( item => item.toLowerCase().indexOf(value.toLowerCase()) > -1 ); + + } reloadPackages(event: any) { @@ -98,8 +105,15 @@ export class TagsFilteringComponent implements OnInit { }).map((item) => { return item.trim(); }); + this.packagesStore.filterByTags(tagsSelected); } + resetFilter() { + this.checkBoxTages = ''; + this.checkboxes.forEach((element) => { + element.nativeElement.checked = false; + }); + } } |