diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2022-12-12 10:52:30 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-01-23 17:35:24 +0000 |
commit | f0100abd146b8c97e4b1ff0ba74175a24bbc5e98 (patch) | |
tree | 824dd98ca8973edea9a4683467c0cc1fb43a8953 /catalog-ui/src/app/ng2 | |
parent | 7457ecefb624682f6dddc558111b1d38f2a2ca83 (diff) |
Improve Composition View Filtering
Issue-ID: SDC-4330
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I0a161605b722ca6db46b6a8259acc17fd8af0c02
Diffstat (limited to 'catalog-ui/src/app/ng2')
3 files changed, 5 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/palette/__snapshots__/palette.component.spec.ts.snap b/catalog-ui/src/app/ng2/pages/composition/palette/__snapshots__/palette.component.spec.ts.snap index e5bd4a9079..054ba6c4b3 100644 --- a/catalog-ui/src/app/ng2/pages/composition/palette/__snapshots__/palette.component.spec.ts.snap +++ b/catalog-ui/src/app/ng2/pages/composition/palette/__snapshots__/palette.component.spec.ts.snap @@ -10,6 +10,7 @@ exports[`palette component should match current snapshot of palette component 1` onDraggableMoved={[Function Function]} onDrop={[Function Function]} onSearchChanged={[Function Function]} + openAccordion="false" position={[Function Point]} > <div diff --git a/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.html b/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.html index 89a12d01d4..080f83cfa1 100644 --- a/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.html +++ b/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.html @@ -8,7 +8,7 @@ <div class="palette-elements-list"> <sdc-loader [global]="false" name="palette-loader" testId="palette-loader" [active]="this.isPaletteLoading" [class.inactive]="!this.isPaletteLoading"></sdc-loader> <div *ngIf="numberOfElements === 0 && searchText" class="no-elements-found">No Elements Found</div> - <sdc-accordion *ngFor="let mapByCategory of paletteElements | keyValue; let first = first" [attr.data-tests-id]="'leftPalette.category.'+mapByCategory.key" [title]="mapByCategory.key" [css-class]="'palette-category'"> + <sdc-accordion *ngFor="let mapByCategory of paletteElements | keyValue; let first = first" [open]="this.openAccordion" [attr.data-tests-id]="'leftPalette.category.'+mapByCategory.key" [title]="mapByCategory.key" [css-class]="'palette-category'"> <div *ngFor="let mapBySubCategory of mapByCategory.value | keyValue"> <div class="palette-subcategory">{{mapBySubCategory.key}}</div> <ng-container *ngIf="!(isViewOnly$ | async)"> diff --git a/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.ts b/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.ts index 673efa4172..020acffd5c 100644 --- a/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/palette/palette.component.ts @@ -49,6 +49,7 @@ export class PaletteComponent { public isPaletteLoading: boolean; private paletteDraggedElement: LeftPaletteComponent; public position: Point = new Point(); + private openAccordion: boolean = false; ngOnInit() { this.isPaletteLoading = true; @@ -66,6 +67,7 @@ export class PaletteComponent { public buildPaletteByCategories = (searchText?: string) => { // create nested by category & subcategory, filtered by search parans // Flat the object and run on its leaves if (searchText) { + this.openAccordion = true; searchText = searchText.toLowerCase(); const paletteElementsAfterSearch = {}; this.paletteElements = this.compositionPaletteService.getLeftPaletteElements(); @@ -83,6 +85,7 @@ export class PaletteComponent { } this.paletteElements = paletteElementsAfterSearch; } else { + this.openAccordion = false; this.paletteElements = this.compositionPaletteService.getLeftPaletteElements(); } this.numberOfElements = this.countLeftPalleteElements(this.paletteElements); |