diff --git a/cypress/e2e/datasets/datasets-general.cy.js b/cypress/e2e/datasets/datasets-general.cy.js index 49dd5e485..7d20517ce 100644 --- a/cypress/e2e/datasets/datasets-general.cy.js +++ b/cypress/e2e/datasets/datasets-general.cy.js @@ -478,7 +478,6 @@ describe("Datasets general", () => { cy.contains("Type").should("exist"); cy.contains("Location").should("not.exist"); - cy.contains("Keyword").should("not.exist"); }); }); @@ -651,7 +650,7 @@ describe("Datasets general", () => { cy.visit("/datasets"); - cy.wait("@getConfig", { timeout: 10000 }); + cy.wait("@getConfig", { timeout: 20000 }); cy.finishedLoading(); }); diff --git a/src/app/datasets/datasets-filter/datasets-filter.component.html b/src/app/datasets/datasets-filter/datasets-filter.component.html index fb6bebb56..1440d82f5 100644 --- a/src/app/datasets/datasets-filter/datasets-filter.component.html +++ b/src/app/datasets/datasets-filter/datasets-filter.component.html @@ -15,37 +15,7 @@ -
- - -
-
= {}; filtersList: FilterConfig[]; - expandedFilters: { [key: string]: boolean } = {}; filterConfigs$ = this.store.select(selectFilters); @@ -133,12 +132,6 @@ export class DatasetsFilterComponent implements OnInit, OnDestroy { if (filterConfigs) { this.filtersList = filterConfigs; - this.filtersList.forEach((filter) => { - if (filter.type === "checkbox" && filter.enabled) { - this.expandedFilters[filter.key] = true; - } - }); - const { queryParams } = this.route.snapshot; const searchQuery = JSON.parse(queryParams.searchQuery || "{}"); @@ -180,10 +173,6 @@ export class DatasetsFilterComponent implements OnInit, OnDestroy { ); } - toggleFilter(key: string) { - this.expandedFilters[key] = !this.expandedFilters[key]; - } - applyEnabledConditions() { this.conditionConfigs$.pipe(take(1)).subscribe((conditionConfigs) => { (conditionConfigs || []).forEach((config) => { diff --git a/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.html b/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.html index 2c39ae069..43ac47fbb 100644 --- a/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.html +++ b/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.html @@ -12,35 +12,7 @@ -
- - -
-
diff --git a/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.scss b/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.scss index 53588d347..b3586543b 100644 --- a/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.scss +++ b/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.scss @@ -41,36 +41,3 @@ mat-card { scale: 0.9; background: rgba($color: #000000, $alpha: 0.05); } - -.collapsible-filter-wrapper { - position: relative; - - .collapse-toggle { - position: absolute; - right: 0; - top: 0; - background: none; - border: none; - cursor: pointer; - padding: 0; - display: flex; - align-items: center; - justify-content: center; - z-index: 10; - color: #666; - height: 1.5em; - - &:hover { - color: #333; - } - } - - &.collapsed ::ng-deep shared-filter { - .facet-search, - .checkbox-list, - .show-more-btn, - .empty-text { - display: none !important; - } - } -} diff --git a/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.ts b/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.ts index 2625f51d7..dd38543a0 100644 --- a/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.ts +++ b/src/app/proposals/proposal-filters/side-bar-filter/proposal-side-filter.component.ts @@ -32,7 +32,6 @@ export class ProposalSideFilterComponent implements OnInit { appConfig = this.appConfigService.getConfig(); activeFilters: Record = {}; collapsed = false; - expandedFilters: { [key: string]: boolean } = {}; @Output() collapsedChange = new EventEmitter(); filterLists: FilterConfig[] = []; @@ -71,12 +70,6 @@ export class ProposalSideFilterComponent implements OnInit { this.filterLists = this.appConfig.defaultProposalsListSettings?.filters; - this.filterLists.forEach((filter) => { - if (filter.type === "checkbox" && filter.enabled) { - this.expandedFilters[filter.key] = true; - } - }); - const { queryParams } = this.route.snapshot; const searchQuery = JSON.parse(queryParams.searchQuery || "{}"); @@ -117,10 +110,6 @@ export class ProposalSideFilterComponent implements OnInit { this.activeFilters = { ...searchQuery }; } - toggleFilter(key: string) { - this.expandedFilters[key] = !this.expandedFilters[key]; - } - setFilter(filterKey: string, value: string[]) { // Text filter type is not supported for proposal side panel filters // This is to seperate the logic of side filter panel and top text search box diff --git a/src/app/shared/modules/shared-filter/shared-filter.component.html b/src/app/shared/modules/shared-filter/shared-filter.component.html index 1ae020478..e793a1b1c 100644 --- a/src/app/shared/modules/shared-filter/shared-filter.component.html +++ b/src/app/shared/modules/shared-filter/shared-filter.component.html @@ -46,7 +46,10 @@ -
+
{{ label | translate: localization }} {{ @@ -86,6 +89,14 @@
No options found
+
diff --git a/src/app/shared/modules/shared-filter/shared-filter.component.scss b/src/app/shared/modules/shared-filter/shared-filter.component.scss index a8d25346d..a48563c73 100644 --- a/src/app/shared/modules/shared-filter/shared-filter.component.scss +++ b/src/app/shared/modules/shared-filter/shared-filter.component.scss @@ -73,4 +73,37 @@ mat-divider { font-size: 0.75rem; display: inline-flex; align-items: center; -} \ No newline at end of file +} + +.collapsible-filter-wrapper { + position: relative; + + .collapse-toggle { + position: absolute; + right: 0; + top: 0; + background: none; + border: none; + cursor: pointer; + padding: 0; + display: flex; + align-items: center; + justify-content: center; + z-index: 10; + color: #666; + height: 1.5em; + + &:hover { + color: #333; + } + } + + &.collapsed { + .facet-search, + .checkbox-list, + .show-more-btn, + .empty-text { + display: none !important; + } + } +} diff --git a/src/app/shared/modules/shared-filter/shared-filter.component.ts b/src/app/shared/modules/shared-filter/shared-filter.component.ts index f459879a4..460fc7499 100644 --- a/src/app/shared/modules/shared-filter/shared-filter.component.ts +++ b/src/app/shared/modules/shared-filter/shared-filter.component.ts @@ -77,7 +77,8 @@ export class SharedFilterComponent implements OnChanges { | DateRange | undefined | null; - @Input() showBadge = false; + @Input() collapsible = false; + collapsed = false; @Output() textChange = new EventEmitter(); @Output() checkBoxChange = new EventEmitter(); @@ -233,7 +234,13 @@ export class SharedFilterComponent implements OnChanges { return Array.isArray(this.filterValue) ? this.filterValue.length : 0; } get shouldShowBadge(): boolean { - return this.showBadge && this.badgeCount > 0; + return this.collapsible && this.collapsed && this.badgeCount > 0; + } + + toggleCollapse() { + if (this.collapsible && this.filterType === "checkbox") { + this.collapsed = !this.collapsed; + } } /** Checkbox filter helpers END*/