From e184d334daf1d7a6043d5f3a371438e8e5163eef Mon Sep 17 00:00:00 2001 From: Fewwy <62722417+Fewwy@users.noreply.github.com> Date: Mon, 21 Mar 2022 11:44:20 +0100 Subject: [PATCH] fix(ClusterListTable): Updated the reset filters behavior (#184) 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. --- src/Components/ClustersListTable/ClustersListTable.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Components/ClustersListTable/ClustersListTable.js b/src/Components/ClustersListTable/ClustersListTable.js index 1c251d52..5f3d93a9 100644 --- a/src/Components/ClustersListTable/ClustersListTable.js +++ b/src/Components/ClustersListTable/ClustersListTable.js @@ -41,6 +41,7 @@ import { NoMatchingClusters, NoRecsForClusters, } from '../MessageState/EmptyStates'; +import isEqual from 'lodash/isEqual'; const ClustersListTable = ({ query: { isError, isUninitialized, isFetching, isSuccess, data, refetch }, @@ -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 = {