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: add v2 rollout task view (#18157)
boojack63683c3c77f5
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskView.vue b/frontend/src/components/Plan/components/RolloutView/TaskView.vueindex 6a6ca7d059..fec6b2bf74 100644--- a/frontend/src/components/Plan/components/RolloutView/TaskView.vue+++ b/frontend/src/components/Plan/components/RolloutView/TaskView.vue@@ -1,5 +1,20 @@<template><div v-if="task" class="w-full h-full flex flex-col gap-y-4 p-4">+ <p v-if="selectedStage">+ <RouterLink+ :to="{+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,+ params: {+ projectId: extractProjectResourceName(plan.name),+ rolloutId: rolloutId,+ stageId: stageId,+ },+ }"+ class="textinfolabel hover:underline"+ >+ ← {{ $t("rollout.stage.back-to-stage", { stage: selectedStageTitle }) }}+ </RouterLink>+ </p><!-- Task Basic Info --><div class="w-full flex flex-col gap-y-3"><div@@ -148,10 +163,14 @@ import { semanticTaskType } from "@/components/IssueV1";import TaskRunDetail from "@/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue";import { MonacoEditor } from "@/components/MonacoEditor";import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";-import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";+import {+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,+} from "@/router/dashboard/projectV1";import {taskRunNamePrefix,useCurrentProjectV1,+ useEnvironmentV1Store,useSheetV1Store,} from "@/store";import { getTimeForPbTimestampProtoEs, unknownTask } from "@/types";@@ -188,12 +207,33 @@ const {plan,} = usePlanContextWithRollout();const sheetStore = useSheetV1Store();+const environmentStore = useEnvironmentV1Store();++// Stage-related computed properties+// Stage → Task relationship: Access tasks via stage.tasks array+const selectedStage = computed(() => {+ return rollout.value.stages.find((s) => s.id === props.stageId);+});++const selectedStageEnvironment = computed(() => {+ if (!selectedStage.value?.environment) return undefined;+ return environmentStore.getEnvironmentByName(selectedStage.value.environment);+});++const selectedStageTitle = computed(() => {+ // Prefer environment title, fallback to stage name+ return (+ selectedStageEnvironment.value?.title || selectedStage.value?.name || ""+ );+});+// Task-related computed properties+// Efficient lookup: We already have the stage from URL, so search within that stage's tasks onlyconst task = computed(() => {return (- rollout.value.stages- .find((s) => s.id === props.stageId)- ?.tasks.find((t) => t.name.endsWith(`/${props.taskId}`)) || unknownTask()+ selectedStage.value?.tasks.find((t) =>+ t.name.endsWith(`/${props.taskId}`)+ ) || unknownTask());});diff --git a/frontend/src/components/Plan/components/RolloutView/v2/RolloutView.vue b/frontend/src/components/Plan/components/RolloutView/v2/RolloutView.vuenew file mode 100644index 0000000000..5082459b92--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/RolloutView.vue@@ -0,0 +1,164 @@+<template>+ <div class="rollout-view-v2 w-full min-h-screen bg-gray-50">+ <BBSpin v-if="!ready" class="flex justify-center py-12" />++ <template v-else>+ <StageNavigationBar+ :stages="mergedStages"+ :selected-stage-id="selectedStage?.name"+ :is-stage-created="isStageCreated"+ @select-stage="handleStageSelect"+ />++ <StageContentView+ :selected-stage="selectedStage"+ :rollout="rollout"+ :is-stage-created="isStageCreated"+ @run-stage="handleRunStage"+ @create-stage="handleCreateStage"+ />+ </template>++ <!-- Stage run action panel -->+ <TaskRolloutActionPanel+ v-if="showStageActionPanel && stageActionTarget"+ :show="showStageActionPanel"+ :action="stageAction"+ :target="stageActionTarget"+ @close="showStageActionPanel = false"+ @confirm="handleStageActionConfirmed"+ />+ </div>+</template>++<script lang="ts" setup>+import { create } from "@bufbuild/protobuf";+import { computed, ref, watch } from "vue";+import { useI18n } from "vue-i18n";+import { useRoute, useRouter } from "vue-router";+import BBSpin from "@/bbkit/BBSpin.vue";+import { rolloutServiceClientConnect } from "@/grpcweb";+import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL } from "@/router/dashboard/projectV1";+import { useCurrentProjectV1 } from "@/store";+import { pushNotification } from "@/store/modules/notification";+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";+import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";+import { extractProjectResourceName } from "@/utils";+import { usePlanContextWithRollout } from "../../../logic/context";+import { useRolloutViewContext } from "../context";+import type { TargetType } from "../TaskRolloutActionPanel.vue";+import TaskRolloutActionPanel from "../TaskRolloutActionPanel.vue";+import { useStageSelection } from "./composables/useStageSelection";+import { useTaskInstancePreload } from "./composables/useTaskInstancePreload";+import StageContentView from "./StageContentView.vue";+import StageNavigationBar from "./StageNavigationBar.vue";++const route = useRoute();+const router = useRouter();+const { t } = useI18n();+const { project } = useCurrentProjectV1();+const { events } = usePlanContextWithRollout();++const { rollout, mergedStages, ready } = useRolloutViewContext();++// Preload instances for all tasks to ensure engine icons display+useTaskInstancePreload(() => mergedStages.value);++const routeStageId = computed(() => route.params.stageId as string | undefined);++const { selectedStage, isStageCreated } = useStageSelection(+ mergedStages,+ routeStageId,+ rollout+);++// Stage action panel state+const showStageActionPanel = ref(false);+const stageAction = ref<"RUN" | "SKIP" | "CANCEL">("RUN");+const stageActionTarget = ref<TargetType | null>(null);++// Auto-navigate to the selected stage if no stageId in route+watch(+ () => [selectedStage.value, routeStageId.value, ready.value] as const,+ ([stage, currentRouteStageId, isReady]) => {+ if (isReady && stage && !currentRouteStageId) {+ // Auto-selected a stage but no stageId in route, navigate to it+ const stageId = stage.name.split("/").pop();+ const rolloutId = rollout.value.name.split("/").pop();++ router.replace({+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,+ params: {+ projectId: extractProjectResourceName(project.value.name),+ rolloutId: rolloutId || "_",+ stageId: stageId || "_",+ },+ });+ }+ },+ { immediate: true }+);++const handleStageSelect = (stage: Stage) => {+ // Navigate to the proper stage route+ const stageId = stage.name.split("/").pop();+ const rolloutId = rollout.value.name.split("/").pop();++ router.push({+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,+ params: {+ projectId: extractProjectResourceName(project.value.name),+ rolloutId: rolloutId || "_",+ stageId: stageId || "_",+ },+ });+};++const handleRunStage = (stage: Stage) => {+ // Show confirmation panel for running all runnable tasks in the stage+ stageAction.value = "RUN";+ stageActionTarget.value = {+ type: "tasks",+ stage,+ };+ showStageActionPanel.value = true;+};++const handleCreateStage = async (stage: Stage) => {+ try {+ const request = create(CreateRolloutRequestSchema, {+ parent: project.value.name,+ rollout: {+ plan: rollout.value.plan,+ },+ target: 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),+ });+ }+};++const handleStageActionConfirmed = () => {+ // Refresh the rollout data after task action is confirmed+ events.emit("status-changed", { eager: true });+ // Close the panel and reset state+ showStageActionPanel.value = false;+ stageActionTarget.value = null;+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/StageContentView.vue b/frontend/src/components/Plan/components/RolloutView/v2/StageContentView.vuenew file mode 100644index 0000000000..8c2bd91bbe--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/StageContentView.vue@@ -0,0 +1,116 @@+<template>+ <div v-if="selectedStage" class="w-full">+ <!-- Stage header -->+ <div class="px-4">+ <div class="w-full flex flex-row items-center justify-between py-4 gap-2">+ <!-- Left: Stage info and filters -->+ <div class="flex flex-row items-center gap-4">+ <div class="flex flex-row items-center gap-2">++ <NTag round>{{ $t("common.stage") }}</NTag>+ <span class="font-medium text-lg">+ <EnvironmentV1Name+ :environment="+ environmentStore.getEnvironmentByName(selectedStage.environment)+ "+ :null-environment-placeholder="'Null'"+ :link="false"+ />+ </span>+ </div>+ <TaskFilter+ v-if="isStageCreated(selectedStage)"+ :stage="selectedStage"+ :selected-statuses="filterStatuses"+ @update:selected-statuses="handleFilterStatusesChange"+ />+ </div>++ <!-- Right: Stage actions -->+ <div class="flex items-center gap-x-2 shrink-0">+ <NButton+ v-if="isStageCreated(selectedStage)"+ type="primary"+ :disabled="!canRunStage"+ :size="'small'"+ @click="$emit('run-stage', selectedStage)"+ >+ <template #icon>+ <PlayIcon :size="16" />+ </template>+ {{ $t("rollout.stage.run-stage") }}+ </NButton>+ <NButton+ v-else+ type="primary"+ :size="'small'"+ @click="$emit('create-stage', selectedStage)"+ >+ <template #icon>+ <PlusIcon :size="16" />+ </template>+ {{ $t("rollout.stage.create-stage") }}+ </NButton>+ </div>+ </div>+ </div>++ <!-- Task list content -->+ <TaskList+ :stage="selectedStage"+ :rollout="rollout"+ :filter-statuses="filterStatuses"+ :readonly="!isStageCreated(selectedStage)"+ />+ </div>++ <div v-else class="flex items-center justify-center py-12">+ <p class="text-gray-500">+ {{ $t("rollout.no-stages") }}+ </p>+ </div>+</template>++<script lang="ts" setup>+import { PlayIcon, PlusIcon } from "lucide-vue-next";+import { NButton, NTag } from "naive-ui";+import { computed, ref } from "vue";+import { EnvironmentV1Name } from "@/components/v2";+import { useEnvironmentV1Store } from "@/store";+import type { Rollout, Stage } from "@/types/proto-es/v1/rollout_service_pb";+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";+import TaskFilter from "./TaskFilter.vue";+import TaskList from "./TaskList.vue";++const props = defineProps<{+ selectedStage: Stage | null | undefined;+ rollout: Rollout;+ isStageCreated: (stage: Stage) => boolean;+}>();++defineEmits<{+ (event: "run-stage", stage: Stage): void;+ (event: "create-stage", stage: Stage): void;+}>();++const environmentStore = useEnvironmentV1Store();+const filterStatuses = ref<Task_Status[]>([]);++const canRunStage = computed(() => {+ if (!props.selectedStage || !props.isStageCreated(props.selectedStage)) {+ return false;+ }+ // Can run if there are NOT_STARTED, FAILED, or CANCELED tasks+ // PENDING tasks cannot be run (only canceled)+ return props.selectedStage.tasks.some(+ (task) =>+ task.status === Task_Status.NOT_STARTED ||+ task.status === Task_Status.FAILED ||+ task.status === Task_Status.CANCELED+ );+});++const handleFilterStatusesChange = (statuses: Task_Status[]) => {+ filterStatuses.value = statuses;+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/StageNavigationBar.vue b/frontend/src/components/Plan/components/RolloutView/v2/StageNavigationBar.vuenew file mode 100644index 0000000000..eedf8a9181--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/StageNavigationBar.vue@@ -0,0 +1,52 @@+<template>+ <div class="relative bg-white pt-3">+ <div class="absolute w-full bottom-0 leading-0 border-b border-b-gray-200" />+ <div class="flex items-center justify-between gap-x-4">+ <!-- Left: Stage tabs -->+ <div class="flex items-center overflow-x-auto px-4">+ <template v-for="(stage, index) in stages" :key="stage.name">+ <div+ class="relative px-4 py-2 transition-all border rounded-t-lg cursor-pointer"+ :class="[+ selectedStageId === stage.name+ ? 'bg-gray-50 border-gray-200 border-b-transparent'+ : 'bg-white hover:bg-gray-50 border-transparent border-b-gray-200',+ !isStageCreated(stage) && 'opacity-80',+ ]"+ @click="handleStageClick(stage)"+ >+ <StageProgressCard+ :stage="stage"+ :is-created="isStageCreated(stage)"+ />+ </div>+ <ArrowRightIcon+ v-if="index < stages.length - 1"+ :size="16"+ class="text-gray-400 shrink-0 mx-2"+ />+ </template>+ </div>+ </div>+ </div>+</template>++<script lang="ts" setup>+import { ArrowRightIcon } from "lucide-vue-next";+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";+import StageProgressCard from "./StageProgressCard.vue";++defineProps<{+ stages: Stage[];+ selectedStageId?: string;+ isStageCreated: (stage: Stage) => boolean;+}>();++const emit = defineEmits<{+ (event: "select-stage", stage: Stage): void;+}>();++const handleStageClick = (stage: Stage) => {+ emit("select-stage", stage);+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/StageProgressCard.vue b/frontend/src/components/Plan/components/RolloutView/v2/StageProgressCard.vuenew file mode 100644index 0000000000..cf5711a0cb--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/StageProgressCard.vue@@ -0,0 +1,31 @@+<template>+ <div class="flex items-center gap-2">+ <TaskStatus :status="stageStatus" size="small" />+ <span class="whitespace-nowrap">+ <EnvironmentV1Name :environment="environment" :link="false" />+ </span>+ </div>+</template>++<script lang="ts" setup>+import { computed } from "vue";+import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";+import EnvironmentV1Name from "@/components/v2/Model/EnvironmentV1Name.vue";+import { useEnvironmentV1Store } from "@/store";+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";+import { useStageStatus } from "./composables/useStageStatus";++const props = defineProps<{+ stage: Stage;+ isCreated: boolean;+}>();++const environmentStore = useEnvironmentV1Store();++const environment = computed(() => {+ return environmentStore.getEnvironmentByName(props.stage.environment);+});++const stageComputed = computed(() => props.stage);+const { stageStatus } = useStageStatus(stageComputed, props.isCreated);+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskFilter.vue b/frontend/src/components/Plan/components/RolloutView/v2/TaskFilter.vuenew file mode 100644index 0000000000..98350f06ef--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskFilter.vue@@ -0,0 +1,65 @@+<template>+ <div class="flex flex-row gap-1 items-center">+ <template v-for="status in TASK_STATUS_FILTERS" :key="status">+ <NTag+ v-if="getTaskCount(status) > 0"+ round+ checkable+ :checked="selectedStatuses.includes(status)"+ @update:checked="+ (checked) => {+ handleStatusToggle(status, checked);+ }+ "+ >+ <template #avatar>+ <TaskStatus :status="status" size="small" />+ </template>+ <div class="flex flex-row items-center gap-1">+ <span class="select-none text-base">{{+ stringifyTaskStatus(status)+ }}</span>+ <span class="select-none text-base font-medium">{{+ getTaskCount(status)+ }}</span>+ </div>+ </NTag>+ </template>+ </div>+</template>++<script lang="ts" setup>+import { NTag } from "naive-ui";+import { computed } from "vue";+import { TASK_STATUS_FILTERS } from "@/components/Plan/constants/task";+import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";+import type {+ Stage,+ Task_Status,+} from "@/types/proto-es/v1/rollout_service_pb";+import { stringifyTaskStatus } from "@/utils";++const props = defineProps<{+ stage: Stage;+ selectedStatuses: Task_Status[];+}>();++const emit = defineEmits<{+ (event: "update:selected-statuses", statuses: Task_Status[]): void;+}>();++const allTasks = computed(() => {+ return props.stage.tasks;+});++const getTaskCount = (status: Task_Status) => {+ return allTasks.value.filter((task) => task.status === status).length;+};++const handleStatusToggle = (status: Task_Status, checked: boolean) => {+ const newStatuses = checked+ ? [...props.selectedStatuses, status]+ : props.selectedStatuses.filter((s) => s !== status);+ emit("update:selected-statuses", newStatuses);+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskItem.vue b/frontend/src/components/Plan/components/RolloutView/v2/TaskItem.vuenew file mode 100644index 0000000000..ee78aa0941--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskItem.vue@@ -0,0 +1,182 @@+<template>+ <div+ class="collapsible-task-item relative bg-white border rounded-lg transition-all group"+ :class="[+ borderClass,+ isExpanded ? 'shadow-sm' : 'hover:shadow-sm',+ ]"+ >+ <!-- Absolute checkbox - center-aligned on left border -->+ <div+ v-if="isSelectable"+ class="absolute left-0 -translate-y-1/2 -translate-x-1/2 z-1 transition-opacity"+ :class="[inSelectMode || isSelected ? 'opacity-100' : 'opacity-0 group-hover:opacity-100', isExpanded ? 'top-8': 'top-6']"+ @click.stop+ >+ <NCheckbox+ :checked="isSelected"+ @update:checked="emit('toggle-select')"+ />+ </div>++ <!-- Task content -->+ <div class="w-full" :class="isExpanded ? 'p-4 space-y-3' : 'py-3 px-4'">+ <!-- Header section -->+ <div class="flex items-center justify-between gap-x-3 mb-2">+ <div class="flex items-center gap-x-2">+ <div+ :class="readonly ? '' : 'cursor-pointer hover:opacity-80'"+ class="transition-opacity"+ @click="handleNavigateToDetail"+ >+ <TaskStatus :status="task.status" :size="isExpanded ? 'large' : 'small'" />+ </div>+ <div+ :class="readonly ? '' : 'cursor-pointer hover:opacity-80'"+ class="transition-opacity shrink-0"+ @click="handleNavigateToDetail"+ >+ <DatabaseDisplay+ :database="task.target"+ :size="isExpanded ? 'large' : 'medium'"+ :link="false"+ />+ </div>+ </div>++ <!-- Expand/Collapse button -->+ <button+ class="shrink-0 p-1 hover:bg-gray-100 rounded transition-colors"+ :class="{ 'self-start': isExpanded }"+ @click.stop="emit('toggle-expand')"+ >+ <ChevronRightIcon v-if="!isExpanded" class="w-4 h-4 text-gray-600" />+ <ChevronDownIcon v-else class="w-4 h-4 text-gray-600" />+ </button>+ </div>++ <!-- SQL preview - collapsed only -->+ <div+ v-if="!isExpanded"+ class="flex flex-row justify-start items-start gap-2"+ >+ <NTag size="tiny" round class="opacity-80">+ {{ $t("common.statement") }}+ </NTag>+ <div+ :class="readonly ? '' : 'cursor-pointer'"+ class="text-xs text-gray-600 font-mono truncate"+ @click="handleNavigateToDetail">++ {{ statementPreview }}+ </div>+ </div>++ <!-- SQL Statement section - expanded only -->+ <div v-else>+ <div class="flex items-center justify-between mb-2">+ <span class="text-sm font-medium text-gray-700">{{ t("common.statement") }}</span>+ </div>++ <BBSpin v-if="loading" />+ <HighlightCodeBlock+ v-else+ :code="displayedStatement"+ language="sql"+ class="text-sm whitespace-pre-wrap wrap-break-word max-h-96 overflow-y-auto rounded p-2 bg-white border border-gray-200"+ />+ </div>++ <!-- Latest Task Run Info - expanded only -->+ <div v-if="isExpanded && latestTaskRun">+ <div class="flex items-center justify-between mb-2">+ <div class="flex items-center gap-x-2">+ <span class="text-sm font-medium text-gray-700">{{ t("task-run.latest") }}</span>+ <span class="text-sm text-gray-500">+ <Timestamp :timestamp="latestTaskRun.updateTime" />+ </span>+ </div>+ <a+ v-if="!readonly"+ href="javascript:void(0)"+ class="text-xs text-blue-600 hover:text-blue-700"+ @click="handleNavigateToDetail"+ >+ {{ t("rollout.task.view-full-details") }} →+ </a>+ </div>+ <div v-if="latestTaskRun.detail" class="text-sm text-gray-700 whitespace-pre-wrap">+ {{ latestTaskRun.detail }}+ </div>+ <div v-else class="text-xs text-gray-500 italic">+ {{ t("task-run.no-detail") }}+ </div>+ </div>+ </div>+ </div>+</template>++<script lang="ts" setup>+import { last } from "lodash-es";+import { ChevronDownIcon, ChevronRightIcon } from "lucide-vue-next";+import { NCheckbox, NTag } from "naive-ui";+import { computed } from "vue";+import { useI18n } from "vue-i18n";+import BBSpin from "@/bbkit/BBSpin.vue";+import HighlightCodeBlock from "@/components/HighlightCodeBlock";+import Timestamp from "@/components/misc/Timestamp.vue";+import { usePlanContextWithRollout } from "@/components/Plan";+import DatabaseDisplay from "@/components/Plan/components/common/DatabaseDisplay.vue";+import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";+import { taskRunNamePrefix } from "@/store";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";+import { useTaskNavigation } from "./composables/useTaskNavigation";+import { useTaskStatement } from "./composables/useTaskStatement";+import { getTaskBorderClass } from "./utils/taskStatus";++const props = withDefaults(+ defineProps<{+ task: Task;+ isExpanded: boolean;+ isSelected: boolean;+ isSelectable: boolean;+ inSelectMode: boolean;+ readonly?: boolean;+ }>(),+ {+ readonly: false,+ }+);++const emit = defineEmits<{+ (event: "toggle-expand"): void;+ (event: "toggle-select"): void;+}>();++const { t } = useI18n();+const { taskRuns: allTaskRuns } = usePlanContextWithRollout();+const { navigateToTaskDetail } = useTaskNavigation();++const { loading, statementPreview, displayedStatement } = useTaskStatement(+ () => props.task,+ () => props.isExpanded+);++const borderClass = computed(() => {+ return getTaskBorderClass(props.task.status);+});++const latestTaskRun = computed(() => {+ const taskRunsForTask = allTaskRuns.value.filter((run) =>+ run.name.startsWith(`${props.task.name}/${taskRunNamePrefix}`)+ );+ return last(taskRunsForTask);+});++const handleNavigateToDetail = () => {+ if (props.readonly) {+ return;+ }+ navigateToTaskDetail(props.task);+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskList.vue b/frontend/src/components/Plan/components/RolloutView/v2/TaskList.vuenew file mode 100644index 0000000000..d3bdf4e1b8--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskList.vue@@ -0,0 +1,135 @@+<template>+ <div class="w-full">+ <TaskToolbar+ v-if="!readonly"+ :selected-tasks="selectedTasks"+ :all-tasks="filteredTasks"+ :is-task-selectable="isTaskSelectable"+ :stage="stage"+ @select-all="selectAll"+ @clear-selection="clearSelection"+ @action-complete="handleActionComplete"+ />++ <div class="task-list px-4 py-4 space-y-3">+ <TaskItem+ v-for="task in visibleTasks"+ :key="task.name"+ :task="task"+ :is-expanded="isTaskExpanded(task)"+ :is-selected="isTaskSelected(task)"+ :is-selectable="!readonly && isTaskSelectable(task)"+ :in-select-mode="!readonly && selectedTasks.length > 0"+ :readonly="readonly"+ @toggle-expand="toggleExpand(task)"+ @toggle-select="toggleSelect(task)"+ />++ <div v-if="filteredTasks.length === 0" class="text-center py-8 text-gray-500">+ {{ $t("rollout.task.no-tasks") }}+ </div>++ <!-- Show More button -->+ <div+ v-if="hasMoreTasks"+ class="flex justify-center py-4"+ >+ <button+ class="px-4 py-2 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors"+ @click="loadMoreTasks"+ >+ {{ $t("common.show-more") }} ({{ remainingTasksCount }} {{ $t("common.remaining") }})+ </button>+ </div>+ </div>+ </div>+</template>++<script lang="ts" setup>+import { computed, ref, watch } from "vue";+import { usePlanContextWithRollout } from "@/components/Plan/logic/context";+import type { Rollout, Stage } from "@/types/proto-es/v1/rollout_service_pb";+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";+import { useSheetPreload } from "./composables/useSheetPreload";+import { useTaskCollapse } from "./composables/useTaskCollapse";+import { useTaskSelection } from "./composables/useTaskSelection";+import { DEFAULT_PAGE_SIZE } from "./constants";+import TaskItem from "./TaskItem.vue";+import TaskToolbar from "./TaskToolbar.vue";+import { compareTasksByStatus } from "./utils/taskStatus";++const props = withDefaults(+ defineProps<{+ stage: Stage;+ rollout: Rollout;+ filterStatuses: Task_Status[];+ readonly?: boolean;+ }>(),+ {+ readonly: false,+ }+);++const { events } = usePlanContextWithRollout();++const displayedTaskCount = ref(DEFAULT_PAGE_SIZE);++const filteredTasks = computed(() => {+ const tasks = props.stage.tasks;+ let result = tasks;++ if (props.filterStatuses.length > 0) {+ result = tasks.filter((task) => props.filterStatuses.includes(task.status));+ }++ // Sort by status priority (order defined in TASK_STATUS_FILTERS)+ return [...result].sort(compareTasksByStatus);+});++const visibleTasks = computed(() => {+ return filteredTasks.value.slice(0, displayedTaskCount.value);+});++const hasMoreTasks = computed(() => {+ return filteredTasks.value.length > displayedTaskCount.value;+});++const remainingTasksCount = computed(() => {+ return filteredTasks.value.length - displayedTaskCount.value;+});++const loadMoreTasks = () => {+ displayedTaskCount.value = Math.min(+ displayedTaskCount.value + DEFAULT_PAGE_SIZE,+ filteredTasks.value.length+ );+};++// Prefetch sheets for visible tasks to improve performance+useSheetPreload(() => visibleTasks.value);++const { isTaskExpanded, toggleExpand } = useTaskCollapse(filteredTasks);++const {+ selectedTasks,+ isTaskSelected,+ isTaskSelectable,+ toggleSelect,+ selectAll,+ clearSelection,+} = useTaskSelection(filteredTasks);++const handleActionComplete = () => {+ clearSelection();+ // Trigger immediate refresh of rollout data after task actions+ events.emit("status-changed", { eager: true });+};++// Reset pagination when filters change or tasks change+watch(+ () => [props.filterStatuses, props.stage.tasks.length],+ () => {+ displayedTaskCount.value = DEFAULT_PAGE_SIZE;+ }+);+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskToolbar.vue b/frontend/src/components/Plan/components/RolloutView/v2/TaskToolbar.vuenew file mode 100644index 0000000000..50976120a2--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskToolbar.vue@@ -0,0 +1,288 @@+<template>+ <div+ class="task-toolbar sticky top-0 z-10 px-4 py-3 transition-colors bg-blue-100"+ >+ <div class="flex items-center justify-between">+ <!-- Left section -->+ <div class="flex items-center gap-x-3">+ <!-- Select all checkbox -->+ <NTooltip :disabled="!isSelectAllDisabled || !getSelectAllTooltip()">+ <template #trigger>+ <NCheckbox+ v-if="allTasks.length > 0"+ :checked="allSelectableTasksSelected"+ :indeterminate="someTasksSelected && !allSelectableTasksSelected"+ :disabled="isSelectAllDisabled"+ @update:checked="handleSelectAllChange"+ />+ </template>+ <span class="w-56 text-sm">{{ getSelectAllTooltip() }}</span>+ </NTooltip>++ <!-- Selection state -->+ <span class="text-sm text-blue-900">+ {{ selectionCountText }}+ </span>++ <!-- Bulk actions (always shown) -->+ <div class="flex items-center ">++ <NTooltip :disabled="!isRunDisabled || !getRunTooltip()">+ <template #trigger>+ <NButton+ quaternary+ size="small"+ type="primary"+ :disabled="isRunDisabled"+ @click="handleAction('RUN')"+ >+ <template #icon>+ <PlayIcon :size="14" />+ </template>+ {{ $t("common.run") }}+ </NButton>+ </template>+ <span class="w-56 text-sm">{{ getRunTooltip() }}</span>+ </NTooltip>++ <NTooltip :disabled="!isSkipDisabled || !getSkipTooltip()">+ <template #trigger>+ <NButton+ quaternary+ size="small"+ type="primary"+ :disabled="isSkipDisabled"+ @click="handleAction('SKIP')"+ >+ <template #icon>+ <SkipForwardIcon :size="14" />+ </template>+ {{ $t("common.skip") }}+ </NButton>+ </template>+ <span class="w-56 text-sm">{{ getSkipTooltip() }}</span>+ </NTooltip>++ <NTooltip :disabled="!isCancelDisabled || !getCancelTooltip()">+ <template #trigger>+ <NButton+ quaternary+ size="small"+ type="primary"+ :disabled="isCancelDisabled"+ @click="handleAction('CANCEL')"+ >+ <template #icon>+ <XIcon :size="14" />+ </template>+ {{ $t("common.cancel") }}+ </NButton>+ </template>+ <span class="w-56 text-sm">{{ getCancelTooltip() }}</span>+ </NTooltip>++ </div>+ </div>++ </div>++ <!-- Action confirmation panel -->+ <TaskRolloutActionPanel+ v-if="showActionPanel && pendingAction"+ :show="showActionPanel"+ :action="pendingAction"+ :target="{ type: 'tasks', tasks: selectedTasks, stage }"+ @close="showActionPanel = false"+ @confirm="handleActionPerformed"+ />+ </div>+</template>++<script lang="ts" setup>+import { PlayIcon, SkipForwardIcon, XIcon } from "lucide-vue-next";+import { NButton, NCheckbox, NTooltip } from "naive-ui";+import { computed, ref } from "vue";+import { useI18n } from "vue-i18n";+import TaskRolloutActionPanel from "@/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue";+import { canRolloutTasks } from "@/components/Plan/components/RolloutView/taskPermissions";+import { usePlanContext } from "@/components/Plan/logic";+import { useCurrentUserV1 } from "@/store";+import { userNamePrefix } from "@/store/modules/v1/common";+import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";+import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";+import type { TaskAction } from "./types";++const props = defineProps<{+ selectedTasks: Task[];+ allTasks: Task[];+ isTaskSelectable: (task: Task) => boolean;+ stage: Stage;+}>();++const emit = defineEmits<{+ (event: "select-all"): void;+ (event: "clear-selection"): void;+ (event: "action-complete"): void;+}>();++const { t } = useI18n();+const { issue } = usePlanContext();+const currentUser = useCurrentUserV1();++const showActionPanel = ref(false);+const pendingAction = ref<TaskAction | null>(null);++const selectableTasks = computed(() => {+ return props.allTasks.filter(props.isTaskSelectable);+});++const allSelectableTasksSelected = computed(() => {+ if (selectableTasks.value.length === 0) {+ return false;+ }+ return (+ props.selectedTasks.length === selectableTasks.value.length &&+ selectableTasks.value.every((task) =>+ props.selectedTasks.some((st) => st.name === task.name)+ )+ );+});++const someTasksSelected = computed(() => {+ return props.selectedTasks.length > 0 && !allSelectableTasksSelected.value;+});++const selectionCountText = computed(() => {+ return t("rollout.task.selected-count", {+ count: props.selectedTasks.length,+ });+});++const isSelectAllDisabled = computed(() => {+ return selectableTasks.value.length === 0;+});++const getSelectAllTooltip = () => {+ if (selectableTasks.value.length === 0) {+ return t("task.no-selectable-tasks");+ }+ return "";+};++const canPerformTaskActions = computed(() => {+ return canRolloutTasks(props.selectedTasks, issue.value);+});++const hasRunnableTasks = computed(() => {+ return props.selectedTasks.some(+ (task) =>+ task.status === Task_Status.NOT_STARTED ||+ task.status === Task_Status.FAILED ||+ task.status === Task_Status.CANCELED+ );+});++const hasSkippableTasks = computed(() => {+ return props.selectedTasks.some(+ (task) => task.status === Task_Status.NOT_STARTED+ );+});++const hasCancellableTasks = computed(() => {+ return props.selectedTasks.some(+ (task) =>+ task.status === Task_Status.PENDING || task.status === Task_Status.RUNNING+ );+});++/**+ * Get base disabled tooltip for common conditions (no selection, no permission)+ */+const getBaseDisabledTooltip = (): string => {+ if (props.selectedTasks.length === 0) {+ return t("task.no-tasks-selected");+ }+ if (!canPerformTaskActions.value) {+ // Special message for data export issues when user is not the creator+ if (+ issue.value &&+ issue.value.type === Issue_Type.DATABASE_EXPORT &&+ issue.value.creator !== `${userNamePrefix}${currentUser.value.email}`+ ) {+ return t("task.data-export-creator-only");+ }+ return t("task.no-permission");+ }+ return "";+};++/**+ * Get action-specific tooltip by combining base tooltip with action requirements+ */+const getActionTooltip = (+ hasValidTasks: boolean,+ noValidTasksMessage: string+): string => {+ const baseTooltip = getBaseDisabledTooltip();+ if (baseTooltip) {+ return baseTooltip;+ }+ if (!hasValidTasks) {+ return noValidTasksMessage;+ }+ return "";+};++const getRunTooltip = () =>+ getActionTooltip(hasRunnableTasks.value, t("task.no-runnable-tasks"));++const getSkipTooltip = () =>+ getActionTooltip(hasSkippableTasks.value, t("task.no-skippable-tasks"));++const getCancelTooltip = () =>+ getActionTooltip(hasCancellableTasks.value, t("task.no-cancellable-tasks"));++const isRunDisabled = computed(() => {+ return (+ props.selectedTasks.length === 0 ||+ !hasRunnableTasks.value ||+ !canPerformTaskActions.value+ );+});++const isSkipDisabled = computed(() => {+ return (+ props.selectedTasks.length === 0 ||+ !hasSkippableTasks.value ||+ !canPerformTaskActions.value+ );+});++const isCancelDisabled = computed(() => {+ return (+ props.selectedTasks.length === 0 ||+ !hasCancellableTasks.value ||+ !canPerformTaskActions.value+ );+});++const handleSelectAllChange = (checked: boolean) => {+ if (checked) {+ emit("select-all");+ } else {+ emit("clear-selection");+ }+};++const handleAction = (action: TaskAction) => {+ pendingAction.value = action;+ showActionPanel.value = true;+};++const handleActionPerformed = () => {+ showActionPanel.value = false;+ pendingAction.value = null;+ emit("action-complete");+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useSheetPreload.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useSheetPreload.tsnew file mode 100644index 0000000000..1e2fcf9c2a--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useSheetPreload.ts@@ -0,0 +1,45 @@+import { ref, watch } from "vue";+import { useSheetV1Store } from "@/store";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";+import { sheetNameOfTaskV1 } from "@/utils";++/**+ * Prefetches sheets for visible tasks in parallel to improve performance+ */+export const useSheetPreload = (tasks: () => Task[]) => {+ const sheetStore = useSheetV1Store();+ const fetchedSheets = ref(new Set<string>());++ watch(+ tasks,+ (currentTasks) => {+ const uniqueSheetNames = new Set<string>();++ // Extract all unique sheet names from tasks+ for (const task of currentTasks) {+ const sheetName = sheetNameOfTaskV1(task);+ if (sheetName) {+ uniqueSheetNames.add(sheetName);+ }+ }++ // Only fetch sheets we haven't fetched yet+ const newSheets = Array.from(uniqueSheetNames).filter(+ (name) => !fetchedSheets.value.has(name)+ );++ if (newSheets.length > 0) {+ // Batch fetch new sheets in parallel+ Promise.all(+ newSheets.map((sheetName) =>+ sheetStore.getOrFetchSheetByName(sheetName, "BASIC")+ )+ );++ // Mark these sheets as fetched+ newSheets.forEach((name) => fetchedSheets.value.add(name));+ }+ },+ { immediate: true }+ );+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageSelection.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageSelection.tsnew file mode 100644index 0000000000..ff13257853--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageSelection.ts@@ -0,0 +1,83 @@+import { head } from "lodash-es";+import { type ComputedRef, computed, type Ref } from "vue";+import type { Rollout, Stage } from "@/types/proto-es/v1/rollout_service_pb";+import { isTaskRunning, isTaskUnfinished } from "../utils/taskStatus";++export interface UseStageSelectionReturn {+ selectedStage: ComputedRef<Stage | undefined>;+ isStageCreated: (stage: Stage) => boolean;+}++export const useStageSelection = (+ mergedStages: Ref<Stage[]>,+ routeStageId: Ref<string | undefined>,+ rollout: Ref<Rollout>+): UseStageSelectionReturn => {+ const isStageCreated = (stage: Stage): boolean => {+ // A stage is created if it exists in the actual rollout (not just preview)+ return rollout.value.stages.some(+ (s) => s.environment === stage.environment+ );+ };++ const hasRunningTasks = (stage: Stage): boolean => {+ return stage.tasks.some(isTaskRunning);+ };++ const hasUnfinishedTasks = (stage: Stage): boolean => {+ return stage.tasks.some(isTaskUnfinished);+ };++ const findSuitableStage = (stages: Stage[]): Stage | undefined => {+ const createdStages = stages.filter(isStageCreated);++ if (createdStages.length === 0) {+ return undefined;+ }++ // Auto-selection logic (only created stages)+ // Priority 1: First created stage with running tasks+ const runningStage = createdStages.find(hasRunningTasks);+ if (runningStage) {+ return runningStage;+ }++ // Priority 2: First created stage with unfinished tasks+ const unfinishedStage = createdStages.find(hasUnfinishedTasks);+ if (unfinishedStage) {+ return unfinishedStage;+ }++ // Priority 3: Last created stage+ return createdStages[createdStages.length - 1];+ };++ const selectedStage = computed(() => {+ const stages = mergedStages.value;+ const createdStages = stages.filter(isStageCreated);++ // Always follow route params if stageId is provided (allow both created and uncreated)+ if (routeStageId.value) {+ const stage = stages.find((s) => {+ const stageId = s.name.split("/").pop();+ return stageId === routeStageId.value;+ });+ if (stage) {+ return stage;+ }+ }++ // If no stageId in route, auto-select a suitable created stage+ if (createdStages.length === 0) {+ // If no created stages, fallback to the first uncreated stage+ return head(stages);+ }++ return findSuitableStage(stages);+ });++ return {+ selectedStage,+ isStageCreated,+ };+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageStatus.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageStatus.tsnew file mode 100644index 0000000000..b019061c05--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageStatus.ts@@ -0,0 +1,41 @@+import { type ComputedRef, computed } from "vue";+import { TASK_STATUS_FILTERS } from "@/components/Plan/constants/task";+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";++export interface UseStageStatusReturn {+ stageStatus: ComputedRef<Task_Status>;+}++/**+ * Composable for computing stage status based on its tasks+ * Priority order follows TASK_STATUS_FILTERS: FAILED > RUNNING > PENDING > NOT_STARTED > CANCELED > SKIPPED > DONE+ */+export const useStageStatus = (+ stage: ComputedRef<Stage> | Stage,+ isCreated: boolean+): UseStageStatusReturn => {+ const stageStatus = computed(() => {+ const stageValue = "value" in stage ? stage.value : stage;++ if (!isCreated || stageValue.tasks.length === 0) {+ return Task_Status.STATUS_UNSPECIFIED;+ }++ const tasks = stageValue.tasks;++ // Check statuses in priority order using TASK_STATUS_FILTERS+ for (const status of TASK_STATUS_FILTERS) {+ if (tasks.some((t) => t.status === status)) {+ return status;+ }+ }++ // Fallback to DONE if no matching status found+ return Task_Status.DONE;+ });++ return {+ stageStatus,+ };+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskCollapse.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskCollapse.tsnew file mode 100644index 0000000000..f501d6ee73--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskCollapse.ts@@ -0,0 +1,31 @@+import { type Ref, ref } from "vue";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";+import { addToSet, deleteFromSet } from "../utils/reactivity";++export interface UseTaskCollapseReturn {+ expandedTaskIds: Ref<Set<string>>;+ isTaskExpanded: (task: Task) => boolean;+ toggleExpand: (task: Task) => void;+}++export const useTaskCollapse = (_tasks: Ref<Task[]>): UseTaskCollapseReturn => {+ const expandedTaskIds = ref<Set<string>>(new Set());++ const isTaskExpanded = (task: Task): boolean => {+ return expandedTaskIds.value.has(task.name);+ };++ const toggleExpand = (task: Task) => {+ if (expandedTaskIds.value.has(task.name)) {+ deleteFromSet(expandedTaskIds, task.name);+ } else {+ addToSet(expandedTaskIds, task.name);+ }+ };++ return {+ expandedTaskIds,+ isTaskExpanded,+ toggleExpand,+ };+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskInstancePreload.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskInstancePreload.tsnew file mode 100644index 0000000000..1b645ff2d7--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskInstancePreload.ts@@ -0,0 +1,44 @@+import { ref, watch } from "vue";+import { batchGetOrFetchDatabases } from "@/store";+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";++/**+ * Preloads databases (and their instances) referenced by tasks+ * This ensures database and engine icons display correctly+ */+export const useTaskInstancePreload = (stages: () => Stage[]) => {+ const fetchedDatabases = ref(new Set<string>());++ watch(+ stages,+ async (currentStages) => {+ const uniqueDatabaseNames = new Set<string>();++ // Extract all unique database names from task targets+ for (const stage of currentStages) {+ for (const task of stage.tasks) {+ if (task.target) {+ uniqueDatabaseNames.add(task.target);+ }+ }+ }++ // Only fetch databases we haven't fetched yet+ const newDatabases = Array.from(uniqueDatabaseNames).filter(+ (name) => !fetchedDatabases.value.has(name)+ );++ if (newDatabases.length > 0) {+ // Batch fetch databases (which also fetches their instances)+ try {+ await batchGetOrFetchDatabases(newDatabases);+ // Mark these databases as fetched+ newDatabases.forEach((name) => fetchedDatabases.value.add(name));+ } catch {+ // Ignore errors - this is just for pre-loading data+ }+ }+ },+ { immediate: true }+ );+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskNavigation.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskNavigation.tsnew file mode 100644index 0000000000..5f4e5f4b5a--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskNavigation.ts@@ -0,0 +1,41 @@+import { useRouter } from "vue-router";+import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL } from "@/router/dashboard/projectV1";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";+import {+ extractProjectResourceName,+ extractRolloutUID,+ extractStageNameFromTaskName,+ extractStageUID,+ extractTaskUID,+} from "@/utils";++export const useTaskNavigation = () => {+ const router = useRouter();++ const navigateToTaskDetail = (task: Task) => {+ // Task name format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}+ // Use utility functions for consistent parsing+ const projectName = extractProjectResourceName(task.name);+ const rolloutId = extractRolloutUID(task.name);++ // Extract stage ID from the task's name (Task → Stage relationship)+ const stageName = extractStageNameFromTaskName(task.name);+ const stageId = extractStageUID(stageName);++ const taskId = extractTaskUID(task.name);++ router.push({+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,+ params: {+ projectId: projectName,+ rolloutId: rolloutId || "-",+ stageId: stageId || "-",+ taskId: taskId || "-",+ },+ });+ };++ return {+ navigateToTaskDetail,+ };+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskSelection.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskSelection.tsnew file mode 100644index 0000000000..495b6771fc--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskSelection.ts@@ -0,0 +1,67 @@+import { type ComputedRef, computed, type Ref, ref } from "vue";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";+import {+ addToSet,+ clearSet,+ deleteFromSet,+ triggerSetReactivity,+} from "../utils/reactivity";+import { isTaskSelectable } from "../utils/taskStatus";++export interface UseTaskSelectionReturn {+ selectedTaskIds: Ref<Set<string>>;+ selectedTasks: ComputedRef<Task[]>;+ isTaskSelected: (task: Task) => boolean;+ isTaskSelectable: (task: Task) => boolean;+ toggleSelect: (task: Task) => void;+ selectAll: () => void;+ clearSelection: () => void;+}++export const useTaskSelection = (+ tasks: Ref<Task[]>+): UseTaskSelectionReturn => {+ const selectedTaskIds = ref<Set<string>>(new Set());++ const selectedTasks = computed(() => {+ return tasks.value.filter((task) => selectedTaskIds.value.has(task.name));+ });++ const isTaskSelected = (task: Task): boolean => {+ return selectedTaskIds.value.has(task.name);+ };++ const toggleSelect = (task: Task) => {+ if (!isTaskSelectable(task)) {+ return;+ }++ if (selectedTaskIds.value.has(task.name)) {+ deleteFromSet(selectedTaskIds, task.name);+ } else {+ addToSet(selectedTaskIds, task.name);+ }+ };++ const selectAll = () => {+ const selectableTasks = tasks.value.filter(isTaskSelectable);+ selectableTasks.forEach((task) => {+ selectedTaskIds.value.add(task.name);+ });+ triggerSetReactivity(selectedTaskIds);+ };++ const clearSelection = () => {+ clearSet(selectedTaskIds);+ };++ return {+ selectedTaskIds,+ selectedTasks,+ isTaskSelected,+ isTaskSelectable,+ toggleSelect,+ selectAll,+ clearSelection,+ };+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskStatement.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskStatement.tsnew file mode 100644index 0000000000..0059fcbf80--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskStatement.ts@@ -0,0 +1,72 @@+import { computed, ref, watchEffect } from "vue";+import { useI18n } from "vue-i18n";+import { useSheetV1Store } from "@/store";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";+import { getSheetStatement, sheetNameOfTaskV1 } from "@/utils";+import { STATEMENT_PREVIEW_LENGTH } from "../constants";++export const useTaskStatement = (+ task: () => Task,+ isExpanded: () => boolean+) => {+ const { t } = useI18n();+ const sheetStore = useSheetV1Store();++ const loading = ref(false);+ const statement = ref("");++ // Load statement - uses cached version for collapsed view, lazy loads for expanded view+ watchEffect(async () => {+ const sheetName = sheetNameOfTaskV1(task());+ if (!sheetName) {+ statement.value = "";+ return;+ }++ // Check cache first for both expanded and collapsed views+ const cachedSheet = sheetStore.getSheetByName(sheetName);++ if (cachedSheet) {+ // Use cached statement immediately+ statement.value = getSheetStatement(cachedSheet);+ } else if (isExpanded()) {+ // Only fetch if expanded and not in cache+ loading.value = true;+ try {+ await sheetStore.getOrFetchSheetByName(sheetName);+ const sheet = sheetStore.getSheetByName(sheetName);+ statement.value = sheet ? getSheetStatement(sheet) : "";+ } finally {+ loading.value = false;+ }+ } else {+ // Collapsed and not in cache: show empty (will be loaded when expanded)+ statement.value = "";+ }+ });++ const statementPreview = computed(() => {+ const stmt = statement.value;+ if (!stmt) {+ return t("rollout.task.no-statement");+ }+ const firstLine = stmt.split("\n")[0];+ return firstLine.length > STATEMENT_PREVIEW_LENGTH+ ? firstLine.substring(0, STATEMENT_PREVIEW_LENGTH) + "..."+ : firstLine;+ });++ const displayedStatement = computed(() => {+ if (!statement.value) {+ return t("rollout.task.no-statement");+ }+ return statement.value;+ });++ return {+ loading,+ statement,+ statementPreview,+ displayedStatement,+ };+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/constants.ts b/frontend/src/components/Plan/components/RolloutView/v2/constants.tsnew file mode 100644index 0000000000..61654bf098--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/constants.ts@@ -0,0 +1,9 @@+/**+ * Number of tasks to display per page in the task list+ */+export const DEFAULT_PAGE_SIZE = 20;++/**+ * Maximum characters to show in collapsed SQL statement preview+ */+export const STATEMENT_PREVIEW_LENGTH = 80;diff --git a/frontend/src/components/Plan/components/RolloutView/v2/types.ts b/frontend/src/components/Plan/components/RolloutView/v2/types.tsnew file mode 100644index 0000000000..18cad823e5--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/types.ts@@ -0,0 +1,8 @@+/**+ * Shared types for Rollout View v2 components+ */++/**+ * Available task actions for rollout operations+ */+export type TaskAction = "RUN" | "SKIP" | "CANCEL";diff --git a/frontend/src/components/Plan/components/RolloutView/v2/utils/reactivity.ts b/frontend/src/components/Plan/components/RolloutView/v2/utils/reactivity.tsnew file mode 100644index 0000000000..76dcea0fd5--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/utils/reactivity.ts@@ -0,0 +1,45 @@+import type { Ref } from "vue";++/**+ * Trigger reactivity for a Set ref by creating a new Set instance.+ * This is necessary because Vue's reactivity system doesn't automatically track Set mutations.+ * By creating a new Set instance, we trigger Vue's reactive system to detect the change.+ */+export const triggerSetReactivity = <T>(setRef: Ref<Set<T>>): void => {+ setRef.value = new Set(setRef.value);+};++/**+ * Add an item to a reactive Set and trigger reactivity+ */+export const addToSet = <T>(setRef: Ref<Set<T>>, item: T): void => {+ setRef.value.add(item);+ triggerSetReactivity(setRef);+};++/**+ * Delete an item from a reactive Set and trigger reactivity+ */+export const deleteFromSet = <T>(setRef: Ref<Set<T>>, item: T): void => {+ setRef.value.delete(item);+ triggerSetReactivity(setRef);+};++/**+ * Clear a reactive Set and trigger reactivity+ */+export const clearSet = <T>(setRef: Ref<Set<T>>): void => {+ setRef.value.clear();+ triggerSetReactivity(setRef);+};++/**+ * Toggle an item in a reactive Set and trigger reactivity+ */+export const toggleInSet = <T>(setRef: Ref<Set<T>>, item: T): void => {+ if (setRef.value.has(item)) {+ deleteFromSet(setRef, item);+ } else {+ addToSet(setRef, item);+ }+};diff --git a/frontend/src/components/Plan/components/RolloutView/v2/utils/taskStatus.ts b/frontend/src/components/Plan/components/RolloutView/v2/utils/taskStatus.tsnew file mode 100644index 0000000000..ad3ab08af8--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/utils/taskStatus.ts@@ -0,0 +1,105 @@+import { TASK_STATUS_FILTERS } from "@/components/Plan/constants/task";+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";++/**+ * Task statuses that are considered "unfinished"+ */+export const UNFINISHED_TASK_STATUSES: Task_Status[] = [+ Task_Status.NOT_STARTED,+ Task_Status.PENDING,+ Task_Status.RUNNING,+ Task_Status.FAILED,+ Task_Status.CANCELED,+];++/**+ * Task statuses that allow task selection for bulk actions+ */+export const SELECTABLE_TASK_STATUSES: Task_Status[] = [+ Task_Status.NOT_STARTED,+ Task_Status.PENDING,+ Task_Status.RUNNING,+ Task_Status.FAILED,+ Task_Status.CANCELED,+];++/**+ * Check if a task is in an unfinished state+ */+export const isTaskUnfinished = (task: Task): boolean => {+ return UNFINISHED_TASK_STATUSES.includes(task.status);+};++/**+ * Check if a task is selectable for bulk actions+ */+export const isTaskSelectable = (task: Task): boolean => {+ return SELECTABLE_TASK_STATUSES.includes(task.status);+};++/**+ * Check if a task is running+ */+export const isTaskRunning = (task: Task): boolean => {+ return task.status === Task_Status.RUNNING;+};++/**+ * Get border and background CSS classes for a task based on its status+ */+export const getTaskBorderClass = (status: Task_Status): string => {+ switch (status) {+ case Task_Status.FAILED:+ return "border-red-300";+ default:+ return "border-gray-300";+ }+};++/**+ * Create a Map of task status to sort priority based on TASK_STATUS_FILTERS order.+ * This ensures a single source of truth for task ordering.+ *+ * @returns Map where keys are Task_Status and values are their sort priority (lower = higher priority)+ */+const createTaskStatusPriorityMap = (): Map<Task_Status, number> => {+ const priorityMap = new Map<Task_Status, number>();+ TASK_STATUS_FILTERS.forEach((status, index) => {+ priorityMap.set(status, index);+ });+ return priorityMap;+};++/**+ * Cached task status priority map+ */+const taskStatusPriorityMap = createTaskStatusPriorityMap();++/**+ * Get the sort priority for a task status.+ * Lower values indicate higher priority in the display order.+ *+ * @param status - The task status+ * @returns The sort priority (0-based index from TASK_STATUS_FILTERS)+ */+export const getTaskStatusPriority = (status: Task_Status): number => {+ return taskStatusPriorityMap.get(status) ?? Number.MAX_SAFE_INTEGER;+};++/**+ * Comparator function for sorting tasks by status priority.+ * Use with Array.sort() to order tasks according to TASK_STATUS_FILTERS.+ *+ * @example+ * const sortedTasks = tasks.slice().sort(compareTasksByStatus);+ *+ * @param a - First task to compare+ * @param b - Second task to compare+ * @returns Negative if a should come before b, positive if b should come before a, 0 if equal+ */+export const compareTasksByStatus = (a: Task, b: Task): number => {+ const priorityA = getTaskStatusPriority(a.status);+ const priorityB = getTaskStatusPriority(b.status);+ return priorityA - priorityB;+};diff --git a/frontend/src/components/Plan/constants/task.ts b/frontend/src/components/Plan/constants/task.tsindex 1ce1038f90..2e267db28b 100644--- a/frontend/src/components/Plan/constants/task.ts+++ b/frontend/src/components/Plan/constants/task.ts@@ -3,9 +3,9 @@ import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";export const TASK_STATUS_FILTERS: Task_Status[] = [Task_Status.RUNNING,Task_Status.FAILED,- Task_Status.CANCELED,Task_Status.PENDING,- Task_Status.DONE,- Task_Status.SKIPPED,Task_Status.NOT_STARTED,+ Task_Status.CANCELED,+ Task_Status.SKIPPED,+ Task_Status.DONE,];diff --git a/frontend/src/components/Rollout/kits/TaskStatus.vue b/frontend/src/components/Rollout/kits/TaskStatus.vueindex ca241849a3..0c38744b3e 100644--- a/frontend/src/components/Rollout/kits/TaskStatus.vue+++ b/frontend/src/components/Rollout/kits/TaskStatus.vue@@ -9,10 +9,12 @@)">+ <template v-if="status === Task_Status.STATUS_UNSPECIFIED">+ <CircleDotDashedIcon class="w-full h-auto" />+ </template><template- v-if="- status === Task_Status.NOT_STARTED ||- status === Task_Status.STATUS_UNSPECIFIED+ v-else-if="+ status === Task_Status.NOT_STARTED"><span@@ -61,7 +63,11 @@</template><script lang="ts" setup>-import { FastForwardIcon, PauseIcon } from "lucide-vue-next";+import {+ CircleDotDashedIcon,+ FastForwardIcon,+ PauseIcon,+} from "lucide-vue-next";import { NTooltip } from "naive-ui";import { twMerge } from "tailwind-merge";import { computed } from "vue";@@ -96,7 +102,6 @@ const classes = computed((): string => {let statusClass = "";switch (props.status) {case Task_Status.NOT_STARTED:- case Task_Status.STATUS_UNSPECIFIED:statusClass = "bg-white border-2 border-control";break;case Task_Status.PENDING:diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex eb388f244f..15e424cefc 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -244,6 +244,8 @@"notification": "Successfully delete the resource '{name}'."},"collapse": "Collapse",+ "show-more": "Show more",+ "remaining": "remaining","line": "Line","column": "Column","apply-to-database": "Apply to database"@@ -312,6 +314,7 @@"no-runnable-tasks": "No runnable tasks","no-skippable-tasks": "No skippable tasks","no-cancellable-tasks": "No cancellable tasks",+ "no-selectable-tasks": "No tasks can be selected","no-permission": "No permission to perform this action","data-export-creator-only": "Only the issue creator can execute data export tasks","scheduled-time": "Scheduled time",@@ -342,6 +345,8 @@"failed-runs": "Failed Tasks - Latest Execution Logs","history": "Execution History","latest-logs": "Latest Logs",+ "latest": "Latest Execution",+ "no-detail": "No execution details available","status": {"enqueued": "Waiting for execution.","enqueued-with-rollout-time": "Waiting to execute after {time}.",@@ -1203,11 +1208,21 @@"stage": {"self": "Stage | Stages","start-stage": "Start stage",+ "run-stage": "Run Stage",+ "create-stage": "Create Stage",+ "back-to-stage": "Back to Stage {stage}","no-stages": {"self": "No stages","description": "No stages are defined for this rollout."}- }+ },+ "task": {+ "selected-count": "{count} task selected | {count} tasks selected",+ "no-tasks": "No tasks in this stage",+ "no-statement": "No SQL statement",+ "view-full-details": "View Full Details"+ },+ "no-stages": "No stages available"},"quick-action": {"create-db": "Create database",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex fac07c4f6c..6e7de07d1f 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -244,6 +244,8 @@"notification": "Se eliminó exitosamente el recurso '{name}'."},"collapse": "Colapsar",+ "show-more": "Mostrar más",+ "remaining": "restante","line": "Línea","column": "Columna","apply-to-database": "Aplicar a la base de datos"@@ -312,6 +314,7 @@"no-runnable-tasks": "No hay tareas ejecutables","no-skippable-tasks": "No hay tareas que se puedan omitir","no-cancellable-tasks": "No hay tareas cancelables",+ "no-selectable-tasks": "No se puede seleccionar ninguna tarea.","no-permission": "No hay permiso para realizar esta acción","data-export-creator-only": "Sólo el creador del problema puede ejecutar tareas de exportación de datos","scheduled-time": "Hora programada",@@ -342,6 +345,8 @@"failed-runs": "Tareas fallidas: últimos registros de ejecución","history": "Historial de ejecución de tareas","latest-logs": "Últimos registros",+ "latest": "Última ejecución",+ "no-detail": "No hay detalles de ejecución disponibles.","status": {"enqueued": "Esperando a ser ejecutada.","enqueued-with-rollout-time": "Esperando para ejecutar, {time} para ejecutar.",@@ -1203,11 +1208,21 @@"stage": {"self": "Escenario | Escenarios","start-stage": "Etapa de inicio",+ "run-stage": "Etapa de ejecución",+ "create-stage": "Crear etapa",+ "back-to-stage": "Volver a la etapa {stage}","no-stages": {"self": "Sin etapas","description": "No se definen etapas para este lanzamiento."}- }+ },+ "task": {+ "selected-count": "{count} tarea seleccionada | {count} tareas seleccionadas",+ "no-tasks": "No hay tareas en esta etapa",+ "no-statement": "Declaración sin SQL",+ "view-full-details": "Ver detalles completos"+ },+ "no-stages": "No hay etapas disponibles"},"quick-action": {"create-db": "Crear base de datos",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex f7105cac65..38c3193a6b 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -244,6 +244,8 @@"notification": "リソース '{name}' を正常に削除しました。"},"collapse": "閉じる",+ "show-more": "もっと見る",+ "remaining": "残り","line": "行","column": "列","apply-to-database": "データベースに適用"@@ -312,6 +314,7 @@"no-runnable-tasks": "実行可能なタスクはありません","no-skippable-tasks": "スキップ可能なタスクはありません","no-cancellable-tasks": "キャンセル可能なタスクはありません",+ "no-selectable-tasks": "タスクを選択できません","no-permission": "この操作を実行する権限がありません","data-export-creator-only": "問題作成者のみがデータエクスポートタスクを実行できます","scheduled-time": "予定時刻",@@ -342,6 +345,8 @@"failed-runs": "失敗したタスク - 最新の実行ログ","history": "タスク実行履歴","latest-logs": "最新のログ",+ "latest": "最新の実行",+ "no-detail": "実行の詳細は不明です","status": {"enqueued": "処刑を待っています。","enqueued-with-rollout-time": "実行を待機しています。{time} の後に実行されます。",@@ -1203,11 +1208,21 @@"stage": {"self": "ステージ | ステージ","start-stage": "スタートステージ",+ "run-stage": "ランステージ",+ "create-stage": "ステージを作成",+ "back-to-stage": "ステージに戻る {stage}","no-stages": {"self": "ステージなし","description": "このロールアウトにはステージが定義されていません。"}- }+ },+ "task": {+ "selected-count": "{count} 個のタスクが選択されました | {count} 個のタスクが選択されました",+ "no-tasks": "このステージにはタスクはありません",+ "no-statement": "SQL文なし",+ "view-full-details": "詳細を表示"+ },+ "no-stages": "利用可能なステージはありません"},"quick-action": {"create-db": "データベースの作成",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 016f8c926c..c64bd83c13 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -244,6 +244,8 @@"notification": "Xóa thành công tài nguyên '{name}'."},"collapse": "Sụp đổ",+ "show-more": "Hiển thị thêm",+ "remaining": "còn lại","line": "Dòng","column": "Cột","apply-to-database": "Áp dụng cho cơ sở dữ liệu"@@ -312,6 +314,7 @@"no-runnable-tasks": "Không có tác vụ nào có thể chạy được","no-skippable-tasks": "Không có nhiệm vụ nào có thể bỏ qua","no-cancellable-tasks": "Không có nhiệm vụ nào có thể hủy bỏ",+ "no-selectable-tasks": "Không thể chọn bất kỳ tác vụ nào","no-permission": "Không có quyền thực hiện hành động này","data-export-creator-only": "Chỉ người tạo sự cố mới có thể thực hiện tác vụ xuất dữ liệu","scheduled-time": "Thời gian đã lên lịch",@@ -342,6 +345,8 @@"failed-runs": "Nhiệm vụ thất bại - Nhật ký thực thi mới nhất","history": "Lịch sử thực hiện nhiệm vụ","latest-logs": "Nhật ký mới nhất",+ "latest": "Thực hiện mới nhất",+ "no-detail": "Không có thông tin chi tiết về việc thực hiện","status": {"enqueued": "Đang chờ thực thi.","enqueued-with-rollout-time": "Đang chờ thực thi sau {time}.",@@ -1203,11 +1208,21 @@"stage": {"self": "Giai đoạn | Các giai đoạn","start-stage": "Giai đoạn bắt đầu",+ "run-stage": "Chạy sân khấu",+ "create-stage": "Tạo sân khấu",+ "back-to-stage": "Trở lại sân khấu {stage}","no-stages": {"self": "Không có giai đoạn","description": "Không có giai đoạn nào được xác định cho lần triển khai này."}- }+ },+ "task": {+ "selected-count": "{count} nhiệm vụ đã chọn | {count} nhiệm vụ đã chọn",+ "no-tasks": "Không có nhiệm vụ nào ở giai đoạn này",+ "no-statement": "Không có câu lệnh SQL",+ "view-full-details": "Xem chi tiết đầy đủ"+ },+ "no-stages": "Không có giai đoạn nào có sẵn"},"quick-action": {"create-db": "Tạo cơ sở dữ liệu",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex d365567d09..d1e04962ee 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -244,6 +244,8 @@"notification": "成功删除资源“{name}”。"},"collapse": "收起",+ "show-more": "显示更多",+ "remaining": "剩余","line": "行","column": "列","apply-to-database": "应用到数据库"@@ -312,6 +314,7 @@"no-runnable-tasks": "没有可运行的任务","no-skippable-tasks": "没有可跳过的任务","no-cancellable-tasks": "没有可取消的任务",+ "no-selectable-tasks": "没有可选择的任务","no-permission": "无权限执行该操作","data-export-creator-only": "只有工单创建者可以执行数据导出任务","scheduled-time": "计划时间",@@ -342,6 +345,8 @@"failed-runs": "失败的任务 - 最新的执行日志","history": "执行记录","latest-logs": "执行日志",+ "latest": "最新执行",+ "no-detail": "暂无执行详情","status": {"enqueued": "等待执行。","enqueued-with-rollout-time": "等待执行,{time}后执行。",@@ -1203,11 +1208,21 @@"stage": {"self": "阶段 | 阶段","start-stage": "开始该阶段",+ "run-stage": "运行阶段",+ "create-stage": "创建阶段",+ "back-to-stage": "返回阶段 {stage}","no-stages": {"self": "没有阶段","description": "本次发布任务未定义任何阶段。"}- }+ },+ "task": {+ "selected-count": "已选择 {count} 个任务",+ "no-tasks": "此阶段没有任务",+ "no-statement": "没有 SQL 语句",+ "view-full-details": "查看完整详情"+ },+ "no-stages": "没有可用的阶段"},"quick-action": {"create-db": "创建数据库",diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.tsindex da9956c920..a48c149c89 100644--- a/frontend/src/router/dashboard/projectV1.ts+++ b/frontend/src/router/dashboard/projectV1.ts@@ -89,7 +89,7 @@ const cicdRoutes: RouteRecordRaw[] = [name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL,component: () =>import(- "@/components/Plan/components/RolloutView/RolloutView.vue"+ "@/components/Plan/components/RolloutView/v2/RolloutView.vue"),props: true,meta: {@@ -100,8 +100,13 @@ const cicdRoutes: RouteRecordRaw[] = [path: "stages/:stageId",name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,component: () =>- import("@/components/Plan/components/RolloutView/StageView.vue"),+ import(+ "@/components/Plan/components/RolloutView/v2/RolloutView.vue"+ ),props: true,+ meta: {+ requiredPermissionList: () => ["bb.rollouts.get"],+ },},{path: "stages/:stageId/tasks/:taskId",@@ -109,6 +114,9 @@ const cicdRoutes: RouteRecordRaw[] = [component: () =>import("@/components/Plan/components/RolloutView/TaskView.vue"),props: true,+ meta: {+ requiredPermissionList: () => ["bb.rollouts.get"],+ },},],},diff --git a/frontend/src/utils/v1/issue/rollout.ts b/frontend/src/utils/v1/issue/rollout.tsindex bba2b88b17..42154f8674 100644--- a/frontend/src/utils/v1/issue/rollout.ts+++ b/frontend/src/utils/v1/issue/rollout.ts@@ -78,6 +78,17 @@ export const taskV1Slug = (task: Task): string => {return extractTaskUID(task.name);};+/**+ * Extracts the stage resource name from a task resource name.+ * Task name format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}+ * Returns: projects/{project}/rollouts/{rollout}/stages/{stage}+ */+export const extractStageNameFromTaskName = (taskName: string): string => {+ const pattern = /^(.+\/stages\/[^/]+)\/tasks\/[^/]+$/;+ const matches = taskName.match(pattern);+ return matches?.[1] ?? "";+};+export const activeTaskInTaskList = (tasks: Task[]): Task => {// Focus on the running task first.const runningTask = tasks.find((task) => task.status === Task_Status.RUNNING);@@ -135,7 +146,7 @@ export const findTaskByName = (): Task => {for (const stage of rollout?.stages ?? []) {for (const task of stage.tasks) {- if (task.name == name) {+ if (task.name === name) {return task;}}diff --git a/frontend/src/views/project/RolloutDetailLayout.vue b/frontend/src/views/project/RolloutDetailLayout.vueindex 138adb0718..8614cff9e9 100644--- a/frontend/src/views/project/RolloutDetailLayout.vue+++ b/frontend/src/views/project/RolloutDetailLayout.vue@@ -1,71 +1,18 @@<template>- <div class="w-full flex flex-col">- <NBreadcrumb class="px-4 pt-2">- <NBreadcrumbItem :clickable="false">- {{ $t("common.rollout") }}- </NBreadcrumbItem>- <NBreadcrumbItem @click="navigateToRollout">- <span>{{ $t("rollout.stage.self", 2) }}</span>- <span v-if="rollout.stages.length > 1" class="opacity-80 ml-1"- >({{ rollout.stages.length }})</span- >- </NBreadcrumbItem>- <NBreadcrumbItem v-if="stageId" @click="navigateToStage">- <EnvironmentV1Name- v-if="stage"- :environment="- environmentStore.getEnvironmentByName(stage.environment)- "- :link="false"- />- <span v-else>{{ stageId }}</span>- </NBreadcrumbItem>- <NBreadcrumbItem v-if="taskId" :clickable="false">- {{ $t("common.task") }} #{{ taskId }}- </NBreadcrumbItem>- </NBreadcrumb>-- <!-- Main content -->- <div class="flex-1 min-h-0">- <router-view />- </div>- </div>+ <router-view /></template><script lang="ts" setup>-import { NBreadcrumb, NBreadcrumbItem } from "naive-ui";-import { computed, watchEffect } from "vue";-import { useRoute, useRouter } from "vue-router";+import { watchEffect } from "vue";import { usePlanContextWithRollout } from "@/components/Plan";import { provideRolloutViewContext } from "@/components/Plan/components/RolloutView/context";-import { EnvironmentV1Name } from "@/components/v2";-import {- PROJECT_V1_ROUTE_ROLLOUT_DETAIL,- PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,-} from "@/router/dashboard/projectV1";-import {- useCurrentProjectV1,- useEnvironmentV1Store,- usePolicyV1Store,-} from "@/store";+import { usePolicyV1Store } from "@/store";import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";-import { extractProjectResourceName } from "@/utils";-const route = useRoute();-const router = useRouter();const { rollout } = usePlanContextWithRollout();-const { project } = useCurrentProjectV1();-const environmentStore = useEnvironmentV1Store();const policyStore = usePolicyV1Store();-const { mergedStages } = provideRolloutViewContext();-// Route parameters-const rolloutId = computed(() => route.params.rolloutId as string);-const stageId = computed(() => route.params.stageId as string);-const taskId = computed(() => route.params.taskId as string);-const stage = computed(() =>- mergedStages.value.find((s) => s.name.endsWith(`/${stageId.value}`))-);+provideRolloutViewContext();// Prepare rollout policies for all stages in the rollout.watchEffect(() => {@@ -91,28 +38,4 @@ watchEffect(() => {});}});--// Navigation handlers-const navigateToRollout = () => {- router.push({- name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL,- params: {- projectId: extractProjectResourceName(project.value.name),- rolloutId: rolloutId.value,- },- });-};--const navigateToStage = () => {- if (!stageId.value) return;-- router.push({- name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,- params: {- projectId: extractProjectResourceName(project.value.name),- rolloutId: rolloutId.value,- stageId: stageId.value,- },- });-};</script>