Skip to content

Commit

Permalink
Refresh data after cleanup or reset
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jan 24, 2025
1 parent 4ca7bf4 commit 3633e7e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/APITables/OverwatcherTable/OverwatcherTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function OverwatcherPill(props: OverwatcherPillProps) {
type RunningGroupProps = {
running?: boolean;
nodata: boolean;
refreshData?: () => void;
};

function RunningGroup(props: RunningGroupProps) {
Expand All @@ -118,13 +119,15 @@ function RunningGroup(props: RunningGroupProps) {

const runCleanup = React.useCallback(async () => {
closeModal();
runner('/macros/cleanup', true).catch(() => {});
runner('/macros/cleanup', true)
.then(() => props.refreshData?.())
.catch(() => {});
}, [runner, closeModal]);

const resetOverwatcher = React.useCallback(() => {
setResetRunning(true);
fetchFromAPI('/overwatcher/reset', {}, false)
.then(() => {})
.then(() => props.refreshData?.())
.catch(() => {})
.finally(() => setResetRunning(false));
}, []);
Expand Down Expand Up @@ -510,7 +513,9 @@ export default function OverwatcherTable() {
{
key: 'running',
label: 'Running',
value: <RunningGroup running={data?.running} nodata={noData} />,
value: (
<RunningGroup running={data?.running} nodata={noData} refreshData={refresh} />
),
},
{
key: 'enabled',
Expand Down

0 comments on commit 3633e7e

Please sign in to comment.