Skip to content

Commit

Permalink
fix(ClusterListTable): Updated the reset filters behavior (#184)
Browse files Browse the repository at this point in the history
The clusters list page Reset filters button change: the button is always available; if the button is clicked with the default filters, then the data are re-fetched; if the button is clicked with extra filters applied, it sets them to the default set.
  • Loading branch information
Fewwy authored Mar 21, 2022
1 parent 2287020 commit e184d33
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Components/ClustersListTable/ClustersListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
NoMatchingClusters,
NoRecsForClusters,
} from '../MessageState/EmptyStates';
import isEqual from 'lodash/isEqual';

const ClustersListTable = ({
query: { isError, isUninitialized, isFetching, isSuccess, data, refetch },
Expand Down Expand Up @@ -152,11 +153,16 @@ const ClustersListTable = ({
];

const activeFiltersConfig = {
showDeleteButton: true,
deleteTitle: intl.formatMessage(messages.resetFilters),
filters: buildFilterChips(filters, CLUSTER_FILTER_CATEGORIES),
onDelete: (_event, itemsToRemove, isAll) => {
if (isAll) {
updateFilters(CLUSTERS_LIST_INITIAL_STATE);
if (isEqual(filters, CLUSTERS_LIST_INITIAL_STATE)) {
refetch();
} else {
updateFilters(CLUSTERS_LIST_INITIAL_STATE);
}
} else {
itemsToRemove.map((item) => {
const newFilter = {
Expand Down

0 comments on commit e184d33

Please sign in to comment.