Skip to content

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

refactor: improve plan task rollout UI and code organization (#17459)

boojackbb3d0d27cde6
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
index a6fa2eff07..a630d022d5 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
@@ -465,18 +465,9 @@ const secondaryActions = computed((): ActionConfig[] => {
if (actions.includes("ISSUE_REVIEW_REJECT")) {
secondary.push({ action: "ISSUE_REVIEW_REJECT" });
}
-
- // Rollout actions in dropdown
- if (
- primaryAction.value?.action !== "ROLLOUT_START" &&
- actions.includes("ROLLOUT_START")
- ) {
- secondary.push({ action: "ROLLOUT_START" });
- }
if (actions.includes("ROLLOUT_CANCEL")) {
secondary.push({ action: "ROLLOUT_CANCEL" });
}
-
if (actions.includes("ISSUE_STATUS_CLOSE")) {
secondary.push({ action: "ISSUE_STATUS_CLOSE" });
}
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
index 88b590690b..c46e62de21 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
@@ -275,9 +275,14 @@ import {
ListTaskRunsRequestSchema,
TaskRun_Status,
} from "@/types/proto-es/v1/rollout_service_pb";
-import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
+import type {
+ BatchRunTasksRequest,
+ Stage,
+ Task,
+} from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import {
+ extractStageUID,
hasProjectPermissionV2,
hasWorkspacePermissionV2,
isNullOrUndefined,
@@ -650,22 +655,16 @@ const handleExecutionModeChange = (value: string) => {
const groupTasksByStage = (tasks: Task[]) => {
const tasksByStage = new Map<string, Task[]>();
for (const task of tasks) {
- // Extract stage from task name: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}
- const pathParts = task.name.split("/");
- const stageIndex = pathParts.findIndex((part) => part === "stages");
- if (stageIndex !== -1 && stageIndex + 1 < pathParts.length) {
- const stageId = pathParts[stageIndex + 1];
- if (!tasksByStage.has(stageId)) {
- tasksByStage.set(stageId, []);
- }
- tasksByStage.get(stageId)!.push(task);
+ const stageId = extractStageUID(task.name);
+ if (!tasksByStage.has(stageId)) {
+ tasksByStage.set(stageId, []);
}
+ tasksByStage.get(stageId)!.push(task);
}
return tasksByStage;
};
-// Helper function to add run time to a request if specified
-const addRunTimeToRequest = (request: any) => {
+const addRunTimeToRequest = (request: BatchRunTasksRequest) => {
if (runTimeInMS.value !== undefined) {
// Convert timestamp to protobuf Timestamp format
const runTimeSeconds = Math.floor(runTimeInMS.value / 1000);
@@ -680,9 +679,6 @@ const addRunTimeToRequest = (request: any) => {
const handleConfirm = async () => {
state.loading = true;
- const parent = isDatabaseCreationOrExportTask.value
- ? rollout.value.name
- : targetStage.value.name;
try {
if (props.action === "RUN") {
// For export tasks, group by stage/environment and make separate batch calls
@@ -690,9 +686,9 @@ const handleConfirm = async () => {
const tasksByStage = groupTasksByStage(eligibleTasks.value);
// Make batch run calls for each stage/environment
- for (const [_stageId, stageTasks] of tasksByStage) {
+ for (const [stageId, stageTasks] of tasksByStage) {
const request = create(BatchRunTasksRequestSchema, {
- parent,
+ parent: `${rollout.value.name}/stages/${stageId}`,
tasks: stageTasks.map((task) => task.name),
reason: comment.value,
});
@@ -702,7 +698,7 @@ const handleConfirm = async () => {
} else {
// For non-export tasks, use the original logic
const request = create(BatchRunTasksRequestSchema, {
- parent,
+ parent: targetStage.value.name,
tasks: eligibleTasks.value.map((task) => task.name),
reason: comment.value,
});
@@ -715,9 +711,9 @@ const handleConfirm = async () => {
const tasksByStage = groupTasksByStage(eligibleTasks.value);
// Make batch skip calls for each stage/environment
- for (const [_stageId, stageTasks] of tasksByStage) {
+ for (const [stageId, stageTasks] of tasksByStage) {
const request = create(BatchSkipTasksRequestSchema, {
- parent,
+ parent: `${rollout.value.name}/stages/${stageId}`,
tasks: stageTasks.map((task) => task.name),
reason: comment.value,
});
@@ -726,7 +722,7 @@ const handleConfirm = async () => {
} else {
// For non-export tasks, use the original logic
const request = create(BatchSkipTasksRequestSchema, {
- parent,
+ parent: targetStage.value.name,
tasks: eligibleTasks.value.map((task) => task.name),
reason: comment.value,
});
diff --git a/frontend/src/components/Plan/components/SpecDetailView/TargetsSelectorDrawer.vue b/frontend/src/components/Plan/components/SpecDetailView/TargetsSelectorDrawer.vue
index b1edebd037..6a4e04eaa1 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/TargetsSelectorDrawer.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/TargetsSelectorDrawer.vue
@@ -17,7 +17,7 @@
</div>
<template #footer>
<div class="flex items-center justify-end gap-x-3">
- <NButton @click="show = false">
+ <NButton @click="show = false" quaternary>
{{ $t("common.cancel") }}
</NButton>
<NButton
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index ae1c1173f1..2bda4d5f45 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1103,7 +1103,7 @@
"schema-migration-description": "数据库结构变更(DDL),包括表、列、索引、约束和模式变更",
"data-change": "数据变更",
"data-change-description": "数据库数据修改(DML),包括插入、更新、删除和数据迁移",
- "select-targets": "选择变更对象",
+ "select-targets": "选择目标库",
"ready-for-review": "提交审批",
"overview": {
"no-checks": "没有检查"
@@ -1136,8 +1136,8 @@
}
},
"targets": {
- "title": "变更对象",
- "no-targets-found": "未找到变更对象",
+ "title": "目标库",
+ "no-targets-found": "未找到目标库",
"type": {
"database-group": "数据库组"
},