From eea49075a4a8bb62a5a15ec31adfe52e1f1f3b7a Mon Sep 17 00:00:00 2001 From: Ahmed Abbas Date: Wed, 27 Nov 2019 15:04:18 +0200 Subject: [PATCH] filter packages by tag rename filter-by-keyword to search-by-packages Issue-ID: CCSDK-1968 Issue-ID: CCSDK-1951 Signed-off-by: Ahmed Abbas Change-Id: I4667f2b9e98ba7e217ba7ab15e5cd8c45bee0c33 --- .../packages/designer/designer.component.css | 9 +- .../packages/model/packages-dashboard.state.ts | 33 +++++ .../filter-by-tags.component.css} | 0 .../filter-by-tags/filter-by-tags.component.html | 18 +++ .../filter-by-tags.component.spec.ts} | 11 +- .../filter-by-tags.component.ts} | 36 +++-- .../package-list/package-list.component.html | 156 +++++++++++---------- .../package-list/package-list.component.ts | 40 +++--- .../package-pagination.component.html | 9 +- .../package-pagination.component.ts | 51 ++++--- .../packages-dashboard.component.html | 70 +++++---- .../packages-dashboard.component.ts | 5 +- .../search-by-packages.component.css | 0 .../search-by-packages.component.html | 4 + .../search-by-packages.component.spec.ts | 25 ++++ .../search-by-packages.component.ts | 25 ++++ .../search-by-tags/search-by-tags.component.html | 46 ------ .../search-by-tags/search-by-tags.service.spec.ts | 12 -- .../packages/packages-list.service.ts | 18 +-- .../feature-modules/packages/packages.module.ts | 9 +- .../packages/packages.routing.module.ts | 4 +- .../feature-modules/packages/packages.store.ts | 73 ++++++++-- cds-ui/client-frankfurt/src/styles.css | 37 ++++- 23 files changed, 419 insertions(+), 272 deletions(-) create mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts rename cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/{search-by-tags/search-by-tags.component.css => filter-by-tags/filter-by-tags.component.css} (100%) create mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html rename cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/{search-by-tags/search-by-tags.component.spec.ts => filter-by-tags/filter-by-tags.component.spec.ts} (82%) rename cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/{search-by-tags/search-by-tags.component.ts => filter-by-tags/filter-by-tags.component.ts} (70%) create mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.css create mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.html create mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.spec.ts create mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.ts delete mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.html delete mode 100644 cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.service.spec.ts diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.css b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.css index d41bf5222..faa419c80 100644 --- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.css +++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.css @@ -184,7 +184,7 @@ button.rotate{ .input-search-controller{ height: 50px; padding-left: 30px; - background: url(/assets/img/icon-search-light.svg) #fff 10px center no-repeat; + background: url(src/assets/img/icon-search-light.svg) #fff 10px center no-repeat; border-radius: 0; border: 0; border-bottom: solid 1px #D7E7F9; @@ -333,7 +333,7 @@ p.compType-4{ padding-left: 36px; border: 0; font-size: 14px; - background: url(/assets/img/icon-drag.svg) #fff 20px center no-repeat; + background: url(src/assets/img/icon-drag.svg) #fff 20px center no-repeat; } /*CANVAS*/ @@ -365,10 +365,10 @@ p.compType-4{ padding-left: 30px; } .viewBtns .topologySource{ - background-image: url(/assets/img/icon-topologyView-active.svg); + background-image: url(src/assets/img/icon-topologyView-active.svg); } .viewBtns .topologyView{ - background-image: url(/assets/img/icon-topologySource.svg); + background-image: url(src/assets/img/icon-topologySource.svg); } .card.actionContainer{ margin: 20px 20px 40px 60px; @@ -391,6 +391,7 @@ p.compType-4{ background: #C3CDDB; } .actionContainer .card-body{ + min-height: 170px; padding: 15px 20px !important; border: solid 1px #C3CDDB; background: #fff; diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts new file mode 100644 index 000000000..068e93160 --- /dev/null +++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts @@ -0,0 +1,33 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2019 Orange. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software 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 {BluePrintPage} from './BluePrint.model'; + +export class PackagesDashboardState { + + page: BluePrintPage; + command: string; + currentPage = 0; + totalPackages: number; + tags: string[]; + sortBy = 'DATE'; + totalPackagesWithoutSearchorFilters: number; +} diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.css b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.css similarity index 100% rename from cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.css rename to cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.css diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html new file mode 100644 index 000000000..6ce3a53a1 --- /dev/null +++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html @@ -0,0 +1,18 @@ + + diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.spec.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.spec.ts similarity index 82% rename from cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.spec.ts rename to cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.spec.ts index aaacfb9e8..8285d8962 100644 --- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.spec.ts +++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.spec.ts @@ -20,22 +20,21 @@ limitations under the License. */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchByTagsComponent } from './search-by-tags.component'; +import { TagsFilteringComponent } from './filter-by-tags.component'; describe('SearchByTagsComponent', () => { - let component: SearchByTagsComponent; - let fixture: ComponentFixture; + let component: TagsFilteringComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SearchByTagsComponent ] + declarations: [ TagsFilteringComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(SearchByTagsComponent); + fixture = TestBed.createComponent(TagsFilteringComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts similarity index 70% rename from cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.ts rename to cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts index b5cc52fc0..b4007215a 100644 --- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/search-by-tags/search-by-tags.component.ts +++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts @@ -24,12 +24,12 @@ import {PackagesStore} from '../../packages.store'; import {BlueprintModel, BluePrintPage} from '../../model/BluePrint.model'; @Component({ - selector: 'app-search-by-tags', - templateUrl: './search-by-tags.component.html', - styleUrls: ['./search-by-tags.component.css'] + selector: 'app-filter-by-tags', + templateUrl: './filter-by-tags.component.html', + styleUrls: ['./filter-by-tags.component.css'] }) -export class SearchByTagsComponent implements OnInit { +export class TagsFilteringComponent implements OnInit { page: BluePrintPage; tags: string[] = []; @@ -37,10 +37,24 @@ export class SearchByTagsComponent implements OnInit { searchTag = ''; viewedPackages: BlueprintModel[] = []; private checkBoxTages = ''; - private searchPackage = ''; + constructor(private packagesStore: PackagesStore, ) { + this.packagesStore.state$.subscribe(state => { + console.log(state); + if (state.page) { + this.viewedPackages = state.page.content; + this.viewedPackages.forEach(element => { + element.tags.split(',').forEach(tag => { + this.tags.push(tag.trim()); + }); + this.tags = this.tags.filter((value, index, self) => self.indexOf(value) === index); + this.assignTags(); + + }); + } + }); } ngOnInit() { @@ -78,17 +92,9 @@ export class SearchByTagsComponent implements OnInit { return; } this.viewedPackages = []; - this.viewedPackages = this.viewedPackages.filter((value, index, self) => self.indexOf(value) === index); + // this.packagesStore.getPagesFilterByTags(this.checkBoxTages); + // this.viewedPackages = this.viewedPackages.filter((value, index, self) => self.indexOf(value) === index); } - searchPackages(event: any) { - this.searchPackage = event.target.value; - this.searchPackage = this.searchPackage.trim(); - if (this.searchPackage) { - this.packagesStore.getPagedPackagesByKeyWord(this.searchPackage, 0, 2); - } else { - this.packagesStore.getPagedPackages(0, 2); - } - } } diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html index f67b3ca6a..18428d4b4 100644 --- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html +++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html @@ -1,92 +1,104 @@ -
- -
-
- -
-