Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): Redefine the meaning of the numbers displayed on the stage block (#4469)
Liu Ji8aef4140b942
diff --git a/frontend/src/components/Issue/PipelineGhostFlow.vue b/frontend/src/components/Issue/PipelineGhostFlow.vueindex f4ae77859e..9ca82f83d8 100644--- a/frontend/src/components/Issue/PipelineGhostFlow.vue+++ b/frontend/src/components/Issue/PipelineGhostFlow.vue@@ -1,10 +1,6 @@<template><div class="divide-y relative">- <PipelineStageList>- <template #task-name-of-stage="{ stage }">- {{ taskNameOfStage(stage) }}- </template>- </PipelineStageList>+ <PipelineStageList /><div class="relative"><div@@ -86,7 +82,7 @@ import type {TaskCreate,Database,} from "@/types";-import { activeTask, activeTaskInStage, taskSlug } from "@/utils";+import { activeTask, taskSlug } from "@/utils";import TaskStatusIcon from "./TaskStatusIcon.vue";import { useDatabaseStore } from "@/store";import PipelineStageList from "./PipelineStageList.vue";@@ -128,20 +124,6 @@ const isActiveTask = (task: Task | TaskCreate): boolean => {return activeTask(pipeline.value as Pipeline).id === task.id;};-const taskNameOfStage = (stage: Stage | StageCreate) => {- if (create.value) {- return stage.taskList[0].status;- }- const activeTask = activeTaskInStage(stage as Stage);- const { taskList } = stage as Stage;- for (let i = 0; i < stage.taskList.length; i++) {- if (taskList[i].id == activeTask.id) {- return `${activeTask.name} (${i + 1}/${stage.taskList.length})`;- }- }- return activeTask.name;-};-const taskNameOfTask = (task: Task | TaskCreate) => {return t(`task.type.${task.type.replace(/\./g, "-")}`);};diff --git a/frontend/src/components/Issue/PipelinePITRFlow.vue b/frontend/src/components/Issue/PipelinePITRFlow.vueindex dc668e613e..be6c7aaaf5 100644--- a/frontend/src/components/Issue/PipelinePITRFlow.vue+++ b/frontend/src/components/Issue/PipelinePITRFlow.vue@@ -1,10 +1,6 @@<template><div class="divide-y">- <PipelineStageList>- <template #task-name-of-stage="{ stage }">- {{ taskNameOfStage(stage) }}- </template>- </PipelineStageList>+ <PipelineStageList /><divv-if="taskList.length > 1"@@ -73,7 +69,6 @@ import { computed } from "vue";import { Pipeline, Stage, StageCreate, Task, TaskCreate } from "@/types";import {activeTask,- activeTaskInStage,extractDatabaseNameFromTask,taskSlug,bytesToString,@@ -108,20 +103,6 @@ const isActiveTask = (task: Task | TaskCreate): boolean => {return activeTask(pipeline.value as Pipeline).id === task.id;};-const taskNameOfStage = (stage: Stage | StageCreate) => {- if (create.value) {- return stage.taskList[0].status;- }- const activeTask = activeTaskInStage(stage as Stage);- const { taskList } = stage as Stage;- for (let i = 0; i < stage.taskList.length; i++) {- if (taskList[i].id == activeTask.id) {- return `${activeTask.name} (${i + 1}/${stage.taskList.length})`;- }- }- return activeTask.name;-};-const taskNameOfTask = (task: Task | TaskCreate) => {// return t(`task.type.${task.type.replace(/\./g, "-")}`);return task.name;diff --git a/frontend/src/components/Issue/PipelineSimpleFlow.vue b/frontend/src/components/Issue/PipelineSimpleFlow.vueindex 52ea388627..2770a55aa1 100644--- a/frontend/src/components/Issue/PipelineSimpleFlow.vue+++ b/frontend/src/components/Issue/PipelineSimpleFlow.vue@@ -1,10 +1,7 @@<template><div class="pipeline-standard-flow divide-y">- <PipelineStageList>- <template #task-name-of-stage="{ stage }">- {{ taskNameOfStage(stage) }}- </template>- </PipelineStageList>+ <PipelineStageList />+<div v-if="shouldShowTaskBar" class="relative"><divref="taskBar"@@ -76,7 +73,7 @@ import {TaskDatabaseCreatePayload,unknown,} from "@/types";-import { activeTaskInStage, taskSlug } from "@/utils";+import { taskSlug } from "@/utils";import { useIssueLogic } from "./logic";import TaskExtraActionsButton from "./TaskExtraActionsButton.vue";import { useVerticalScrollState } from "@/composables/useScrollState";@@ -95,20 +92,6 @@ const databaseStore = useDatabaseStore();const taskBar = ref<HTMLDivElement>();const taskBarScrollState = useVerticalScrollState(taskBar, 192);-const taskNameOfStage = (stage: Stage | StageCreate) => {- if (create.value) {- return stage.taskList[0].status;- }- const activeTask = activeTaskInStage(stage as Stage);- const { taskList } = stage as Stage;- for (let i = 0; i < stage.taskList.length; i++) {- if (taskList[i].id == activeTask.id) {- return `${activeTask.name} (${i + 1}/${stage.taskList.length})`;- }- }- return activeTask.name;-};-const pipeline = computed(() => issue.value.pipeline!);const taskList = computed(() => selectedStage.value.taskList);diff --git a/frontend/src/components/Issue/PipelineStageList.vue b/frontend/src/components/Issue/PipelineStageList.vueindex 74a50b1345..f100da88a3 100644--- a/frontend/src/components/Issue/PipelineStageList.vue+++ b/frontend/src/components/Issue/PipelineStageList.vue@@ -13,11 +13,16 @@/><div class="text" @click.prevent="onClickStage(stage, i)">- <span class="text-sm min-w-32 lg:min-w-fit">+ <span class="text-sm min-w-32 lg:min-w-fit with-underline">{{ $t("common.stage") }} - {{ stage.name }}</span>- <span class="text-xs flex-1 ml-4 lg:ml-0 whitespace-pre-wrap break-all">- <slot name="task-name-of-stage" :stage="stage" :index="i" />+ <span class="text-xs flex flex-col gap-1 md:flex-row md:items-center">+ <slot name="task-name-of-stage" :stage="stage" :index="i">+ <div class="whitespace-pre-wrap break-all with-underline">+ {{ taskNameOfStage(stage) }}+ </div>+ <StageSummary :stage="(stage as Stage)" />+ </slot></span></div>@@ -61,7 +66,9 @@import { NPopover } from "naive-ui";import { Issue, Stage, StageCreate } from "@/types";import TaskStatusIcon from "./TaskStatusIcon.vue";+import StageSummary from "./StageSummary.vue";import { useIssueLogic } from "./logic";+import { activeTaskInStage } from "@/utils";const {create,@@ -109,6 +116,13 @@ const stageClass = (stage: Stage | StageCreate, index: number): string[] => {return classList;};+const taskNameOfStage = (stage: Stage | StageCreate) => {+ if (create.value) {+ return stage.taskList[0].status;+ }+ return activeTaskInStage(stage as Stage).name;+};+const onClickStage = (stage: Stage | StageCreate, index: number) => {if (create.value) {selectStageOrTask(index);@@ -128,10 +142,9 @@ const onClickStage = (stage: Stage | StageCreate, index: number) => {}.stage-item .text {- @apply cursor-pointer ml-4 flex items-center flex-1;- @apply lg:flex-col lg:items-start;+ @apply cursor-pointer ml-4 flex-col space-y-1;}-.stage-item.selected .text {+.stage-item.selected .text .with-underline {@apply underline;}.stage-item.active .text {diff --git a/frontend/src/components/Issue/PipelineTenantFlow.vue b/frontend/src/components/Issue/PipelineTenantFlow.vueindex 40070492fe..93eedcc17b 100644--- a/frontend/src/components/Issue/PipelineTenantFlow.vue+++ b/frontend/src/components/Issue/PipelineTenantFlow.vue@@ -1,10 +1,6 @@<template><div class="divide-y">- <PipelineStageList>- <template #task-name-of-stage="{ stage }">- {{ taskNameOfStage(stage) }}- </template>- </PipelineStageList>+ <PipelineStageList /><div class="relative"><div@@ -66,7 +62,7 @@ import type {TaskCreate,Database,} from "@/types";-import { activeTask, activeTaskInStage, taskSlug } from "@/utils";+import { activeTask, taskSlug } from "@/utils";import TaskStatusIcon from "./TaskStatusIcon.vue";import TaskExtraActionsButton from "./TaskExtraActionsButton.vue";import { useDatabaseStore } from "@/store";@@ -111,20 +107,6 @@ const selectedStageIdOrIndex = computed(() => {);});-const taskNameOfStage = (stage: Stage | StageCreate) => {- if (create.value) {- return stage.taskList[0].status;- }- const activeTask = activeTaskInStage(stage as Stage);- const { taskList } = stage as Stage;- for (let i = 0; i < stage.taskList.length; i++) {- if (taskList[i].id == activeTask.id) {- return `${activeTask.name} (${i + 1}/${stage.taskList.length})`;- }- }- return activeTask.name;-};-const taskClass = (task: Task | TaskCreate) => {const classes: string[] = [];if (isSelectedTask(task)) classes.push("selected");diff --git a/frontend/src/components/Issue/StageSummary.vue b/frontend/src/components/Issue/StageSummary.vuenew file mode 100644index 0000000000..705540c0b4--- /dev/null+++ b/frontend/src/components/Issue/StageSummary.vue@@ -0,0 +1,47 @@+<template>+ <div class="!no-underline">+ <span class="!no-underline">(</span>+ <span class="!no-underline">{{ summary.done + summary.canceled }}</span>+ <span class="!no-underline">/</span>+ <span class="!no-underline">{{ summary.total }}</span>+ <span class="!no-underline">)</span>+ </div>+</template>++<script lang="ts" setup>+import { computed } from "vue";++import type { Stage } from "@/types";++const props = defineProps<{+ stage: Stage;+}>();++const summary = computed(() => {+ const { taskList } = props.stage;+ const summary = {+ done: 0,+ failed: 0,+ canceled: 0,+ running: 0,+ total: taskList.length,+ };+ taskList.forEach((task) => {+ switch (task.status) {+ case "DONE":+ summary.done++;+ break;+ case "FAILED":+ summary.failed++;+ break;+ case "CANCELED":+ summary.canceled++;+ break;+ case "RUNNING":+ summary.running++;+ break;+ }+ });+ return summary;+});+</script>diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 19f26ff39e..24bd1cc719 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -218,6 +218,7 @@"want-help": "Want help","operation": "Operation","rollback": "Rollback",+ "total": "Total","discard-changes": "Discard changes","error-message": "Error message"},diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex d04ef2e891..ee084d5cd2 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -218,6 +218,7 @@"want-help": "加入用户群","operation": "操作","rollback": "回滚",+ "total": "共计","discard-changes": "取消修改","error-message": "错误信息"},