Skip to content

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

feat(frontend): skip tasks (#3977)

Liu Jif0c36207fdfd
diff --git a/frontend/src/components/Icon/SkipIcon.vue b/frontend/src/components/Icon/SkipIcon.vue
new file mode 100644
index 0000000000..5c9b0f63da
--- /dev/null
+++ b/frontend/src/components/Icon/SkipIcon.vue
@@ -0,0 +1,14 @@
+<template>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ viewBox="0 0 24 24"
+ >
+ <g fill="none">
+ <path
+ d="M21.5 3.75a.75.75 0 0 0-1.5 0v3.4c-1.154-1.388-2.65-2.563-4.528-3.145a11.185 11.185 0 0 0-7.233.192c-2.316.862-4.504 2.61-5.646 4.693a.75.75 0 1 0 1.315.72c.944-1.722 2.825-3.252 4.854-4.007a9.685 9.685 0 0 1 6.266-.165c1.702.527 3.071 1.664 4.13 3.062H15.25a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 .75-.75v-5.5zM8 14a.5.5 0 0 0-.5.5v4a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 0-.5-.5H8zm-2 .5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-4z"
+ fill="currentColor"
+ ></path>
+ </g>
+ </svg>
+</template>
diff --git a/frontend/src/components/Icon/index.ts b/frontend/src/components/Icon/index.ts
new file mode 100644
index 0000000000..a4a8699142
--- /dev/null
+++ b/frontend/src/components/Icon/index.ts
@@ -0,0 +1,3 @@
+import SkipIcon from "./SkipIcon.vue";
+
+export { SkipIcon };
diff --git a/frontend/src/components/Issue/IssueActivityPanel.vue b/frontend/src/components/Issue/IssueActivityPanel.vue
index b822ceed1b..898c1338f2 100644
--- a/frontend/src/components/Issue/IssueActivityPanel.vue
+++ b/frontend/src/components/Issue/IssueActivityPanel.vue
@@ -113,6 +113,15 @@
</div>
</div>
</template>
+ <template v-else-if="actionIcon(item.activity) == 'skip'">
+ <div class="relative pl-1">
+ <div
+ class="w-6 h-6 bg-gray-200 rounded-full ring-4 ring-white flex items-center justify-center"
+ >
+ <SkipIcon class="w-5 h-5 text-gray-500" />
+ </div>
+ </div>
+ </template>
<template v-else-if="actionIcon(item.activity) == 'commit'">
<div class="relative pl-0.5">
<div
@@ -337,6 +346,7 @@ import {
import { useRoute } from "vue-router";
import PrincipalAvatar from "../PrincipalAvatar.vue";
import HumanizeTs from "../misc/HumanizeTs.vue";
+import { SkipIcon } from "../Icon";
import type {
Issue,
Activity,
@@ -384,6 +394,7 @@ type ActionIconType =
| "cancel"
| "fail"
| "complete"
+ | "skip"
| "commit";
type DistinctActivity = {
@@ -601,7 +612,11 @@ const actionIcon = (activity: Activity): ActionIconType => {
return "run";
}
case "DONE": {
- return "complete";
+ if (payload.oldStatus === "RUNNING") {
+ return "complete";
+ } else {
+ return "skip";
+ }
}
case "FAILED": {
return "fail";
diff --git a/frontend/src/components/Issue/PipelineGhostFlow.vue b/frontend/src/components/Issue/PipelineGhostFlow.vue
index 6168b469ae..bb10abfc5d 100644
--- a/frontend/src/components/Issue/PipelineGhostFlow.vue
+++ b/frontend/src/components/Issue/PipelineGhostFlow.vue
@@ -28,6 +28,7 @@
:create="create"
:active="isActiveTask(task)"
:status="task.status"
+ :task="task"
class="transform scale-75"
/>
<heroicons-solid:arrow-narrow-right
diff --git a/frontend/src/components/Issue/PipelinePITRFlow.vue b/frontend/src/components/Issue/PipelinePITRFlow.vue
index 99bf39c40c..c1370acb2b 100644
--- a/frontend/src/components/Issue/PipelinePITRFlow.vue
+++ b/frontend/src/components/Issue/PipelinePITRFlow.vue
@@ -23,6 +23,7 @@
:create="create"
:active="isActiveTask(task)"
:status="task.status"
+ :task="task"
class="transform scale-75"
/>
<heroicons-solid:arrow-narrow-right
diff --git a/frontend/src/components/Issue/PipelineSimpleFlow.vue b/frontend/src/components/Issue/PipelineSimpleFlow.vue
index 56845beee2..8b2b4de104 100644
--- a/frontend/src/components/Issue/PipelineSimpleFlow.vue
+++ b/frontend/src/components/Issue/PipelineSimpleFlow.vue
@@ -27,6 +27,7 @@
:create="create"
:active="isActiveTask(task)"
:status="task.status"
+ :task="task"
class="transform scale-75"
/>
<heroicons-solid:arrow-narrow-right
diff --git a/frontend/src/components/Issue/PipelineTenantFlow.vue b/frontend/src/components/Issue/PipelineTenantFlow.vue
index 4aac8fc2de..94ae70df66 100644
--- a/frontend/src/components/Issue/PipelineTenantFlow.vue
+++ b/frontend/src/components/Issue/PipelineTenantFlow.vue
@@ -28,6 +28,7 @@
:create="create"
:active="isActiveTask(task)"
:status="task.status"
+ :task="task"
class="transform scale-75"
/>
<heroicons-solid:arrow-narrow-right
diff --git a/frontend/src/components/Issue/TaskExtraActionsButton.vue b/frontend/src/components/Issue/TaskExtraActionsButton.vue
index c733a30aa4..c14a5b9147 100644
--- a/frontend/src/components/Issue/TaskExtraActionsButton.vue
+++ b/frontend/src/components/Issue/TaskExtraActionsButton.vue
@@ -1,6 +1,6 @@
<template>
<NDropdown
- v-if="allowMarkTaskAsDone"
+ v-if="allowSkipTask"
trigger="click"
placement="bottom-end"
:options="options"
@@ -81,7 +81,7 @@ const currentUser = useCurrentUser();
const { create, issue } = useIssueLogic();
const { changeTaskStatus } = useExtraIssueLogic();
-const allowMarkTaskAsDone = computed(() => {
+const allowSkipTask = computed(() => {
if (create.value) {
return false;
}
@@ -118,34 +118,34 @@ const allowMarkTaskAsDone = computed(() => {
const options = computed(() => {
const list: DropdownOption[] = [];
- if (allowMarkTaskAsDone.value) {
+ if (allowSkipTask.value) {
list.push({
- key: "mark-task-as-done",
- label: t("task.mark-as-done"),
+ key: "skip",
+ label: t("task.skip"),
});
}
return list;
});
const handleSelect = (key: string) => {
- if (key === "mark-task-as-done") {
+ if (key === "skip") {
state.showModal = true;
}
};
-const confirmButtonText = computed(() => t("task.mark-as-done"));
+const confirmButtonText = computed(() => t("task.skip"));
const transition = computed((): TaskStatusTransition => {
return {
buttonType: "PRIMARY",
- buttonName: t("task.mark-as-done"),
+ buttonName: t("task.skip"),
type: "SKIP",
to: "DONE",
};
});
const modalTitle = computed(() => {
- return t("task.mark-as-done-modal-title", {
+ return t("task.skip-modal-title", {
name: props.task.name,
});
});
diff --git a/frontend/src/components/Issue/TaskStatusIcon.vue b/frontend/src/components/Issue/TaskStatusIcon.vue
index c8971c7979..41f47383ca 100644
--- a/frontend/src/components/Issue/TaskStatusIcon.vue
+++ b/frontend/src/components/Issue/TaskStatusIcon.vue
@@ -32,7 +32,8 @@
</div>
</template>
<template v-else-if="status === 'DONE'">
- <heroicons-solid:check class="w-5 h-5" />
+ <SkipIcon v-if="isSkipped" class="w-5 h-5" />
+ <heroicons-solid:check v-else class="w-5 h-5" />
</template>
<template v-else-if="status === 'FAILED'">
<span
@@ -51,14 +52,22 @@
<script lang="ts" setup>
import { computed } from "vue";
-import { TaskStatus } from "../../types";
+
+import type { Task, TaskCreate, TaskStatus } from "../../types";
+import { SkipIcon } from "../Icon";
+import { isTaskSkipped } from "@/utils";
const props = defineProps<{
create: boolean;
active: boolean;
status: TaskStatus;
+ task?: Task | TaskCreate;
}>();
+const isSkipped = computed(() => {
+ return !props.create && props.task && isTaskSkipped(props.task as Task);
+});
+
const classes = computed((): string => {
switch (props.status) {
case "PENDING":
@@ -74,6 +83,9 @@ const classes = computed((): string => {
case "RUNNING":
return "bg-white border-2 border-info text-info";
case "DONE":
+ if (isSkipped.value) {
+ return "bg-gray-200 text-gray-500";
+ }
return "bg-success text-white";
case "FAILED":
return "bg-error text-white";
diff --git a/frontend/src/components/Issue/activity/ActionSentence.vue b/frontend/src/components/Issue/activity/ActionSentence.vue
index a31e210135..6afecf6866 100644
--- a/frontend/src/components/Issue/activity/ActionSentence.vue
+++ b/frontend/src/components/Issue/activity/ActionSentence.vue
@@ -1,9 +1,9 @@
<template>
- <renderer />
+ <Renderer />
</template>
<script lang="ts" setup>
-import { h, PropType } from "vue";
+import { defineComponent, h, PropType } from "vue";
import {
Activity,
ActivityIssueCommentCreatePayload,
@@ -85,7 +85,11 @@ const renderActionSentence = () => {
break;
}
case "DONE": {
- str = t("activity.sentence.completed");
+ if (payload.oldStatus === "RUNNING") {
+ str = t("activity.sentence.completed");
+ } else {
+ str = t("activity.sentence.skipped");
+ }
break;
}
case "FAILED": {
@@ -144,9 +148,9 @@ const renderActionSentence = () => {
return "";
};
-const renderer = {
+const Renderer = defineComponent({
render: renderActionSentence,
-};
+});
const renderStatement = (statement: string) => {
return h(SQLPreviewPopover, {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 2c28346d92..3406d45b6a 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -290,8 +290,8 @@
"counting": "Counting"
},
"n-similar-tasks": "({count} similar tasks)",
- "mark-as-done": "Mark as done",
- "mark-as-done-modal-title": "Mark task [{name}] as done?"
+ "skip": "Skip",
+ "skip-modal-title": "Skip task [{name}]?"
},
"banner": {
"demo-intro": "This is a demo version of Bytebase.",
@@ -483,7 +483,8 @@
"task-name": " task {name}",
"committed-to-at": "committed {file} to {branch}{'@'}{repo}",
"dismissed-stale-approval": "dismissed stale approvals of {task}",
- "external-approval-rejected": "rejected external approval from {imName} of stage \"{stageName}\""
+ "external-approval-rejected": "rejected external approval from {imName} of stage \"{stageName}\"",
+ "skipped": "skipped"
},
"subject-prefix": {
"task": "Task"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 85fe32138d..d977efd72e 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -290,8 +290,8 @@
"counting": "统计中"
},
"n-similar-tasks": "({count} 个相似的任务)",
- "mark-as-done": "标记为已完成",
- "mark-as-done-modal-title": "将任务[{name}]标记为已完成?"
+ "skip": "跳过",
+ "skip-modal-title": "跳过任务[{name}]?"
},
"banner": {
"demo-intro": "这是 Bytebase 的演示版本。",
@@ -483,7 +483,8 @@
"task-name": "任务 {name}",
"committed-to-at": "提交 {file} 到 {branch}{'@'}{repo}",
"dismissed-stale-approval": "更新了{task},此前的批准已被撤销",
- "external-approval-rejected": "拒绝阶段 \"{stageName}\" 的{imName}外部审批"
+ "external-approval-rejected": "拒绝阶段 \"{stageName}\" 的{imName}外部审批",
+ "skipped": "跳过"
},
"subject-prefix": {
"task": "任务"
diff --git a/frontend/src/types/pipeline/task.ts b/frontend/src/types/pipeline/task.ts
index 310aeb68b8..bd9b13a04f 100644
--- a/frontend/src/types/pipeline/task.ts
+++ b/frontend/src/types/pipeline/task.ts
@@ -46,6 +46,8 @@ export type TaskEarliestAllowedTimePayload = {
};
export type TaskDatabaseCreatePayload = {
+ skipped: boolean;
+ skippedReason: string;
projectId: ProjectId;
statement: string;
sheetId: SheetId;
@@ -55,35 +57,45 @@ export type TaskDatabaseCreatePayload = {
};
export type TaskDatabaseSchemaBaselinePayload = {
+ skipped: boolean;
+ skippedReason: string;
statement: string;
schemaVersion: string;
pushEvent?: VCSPushEvent;
};
export type TaskDatabaseSchemaUpdatePayload = {
+ skipped: boolean;
+ skippedReason: string;
statement: string;
sheetId: SheetId;
pushEvent?: VCSPushEvent;
};
export type TaskDatabaseSchemaUpdateSDLPayload = {
+ skipped: boolean;
+ skippedReason: string;
statement: string;
sheetId: SheetId;
pushEvent?: VCSPushEvent;
};
export type TaskDatabaseSchemaUpdateGhostSyncPayload = {
+ skipped: boolean;
+ skippedReason: string;
statement: string;
sheetId: SheetId;
pushEvent?: VCSPushEvent;
};
export type TaskDatabaseSchemaUpdateGhostCutoverPayload = {
- // empty by now
- // more input and output parameters in the future
+ skipped: boolean;
+ skippedReason: string;
};
export type TaskDatabasePITRRestorePayload = {
+ skipped: boolean;
+ skippedReason: string;
projectId: ProjectId;
pointInTimeTs: number; // UNIX timestamp
databaseName?: string; // used when PITR to new DB
@@ -91,8 +103,8 @@ export type TaskDatabasePITRRestorePayload = {
};
export type TaskDatabasePITRCutoverPayload = {
- // empty by now
- // more input and output parameters in the future
+ skipped: boolean;
+ skippedReason: string;
};
export type TaskDatabasePITRDeletePayload = {
@@ -101,6 +113,8 @@ export type TaskDatabasePITRDeletePayload = {
};
export type TaskDatabaseDataUpdatePayload = {
+ skipped: boolean;
+ skippedReason: string;
statement: string;
sheetId: SheetId;
pushEvent?: VCSPushEvent;
diff --git a/frontend/src/utils/task.ts b/frontend/src/utils/task.ts
index 5068b0bf2c..91dff40fb6 100644
--- a/frontend/src/utils/task.ts
+++ b/frontend/src/utils/task.ts
@@ -138,3 +138,11 @@ export function taskCheckRunSummary(task?: Task): TaskCheckRunSummary {
return summary;
}
+
+export const isTaskSkipped = (task: Task): boolean => {
+ if (task.status === "DONE") {
+ const payload = task.payload as any;
+ return payload?.skipped === true;
+ }
+ return false;
+};