Skip to content

Commit

Permalink
ISPN-14264 [Console] Counters page - double click on Strong/Weak sele…
Browse files Browse the repository at this point in the history
…ct loads all counters
  • Loading branch information
dpanshug committed Nov 1, 2022
1 parent e20eaf0 commit b77ba63
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/app/CacheManagers/CounterTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi
});
const [rows, setRows] = useState<(string | any)[]>([]);

useEffect(() => {
if (filteredCounters !== null) {
const initSlice = (countersPagination.page - 1) * countersPagination.perPage;
updateRows(filteredCounters.slice(initSlice, initSlice + countersPagination.perPage));
}
}, [countersPagination, filteredCounters]);

const columns = [
{
title: t('cache-managers.counter-name'),
Expand Down Expand Up @@ -104,27 +111,21 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi

setFilteredCounters(currentCounters);
props.setCountersCount(counters.length);
const initSlice = (countersPagination.page - 1) * countersPagination.perPage;
updateRows(currentCounters.slice(initSlice, initSlice + countersPagination.perPage));
}
};

const onSetPage = (_event, pageNumber) => {
setCountersPagination({
page: pageNumber,
perPage: countersPagination.perPage
...countersPagination,
page: pageNumber
});
const initSlice = (pageNumber - 1) * countersPagination.perPage;
updateRows(filteredCounters.slice(initSlice, initSlice + countersPagination.perPage));
};

const onPerPageSelect = (_event, perPage) => {
setCountersPagination({
page: countersPagination.page,
page: 1,
perPage: perPage
});
const initSlice = (countersPagination.page - 1) * perPage;
updateRows(filteredCounters.slice(initSlice, initSlice + perPage));
};

const displayConfig = (config: CounterConfig) => {
Expand Down Expand Up @@ -216,7 +217,6 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi
}

setFilteredCounters(switchCounters);
updateRows(switchCounters);
setSelectedCounterType(id);
setIsOpenFilter(false);
};
Expand Down

0 comments on commit b77ba63

Please sign in to comment.