Skip to content

Commit

Permalink
feat: add reload table button (#450)
Browse files Browse the repository at this point in the history
Adds a button to refresh the logs from indexer logs page.
  • Loading branch information
roshaans authored Dec 15, 2023
1 parent af38be3 commit 8fb35fe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
14 changes: 13 additions & 1 deletion frontend/src/components/Logs/IndexerLogs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const IndexerLogsComponent = () => {
return mergedEntries;
};

useEffect(() => {
const initializeTable = () => {
const grid = new Grid({
columns: [
{
Expand Down Expand Up @@ -204,8 +204,19 @@ const IndexerLogsComponent = () => {
});

grid.render(indexerLogsRef.current);
};

useEffect(() => {
initializeTable();
}, []);

const reloadData = () => {
indexerLogsRef.current.innerHTML = "";
setTimeout(() => {
initializeTable();
}, 500);
};

return (
<>
<div
Expand All @@ -222,6 +233,7 @@ const IndexerLogsComponent = () => {
setHeights={setHeights}
latestHeight={height}
isUserIndexer={indexerDetails.accountId === currentUserAccountId}
reloadData={reloadData}
/>
<Status
functionName={functionName}
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/components/Logs/LogButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const LogButtons = ({
setHeights,
latestHeight,
isUserIndexer,
reloadData
}) => {
const {
indexerName,
Expand Down Expand Up @@ -93,6 +94,20 @@ const LogButtons = ({
aria-label="Action Button Group"
>
<>
<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Reload Data</Tooltip>}
>
<Button
size="sm"
variant="secondary"
className="flex align-center"
onClick={() => reloadData()}
>
<ArrowCounterclockwise style={{ paddingRight: "2px" }} size={24} />
Reload
</Button>
</OverlayTrigger>
<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Open Editor</Tooltip>}
Expand Down

0 comments on commit 8fb35fe

Please sign in to comment.