fleet/frontend/pages/DashboardPage/cards/ActivityFeed/components/ScriptBatchStatusTable/ScriptBatchStatusTable.tsx
jacobshandling e25c1c3728
UI: Add ability to run a script on all hosts that match a set of supported filters; Add UI to view batch run summaries (#29025)
_Only merge to `main` after [back
end](https://github.com/fleetdm/fleet/pull/29149) and [back end
extension](https://github.com/fleetdm/fleet/pull/29312)_

## For #28699, #29143, #29281

- Run scripts by filter
- View batch script run summary via activity feed
- Code clean up

### Run scripts by filter:
<img width="1280" alt="Screenshot 2025-05-09 at 5 21 51 PM"
src="https://github.com/user-attachments/assets/bcf2e275-f229-461b-8411-0e99c34af5bf"
/>
<img width="1280" alt="Screenshot 2025-05-09 at 5 22 47 PM"
src="https://github.com/user-attachments/assets/d4882ed3-cfa6-4952-acbe-89c60d65d482"
/>

### View script run summary:

![ezgif-4ebaf9c57d6e57](https://github.com/user-attachments/assets/4201ff85-04e3-473f-8a82-969f85e59558)

- [x] Changes file added for user-visible changes in `changes/`
- [x] A detailed QA plan exists on the associated ticket (if it isn't
there, work with the product group's QA engineer to add it)
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-05-22 16:45:43 -07:00

44 lines
1.1 KiB
TypeScript

import EmptyTable from "components/EmptyTable";
import TableContainer from "components/TableContainer";
import React, { useMemo } from "react";
import { IScriptBatchSummaryResponse } from "services/entities/scripts";
import {
generateTableConfig,
generateTableData,
} from "./ScriptBatchStatusTableConfig";
const baseClass = "script-batch-status-table";
interface IScriptBatchStatusTableProps {
statusData: IScriptBatchSummaryResponse;
onClickCancel: () => void;
}
const ScriptBatchStatusTable = ({
statusData,
onClickCancel,
}: IScriptBatchStatusTableProps) => {
const columnConfigs = useMemo(() => {
return generateTableConfig(onClickCancel);
}, [onClickCancel]);
const tableData = generateTableData(statusData);
return (
<TableContainer
className={baseClass}
columnConfigs={columnConfigs}
data={tableData}
isLoading={false}
emptyComponent={() => <EmptyTable />}
showMarkAllPages={false}
isAllPagesSelected={false}
manualSortBy
disableTableHeader
disablePagination
disableCount
hideFooter
/>
);
};
export default ScriptBatchStatusTable;