Skip to content

Commit

Permalink
[Discover] Fix 0 filters applied state (#5733)
Browse files Browse the repository at this point in the history
* [Discover] Fix 0 filters applied state

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

* Adds changelog

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

* fixes unit test

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>

---------

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
  • Loading branch information
ashwin-pc authored Jan 26, 2024
1 parent 1a0cf47 commit f8ee03a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [BUG][Data] Fix empty suggestion history when querying in search bar [#5349](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5349)
- [BUG][Discover] Fix what is displayed in `selected fields` when removing columns from canvas [#5537](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5537)
- [BUG][Discover] Fix advanced setting `discover:modifyColumnsOnSwitch` ([#5508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5508))
- [BUG][Discover] Show 0 filters when there are no active filters ([#5508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5508))
- [Discover] Fix missing index pattern field from breaking Discover [#5626](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5626)
- [BUG] Remove duplicate sample data as id 90943e30-9a47-11e8-b64d-95841ca0b247 ([5668](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5668))
- [BUG][Multiple Datasource] Fix datasource testing connection unexpectedly passed with wrong endpoint [#5663](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5663)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('DiscoverFieldSearch', () => {
btn = findTestSubject(component, 'toggleFieldFilterButton');
const badge = btn.find('.euiNotificationBadge');
// available filters
expect(badge.text()).toEqual(NUM_FILTERS.toString());
expect(badge.text()).toEqual('0');
// change value of aggregatable select
const aggregatableButtonGroup = findButtonGroup(component, 'aggregatable');
act(() => {
Expand Down Expand Up @@ -114,10 +114,10 @@ describe('DiscoverFieldSearch', () => {
const btn = findTestSubject(component, 'toggleFieldFilterButton');
btn.simulate('click');
const badge = btn.find('.euiNotificationBadge');
expect(badge.text()).toEqual(NUM_FILTERS.toString());
expect(badge.text()).toEqual('0');
const missingSwitch = findTestSubject(component, 'missingSwitch');
missingSwitch.simulate('change', { target: { value: false } });
expect(badge.text()).toEqual(NUM_FILTERS.toString());
expect(badge.text()).toEqual('0');
});

test('change in filters triggers onChange', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export function DiscoverFieldSearch({ onChange, value, types }: Props) {
hasActiveFilters={activeFiltersCount > 0}
aria-label={filterBtnAriaLabel}
data-test-subj="toggleFieldFilterButton"
numFilters={NUM_FILTERS}
numFilters={activeFiltersCount} // {NUM_FILTERS} https://github.com/opensearch-project/oui/issues/1219
onClick={handleFacetButtonClicked}
numActiveFilters={activeFiltersCount}
isSelected={isPopoverOpen}
Expand Down

0 comments on commit f8ee03a

Please sign in to comment.