Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add rollback entry (#16884)
boojackabc90b2234dc
diff --git a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue b/frontend/src/components/Plan/components/RolloutView/RolloutView.vueindex 777ea1eaac..24add37a41 100644--- a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue+++ b/frontend/src/components/Plan/components/RolloutView/RolloutView.vue@@ -39,6 +39,9 @@@create-rollout-to-stage="handleCreateRolloutToStage"/></template>++ <!-- Rollback Section -->+ <TaskRunRollbackSection :rollout="rollout" /></div><!-- Task Rollout Action Panel -->@@ -65,6 +68,7 @@ import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";import { usePlanContextWithRollout } from "../../logic";import StagesView from "./StagesView.vue";import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";+import TaskRunRollbackSection from "./TaskRunRollbackSection.vue";import { useRolloutViewContext } from "./context";const { t } = useI18n();diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackDrawer.vue b/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackDrawer.vuenew file mode 100644index 0000000000..e87d0c608f--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackDrawer.vue@@ -0,0 +1,351 @@+<template>+ <Drawer v-model:show="show" :width="720" placement="right">+ <DrawerContent :title="$t('common.rollback')" :closable="!state.loading">+ <div class="flex flex-col gap-y-4">+ <!-- Steps indicator -->+ <NSteps :current="currentStep" size="small">+ <NStep :title="$t('task.select-task', 2)" />+ <NStep :title="$t('task-run.rollback.preview-statement.self')" />+ </NSteps>++ <!-- Step content -->+ <div class="flex-1">+ <!-- Step 1: Select Tasks -->+ <template v-if="currentStep === 1">+ <TaskTable+ bordered+ :tasks="rollbackableTasks"+ :task-status-filter="[]"+ :selected-tasks="selectedTasks"+ :task-selectable="isTaskSelectable"+ @update:selected-tasks="handleSelectedTasksUpdate"+ />+ </template>++ <!-- Step 2: Preview Statements -->+ <template v-else-if="currentStep === 2">+ <div class="flex flex-col gap-y-4">+ <NAlert type="info">+ {{ $t("task-run.rollback.preview-statement.description") }}+ </NAlert>++ <div class="space-y-4">+ <div+ v-for="preview in rollbackPreviews"+ :key="preview.taskRunName"+ class="space-y-2"+ >+ <DatabaseDisplay :database="preview.task.target" />+ <MonacoEditor+ v-if="preview.statement"+ class="border rounded-[3px] text-sm overflow-clip"+ :content="preview.statement"+ :readonly="true"+ :auto-height="{ min: 100, max: 200 }"+ />+ <div+ v-else-if="preview.error"+ class="p-3 border border-red-200 bg-red-50 rounded text-sm text-red-600"+ >+ {{ preview.error }}+ </div>+ <NSkeleton v-else text :repeat="3" class="h-24" />+ </div>+ </div>+ </div>+ </template>+ </div>+ </div>++ <template #footer>+ <div class="flex items-center justify-between">+ <div class="flex items-center gap-x-2">+ <NButton+ v-if="currentStep === 1"+ quaternary+ :disabled="state.loading"+ @click="handleCancel"+ >+ {{ $t("common.cancel") }}+ </NButton>+ <NButton+ v-else+ quaternary+ :disabled="state.loading"+ @click="handlePrevStep"+ >+ {{ $t("common.back") }}+ </NButton>+ <NButton+ v-if="currentStep === 1"+ type="primary"+ :disabled="selectedTasks.length === 0"+ @click="handleNextStep"+ >+ {{ $t("common.next") }}+ </NButton>+ <NButton+ v-else-if="currentStep === 2"+ type="primary"+ :loading="state.loading"+ :disabled="!canCreateRollback"+ @click="handleConfirm"+ >+ {{ $t("common.confirm") }}+ </NButton>+ </div>+ </div>+ </template>+ </DrawerContent>+ </Drawer>+</template>++<script setup lang="ts">+import { create } from "@bufbuild/protobuf";+import { createContextValues } from "@connectrpc/connect";+import { NSteps, NStep, NButton, NAlert, NSkeleton } from "naive-ui";+import { v4 as uuidv4 } from "uuid";+import { computed, reactive, ref, watch } from "vue";+import { useRouter } from "vue-router";+import { MonacoEditor } from "@/components/MonacoEditor";+import DatabaseDisplay from "@/components/Plan/components/common/DatabaseDisplay.vue";+import { Drawer, DrawerContent } from "@/components/v2";+import {+ planServiceClientConnect,+ rolloutServiceClientConnect,+} from "@/grpcweb";+import { silentContextKey } from "@/grpcweb/context-key";+import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";+import {+ pushNotification,+ useCurrentProjectV1,+ useSheetV1Store,+} from "@/store";+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";+import {+ CreatePlanRequestSchema,+ Plan_ChangeDatabaseConfig_Type,+ Plan_ChangeDatabaseConfigSchema,+ Plan_SpecSchema,+ PlanSchema,+} from "@/types/proto-es/v1/plan_service_pb";+import type {+ Task,+ TaskRun,+ Rollout,+} from "@/types/proto-es/v1/rollout_service_pb";+import { PreviewTaskRunRollbackRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";+import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";+import {+ databaseForTask,+ extractPlanUID,+ extractProjectResourceName,+ extractRolloutUID,+ hasProjectPermissionV2,+} from "@/utils";+import TaskTable from "./TaskTable.vue";++type LocalState = {+ loading: boolean;+};++const props = defineProps<{+ rollout: Rollout;+ rollbackableTaskRuns: Array<{+ task: Task;+ taskRun: TaskRun;+ database: ReturnType<typeof databaseForTask>;+ }>;+}>();++const emit = defineEmits<{+ (event: "close"): void;+}>();++const router = useRouter();+const { project } = useCurrentProjectV1();++const show = defineModel<boolean>("show", { default: false });++const state = reactive<LocalState>({+ loading: false,+});++const currentStep = ref(1);+const selectedTasks = ref<Task[]>([]);+const rollbackPreviews = ref<+ Array<{+ taskRunName: string;+ task: Task;+ database: ReturnType<typeof databaseForTask>;+ statement?: string;+ error?: string;+ }>+>([]);++// Extract just the tasks from rollbackableTaskRuns+const rollbackableTasks = computed(() => {+ return props.rollbackableTaskRuns.map((item) => item.task);+});++// Map selected tasks back to their task runs+const selectedTaskRuns = computed(() => {+ return props.rollbackableTaskRuns.filter((item) =>+ selectedTasks.value.some((task) => task.name === item.task.name)+ );+});++// Task is selectable if it has a corresponding rollbackable task run+const isTaskSelectable = (task: Task): boolean => {+ // In this case, all tasks in rollbackableTasks should be selectable+ // but we can add additional logic here if needed+ return rollbackableTasks.value.some((t) => t.name === task.name);+};++const canCreateRollback = computed(() => {+ return (+ rollbackPreviews.value.length > 0 &&+ rollbackPreviews.value.every((p) => p.statement && !p.error) &&+ hasProjectPermissionV2(project.value, "bb.plans.create")+ );+});++const handleSelectedTasksUpdate = (tasks: Task[]) => {+ selectedTasks.value = tasks;+};++const handleCancel = () => {+ show.value = false;+ emit("close");+};++const handleNextStep = async () => {+ if (selectedTasks.value.length === 0) return;++ currentStep.value = 2;+ rollbackPreviews.value = selectedTaskRuns.value.map((item) => ({+ taskRunName: item.taskRun.name,+ task: item.task,+ database: item.database,+ }));++ // Fetch preview for each selected task run+ for (const preview of rollbackPreviews.value) {+ try {+ const request = create(PreviewTaskRunRollbackRequestSchema, {+ name: preview.taskRunName,+ });+ const response = await rolloutServiceClientConnect.previewTaskRunRollback(+ request,+ {+ contextValues: createContextValues().set(silentContextKey, true),+ }+ );+ const index = rollbackPreviews.value.findIndex(+ (p) => p.taskRunName === preview.taskRunName+ );+ if (index !== -1) {+ rollbackPreviews.value[index].statement = response.statement;+ }+ } catch (error) {+ const index = rollbackPreviews.value.findIndex(+ (p) => p.taskRunName === preview.taskRunName+ );+ if (index !== -1) {+ rollbackPreviews.value[index].error = String(error);+ }+ }+ }+};++const handlePrevStep = () => {+ if (currentStep.value === 2) {+ currentStep.value = 1;+ }+};++const handleConfirm = async () => {+ if (!canCreateRollback.value) return;++ state.loading = true;+ try {+ const sheetStore = useSheetV1Store();+ const specs: Plan_Spec[] = [];++ // Create sheets and specs for each rollback+ for (const preview of rollbackPreviews.value) {+ if (!preview.statement) continue;++ // Create a sheet for the rollback statement+ const sheet = await sheetStore.createSheet(+ project.value.name,+ create(SheetSchema, {+ name: `${project.value.name}/sheets/${uuidv4()}`,+ title: `Rollback for ${preview.task.target}`,+ content: new TextEncoder().encode(preview.statement),+ engine: preview.database.instanceResource.engine,+ })+ );++ // Create spec for this database+ const spec = create(Plan_SpecSchema, {+ id: uuidv4(),+ config: {+ case: "changeDatabaseConfig",+ value: create(Plan_ChangeDatabaseConfigSchema, {+ targets: [preview.task.target],+ type: Plan_ChangeDatabaseConfig_Type.DATA,+ sheet: sheet.name,+ }),+ },+ });+ specs.push(spec);+ }++ // Create the plan+ const plan = create(PlanSchema, {+ name: `${project.value.name}/plans/${uuidv4()}`,+ title: `Rollback for rollout#${extractRolloutUID(props.rollout.name)}`,+ description: `This plan is created to rollback ${rollbackPreviews.value.length} task(s) in rollout #${extractRolloutUID(props.rollout.name)}`,+ specs,+ });++ const request = create(CreatePlanRequestSchema, {+ parent: project.value.name,+ plan,+ });+ const createdPlan = await planServiceClientConnect.createPlan(request);+ router.push({+ name: PROJECT_V1_ROUTE_PLAN_DETAIL,+ params: {+ projectId: extractProjectResourceName(project.value.name),+ planId: extractPlanUID(createdPlan.name),+ },+ });+ } catch (error) {+ pushNotification({+ module: "bytebase",+ style: "CRITICAL",+ title: "Failed to create rollback plan",+ description: String(error),+ });+ } finally {+ state.loading = false;+ }+};++// Reset state when drawer opens+const resetState = () => {+ currentStep.value = 1;+ selectedTasks.value = [];+ rollbackPreviews.value = [];+ state.loading = false;+};++// Reset state when drawer closes+watch(show, (newValue) => {+ if (newValue) {+ resetState();+ }+});+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackSection.vue b/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackSection.vuenew file mode 100644index 0000000000..b4c64c0f64--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/TaskRunRollbackSection.vue@@ -0,0 +1,78 @@+<template>+ <div v-if="rollbackableTaskRuns.length > 0" class="w-full mt-3 pl-4">+ <NButton+ size="small"+ text+ @click="showRollbackDrawer = true"+ icon-placement="right"+ >+ <template #icon>+ <DatabaseBackupIcon class="w-4 h-auto" />+ </template>+ {{ $t("task-run.rollback.available", rollbackableTaskRuns.length) }}+ </NButton>++ <TaskRunRollbackDrawer+ v-model:show="showRollbackDrawer"+ :rollout="rollout"+ :rollbackable-task-runs="rollbackableTaskRuns"+ @close="showRollbackDrawer = false"+ />+ </div>+</template>++<script setup lang="ts">+import { DatabaseBackupIcon } from "lucide-vue-next";+import { NButton } from "naive-ui";+import { computed, ref } from "vue";+import { taskRunNamePrefix, useCurrentProjectV1 } from "@/store";+import type {+ Task,+ TaskRun,+ Rollout,+} from "@/types/proto-es/v1/rollout_service_pb";+import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";+import { databaseForTask } from "@/utils";+import { usePlanContextWithRollout } from "../../logic";+import TaskRunRollbackDrawer from "./TaskRunRollbackDrawer.vue";++const props = defineProps<{+ rollout: Rollout;+}>();++const { project } = useCurrentProjectV1();+const { taskRuns } = usePlanContextWithRollout();++const showRollbackDrawer = ref(false);++// Get rollbackable task runs+const rollbackableTaskRuns = computed(() => {+ const result: Array<{+ task: Task;+ taskRun: TaskRun;+ database: ReturnType<typeof databaseForTask>;+ }> = [];++ for (const stage of props.rollout.stages) {+ for (const task of stage.tasks) {+ // Find the latest successful task run with prior backup+ const rollbackableRun = taskRuns.value.find(+ (run) =>+ run.name.startsWith(`${task.name}/${taskRunNamePrefix}`) &&+ run.status === TaskRun_Status.DONE &&+ run.priorBackupDetail !== undefined+ );++ if (rollbackableRun) {+ result.push({+ task,+ taskRun: rollbackableRun,+ database: databaseForTask(project.value, task),+ });+ }+ }+ }++ return result;+});+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue b/frontend/src/components/Plan/components/RolloutView/TaskTable.vueindex 1c82deba8a..9efacded46 100644--- a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue+++ b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue@@ -16,7 +16,6 @@</template><script lang="tsx" setup>-import { flatten } from "lodash-es";import { CalendarClockIcon } from "lucide-vue-next";import type { DataTableColumn } from "naive-ui";import { NDataTable, NTag, NTooltip } from "naive-ui";@@ -29,7 +28,7 @@ import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL } from "@/router/dashboard/projectV1";import { useCurrentProjectV1 } from "@/store";import { getTimeForPbTimestampProtoEs } from "@/types";-import type { Task, Stage } from "@/types/proto-es/v1/rollout_service_pb";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";import {extractProjectResourceName,@@ -41,17 +40,18 @@ import { useRolloutViewContext } from "./context";const props = withDefaults(defineProps<{taskStatusFilter: Task_Status[];- stage: Stage;+ tasks: Task[];selectedTasks?: Task[];+ taskSelectable?: (task: Task) => boolean;}>(),{selectedTasks: () => [],+ taskSelectable: () => () => true,});const emit = defineEmits<{(event: "update:selected-tasks", tasks: Task[]): void;- (event: "refresh"): void;}>();const { t } = useI18n();@@ -60,19 +60,10 @@ const { project } = useCurrentProjectV1();const { rollout, mergedStages } = useRolloutViewContext();const taskList = computed(() => {- let allTasks: Task[];- if (props.stage) {- // If a specific stage is provided, use only its tasks- allTasks = props.stage.tasks;- } else {- // Otherwise, use all tasks from all stages- allTasks = flatten(rollout.value.stages.map((stage) => stage.tasks));- }-if (props.taskStatusFilter.length === 0) {- return allTasks;+ return props.tasks;}- return allTasks.filter((task) =>+ return props.tasks.filter((task) =>props.taskStatusFilter.includes(task.status));});@@ -147,7 +138,7 @@ const columnList = computed((): DataTableColumn<Task>[] => {type: "selection",width: 50,disabled: (task: Task) => {- return task.status === Task_Status.DONE;+ return !props.taskSelectable(task);},cellProps: () => {return {diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue b/frontend/src/components/Plan/components/RolloutView/TaskTableView.vueindex 222b1d4d52..f7e81beb51 100644--- a/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue+++ b/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue@@ -15,9 +15,9 @@<TaskTable:task-status-filter="props.taskStatusFilter":selected-tasks="selectedTasks"- :stage="props.stage"+ :tasks="props.stage.tasks"+ :task-selectable="(task) => task.status !== Task_Status.DONE"@update:selected-tasks="handleSelectedTasksUpdate"- @refresh="handleRefresh"/></div></div>@@ -25,10 +25,10 @@<script setup lang="ts">import { ref } from "vue";-import type {- Task,+import {+ type Task,Task_Status,- Stage,+ type Stage,} from "@/types/proto-es/v1/rollout_service_pb";import { usePlanContextWithRollout } from "../../logic";import TaskOperations from "./TaskOperations.vue";diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.tsindex 3436120639..425b98f58a 100644--- a/frontend/src/components/Plan/logic/context.ts+++ b/frontend/src/components/Plan/logic/context.ts@@ -4,7 +4,7 @@ import type { ComputedRef, InjectionKey, Ref } from "vue";import { inject, provide } from "vue";import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";+import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";import type {IssueReviewAction,IssueStatusAction,@@ -29,6 +29,7 @@ export type PlanContext = {planCheckRuns: Ref<PlanCheckRun[]>;issue?: Ref<Issue | undefined>;rollout?: Ref<Rollout | undefined>;+ taskRuns?: Ref<TaskRun[]>;readonly: ComputedRef<boolean>;@@ -67,6 +68,7 @@ export const usePlanContextWithRollout = () => {return {...context,rollout: context.rollout as Ref<Rollout>,+ taskRuns: context.taskRuns as Ref<TaskRun[]>,};};diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.tsindex 1c5343fe54..afdcb3b3e8 100644--- a/frontend/src/components/Plan/logic/initialize/index.ts+++ b/frontend/src/components/Plan/logic/initialize/index.ts@@ -11,7 +11,7 @@ import { GetIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";+import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";import { emptyPlan } from "@/types/v1/issue/plan";import { createPlanSkeleton } from "./create";@@ -65,6 +65,7 @@ export function useInitializePlan(const planCheckRuns = ref<PlanCheckRun[]>([]);const issue = ref<Issue | undefined>(undefined);const rollout = ref<Rollout | undefined>(undefined);+ const taskRuns = ref<TaskRun[]>([]);const runner = async (uid: string, projectId: string, url: string) => {let planResult: Plan;@@ -208,6 +209,7 @@ export function useInitializePlan(isCreating,plan,planCheckRuns,+ taskRuns,issue,rollout,isInitializing,diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.tsindex 194d5f8f6d..352c21c280 100644--- a/frontend/src/components/Plan/logic/poller/poller.ts+++ b/frontend/src/components/Plan/logic/poller/poller.ts@@ -28,6 +28,7 @@ import {refreshRollout,refreshIssue,refreshIssueComments,+ refreshTaskRuns,} from "./utils";type ResourceType =@@ -35,7 +36,8 @@ type ResourceType =| "planCheckRuns"| "issue"| "issueComments"- | "rollout";+ | "rollout"+ | "taskRuns";// Progressive polling configuration for the resource poller// This configuration implements an exponential backoff strategy to reduce server load@@ -65,7 +67,7 @@ const KEY = Symbol(export const provideResourcePoller = () => {const route = useRoute();const { project } = useCurrentProjectV1();- const { isCreating, plan, planCheckRuns, issue, rollout, events } =+ const { isCreating, plan, planCheckRuns, taskRuns, issue, rollout, events } =usePlanContext();// Track refreshing state@@ -125,11 +127,18 @@ export const provideResourcePoller = () => {routeName)) {- return ["rollout"];+ return ["rollout", "taskRuns"];}// Default to polling all resources- return ["plan", "planCheckRuns", "issue", "issueComments", "rollout"];+ return [+ "plan",+ "planCheckRuns",+ "issue",+ "issueComments",+ "rollout",+ "taskRuns",+ ];});const resourcesToPolled = computed<ResourceType[]>(() => {@@ -165,6 +174,11 @@ export const provideResourcePoller = () => {await refreshRollout(plan.value.rollout, project.value, rollout);};+ const refreshTaskRunsOnly = async () => {+ if (!rollout?.value || !taskRuns) return;+ await refreshTaskRuns(rollout.value, project.value, taskRuns);+ };+// Single refresh function for all resourcesconst refreshActiveResources = async () => {const activeResources = resourcesToPolled.value;@@ -201,6 +215,11 @@ export const provideResourcePoller = () => {refreshRollout(plan.value.rollout, project.value, rollout));}+ if (activeResources.includes("taskRuns") && rollout?.value && taskRuns) {+ refreshPromises.push(+ refreshTaskRuns(rollout.value, project.value, taskRuns)+ );+ }await Promise.all(refreshPromises);@@ -282,6 +301,8 @@ export const provideResourcePoller = () => {refreshPromises.push(refreshIssueCommentsOnly());if (activeResources.includes("rollout"))refreshPromises.push(refreshRolloutOnly());+ if (activeResources.includes("taskRuns"))+ refreshPromises.push(refreshTaskRunsOnly());await Promise.all(refreshPromises);diff --git a/frontend/src/components/Plan/logic/poller/utils.ts b/frontend/src/components/Plan/logic/poller/utils.tsindex 1b770c22bb..f412a8f28b 100644--- a/frontend/src/components/Plan/logic/poller/utils.ts+++ b/frontend/src/components/Plan/logic/poller/utils.ts@@ -15,8 +15,11 @@ import {ListPlanCheckRunsRequestSchema,} from "@/types/proto-es/v1/plan_service_pb";import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";-import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";+import {+ GetRolloutRequestSchema,+ ListTaskRunsRequestSchema,+} from "@/types/proto-es/v1/rollout_service_pb";+import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";import { hasProjectPermissionV2 } from "@/utils";export const refreshPlan = async (plan: Ref<Plan>): Promise<void> => {@@ -78,3 +81,19 @@ export const refreshIssueComments = async (issue: Issue): Promise<void> => {}));};++export const refreshTaskRuns = async (+ rollout: Rollout,+ project: ComposedProject,+ taskRuns: Ref<TaskRun[]>+): Promise<void> => {+ if (!hasProjectPermissionV2(project, "bb.taskRuns.list")) {+ return;+ }++ const request = create(ListTaskRunsRequestSchema, {+ parent: `${rollout.name}/stages/-/tasks/-`,+ });+ const response = await rolloutServiceClientConnect.listTaskRuns(request);+ taskRuns.value = response.taskRuns;+};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 09e1c14342..bbc9b7b254 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -281,6 +281,7 @@"cancel-task": "Cancel task | Cancel tasks","created": "Created","run-immediately": "Run task immediately | Run tasks immediately",+ "select-task": "Select task | Select tasks","selected-n-tasks": "{n} task selected | {n} tasks selected","no-tasks-selected": "No tasks selected","no-runnable-tasks": "No runnable tasks",@@ -320,6 +321,13 @@"waiting-connection": "Waiting for available instance connections. The instance connection count has reached the limit set on Bytebase. Last report at {time}.","waiting-task": "Waiting for another task to finish. Last report at {time}.","waiting-max-tasks-per-rollout": "Waiting for other tasks to finish. Maximum running tasks limit per rollout has been reached. Last report at {time}."+ },+ "rollback": {+ "available": "Rollback available for {n} task | Rollback available for {n} tasks",+ "preview-statement": {+ "self": "Preview Statement",+ "description": "Bytebase generates a rollback statement based on the task run. You can review the statement before executing the rollback."+ }}},"banner": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex b7dad093f2..fc8dab7d6f 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -281,6 +281,7 @@"cancel-task": "Cancelar tarea | Cancelar tareas","created": "Creado","run-immediately": "Ejecutar tarea inmediatamente",+ "select-task": "Seleccionar tarea | Seleccionar tareas","selected-n-tasks": "{n} tarea seleccionada | {n} tareas seleccionadas","no-tasks-selected": "No hay tareas seleccionadas","no-runnable-tasks": "No hay tareas ejecutables",@@ -320,6 +321,13 @@"waiting-connection": "Esperando conexiones de instancias disponibles. El recuento de conexión de instancia ha alcanzado el límite establecido en Bytebase. Último informe a las {time}.","waiting-task": "Esperando a que termine otra tarea. Último informe a las {time}.","waiting-max-tasks-per-rollout": "Esperando a que terminen otras tareas. Se ha alcanzado el límite máximo de tareas en ejecución por despliegue. Último informe a las {time}."+ },+ "rollback": {+ "available": "Reversión disponible para {n} tarea | Reversión disponible para {n} tareas",+ "preview-statement": {+ "self": "Declaración de vista previa",+ "description": "Bytebase genera una sentencia de reversión según la ejecución de la tarea. Puede revisar la sentencia antes de ejecutar la reversión."+ }}},"banner": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex fc1d4d36da..939266ec29 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -281,6 +281,7 @@"cancel-task": "タスクをキャンセルする","created": "内蔵","run-immediately": "すぐに実行",+ "select-task": "タスクを選択 | タスクを選択","selected-n-tasks": "{n} 個のタスクが選択されました | {n} 個のタスクが選択されました","no-tasks-selected": "タスクが選択されていません","no-runnable-tasks": "実行可能なタスクはありません",@@ -320,6 +321,13 @@"waiting-connection": "利用可能なインスタンス接続を待っています。インスタンス接続カウントは、Bytebaseの制限設定に達しました。最後の報告は {time} です。","waiting-task": "別のタスクが完了するのを待っています。最後の報告は {time} です。","waiting-max-tasks-per-rollout": "他のタスクが完了するのを待っています。ロールアウトごとの最大実行タスク数制限に達しました。最後の報告は {time} です。"+ },+ "rollback": {+ "available": "{n} タスクのロールバックが利用可能 | {n} タスクのロールバックが利用可能",+ "preview-statement": {+ "self": "プレビューステートメント",+ "description": "Bytebaseはタスク実行に基づいてロールバックステートメントを生成します。ロールバックを実行する前にステートメントを確認できます。"+ }}},"banner": {diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 6f4a0542cf..2d8f9f14fa 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -281,6 +281,7 @@"cancel-task": "Hủy tác vụ | Hủy các tác vụ","created": "Đã tạo","run-immediately": "Chạy nhiệm vụ ngay lập tức",+ "select-task": "Chọn nhiệm vụ | Chọn nhiệm vụ","selected-n-tasks": "{n} nhiệm vụ đã chọn | {n} nhiệm vụ đã chọn","no-tasks-selected": "Không có nhiệm vụ nào được chọn","no-runnable-tasks": "Không có tác vụ nào có thể chạy được",@@ -320,6 +321,13 @@"waiting-connection": "Đang chờ kết nối thể hiện có sẵn. Số lượng kết nối thể hiện đã đạt đến giới hạn được đặt trên Bytebase. Báo cáo gần nhất lúc {time}.","waiting-task": "Đang chờ một tác vụ khác kết thúc. Báo cáo gần nhất lúc {time}.","waiting-max-tasks-per-rollout": "Đang chờ các tác vụ khác hoàn thành. Đã đạt đến giới hạn số lượng tác vụ đang chạy tối đa cho mỗi lần triển khai. Báo cáo gần nhất lúc {time}."+ },+ "rollback": {+ "available": "Có thể khôi phục lại cho tác vụ {n} | Có thể khôi phục lại cho tác vụ {n}",+ "preview-statement": {+ "self": "Xem trước tuyên bố",+ "description": "Bytebase tạo ra một câu lệnh khôi phục dựa trên tác vụ đang chạy. Bạn có thể xem lại câu lệnh này trước khi thực hiện khôi phục."+ }}},"banner": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex beca0fa30a..6e1d9282ae 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -281,6 +281,7 @@"cancel-task": "取消任务","created": "创建于","run-immediately": "立即运行任务",+ "select-task": "选择任务 | 选择任务","selected-n-tasks": "已选择 {n} 个任务","no-tasks-selected": "未选择任何任务","no-runnable-tasks": "没有可运行的任务",@@ -320,6 +321,13 @@"waiting-connection": "等待可用的实例连接。实例连接数已达到 Bytebase 上设置的限制。上次报告时间:{time}。","waiting-task": "等待另一个任务完成。上次报告时间:{time}。","waiting-max-tasks-per-rollout": "正在等待其他任务完成。已达到每次发布的最大运行任务数限制。上次报告时间:{time}。"+ },+ "rollback": {+ "available": "可回滚 {n} 个任务",+ "preview-statement": {+ "self": "预览语句",+ "description": "Bytebase 根据任务运行情况生成回滚语句,您可以在执行回滚前查看该语句。"+ }}},"banner": {diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.tsindex 600c102105..d6404d5f8b 100644--- a/frontend/src/store/modules/v1/common.ts+++ b/frontend/src/store/modules/v1/common.ts@@ -25,6 +25,7 @@ export const planCheckRunPrefix = "planCheckRuns/";export const rolloutNamePrefix = "rollouts/";export const stageNamePrefix = "stages/";export const taskNamePrefix = "tasks/";+export const taskRunNamePrefix = "taskRuns/";export const releaseNamePrefix = "releases/";export const revisionNamePrefix = "revisions/";diff --git a/frontend/src/views/project/CICDLayout.vue b/frontend/src/views/project/CICDLayout.vueindex 41eccb440f..15dd6e2d01 100644--- a/frontend/src/views/project/CICDLayout.vue+++ b/frontend/src/views/project/CICDLayout.vue@@ -109,13 +109,20 @@ const props = defineProps<{}>();const { t } = useI18n();-const { isCreating, plan, planCheckRuns, issue, rollout, isInitializing } =- useInitializePlan(- toRef(props, "projectId"),- toRef(props, "planId"),- toRef(props, "issueId"),- toRef(props, "rolloutId")- );+const {+ isCreating,+ plan,+ planCheckRuns,+ issue,+ rollout,+ taskRuns,+ isInitializing,+} = useInitializePlan(+ toRef(props, "projectId"),+ toRef(props, "planId"),+ toRef(props, "issueId"),+ toRef(props, "rolloutId")+);const planBaseContext = useBasePlanContext({isCreating,plan,@@ -137,6 +144,7 @@ providePlanContext({planCheckRuns,issue,rollout,+ taskRuns,...planBaseContext,});