Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(frontend): Allow restarting canceled gh-ost sync tasks (#2994)

Liu Ji349a310272cd
diff --git a/frontend/src/components/Issue/IssueBanner.vue b/frontend/src/components/Issue/IssueBanner.vue
index b198408958..90175e08fa 100644
--- a/frontend/src/components/Issue/IssueBanner.vue
+++ b/frontend/src/components/Issue/IssueBanner.vue
@@ -38,7 +38,12 @@ import { useIssueLogic } from "./logic";
const issue = useIssueLogic().issue as Ref<Issue>;
const showCancelBanner = computed(() => {
- return issue.value.status == "CANCELED";
+ if (issue.value.status == "CANCELED") {
+ return true;
+ }
+
+ const task = activeTask(issue.value.pipeline);
+ return task.status == "CANCELED";
});
const showSuccessBanner = computed(() => {
diff --git a/frontend/src/components/Issue/StatusTransitionForm.vue b/frontend/src/components/Issue/StatusTransitionForm.vue
index fcfd2d6606..57c8dcb89a 100644
--- a/frontend/src/components/Issue/StatusTransitionForm.vue
+++ b/frontend/src/components/Issue/StatusTransitionForm.vue
@@ -224,6 +224,8 @@ export default defineComponent({
return "btn-danger";
case "SKIP":
return "btn-danger";
+ case "RESTART":
+ return "btn-normal";
}
}
}
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 43ab7b988b..d8a0db50e1 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -212,7 +212,8 @@
"access-denied": "Access denied",
"no": "No",
"yes": "Yes",
- "advanced": "Advanced"
+ "advanced": "Advanced",
+ "restart": "Restart"
},
"error-page": {
"go-back-home": "Go back home"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 21d7a7b675..ab77bc647b 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -212,7 +212,8 @@
"access-denied": "拒绝访问",
"no": "否",
"yes": "是",
- "advanced": "高级"
+ "advanced": "高级",
+ "restart": "重启"
},
"error-page": {
"go-back-home": "回到主页"
diff --git a/frontend/src/utils/pipeline.ts b/frontend/src/utils/pipeline.ts
index e17b8c28e7..d4b2388fd5 100644
--- a/frontend/src/utils/pipeline.ts
+++ b/frontend/src/utils/pipeline.ts
@@ -76,12 +76,13 @@ export function activeStage(pipeline: Pipeline): Stage {
for (const stage of pipeline.stageList) {
for (const task of stage.taskList) {
if (
- task.status == "PENDING" ||
- task.status == "PENDING_APPROVAL" ||
- task.status == "RUNNING" ||
+ task.status === "PENDING" ||
+ task.status === "PENDING_APPROVAL" ||
+ task.status === "RUNNING" ||
// "FAILED" is also a transient task status, which requires user
// to take further action (e.g. Skip, Retry)
- task.status == "FAILED"
+ task.status === "FAILED" ||
+ task.status === "CANCELED"
) {
return stage;
}
@@ -98,12 +99,13 @@ export function activeTask(pipeline: Pipeline): Task {
for (const stage of pipeline.stageList) {
for (const task of stage.taskList) {
if (
- task.status == "PENDING" ||
- task.status == "PENDING_APPROVAL" ||
- task.status == "RUNNING" ||
+ task.status === "PENDING" ||
+ task.status === "PENDING_APPROVAL" ||
+ task.status === "RUNNING" ||
// "FAILED" is also a transient task status, which requires user
// to take further action (e.g. Skip, Retry)
- task.status == "FAILED"
+ task.status === "FAILED" ||
+ task.status === "CANCELED"
) {
return task;
}
@@ -121,12 +123,13 @@ export function activeTask(pipeline: Pipeline): Task {
export function activeTaskInStage(stage: Stage): Task {
for (const task of stage.taskList) {
if (
- task.status == "PENDING" ||
- task.status == "PENDING_APPROVAL" ||
- task.status == "RUNNING" ||
+ task.status === "PENDING" ||
+ task.status === "PENDING_APPROVAL" ||
+ task.status === "RUNNING" ||
// "FAILED" is also a transient task status, which requires user
// to take further action (e.g. Skip, Retry)
- task.status == "FAILED"
+ task.status === "FAILED" ||
+ task.status === "CANCELED"
) {
return task;
}
@@ -160,7 +163,8 @@ export type TaskStatusTransitionType =
| "APPROVE"
| "RETRY"
| "CANCEL"
- | "SKIP";
+ | "SKIP"
+ | "RESTART";
export interface TaskStatusTransition {
type: TaskStatusTransitionType;
@@ -209,6 +213,15 @@ const TASK_STATUS_TRANSITION_LIST: Map<
buttonType: "NORMAL",
},
],
+ [
+ "RESTART",
+ {
+ type: "RESTART",
+ to: "PENDING_APPROVAL",
+ buttonName: "common.restart",
+ buttonType: "NORMAL",
+ },
+ ],
]);
// The transition button are displayed from left to right on the UI, and the right-most one is the primary button
@@ -221,7 +234,7 @@ const APPLICABLE_TASK_TRANSITION_LIST: Map<
["RUNNING", ["CANCEL"]],
["DONE", []],
["FAILED", ["RETRY"]],
- ["CANCELED", []],
+ ["CANCELED", ["RESTART"]],
]);
export function applicableTaskTransition(