diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index a26eb9ebb9..0f67831056 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -239,7 +239,9 @@ "updateFailed": "Update failed.", "updateRequestSubmitted": "Update request submitted.", "cancelationFailed": "Cancelation failed.", - "cancelationRequestSubmitted": "Cancelation request submitted" + "cancelationRequestSubmitted": "Cancelation request submitted", + "cancelNotAvailable": "It is not possible to cancel a task that is in status {{statusName}}", + "togglePreemptionNotAvailable": "It is not possible to toggle preemption for a task that is in status {{statusName}}" }, "proposedActions": { "refactor": "Refactor", diff --git a/client/src/app/components/task-manager/TaskManagerDrawer.tsx b/client/src/app/components/task-manager/TaskManagerDrawer.tsx index 10824bc16e..03ca609a17 100644 --- a/client/src/app/components/task-manager/TaskManagerDrawer.tsx +++ b/client/src/app/components/task-manager/TaskManagerDrawer.tsx @@ -189,7 +189,9 @@ const TaskItem: React.FC<{ isDisabled)} + isDisabled={taskActionItems.every( + ({ isAriaDisabled }) => isAriaDisabled + )} onClick={() => onActionsExpandToggle(!actionsExpanded)} variant="plain" aria-label={`Actions for task ${task.name}`} @@ -199,11 +201,11 @@ const TaskItem: React.FC<{ )} > - {taskActionItems.map(({ title, onClick, isDisabled }) => ( + {taskActionItems.map(({ title, onClick, isAriaDisabled }) => ( {title} diff --git a/client/src/app/pages/tasks/useTaskActions.tsx b/client/src/app/pages/tasks/useTaskActions.tsx index bfcd70c288..c9e6c4e190 100644 --- a/client/src/app/pages/tasks/useTaskActions.tsx +++ b/client/src/app/pages/tasks/useTaskActions.tsx @@ -69,15 +69,27 @@ export const useTaskActions = (task: Task) => { return [ { title: t("actions.cancel"), - isDisabled: !canCancel(task.state), + isAriaDisabled: !canCancel(task.state), + tooltipProps: { + content: !canCancel(task.state) + ? t("message.cancelNotAvailable", { statusName: task.state }) + : "", + }, onClick: () => cancelTask(task.id), }, { title: task.policy?.preemptEnabled ? t("actions.disablePreemption") : t("actions.enablePreemption"), - isDisabled: !canTogglePreemption(task.state), + isAriaDisabled: !canTogglePreemption(task.state), onClick: () => togglePreemption(task), + tooltipProps: { + content: !canTogglePreemption(task.state) + ? t("message.togglePreemptionNotAvailable", { + statusName: task.state, + }) + : "", + }, }, { title: t("actions.taskDetails"),