Skip to content

Commit

Permalink
add same logic to details cards in table
Browse files Browse the repository at this point in the history
  • Loading branch information
fakefeik committed Mar 5, 2024
1 parent d373ff7 commit 81e44c8
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export function TaskDetails(props: TaskDetailsProps): JSX.Element {
const theme = React.useContext(ThemeContext);
const { customStateCaptions } = useCustomSettings();

const isCancelable =
taskInfo.taskActions ? taskInfo.taskActions.canCancel : cancelableStates.includes(taskInfo.state);

const isRerunable =
taskInfo.taskActions ? taskInfo.taskActions.canRerun : rerunableStates.includes(taskInfo.state);

const renderTaskDate = (
taskInfo: RtqMonitoringTaskMeta,
caption: string,
Expand Down Expand Up @@ -93,7 +99,7 @@ export function TaskDetails(props: TaskDetailsProps): JSX.Element {
<Fit>
<Link
data-tid="Cancel"
disabled={!cancelableStates.includes(taskInfo.state)}
disabled={!isCancelable}
onClick={onCancel}
icon={<XIcon16Regular />}>
Cancel
Expand All @@ -102,7 +108,7 @@ export function TaskDetails(props: TaskDetailsProps): JSX.Element {
<Fit>
<Link
data-tid="Rerun"
disabled={!rerunableStates.includes(taskInfo.state)}
disabled={!isRerunable}
onClick={onRerun}
icon={<ArrowRoundTimeForwardIcon16Regular />}>
Rerun
Expand Down

0 comments on commit 81e44c8

Please sign in to comment.