2025-02-27 15:48:08 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import classnames from "classnames";
|
|
|
|
|
|
UI: Batch script run detail page (#32333)
## For #31226
New features:
- Dynamic header for each possible state of a batch script run: Started,
Scheduled, and Finished (corresponds to tabs at
`/controls/scripts/progress`
- Unique tabs for each possible status of hosts targeted by a batch
script run: Ran, Errored, Pending, Incompatible, Canceled.
- Within each tab, sortable, paginated host results with output preview
and execution time.
- View script/run details, cancel a batch, view manage hosts page
filtered for the script batch run and a status.
- Global script batch runs activities and and Scripts progress rows now
navigate to this details page.
Cleanups and improvements:
- Expand tab count badge options using “alert”/“pending” variants across
hosts, policies, and query results.
- Misc cleanups and improvements

- [x] Changes file added for user-visible changes in `changes/`,
- [x] Updated automated tests - new tests tracked for follow-up work
- [x] QA'd all new/changed functionality manually
---------
Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-08-29 15:37:05 +00:00
|
|
|
type TabCountVariant = "alert" | "pending";
|
2025-02-27 15:48:08 +00:00
|
|
|
interface ITabTextProps {
|
|
|
|
|
className?: string;
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
count?: number;
|
UI: Batch script run detail page (#32333)
## For #31226
New features:
- Dynamic header for each possible state of a batch script run: Started,
Scheduled, and Finished (corresponds to tabs at
`/controls/scripts/progress`
- Unique tabs for each possible status of hosts targeted by a batch
script run: Ran, Errored, Pending, Incompatible, Canceled.
- Within each tab, sortable, paginated host results with output preview
and execution time.
- View script/run details, cancel a batch, view manage hosts page
filtered for the script batch run and a status.
- Global script batch runs activities and and Scripts progress rows now
navigate to this details page.
Cleanups and improvements:
- Expand tab count badge options using “alert”/“pending” variants across
hosts, policies, and query results.
- Misc cleanups and improvements

- [x] Changes file added for user-visible changes in `changes/`,
- [x] Updated automated tests - new tests tracked for follow-up work
- [x] QA'd all new/changed functionality manually
---------
Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-08-29 15:37:05 +00:00
|
|
|
countVariant?: TabCountVariant;
|
2025-02-27 15:48:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This component exists so we can unify the styles
|
|
|
|
|
* and add styles to react-tab text.
|
|
|
|
|
*/
|
|
|
|
|
const baseClass = "tab-text";
|
|
|
|
|
|
|
|
|
|
const TabText = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
count,
|
UI: Batch script run detail page (#32333)
## For #31226
New features:
- Dynamic header for each possible state of a batch script run: Started,
Scheduled, and Finished (corresponds to tabs at
`/controls/scripts/progress`
- Unique tabs for each possible status of hosts targeted by a batch
script run: Ran, Errored, Pending, Incompatible, Canceled.
- Within each tab, sortable, paginated host results with output preview
and execution time.
- View script/run details, cancel a batch, view manage hosts page
filtered for the script batch run and a status.
- Global script batch runs activities and and Scripts progress rows now
navigate to this details page.
Cleanups and improvements:
- Expand tab count badge options using “alert”/“pending” variants across
hosts, policies, and query results.
- Misc cleanups and improvements

- [x] Changes file added for user-visible changes in `changes/`,
- [x] Updated automated tests - new tests tracked for follow-up work
- [x] QA'd all new/changed functionality manually
---------
Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-08-29 15:37:05 +00:00
|
|
|
countVariant,
|
2025-02-27 15:48:08 +00:00
|
|
|
}: ITabTextProps): JSX.Element => {
|
|
|
|
|
const classNames = classnames(baseClass, className);
|
|
|
|
|
|
|
|
|
|
const countClassNames = classnames(`${baseClass}__count`, {
|
UI: Batch script run detail page (#32333)
## For #31226
New features:
- Dynamic header for each possible state of a batch script run: Started,
Scheduled, and Finished (corresponds to tabs at
`/controls/scripts/progress`
- Unique tabs for each possible status of hosts targeted by a batch
script run: Ran, Errored, Pending, Incompatible, Canceled.
- Within each tab, sortable, paginated host results with output preview
and execution time.
- View script/run details, cancel a batch, view manage hosts page
filtered for the script batch run and a status.
- Global script batch runs activities and and Scripts progress rows now
navigate to this details page.
Cleanups and improvements:
- Expand tab count badge options using “alert”/“pending” variants across
hosts, policies, and query results.
- Misc cleanups and improvements

- [x] Changes file added for user-visible changes in `changes/`,
- [x] Updated automated tests - new tests tracked for follow-up work
- [x] QA'd all new/changed functionality manually
---------
Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-08-29 15:37:05 +00:00
|
|
|
[`${baseClass}__count__alert`]: countVariant === "alert",
|
|
|
|
|
[`${baseClass}__count__pending`]: countVariant === "pending",
|
2025-02-27 15:48:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const renderCount = () => {
|
|
|
|
|
if (count && count > 0) {
|
|
|
|
|
return <div className={countClassNames}>{count.toLocaleString()}</div>;
|
|
|
|
|
}
|
|
|
|
|
return undefined;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={classNames}>
|
2025-09-29 17:10:41 +00:00
|
|
|
<div className={`${baseClass}__text`} data-text={children}>
|
2025-02-27 15:48:08 +00:00
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
{renderCount()}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default TabText;
|