Remove tab counts and update page-level data on each tab click (#33367)

## For #33225

(blank host name a known and tracked bug)

https://github.com/user-attachments/assets/5698b8a0-693c-4aae-bc91-9925d856c400


- [x] QA'd all new/changed functionality manually

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
jacobshandling 2025-09-23 14:07:50 -07:00 committed by GitHub
parent d467968c03
commit df5d69d2ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -106,7 +106,12 @@ const ScriptBatchDetailsPage = ({
const { renderFlash } = useContext(NotificationContext);
const { data: batchDetails, isLoading, isError } = useQuery<
const {
data: batchDetails,
isLoading,
isError,
refetch: refetchBatchDetails,
} = useQuery<
IScriptBatchSummaryV2,
AxiosError,
IScriptBatchSummaryV2,
@ -155,8 +160,10 @@ const ScriptBatchDetailsPage = ({
.CONTROLS_SCRIPTS_BATCH_DETAILS(batchExecutionId)
.concat(newQuery ? `?${newQuery}` : "")
);
// update page's summary data (e.g. pct hosts responded) whenever changing tabs
refetchBatchDetails();
},
[batchExecutionId, location?.search, router]
[batchExecutionId, location?.search, refetchBatchDetails, router]
);
useEffect(() => {
@ -279,27 +286,19 @@ const ScriptBatchDetailsPage = ({
>
<TabList>
<Tab>
<TabText count={ran}>Ran</TabText>
<TabText>Ran</TabText>
</Tab>
<Tab>
<TabText count={errored} countVariant="alert">
Errored
</TabText>
<TabText>Errored</TabText>
</Tab>
<Tab>
<TabText count={pending} countVariant="pending">
Pending
</TabText>
<TabText>Pending</TabText>
</Tab>
<Tab>
<TabText count={incompatible} countVariant="pending">
Incompatible
</TabText>
<TabText>Incompatible</TabText>
</Tab>
<Tab>
<TabText count={canceled} countVariant="pending">
Canceled
</TabText>
<TabText>Canceled</TabText>
</Tab>
</TabList>
<TabPanel>