From b784c8c0f8f3243dfbf740dee69310a3b539336e Mon Sep 17 00:00:00 2001 From: Mohamed Khelif Date: Fri, 29 Sep 2023 14:07:41 -0400 Subject: [PATCH] EVG-18598 Surface warning when restarting a disabled task. (#2069) --- src/gql/generated/types.ts | 1 + src/gql/mutations/restart-task.graphql | 1 + src/pages/task/ActionButtons.tsx | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index d312e9e046..ee8713b798 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -4861,6 +4861,7 @@ export type RestartTaskMutation = { __typename?: "Task"; execution: number; latestExecution: number; + priority?: number | null; buildVariant: string; buildVariantDisplayName?: string | null; displayName: string; diff --git a/src/gql/mutations/restart-task.graphql b/src/gql/mutations/restart-task.graphql index d17153852b..acbfab9355 100644 --- a/src/gql/mutations/restart-task.graphql +++ b/src/gql/mutations/restart-task.graphql @@ -4,5 +4,6 @@ mutation RestartTask($taskId: String!, $failedOnly: Boolean!) { ...BaseTask execution latestExecution + priority } } diff --git a/src/pages/task/ActionButtons.tsx b/src/pages/task/ActionButtons.tsx index 9a36f7c1a5..4c657b6970 100644 --- a/src/pages/task/ActionButtons.tsx +++ b/src/pages/task/ActionButtons.tsx @@ -129,8 +129,14 @@ export const ActionButtons: React.FC = ({ RestartTaskMutationVariables >(RESTART_TASK, { onCompleted: (data) => { - const { latestExecution } = data.restartTask; - dispatchToast.success("Task scheduled to restart"); + const { latestExecution, priority } = data.restartTask; + if (priority < 0) { + dispatchToast.warning( + "Task scheduled to restart, but is disabled. Enable the task to run." + ); + } else { + dispatchToast.success("Task scheduled to restart"); + } setExecution(latestExecution); }, onError: (err) => {