From 1547f9d35eda2b26c7c853b69302f7c9d91738f1 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Mon, 25 Apr 2022 19:10:52 +0300 Subject: [PATCH] cherry-pick: client: fix constant loading for blocked requests Updates #4420 Squashed commit of the following: commit 461a59e1541626020bf0bcfaf34ba7d2f4509dc7 Merge: 5c5e7b5d 2a1ad532 Author: Ainar Garipov Date: Mon Apr 25 18:46:02 2022 +0300 Merge branch 'master' into 4420-loading-log commit 5c5e7b5d1a69d30e40e71f49f46dea89fa8c40a2 Author: Ildar Kamalov Date: Sun Apr 24 22:18:22 2022 +0300 client: fix constant loading for blocked requests --- client/src/components/Logs/InfiniteTable.js | 29 ++++++++++++++------- client/src/helpers/helpers.js | 4 +-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/client/src/components/Logs/InfiniteTable.js b/client/src/components/Logs/InfiniteTable.js index d419ac3d..36f411c8 100644 --- a/client/src/components/Logs/InfiniteTable.js +++ b/client/src/components/Logs/InfiniteTable.js @@ -43,7 +43,7 @@ const InfiniteTable = ({ useEffect(() => { listener(); - }, [items.length < QUERY_LOGS_PAGE_LIMIT]); + }, [items.length < QUERY_LOGS_PAGE_LIMIT, isEntireLog]); useEffect(() => { const THROTTLE_TIME = 100; @@ -66,15 +66,24 @@ const InfiniteTable = ({ const isNothingFound = items.length === 0 && !processingGetLogs; - return
- {loading && } -
- {isNothingFound - ? - : <>{items.map(renderRow)} - {!isEntireLog &&
{t('loading_table_status')}
} - } -
; + return ( +
+ {loading && } +
+ {isNothingFound ? ( + + ) : ( + <> + {items.map(renderRow)} + {!isEntireLog && ( +
+ {t('loading_table_status')} +
+ )} + + )} +
+ ); }; InfiniteTable.propTypes = { diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index 5fb42c05..a7bf9485 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -693,8 +693,8 @@ export const replaceZeroWithEmptyString = (value) => (parseInt(value, 10) === 0 * @returns {string} */ export const getLogsUrlParams = (search, response_status) => `?${queryString.stringify({ - search, - response_status, + search: search || undefined, + response_status: response_status || undefined, })}`; export const processContent = (