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: handle more task actions (#16706)
boojackfe13fd09ac22
diff --git a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vueindex 0311bd1294..c6b6b77d89 100644--- a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue@@ -58,28 +58,11 @@<PreBackupSection ref="preBackupSectionRef" /><GhostSection v-if="shouldShowGhostSection" /></div>-- <router-link- v-if="shouldShowExperimentalIssuePageLink"- :to="{- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,- params: {- projectId: extractProjectResourceName(project.name),- issueId: extractIssueUID(issue.name),- },- }"- class="text-sm font-normal text-gray-500 hover:text-blue-600 hover:underline flex items-center"- target="_blank"- >- <span>{{ $t("issue.expermental-page.self") }}</span>- <ExternalLinkIcon class="inline w-4 h-4 ml-1" />- </router-link></div></template><script lang="ts" setup>import { create } from "@bufbuild/protobuf";-import { ExternalLinkIcon } from "lucide-vue-next";import { NTooltip } from "naive-ui";import { computed, ref } from "vue";import { useI18n } from "vue-i18n";@@ -89,13 +72,11 @@ import { GhostSection } from "@/components/Plan/components/Configuration";import { provideGhostSettingContext } from "@/components/Plan/components/Configuration/GhostSection/context";import { ApprovalFlowSection } from "@/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection";import { issueServiceClientConnect } from "@/grpcweb";-import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";import { pushNotification, useCurrentProjectV1 } from "@/store";import { UpdateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";+import { Issue } from "@/types/proto/v1/issue_service";import type { Plan } from "@/types/proto/v1/plan_service";-import { extractIssueUID, extractProjectResourceName, isDev } from "@/utils";import {convertNewIssueToOld,convertOldIssueToNew,@@ -138,14 +119,6 @@ const shouldShowPreBackupSection = computed(() => {return preBackupSectionRef.value?.shouldShow ?? false;});-const shouldShowExperimentalIssuePageLink = computed(() => {- return (- !isCreating.value &&- isDev() &&- issue.value.type === Issue_Type.DATABASE_CHANGE- );-});-const onIssueLabelsUpdate = async (labels: string[]) => {if (isCreating.value) {issue.value.labels = labels;diff --git a/frontend/src/components/Plan/components/RolloutView/StageCard.vue b/frontend/src/components/Plan/components/RolloutView/StageCard.vueindex f91badcf03..e82439fa66 100644--- a/frontend/src/components/Plan/components/RolloutView/StageCard.vue+++ b/frontend/src/components/Plan/components/RolloutView/StageCard.vue@@ -17,7 +17,24 @@<NTag class="ml-2" v-if="!isCreated" round size="tiny">Preview</NTag></p><div v-if="isCreated">- <RunTasksButton :stage="stage" @run-tasks="showRunTasksPanel = true" />+ <RunTasksButton :stage="stage" @run-tasks="handleRunAllTasks" />+ </div>+ <div v-else>+ <NPopconfirm+ :negative-text="null"+ :positive-text="$t('common.confirm')"+ :positive-button-props="{ size: 'tiny' }"+ @positive-click="createRolloutToStage"+ >+ <template #trigger>+ <NButton text size="small">+ <template #icon>+ <CirclePlayIcon class="w-4 h-4" />+ </template>+ </NButton>+ </template>+ {{ $t("common.confirm-and-add") }}+ </NPopconfirm></div></div><NVirtualList@@ -52,30 +69,40 @@<!-- Task Rollout Action Panel --><TaskRolloutActionPanel- :action="showRunTasksPanel ? 'RUN_TASKS' : undefined"- :stage="stage"- @close="showRunTasksPanel = false"+ v-if="showRunTasksPanel"+ action="RUN"+ :target="{ type: 'tasks', stage }"+ @close="handlePanelClose"/></div></template><script setup lang="ts">-import { NTag, NTooltip, NVirtualList } from "naive-ui";+import { create } from "@bufbuild/protobuf";+import { CirclePlayIcon } from "lucide-vue-next";+import { NTag, NTooltip, NVirtualList, NButton, NPopconfirm } from "naive-ui";import { twMerge } from "tailwind-merge";import { computed, ref } from "vue";import { useI18n } from "vue-i18n";import { useRouter } from "vue-router";import { semanticTaskType } from "@/components/IssueV1";import TaskStatus from "@/components/Rollout/RolloutDetail/Panels/kits/TaskStatus.vue";+import { rolloutServiceClientConnect } from "@/grpcweb";import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL } from "@/router/dashboard/projectV1";-import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";-import { extractProjectResourceName } from "@/utils";+import {+ useCurrentProjectV1,+ useEnvironmentV1Store,+ pushNotification,+} from "@/store";+import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";import {Stage,type Task,type Task_Status,} from "@/types/proto/v1/rollout_service";+import { extractProjectResourceName } from "@/utils";import { extractSchemaVersionFromTask } from "@/utils";+import { usePlanContextWithRollout } from "../../logic";import RunTasksButton from "./RunTasksButton.vue";import TaskDatabaseName from "./TaskDatabaseName.vue";import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";@@ -90,6 +117,7 @@ const { t: $t } = useI18n();const router = useRouter();const { project } = useCurrentProjectV1();const environmentStore = useEnvironmentV1Store();+const { events } = usePlanContextWithRollout();const { rollout } = useRolloutViewContext();const showRunTasksPanel = ref(false);@@ -114,10 +142,10 @@ const filteredTasks = computed(() => {// Helper function to extract IDs from task and stage namesconst getTaskRouteParams = (task: Task) => {- const rolloutId = rollout.value?.name.split('/').pop();- const stageId = props.stage.name.split('/').pop();- const taskId = task.name.split('/').pop();-+ const rolloutId = rollout.value?.name.split("/").pop();+ const stageId = props.stage.name.split("/").pop();+ const taskId = task.name.split("/").pop();+return { rolloutId, stageId, taskId };};@@ -136,4 +164,42 @@ const handleTaskClick = (task: Task) => {});}};++const handleRunAllTasks = () => {+ showRunTasksPanel.value = true;+};++const handlePanelClose = () => {+ showRunTasksPanel.value = false;+};++const createRolloutToStage = async () => {+ try {+ const request = create(CreateRolloutRequestSchema, {+ parent: project.value.name,+ rollout: {+ plan: rollout.value.plan,+ },+ target: props.stage.environment,+ });+ await rolloutServiceClientConnect.createRollout(request);++ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: $t("common.success"),+ description: $t("common.created"),+ });++ // Trigger immediate refresh of rollout data+ events.emit("status-changed", { eager: true });+ } catch (error) {+ pushNotification({+ module: "bytebase",+ style: "CRITICAL",+ title: $t("common.error"),+ description: String(error),+ });+ }+};</script>diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vueindex c565293708..d9c0a15126 100644--- a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue+++ b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue@@ -1,16 +1,13 @@<template><CommonDrawer- :show="action !== undefined"+ :show="true":title="title":loading="state.loading"@show="resetState"@close="$emit('close')"><template #default>- <div- v-if="action"- class="flex flex-col gap-y-4 h-full overflow-y-hidden px-1"- >+ <div class="flex flex-col gap-y-4 h-full overflow-y-hidden px-1"><divclass="flex flex-row gap-x-2 shrink-0 overflow-y-hidden justify-start items-center">@@ -18,26 +15,50 @@{{ $t("common.stage") }}</label><span class="break-all">- {{ environmentStore.getEnvironmentByName(stage.environment).title }}+ {{+ environmentStore.getEnvironmentByName(targetStage.environment)+ .title+ }}</span></div><divclass="flex flex-col gap-y-1 shrink overflow-y-hidden justify-start">- <label class="font-medium text-control">- <template v-if="runnableTasks.length === 1">- {{ $t("common.task") }}- </template>- <template v-else>{{ $t("common.tasks") }}</template>- <span class="opacity-80" v-if="runnableTasks.length > 1"- >({{ runnableTasks.length }})</span- >- </label>+ <div class="flex items-center justify-between">+ <label class="font-medium text-control">+ <template v-if="eligibleTasks.length === 1">+ {{ $t("common.task") }}+ </template>+ <template v-else>{{ $t("common.tasks") }}</template>+ <span class="opacity-80" v-if="eligibleTasks.length > 1">+ <template v-if="showTaskSelection">+ ({{ selectedTaskNames.size }} / {{ eligibleTasks.length }})+ </template>+ <template v-else> ({{ eligibleTasks.length }}) </template>+ </span>+ </label>+ <div v-if="showTaskSelection" class="flex gap-x-2">+ <NButton+ size="tiny"+ :disabled="selectedTaskNames.size === eligibleTasks.length"+ @click="selectAllTasks"+ >+ {{ $t("sql-review.select-all") }}+ </NButton>+ <NButton+ size="tiny"+ :disabled="selectedTaskNames.size === 0"+ @click="selectNoTasks"+ >+ {{ "Clear" }}+ </NButton>+ </div>+ </div><div class="flex-1 overflow-y-auto"><template v-if="useVirtualScroll"><NVirtualList- :items="runnableTasks"+ :items="eligibleTasks":item-size="itemHeight"class="max-h-64"item-resizable@@ -48,6 +69,14 @@class="flex items-center text-sm":style="{ height: `${itemHeight}px` }">+ <NCheckbox+ v-if="showTaskSelection"+ :checked="selectedTaskNames.has(task.name)"+ @update:checked="+ (checked) => handleTaskSelectionChange(task, checked)+ "+ class="mr-2"+ /><NTagv-if="semanticTaskType(task.type)"class="mr-2"@@ -66,10 +95,18 @@<NScrollbar class="max-h-64"><ul class="text-sm space-y-2"><li- v-for="task in runnableTasks"+ v-for="task in eligibleTasks":key="task.name"class="flex items-center">+ <NCheckbox+ v-if="showTaskSelection"+ :checked="selectedTaskNames.has(task.name)"+ @update:checked="+ (checked) => handleTaskSelectionChange(task, checked)+ "+ class="mr-2"+ /><NTagv-if="semanticTaskType(task.type)"class="mr-2"@@ -106,7 +143,7 @@</div><div v-if="runTimeInMS !== undefined" class="flex flex-col gap-y-1"><p class="font-medium text-control">- {{ $t("task.scheduled-time", runnableTasks.length) }}+ {{ $t("task.scheduled-time", { count: runnableTasks.length }) }}</p><NDatePickerv-model:value="runTimeInMS"@@ -138,10 +175,7 @@</div></template><template #footer>- <div- v-if="action"- class="w-full flex flex-row justify-between items-center gap-x-2"- >+ <div class="w-full flex flex-row justify-between items-center gap-x-2"><div class="flex justify-end gap-x-3 w-full"><NButton @click="$emit('close')">{{ $t("common.cancel") }}@@ -154,7 +188,15 @@type="primary"@click="handleConfirm">- {{ $t("common.rollout") }}+ <template v-if="action === 'RUN'">{{+ $t("common.run")+ }}</template>+ <template v-else-if="action === 'SKIP'">{{+ $t("common.skip")+ }}</template>+ <template v-else-if="action === 'CANCEL'">{{+ $t("common.cancel")+ }}</template></NButton></template><template #default>@@ -188,8 +230,12 @@ import CommonDrawer from "@/components/IssueV1/components/Panel/CommonDrawer.vueimport { ErrorList } from "@/components/IssueV1/components/common";import { rolloutServiceClientConnect } from "@/grpcweb";import { pushNotification, useEnvironmentV1Store } from "@/store";-import { BatchRunTasksRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";-import type { Stage } from "@/types/proto/v1/rollout_service";+import {+ BatchRunTasksRequestSchema,+ BatchSkipTasksRequestSchema,+ BatchCancelTaskRunsRequestSchema,+} from "@/types/proto-es/v1/rollout_service_pb";+import type { Stage, Task, TaskRun } from "@/types/proto/v1/rollout_service";import { Task_Status } from "@/types/proto/v1/rollout_service";import TaskDatabaseName from "./TaskDatabaseName.vue";@@ -200,9 +246,13 @@ type LocalState = {loading: boolean;};+export type TargetType =+ | { type: "tasks"; tasks?: Task[]; stage: Stage }+ | { type: "taskRuns"; taskRuns: TaskRun[]; stage: Stage };+const props = defineProps<{- action?: "RUN_TASKS";- stage: Stage;+ action: "RUN" | "SKIP" | "CANCEL";+ target: TargetType;}>();const emit = defineEmits<{@@ -216,68 +266,175 @@ const state = reactive<LocalState>({const environmentStore = useEnvironmentV1Store();const comment = ref("");const runTimeInMS = ref<number | undefined>(undefined);+const selectedTaskNames = ref<Set<string>>(new Set());++// Extract stage from target+const targetStage = computed(() => {+ return props.target.stage;+});++// Extract tasks if provided directly+const targetTasks = computed(() => {+ if (props.target.type === "tasks") {+ return props.target.tasks;+ }+ return undefined;+});++// Extract task runs if provided+const targetTaskRuns = computed(() => {+ if (props.target.type === "taskRuns") {+ return props.target.taskRuns;+ }+ return undefined;+});const title = computed(() => {- if (!props.action) return "";- return t("common.rollout");+ switch (props.action) {+ case "RUN":+ return t("common.run");+ case "SKIP":+ return t("common.skip");+ case "CANCEL":+ return t("common.cancel");+ default:+ return "";+ }});-const runnableTasks = computed(() => {- return props.stage.tasks.filter(- (task) =>- task.status === Task_Status.NOT_STARTED ||- task.status === Task_Status.PENDING ||- task.status === Task_Status.FAILED+// Get eligible tasks based on action type and target+const eligibleTasks = computed(() => {+ // If specific tasks are provided, use them+ if (+ props.target.type === "tasks" &&+ targetTasks.value &&+ targetTasks.value.length > 0+ ) {+ return targetTasks.value;+ }++ // Otherwise filter from stage tasks based on action+ const stageTasks = targetStage.value.tasks || [];++ if (props.action === "RUN") {+ return stageTasks.filter(+ (task) =>+ task.status === Task_Status.NOT_STARTED ||+ task.status === Task_Status.PENDING ||+ task.status === Task_Status.FAILED+ );+ } else if (props.action === "SKIP") {+ return stageTasks.filter(+ (task) =>+ task.status === Task_Status.NOT_STARTED ||+ task.status === Task_Status.FAILED ||+ task.status === Task_Status.CANCELED+ );+ } else if (props.action === "CANCEL") {+ return stageTasks.filter(+ (task) =>+ task.status === Task_Status.PENDING ||+ task.status === Task_Status.RUNNING+ );+ }++ return [];+});++// Show task selection UI when there are multiple eligible tasks and no specific tasks provided+const showTaskSelection = computed(() => {+ return (+ eligibleTasks.value.length > 1 &&+ props.target.type === "tasks" &&+ !targetTasks.value);});+// Get the tasks that will actually be run (selected or all)+const runnableTasks = computed(() => {+ if (showTaskSelection.value && selectedTaskNames.value.size > 0) {+ return eligibleTasks.value.filter((task) =>+ selectedTaskNames.value.has(task.name)+ );+ }+ return eligibleTasks.value;+});+// Virtual scroll configuration-const useVirtualScroll = computed(() => runnableTasks.value.length > 50);-const itemHeight = 32; // Height of each task item in pixels+const useVirtualScroll = computed(() => eligibleTasks.value.length > 50);+const itemHeight = computed(() => (showTaskSelection.value ? 40 : 32)); // Height of each task item in pixelsconst showScheduledTimePicker = computed(() => {- return props.action === "RUN_TASKS";+ return props.action === "RUN";});const confirmErrors = computed(() => {const errors: string[] = [];if (runnableTasks.value.length === 0) {- errors.push(t("common.no-data"));+ if (showTaskSelection.value && eligibleTasks.value.length > 0) {+ errors.push("Please select at least one task");+ } else {+ errors.push(t("common.no-data"));+ }}- // Validate scheduled time if not running immediately- if (runTimeInMS.value !== undefined) {+ // Validate scheduled time if not running immediately (only for RUN)+ if (props.action === "RUN" && runTimeInMS.value !== undefined) {if (runTimeInMS.value <= Date.now()) {errors.push(t("task.error.scheduled-time-must-be-in-the-future"));}}+ // For CANCEL, we need task runs+ if (+ props.action === "CANCEL" &&+ (!targetTaskRuns.value || targetTaskRuns.value.length === 0)+ ) {+ errors.push("No active task runs to cancel");+ }+return errors;});const handleConfirm = async () => {state.loading = true;try {- // Prepare the request parameters- const requestParams: any = {- parent: props.stage.name,- tasks: runnableTasks.value.map((task) => task.name),- reason: comment.value,- };-- if (runTimeInMS.value !== undefined) {- // Convert timestamp to protobuf Timestamp format- const runTimeSeconds = Math.floor(runTimeInMS.value / 1000);- const runTimeNanos = (runTimeInMS.value % 1000) * 1000000;- requestParams.runTime = {- seconds: Long.fromNumber(runTimeSeconds),- nanos: runTimeNanos,+ if (props.action === "RUN") {+ // Prepare the request parameters+ const requestParams: any = {+ parent: targetStage.value.name,+ tasks: runnableTasks.value.map((task) => task.name),+ reason: comment.value,};- }- const request = create(BatchRunTasksRequestSchema, requestParams);- await rolloutServiceClientConnect.batchRunTasks(request);+ if (runTimeInMS.value !== undefined) {+ // Convert timestamp to protobuf Timestamp format+ const runTimeSeconds = Math.floor(runTimeInMS.value / 1000);+ const runTimeNanos = (runTimeInMS.value % 1000) * 1000000;+ requestParams.runTime = {+ seconds: Long.fromNumber(runTimeSeconds),+ nanos: runTimeNanos,+ };+ }++ const request = create(BatchRunTasksRequestSchema, requestParams);+ await rolloutServiceClientConnect.batchRunTasks(request);+ } else if (props.action === "SKIP") {+ const request = create(BatchSkipTasksRequestSchema, {+ parent: targetStage.value.name,+ tasks: runnableTasks.value.map((task) => task.name),+ reason: comment.value,+ });+ await rolloutServiceClientConnect.batchSkipTasks(request);+ } else if (props.action === "CANCEL") {+ const request = create(BatchCancelTaskRunsRequestSchema, {+ parent: `${targetStage.value.name}/tasks/-`,+ taskRuns: targetTaskRuns.value?.map((taskRun) => taskRun.name) || [],+ reason: comment.value,+ });+ await rolloutServiceClientConnect.batchCancelTaskRuns(request);+ }pushNotification({module: "bytebase",@@ -297,8 +454,33 @@ const handleConfirm = async () => {}};+const handleTaskSelectionChange = (task: Task, checked: boolean) => {+ if (checked) {+ selectedTaskNames.value.add(task.name);+ } else {+ selectedTaskNames.value.delete(task.name);+ }+ // Trigger reactivity+ selectedTaskNames.value = new Set(selectedTaskNames.value);+};++const selectAllTasks = () => {+ selectedTaskNames.value = new Set(eligibleTasks.value.map((t) => t.name));+};++const selectNoTasks = () => {+ selectedTaskNames.value.clear();+ selectedTaskNames.value = new Set();+};+const resetState = () => {comment.value = "";runTimeInMS.value = undefined;+ selectedTaskNames.value.clear();++ // Pre-select all tasks by default when showing selection+ if (showTaskSelection.value) {+ selectAllTasks();+ }};</script>diff --git a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vueindex b45e8496e4..5da2fc40bd 100644--- a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue+++ b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue@@ -1,45 +1,54 @@<template>- <div- v-if="primaryAction || dropdownOptions.length > 0"- class="flex flex-row justify-end items-center gap-x-2"- >- <NButton- v-if="primaryAction"- type="primary"- size="small"- @click="handleTaskStatusAction(primaryAction)"+ <div>+ <div+ v-if="primaryAction || dropdownOptions.length > 0"+ class="flex flex-row justify-end items-center gap-x-2">- {{ actionDisplayTitle(primaryAction) }}- </NButton>- <NDropdown- v-if="dropdownOptions.length > 0"- trigger="hover"- :options="dropdownOptions"- @select="(action) => handleTaskStatusAction(action)"- >- <NButton size="small">- <template #icon>- <EllipsisVerticalIcon class="w-4 h-4" />- </template>+ <NButton+ v-if="primaryAction"+ type="primary"+ size="small"+ @click="handlePrimaryAction"+ >+ {{ actionDisplayTitle(primaryAction) }}</NButton>- </NDropdown>+ <NDropdown+ v-if="dropdownOptions.length > 0"+ trigger="hover"+ :options="dropdownOptions"+ @select="handleDropdownSelect"+ >+ <NButton size="small">+ <template #icon>+ <EllipsisVerticalIcon class="w-4 h-4" />+ </template>+ </NButton>+ </NDropdown>+ </div>++ <!-- Task Rollout Action Panel -->+ <TaskRolloutActionPanel+ v-if="currentPanelAction && showActionPanel && actionTarget"+ :action="currentPanelAction"+ :target="actionTarget"+ @close="handleActionPanelClose"+ /></div></template><script setup lang="ts">import { EllipsisVerticalIcon } from "lucide-vue-next";import { NButton, NDropdown } from "naive-ui";-import { computed } from "vue";+import { computed, ref } from "vue";import { useI18n } from "vue-i18n";-import { create } from "@bufbuild/protobuf";-import {- BatchRunTasksRequestSchema,- BatchSkipTasksRequestSchema,- BatchCancelTaskRunsRequestSchema,-} from "@/types/proto-es/v1/rollout_service_pb";-import { rolloutServiceClientConnect } from "@/grpcweb";import { Task_Status } from "@/types/proto/v1/rollout_service";-import type { Task, TaskRun, Rollout, Stage } from "@/types/proto/v1/rollout_service";+import type {+ Task,+ TaskRun,+ Rollout,+ Stage,+} from "@/types/proto/v1/rollout_service";+import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";type TaskStatusAction =// NOT_STARTED -> PENDING@@ -62,20 +71,69 @@ const emit = defineEmits<{}>();const { t } = useI18n();+const showActionPanel = ref(false);+const selectedAction = ref<TaskStatusAction>();++type PanelAction = "RUN" | "SKIP" | "CANCEL" | undefined;++const currentPanelAction = computed((): PanelAction => {+ if (!showActionPanel.value || !selectedAction.value) return undefined;++ switch (selectedAction.value) {+ case "RUN":+ case "RETRY":+ return "RUN";+ case "SKIP":+ return "SKIP";+ case "CANCEL":+ return "CANCEL";+ default:+ return undefined;+ }+});++// Determine target based on action type+const actionTarget = computed(() => {+ if (!currentPanelAction.value) return undefined;++ if (currentPanelAction.value === "CANCEL") {+ // For cancel actions, we need task runs+ return {+ type: "taskRuns" as const,+ taskRuns: props.taskRuns,+ stage: stage.value,+ };+ } else {+ // For run and skip actions, we use specific tasks+ return {+ type: "tasks" as const,+ tasks: [props.task],+ stage: stage.value,+ };+ }+});-// Helper function to find the stage for a task-const findStageForTask = (rollout: Rollout | undefined, task: Task): Stage | undefined => {- if (!rollout) return undefined;-- for (const stage of rollout.stages) {- for (const stageTask of stage.tasks) {- if (stageTask.name === task.name) {- return stage;+// Get the stage for the current task+const stage = computed((): Stage => {+ // Find the actual stage if rollout is provided+ if (props.rollout) {+ for (const stage of props.rollout.stages) {+ for (const stageTask of stage.tasks) {+ if (stageTask.name === props.task.name) {+ return stage;+ }}}}- return undefined;-};++ // Should not reach here.+ return {+ id: "",+ name: "",+ environment: "",+ tasks: [],+ } as Stage;+});const primaryAction = computed((): TaskStatusAction | null => {if (props.task.status === Task_Status.NOT_STARTED) {@@ -126,36 +184,21 @@ const actionDisplayTitle = (action: TaskStatusAction) => {}};-const handleTaskStatusAction = async (action: TaskStatusAction) => {- const stage = findStageForTask(props.rollout, props.task);- if (!stage) return;-- try {- if (action === "RUN" || action === "RETRY") {- const request = create(BatchRunTasksRequestSchema, {- parent: stage.name,- tasks: [props.task.name],- });- await rolloutServiceClientConnect.batchRunTasks(request);- } else if (action === "SKIP") {- const request = create(BatchSkipTasksRequestSchema, {- parent: stage.name,- tasks: [props.task.name],- });- await rolloutServiceClientConnect.batchSkipTasks(request);- } else if (action === "CANCEL") {- const request = create(BatchCancelTaskRunsRequestSchema, {- parent: `${stage.name}/tasks/-`,- taskRuns: props.taskRuns.map((taskRun) => taskRun.name),- // TODO: Let user input reason.- reason: "",- });- await rolloutServiceClientConnect.batchCancelTaskRuns(request);- }-- emit("task-action-completed");- } catch (error) {- console.error("Failed to execute task action:", error);+const handlePrimaryAction = () => {+ if (primaryAction.value) {+ selectedAction.value = primaryAction.value;+ showActionPanel.value = true;}};-</script>\ No newline at end of file++const handleDropdownSelect = (action: TaskStatusAction) => {+ selectedAction.value = action;+ showActionPanel.value = true;+};++const handleActionPanelClose = () => {+ showActionPanel.value = false;+ selectedAction.value = undefined;+ emit("task-action-completed");+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/context.ts b/frontend/src/components/Plan/components/RolloutView/context.tsindex c7111a9446..3571ab646e 100644--- a/frontend/src/components/Plan/components/RolloutView/context.ts+++ b/frontend/src/components/Plan/components/RolloutView/context.ts@@ -8,8 +8,11 @@ import { silentContextKey } from "@/grpcweb/context-key";import { useCurrentProjectV1 } from "@/store";import { PreviewRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";import { Rollout, type Stage } from "@/types/proto/v1/rollout_service";-import { convertNewRolloutToOld, convertOldPlanToNew } from "@/utils/v1/rollout-conversions";-import { usePlanContextWithRollout } from "../../logic";+import {+ convertNewRolloutToOld,+ convertOldPlanToNew,+} from "@/utils/v1/rollout-conversions";+import { usePlanContextWithRollout, usePlanContext } from "../../logic";export type RolloutViewContext = {rollout: Ref<Rollout>;@@ -27,6 +30,7 @@ export const useRolloutViewContext = () => {export const provideRolloutViewContext = () => {const { plan, rollout } = usePlanContextWithRollout();+ const { events } = usePlanContext();const { project } = useCurrentProjectV1();const rolloutPreview = ref<Rollout>(Rollout.fromPartial({}));@@ -59,12 +63,10 @@ export const provideRolloutViewContext = () => {});try {- const rolloutPreviewNew = await rolloutServiceClientConnect.previewRollout(- request,- {+ const rolloutPreviewNew =+ await rolloutServiceClientConnect.previewRollout(request, {contextValues: createContextValues().set(silentContextKey, true),- }- );+ });rolloutPreview.value = convertNewRolloutToOld(rolloutPreviewNew);} catch (error) {// Handle preview errors gracefully@@ -87,6 +89,13 @@ export const provideRolloutViewContext = () => {});poller.start();+ events.on("status-changed", async (data) => {+ // Only refresh if the event is eager or if rollout is not yet created+ if (data.eager) {+ await fetchRolloutPreview();+ }+ });+const context: RolloutViewContext = {rollout,rolloutPreview,diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex fbb26e9244..ba0cb2b117 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -849,8 +849,7 @@"title": "Creator","description": "Search by the issue creator"},- "subscriber": {- },+ "subscriber": {},"approver": {"title": "Approver","description": "Search by the issue approver"@@ -1027,9 +1026,6 @@"approved": "Approved","rejected": "Rejected","under-review": "Under review"- },- "expermental-page": {- "self": "Experimental issue page"}},"plan": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex f648e3b70b..9b8d386ca7 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1026,9 +1026,6 @@"approved": "Aprobado","rejected": "Rechazado","under-review": "Bajo revisión"- },- "expermental-page": {- "self": "Página de problemas experimentales"}},"plan": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 1f85f890b1..0dc5ef2dbc 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1026,9 +1026,6 @@"approved": "承認された","rejected": "拒否","under-review": "審査中"- },- "expermental-page": {- "self": "実験問題ページ"}},"plan": {diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 9b08446811..42b2636069 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -1026,9 +1026,6 @@"approved": "Tán thành","rejected": "Vật bị loại bỏ","under-review": "Đang xem xét"- },- "expermental-page": {- "self": "Trang vấn đề thử nghiệm"}},"plan": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 58239e9f87..d6add8bf32 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1026,9 +1026,6 @@"approved": "已批准","rejected": "已拒绝","under-review": "等待审批"- },- "expermental-page": {- "self": "实验性工单页面"}},"plan": {