Skip to content

Commit

Permalink
Pull request: client: fix constant loading for blocked requests
Browse files Browse the repository at this point in the history
Updates AdguardTeam#4420

Squashed commit of the following:

commit 461a59e
Merge: 5c5e7b5 2a1ad53
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Apr 25 18:46:02 2022 +0300

    Merge branch 'master' into 4420-loading-log

commit 5c5e7b5
Author: Ildar Kamalov <ik@adguard.com>
Date:   Sun Apr 24 22:18:22 2022 +0300

    client: fix constant loading for blocked requests
  • Loading branch information
IldarKamalov committed Apr 25, 2022
1 parent 2a1ad53 commit 0a1ff65
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
29 changes: 19 additions & 10 deletions client/src/components/Logs/InfiniteTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -66,15 +66,24 @@ const InfiniteTable = ({

const isNothingFound = items.length === 0 && !processingGetLogs;

return <div className='logs__table' role='grid'>
{loading && <Loading />}
<Header />
{isNothingFound
? <label className="logs__no-data">{t('nothing_found')}</label>
: <>{items.map(renderRow)}
{!isEntireLog && <div ref={loader} className="logs__loading text-center">{t('loading_table_status')}</div>}
</>}
</div>;
return (
<div className="logs__table" role="grid">
{loading && <Loading />}
<Header />
{isNothingFound ? (
<label className="logs__no-data">{t('nothing_found')}</label>
) : (
<>
{items.map(renderRow)}
{!isEntireLog && (
<div ref={loader} className="logs__loading text-center">
{t('loading_table_status')}
</div>
)}
</>
)}
</div>
);
};

InfiniteTable.propTypes = {
Expand Down
4 changes: 2 additions & 2 deletions client/src/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down

0 comments on commit 0a1ff65

Please sign in to comment.