Skip to content

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

chore: update task view in rollout (#16815)

boojack85f8290a2d26
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
index 4b764dc602..87c2a70166 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
@@ -180,21 +180,21 @@ const columns = computed(() => {
},
},
{
- key: "log-time",
- title: () => t("common.time"),
+ key: "duration",
+ title: () => t("common.duration"),
width: 120,
rowSpan,
render: (entry) => {
- return <LogTimeCell entry={entry} />;
+ return <DurationCell entry={entry} />;
},
},
{
- key: "duration",
- title: () => t("common.duration"),
+ key: "log-time",
+ title: () => t("common.time"),
width: 120,
rowSpan,
render: (entry) => {
- return <DurationCell entry={entry} />;
+ return <LogTimeCell entry={entry} />;
},
},
];
diff --git a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue b/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
index 886c78bb20..de207c7353 100644
--- a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
@@ -2,6 +2,14 @@
<div class="w-full h-full flex flex-col">
<!-- Content area -->
<div class="w-full flex-1 p-4">
+ <div class="flex items-center gap-1 mb-4 pl-4">
+ <h3 class="text-base font-medium">
+ {{ $t("rollout.stage.self", mergedStages.length) }}
+ </h3>
+ <span class="text-control-light" v-if="mergedStages.length > 1"
+ >({{ mergedStages.length }})</span
+ >
+ </div>
<StagesView
:rollout="rollout"
:merged-stages="mergedStages"
@@ -16,7 +24,8 @@
:show="runTasksPanel.show"
action="RUN"
:target="runTasksPanel.target"
- @close="handlePanelClose"
+ @confirm="handleTaskActionPanelConfirm"
+ @close="handleTaskActionPanelClose"
/>
</div>
</template>
@@ -83,7 +92,13 @@ const handleCreateRolloutToStage = async (stage: Stage) => {
}
};
-const handlePanelClose = () => {
+const handleTaskActionPanelConfirm = () => {
+ // Refresh the rollout data after task action is confirmed.
+ events.emit("status-changed", { eager: true });
+ handleTaskActionPanelClose();
+};
+
+const handleTaskActionPanelClose = () => {
runTasksPanel.value = {
show: false,
};
diff --git a/frontend/src/components/Plan/components/RolloutView/StageCard.vue b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
index a47a17ea1c..c99d7fefd6 100644
--- a/frontend/src/components/Plan/components/RolloutView/StageCard.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
@@ -26,118 +26,37 @@
</div>
<!-- Task status counts -->
- <div class="flex items-center gap-x-3 gap-y-2 flex-wrap">
- <NTag v-if="taskCounts.done > 0" round size="medium" type="default">
- <template #avatar>
- <TaskStatus :status="Task_Status.DONE" size="small" />
- </template>
- <div class="flex flex-row items-center gap-2">
- <span class="select-none text-base">{{
- stringifyTaskStatus(Task_Status.DONE)
- }}</span>
- <span class="select-none text-base font-medium">{{
- taskCounts.done
- }}</span>
- </div>
- </NTag>
- <NTag
- v-if="taskCounts.notStarted > 0"
- round
- size="medium"
- type="default"
- >
- <template #avatar>
- <TaskStatus :status="Task_Status.NOT_STARTED" size="small" />
- </template>
- <div class="flex flex-row items-center gap-2">
- <span class="select-none text-base">{{
- stringifyTaskStatus(Task_Status.NOT_STARTED)
- }}</span>
- <span class="select-none text-base font-medium">{{
- taskCounts.notStarted
- }}</span>
- </div>
- </NTag>
- <NTag v-if="taskCounts.running > 0" round size="medium" type="info">
- <template #avatar>
- <TaskStatus :status="Task_Status.RUNNING" size="small" />
- </template>
- <div class="flex flex-row items-center gap-2">
- <span class="select-none text-base">{{
- stringifyTaskStatus(Task_Status.RUNNING)
- }}</span>
- <span class="select-none text-base font-medium">{{
- taskCounts.running
- }}</span>
- </div>
- </NTag>
- <NTag v-if="taskCounts.failed > 0" round size="medium" type="error">
- <template #avatar>
- <TaskStatus :status="Task_Status.FAILED" size="small" />
- </template>
- <div class="flex flex-row items-center gap-2">
- <span class="select-none text-base">{{
- stringifyTaskStatus(Task_Status.FAILED)
- }}</span>
- <span class="select-none text-base font-medium">{{
- taskCounts.failed
- }}</span>
- </div>
- </NTag>
- <NTag
- v-if="taskCounts.canceled > 0"
- round
- size="medium"
- type="default"
- >
- <template #avatar>
- <TaskStatus :status="Task_Status.CANCELED" size="small" />
- </template>
- <div class="flex flex-row items-center gap-2">
- <span class="select-none text-base">{{
- stringifyTaskStatus(Task_Status.CANCELED)
- }}</span>
- <span class="select-none text-base font-medium">{{
- taskCounts.canceled
- }}</span>
- </div>
- </NTag>
- <NTag
- v-if="taskCounts.pending > 0"
- round
- size="medium"
- type="warning"
- >
- <template #avatar>
- <TaskStatus :status="Task_Status.PENDING" size="small" />
- </template>
- <div class="flex flex-row items-center gap-2">
- <span class="select-none text-base">{{
- stringifyTaskStatus(Task_Status.PENDING)
- }}</span>
- <span class="select-none text-base font-medium">{{
- taskCounts.pending
- }}</span>
- </div>
- </NTag>
- <NTag
- v-if="taskCounts.skipped > 0"
- round
- size="medium"
- type="default"
- >
- <template #avatar>
- <TaskStatus :status="Task_Status.SKIPPED" size="small" />
- </template>
- <div class="flex flex-row items-center gap-2">
- <span class="select-none text-base">{{
- stringifyTaskStatus(Task_Status.SKIPPED)
- }}</span>
- <span class="select-none text-base font-medium">{{
- taskCounts.skipped
- }}</span>
- </div>
- </NTag>
+ <div class="flex items-center gap-2 flex-wrap">
+ <template v-for="status in TASK_STATUS_FILTERS" :key="status">
+ <NTag
+ v-if="getTaskCount(status) > 0"
+ round
+ size="medium"
+ :type="
+ status === Task_Status.RUNNING
+ ? 'info'
+ : status === Task_Status.FAILED
+ ? 'error'
+ : status === Task_Status.PENDING
+ ? 'warning'
+ : 'default'
+ "
+ class="cursor-pointer hover:opacity-80 transition-opacity"
+ @click.stop="handleTaskStatusClick(status)"
+ >
+ <template #avatar>
+ <TaskStatus :status="status" size="small" />
+ </template>
+ <div class="flex flex-row items-center gap-2">
+ <span class="select-none text-base">{{
+ stringifyTaskStatus(status)
+ }}</span>
+ <span class="select-none text-base font-medium">{{
+ getTaskCount(status)
+ }}</span>
+ </div>
+ </NTag>
+ </template>
</div>
</div>
@@ -216,6 +135,16 @@ const emit = defineEmits<{
const { canPerformTaskAction } = useTaskActionPermissions();
+const TASK_STATUS_FILTERS: Task_Status[] = [
+ Task_Status.DONE,
+ Task_Status.RUNNING,
+ Task_Status.PENDING,
+ Task_Status.FAILED,
+ Task_Status.CANCELED,
+ Task_Status.NOT_STARTED,
+ Task_Status.SKIPPED,
+];
+
const isCreated = computed(() => {
return props.rollout.stages.some(
(stage) => stage.environment === props.stage.environment
@@ -262,45 +191,9 @@ const stageStatus = computed(() => {
return getStageStatus(stageWithFilteredTasks);
});
-const taskCounts = computed(() => {
- const counts = {
- done: 0,
- notStarted: 0,
- running: 0,
- failed: 0,
- canceled: 0,
- pending: 0,
- skipped: 0,
- };
-
- filteredTasks.value.forEach((task) => {
- switch (task.status) {
- case Task_Status.DONE:
- counts.done++;
- break;
- case Task_Status.NOT_STARTED:
- counts.notStarted++;
- break;
- case Task_Status.RUNNING:
- counts.running++;
- break;
- case Task_Status.FAILED:
- counts.failed++;
- break;
- case Task_Status.CANCELED:
- counts.canceled++;
- break;
- case Task_Status.PENDING:
- counts.pending++;
- break;
- case Task_Status.SKIPPED:
- counts.skipped++;
- break;
- }
- });
-
- return counts;
-});
+const getTaskCount = (status: Task_Status) => {
+ return filteredTasks.value.filter((task) => task.status === status).length;
+};
const handleRunAllTasks = () => {
emit("run-tasks", props.stage, runableTasks.value);
@@ -329,4 +222,27 @@ const handleClickStageTitle = () => {
},
});
};
+
+const handleTaskStatusClick = (status: Task_Status) => {
+ // Only navigate if the stage is created
+ if (!isCreated.value) return;
+
+ const rolloutId = props.rollout.name.split("/").pop();
+ const stageId = props.stage.name.split("/").pop();
+
+ if (!rolloutId || !stageId) return;
+
+ // Navigate to the stage detail route with task status filter
+ router.push({
+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(project.value.name),
+ rolloutId,
+ stageId,
+ },
+ query: {
+ taskStatus: Task_Status[status],
+ },
+ });
+};
</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/StageView.vue b/frontend/src/components/Plan/components/RolloutView/StageView.vue
index 6797ffd3ac..44b77e69f8 100644
--- a/frontend/src/components/Plan/components/RolloutView/StageView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StageView.vue
@@ -13,7 +13,7 @@
<div class="px-4">
<!-- Task Filter -->
<TaskFilter
- :rollout="rollout || emptyRollout"
+ :rollout="rollout"
:task-status-list="taskStatusFilter"
:stage="stage"
@update:task-status-list="taskStatusFilter = $event"
@@ -28,19 +28,13 @@
</template>
<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
import { NDivider, NTag } from "naive-ui";
-import { computed, ref, watchEffect } from "vue";
-import { useI18n } from "vue-i18n";
+import { computed, ref, watch } from "vue";
import { useRoute } from "vue-router";
-import { rolloutServiceClientConnect } from "@/grpcweb";
-import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";
-import type { Stage, Rollout } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- GetRolloutRequestSchema,
- RolloutSchema,
- Task_Status,
-} from "@/types/proto-es/v1/rollout_service_pb";
+import { useEnvironmentV1Store } from "@/store";
+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
+import { usePlanContextWithRollout } from "../../logic";
import TaskFilter from "./TaskFilter.vue";
import TaskTableView from "./TaskTableView.vue";
@@ -49,51 +43,37 @@ const props = defineProps<{
stageId: string;
}>();
-const { t: _t } = useI18n();
const route = useRoute();
-const { project } = useCurrentProjectV1();
const environmentStore = useEnvironmentV1Store();
+const { rollout } = usePlanContextWithRollout();
-const rolloutRef = ref<Rollout>();
-const routeStageRef = ref<Stage>();
-const taskStatusFilter = ref<Task_Status[]>([]);
-
-// Create an empty rollout for TaskFilter when rollout is not available
-const emptyRollout = create(RolloutSchema, {});
-
-// Get the stage - either from props or from fetched rollout
const stage = computed(() => {
- if (routeStageRef.value) return routeStageRef.value;
- return undefined;
+ return rollout.value.stages.find((s) => s.id === props.stageId) as Stage;
});
-// Get rollout
-const rollout = computed(() => rolloutRef.value);
-
-// Fetch rollout and stage when in route mode
-watchEffect(async () => {
- const rolloutId = props.rolloutId || (route.params.rolloutId as string);
- const stageId = props.stageId || (route.params.stageId as string);
-
- if (!rolloutId || !stageId) return;
+const taskStatusFilter = ref<Task_Status[]>([]);
- try {
- const rolloutName = `projects/${project.value.name.split("/")[1]}/rollouts/${rolloutId}`;
- const request = create(GetRolloutRequestSchema, { name: rolloutName });
- const rollout = await rolloutServiceClientConnect.getRollout(request);
- rolloutRef.value = rollout;
+// Watch for query parameter changes
+watch(
+ () => route.query.taskStatus,
+ (taskStatus) => {
+ if (taskStatus && typeof taskStatus === "string") {
+ // Find the Task_Status enum value from the string
+ const statusValue = Object.entries(Task_Status).find(
+ ([key]) => key === taskStatus
+ )?.[1];
- // Find the specific stage
- for (const rolloutStage of rollout.stages) {
- if (rolloutStage.name.endsWith(`/${stageId}`)) {
- routeStageRef.value = rolloutStage;
- return;
+ if (statusValue !== undefined && typeof statusValue === "number") {
+ taskStatusFilter.value = [statusValue as Task_Status];
+ } else {
+ taskStatusFilter.value = [];
}
+ } else {
+ taskStatusFilter.value = [];
}
- } catch (error) {
- console.error("Failed to fetch rollout:", error);
- }
-});
+ },
+ { immediate: true }
+);
// Stage environment info
const environmentTitle = computed(() => {
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue b/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
index 90c6144ad0..dacea370fd 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
@@ -5,7 +5,7 @@
{{ $t("common.tasks") }}
</h3>
</div>
- <div class="flex flex-row gap-1 items-center">
+ <div class="flex flex-row gap-2 items-center">
<template v-for="status in TASK_STATUS_FILTERS" :key="status">
<NTag
v-if="getTaskCount(status) > 0"
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue b/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
index adfa245a43..c3b71fbe12 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
@@ -43,6 +43,7 @@
:show="state.showActionPanel"
:action="state.selectedAction"
:target="actionTarget"
+ @confirm="handleActionPanelConfirm"
@close="handleActionPanelClose"
/>
</template>
@@ -81,11 +82,12 @@ interface LocalState {
const props = defineProps<{
tasks: Task[];
rollout: Rollout;
+ stage: Stage;
}>();
const emit = defineEmits<{
(event: "refresh"): void;
- (event: "task-action-completed"): void;
+ (event: "action-confirmed"): void;
}>();
const state = reactive<LocalState>({
@@ -98,24 +100,6 @@ const { project } = useCurrentProjectV1();
const planContext = usePlanContext();
const { canPerformTaskAction } = useTaskActionPermissions();
-// Get stages for selected tasks
-const selectedTaskStages = computed(() => {
- const stageMap = new Map<string, Stage>();
- props.rollout.stages.forEach((stage) => {
- stage.tasks.forEach((task) => {
- if (props.tasks.some((selectedTask) => selectedTask.name === task.name)) {
- stageMap.set(stage.name, stage);
- }
- });
- });
- return Array.from(stageMap.values());
-});
-
-// Check if selected tasks are from multiple stages (cross-stage)
-const isCrossStage = computed(() => {
- return selectedTaskStages.value.length > 1;
-});
-
// Permission checks for each action
const canRunTasks = computed(() => {
if (props.tasks.length === 0) return false;
@@ -149,7 +133,7 @@ const canCancelTasks = computed(() => {
// Action target for the panel
const actionTarget = computed(() => {
- if (!state.selectedAction || selectedTaskStages.value.length === 0) {
+ if (!state.selectedAction) {
return undefined;
}
@@ -158,13 +142,13 @@ const actionTarget = computed(() => {
return {
type: "tasks" as const,
tasks: props.tasks,
- stage: selectedTaskStages.value[0], // Use first stage for simplicity
+ stage: props.stage,
};
} else {
return {
type: "tasks" as const,
tasks: props.tasks,
- stage: selectedTaskStages.value[0], // Use first stage for simplicity
+ stage: props.stage,
};
}
});
@@ -196,9 +180,6 @@ const getDisabledTooltip = (_action: string) => {
if (props.tasks.length === 0) {
return t("task.no-tasks-selected");
}
- if (isCrossStage.value) {
- return t("task.cross-stage-not-supported");
- }
return "";
};
@@ -210,10 +191,7 @@ const actions = computed((): TaskAction[] => {
icon: h(PlayIcon),
text: t("common.run"),
disabled:
- props.tasks.length === 0 ||
- isCrossStage.value ||
- !canRunTasks.value ||
- !hasRunnableTasks.value,
+ props.tasks.length === 0 || !canRunTasks.value || !hasRunnableTasks.value,
click: () => {
state.selectedAction = "RUN";
state.showActionPanel = true;
@@ -222,9 +200,6 @@ const actions = computed((): TaskAction[] => {
if (props.tasks.length === 0) {
return getDisabledTooltip(action);
}
- if (isCrossStage.value) {
- return getDisabledTooltip(action);
- }
if (!canRunTasks.value) {
return t("task.no-permission");
}
@@ -241,7 +216,6 @@ const actions = computed((): TaskAction[] => {
text: t("common.skip"),
disabled:
props.tasks.length === 0 ||
- isCrossStage.value ||
!canSkipTasks.value ||
!hasSkippableTasks.value,
click: () => {
@@ -252,9 +226,6 @@ const actions = computed((): TaskAction[] => {
if (props.tasks.length === 0) {
return getDisabledTooltip(action);
}
- if (isCrossStage.value) {
- return getDisabledTooltip(action);
- }
if (!canSkipTasks.value) {
return t("task.no-permission");
}
@@ -271,7 +242,6 @@ const actions = computed((): TaskAction[] => {
text: t("common.cancel"),
disabled:
props.tasks.length === 0 ||
- isCrossStage.value ||
!canCancelTasks.value ||
!hasCancellableTasks.value,
click: () => {
@@ -282,9 +252,6 @@ const actions = computed((): TaskAction[] => {
if (props.tasks.length === 0) {
return getDisabledTooltip(action);
}
- if (isCrossStage.value) {
- return getDisabledTooltip(action);
- }
if (!canCancelTasks.value) {
return t("task.no-permission");
}
@@ -298,10 +265,14 @@ const actions = computed((): TaskAction[] => {
return resp;
});
+const handleActionPanelConfirm = () => {
+ emit("refresh");
+ emit("action-confirmed");
+ handleActionPanelClose();
+};
+
const handleActionPanelClose = () => {
state.showActionPanel = false;
state.selectedAction = undefined;
- emit("task-action-completed");
- emit("refresh");
};
</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
index 6cce30ee31..b7b85cefe5 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
@@ -166,9 +166,9 @@
</div>
<div v-else></div>
- <div class="flex justify-end gap-x-3">
- <NButton @click="$emit('close')">
- {{ $t("common.cancel") }}
+ <div class="flex justify-end gap-x-2">
+ <NButton quaternary @click="$emit('close')">
+ {{ $t("common.close") }}
</NButton>
<NTooltip :disabled="confirmErrors.length === 0" placement="top">
@@ -257,6 +257,7 @@ const props = defineProps<{
const emit = defineEmits<{
(event: "close"): void;
+ (event: "confirm"): void;
}>();
const { t } = useI18n();
@@ -480,6 +481,7 @@ const handleConfirm = async () => {
style: "SUCCESS",
title: t("common.success"),
});
+ emit("confirm");
} catch (error) {
pushNotification({
module: "bytebase",
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
index e1f55c0ad1..d2145b263c 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
@@ -69,7 +69,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
- "task-action-completed": [];
+ "action-confirmed": [];
}>();
const { t } = useI18n();
@@ -201,6 +201,6 @@ const handleDropdownSelect = (action: TaskStatusAction) => {
const handleActionPanelClose = () => {
showActionPanel.value = false;
selectedAction.value = undefined;
- emit("task-action-completed");
+ emit("action-confirmed");
};
</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
index d3aba162b8..232aa86d5c 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
@@ -28,11 +28,8 @@ import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
import { InstanceV1EngineIcon } from "@/components/v2";
import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL } from "@/router/dashboard/projectV1";
import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";
-import type {
- Task,
- Task_Status,
- Stage,
-} from "@/types/proto-es/v1/rollout_service_pb";
+import type { Task, Stage } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import {
extractProjectResourceName,
@@ -149,6 +146,9 @@ const columnList = computed((): DataTableColumn<Task>[] => {
{
type: "selection",
width: 50,
+ disabled: (task: Task) => {
+ return task.status === Task_Status.DONE;
+ },
cellProps: () => {
return {
onClick: (e: MouseEvent) => {
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue b/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue
index 9dd20a9941..175e855a11 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue
@@ -4,8 +4,9 @@
<TaskOperations
:tasks="selectedTasks"
:rollout="rollout"
+ :stage="props.stage"
@refresh="handleRefresh"
- @task-action-completed="handleTaskActionCompleted"
+ @action-confirmed="handleTaskActionConfirmed"
/>
<!-- Task Table -->
@@ -34,7 +35,7 @@ import TaskTable from "./TaskTable.vue";
const props = defineProps<{
taskStatusFilter: Task_Status[];
- stage?: Stage;
+ stage: Stage;
}>();
const { rollout, events } = usePlanContextWithRollout();
@@ -48,8 +49,8 @@ const handleRefresh = () => {
events.emit("status-changed", { eager: true });
};
-const handleTaskActionCompleted = () => {
- // Clear selection after action is completed
+const handleTaskActionConfirmed = () => {
+ // Clear selection after action is confirmed.
selectedTasks.value = [];
handleRefresh();
};
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskView.vue b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
index bc1442e408..d5e0d9a585 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
@@ -15,6 +15,15 @@
<ChevronRightIcon class="inline opacity-40 mx-1 w-5" />
<span class="font-medium">{{ database.databaseName }}</span>
</div>
+ <div class="flex flex-row gap-x-2">
+ <NTag round>{{ semanticTaskType(task.type) }}</NTag>
+ <NTooltip v-if="schemaVersion">
+ <template #trigger>
+ <NTag round>{{ schemaVersion }}</NTag>
+ </template>
+ {{ $t("common.version") }}
+ </NTooltip>
+ </div>
</div>
<!-- Task Status Actions -->
@@ -22,27 +31,28 @@
:task="task"
:task-runs="taskRuns"
:rollout="rollout"
- @task-action-completed="handleTaskActionCompleted"
+ @action-confirmed="handleTaskActionConfirmed"
/>
</div>
+ </div>
- <div class="flex flex-row gap-x-2">
- <NTag round>{{ semanticTaskType(task.type) }}</NTag>
- <NTooltip v-if="schemaVersion">
- <template #trigger>
- <NTag round>{{ schemaVersion }}</NTag>
- </template>
- {{ $t("common.version") }}
- </NTooltip>
+ <!-- Latest Task Run Detail -->
+ <div v-if="latestTaskRun" class="w-full">
+ <div class="flex items-center justify-between">
+ <span class="text-base font-medium">{{
+ $t("task-run.latest-logs")
+ }}</span>
</div>
+ <TaskRunDetail :task-run="latestTaskRun" :database="database" />
</div>
<!-- Task Runs Table -->
- <TaskRunTable
- v-if="taskRuns.length > 0"
- :task="task"
- :task-runs="taskRuns"
- />
+ <div v-if="taskRuns.length > 0" class="w-full">
+ <div class="flex items-center justify-between mb-2">
+ <span class="text-base font-medium">{{ $t("task-run.history") }}</span>
+ </div>
+ <TaskRunTable :task="task" :task-runs="taskRuns" />
+ </div>
<!-- Sheet Statement -->
<div class="w-full flex-1 min-h-0">
@@ -73,24 +83,16 @@ import { isEqual, sortBy } from "lodash-es";
import { ChevronRightIcon } from "lucide-vue-next";
import { NTag, NTooltip } from "naive-ui";
import { computed, ref, watchEffect } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRoute } from "vue-router";
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 { InstanceV1EngineIcon, CopyButton } from "@/components/v2";
import { rolloutServiceClientConnect } from "@/grpcweb";
import { useCurrentProjectV1, useSheetV1Store } from "@/store";
import { getDateForPbTimestampProtoEs, unknownTask } from "@/types";
-import type {
- Task,
- TaskRun,
- Rollout,
-} from "@/types/proto-es/v1/rollout_service_pb";
-import {
- ListTaskRunsRequestSchema,
- GetRolloutRequestSchema,
-} from "@/types/proto-es/v1/rollout_service_pb";
+import type { TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
+import { ListTaskRunsRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import {
extractSchemaVersionFromTask,
@@ -98,6 +100,7 @@ import {
sheetNameOfTaskV1,
isValidTaskName,
} from "@/utils";
+import { usePlanContextWithRollout } from "../../logic";
import TaskRunTable from "./TaskRunTable.vue";
import TaskStatusActions from "./TaskStatusActions.vue";
@@ -107,48 +110,18 @@ const props = defineProps<{
taskId: string;
}>();
-const { t: _t } = useI18n();
-const route = useRoute();
const { project } = useCurrentProjectV1();
+const { rollout } = usePlanContextWithRollout();
const sheetStore = useSheetV1Store();
const taskRunsRef = ref<TaskRun[]>([]);
-const rolloutRef = ref<Rollout>();
-const routeTaskRef = ref<Task>();
// Get the task - either from props or from fetched rollout
const task = computed(() => {
- if (routeTaskRef.value) return routeTaskRef.value;
- return unknownTask();
-});
-
-// Fetch rollout and task when in route mode
-watchEffect(async () => {
- const rolloutId = props.rolloutId || (route.params.rolloutId as string);
- const stageId = props.stageId || (route.params.stageId as string);
- const taskId = props.taskId || (route.params.taskId as string);
-
- if (!rolloutId || !stageId || !taskId) return;
-
- try {
- const rolloutName = `projects/${project.value.name.split("/")[1]}/rollouts/${rolloutId}`;
- const request = create(GetRolloutRequestSchema, { name: rolloutName });
- const rollout = await rolloutServiceClientConnect.getRollout(request);
- rolloutRef.value = rollout;
-
- // Find the specific task
- for (const stage of rollout.stages) {
- if (stage.name.endsWith(`/${stageId}`)) {
- for (const stageTask of stage.tasks) {
- if (stageTask.name.endsWith(`/${taskId}`)) {
- routeTaskRef.value = stageTask;
- return;
- }
- }
- }
- }
- } catch (error) {
- console.error("Failed to fetch rollout:", error);
- }
+ return (
+ rollout.value.stages
+ .find((s) => s.id === props.stageId)
+ ?.tasks.find((t) => t.name.endsWith(`/${props.taskId}`)) || unknownTask()
+ );
});
// Task basic info
@@ -197,12 +170,10 @@ watchEffect(async () => {
// Task run info
const taskRuns = computed(() => taskRunsRef.value);
-
-// Get the rollout for task status actions
-const rollout = computed(() => rolloutRef.value);
+const latestTaskRun = computed(() => taskRuns.value[0]);
// Handle task action completion to refresh data
-const handleTaskActionCompleted = async () => {
+const handleTaskActionConfirmed = async () => {
// Refresh task runs after action
if (isValidTaskName(task.value.name)) {
try {
@@ -219,32 +190,5 @@ const handleTaskActionCompleted = async () => {
console.error("Failed to refresh task runs:", error);
}
}
-
- const rolloutId = props.rolloutId || (route.params.rolloutId as string);
- const stageId = props.stageId || (route.params.stageId as string);
- const taskId = props.taskId || (route.params.taskId as string);
-
- if (rolloutId && stageId && taskId) {
- try {
- const rolloutName = `projects/${project.value.name.split("/")[1]}/rollouts/${rolloutId}`;
- const request = create(GetRolloutRequestSchema, { name: rolloutName });
- const rollout = await rolloutServiceClientConnect.getRollout(request);
- rolloutRef.value = rollout;
-
- // Update the task reference
- for (const stage of rollout.stages) {
- if (stage.name.endsWith(`/${stageId}`)) {
- for (const stageTask of stage.tasks) {
- if (stageTask.name.endsWith(`/${taskId}`)) {
- routeTaskRef.value = stageTask;
- return;
- }
- }
- }
- }
- } catch (error) {
- console.error("Failed to refresh rollout:", error);
- }
- }
};
</script>
diff --git a/frontend/src/components/Rollout/RolloutDataTable.vue b/frontend/src/components/Rollout/RolloutDataTable.vue
index 3bf23854f0..e77d5fb95b 100644
--- a/frontend/src/components/Rollout/RolloutDataTable.vue
+++ b/frontend/src/components/Rollout/RolloutDataTable.vue
@@ -107,8 +107,15 @@ const columnList = computed(
},
{
key: "stages",
- title: t("rollout.stage.stages"),
+ title: t("rollout.stage.self", 2),
render: (rollout) => {
+ if (rollout.stages.length === 0) {
+ return (
+ <span class="text-sm text-gray-400 italic">
+ {t("common.no-data")}
+ </span>
+ );
+ }
return (
<div class="flex items-center gap-2">
{rollout.stages.map((stage, index) => {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index c5abe13334..f8ff21c7e9 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -287,7 +287,6 @@
"no-runnable-tasks": "No runnable tasks",
"no-skippable-tasks": "No skippable tasks",
"no-cancellable-tasks": "No cancellable tasks",
- "cross-stage-not-supported": "Cross-stage operations not supported",
"no-permission": "No permission to perform this action",
"scheduled-time": "Scheduled time",
"select-scheduled-time": "Select scheduled time",
@@ -314,6 +313,8 @@
}
},
"task-run": {
+ "history": "Execution History",
+ "latest-logs": "Latest Logs",
"status": {
"enqueued": "Waiting for execution.",
"enqueued-with-rollout-time": "Waiting to execute after {time}.",
@@ -1128,7 +1129,7 @@
"rollouts": "Rollouts",
"force-rollout": "Force rollout",
"stage": {
- "stages": "Stages",
+ "self": "Stage | Stages",
"start-stage": "Start stage"
}
},
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index d23bc83d45..dd33d9ee54 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -287,7 +287,6 @@
"no-runnable-tasks": "No hay tareas ejecutables",
"no-skippable-tasks": "No hay tareas que se puedan omitir",
"no-cancellable-tasks": "No hay tareas cancelables",
- "cross-stage-not-supported": "No se admiten operaciones entre etapas",
"no-permission": "No hay permiso para realizar esta acción",
"scheduled-time": "Hora programada",
"select-scheduled-time": "Seleccionar hora programada",
@@ -314,6 +313,8 @@
}
},
"task-run": {
+ "history": "Historial de ejecución de tareas",
+ "latest-logs": "Últimos registros",
"status": {
"enqueued": "Esperando a ser ejecutada.",
"enqueued-with-rollout-time": "Esperando para ejecutar, {time} para ejecutar.",
@@ -1128,7 +1129,7 @@
"rollouts": "Despliegues",
"force-rollout": "Despliegue de fuerza",
"stage": {
- "stages": "Etapas",
+ "self": "Escenario | Escenarios",
"start-stage": "Etapa de inicio"
}
},
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 8cb2e29788..a703e4b8b0 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -287,7 +287,6 @@
"no-runnable-tasks": "実行可能なタスクはありません",
"no-skippable-tasks": "スキップ可能なタスクはありません",
"no-cancellable-tasks": "キャンセル可能なタスクはありません",
- "cross-stage-not-supported": "ステージ間の操作はサポートされていません",
"no-permission": "この操作を実行する権限がありません",
"scheduled-time": "予定時刻",
"select-scheduled-time": "予定時刻を選択してください",
@@ -314,6 +313,8 @@
}
},
"task-run": {
+ "history": "タスク実行履歴",
+ "latest-logs": "最新のログ",
"status": {
"enqueued": "処刑を待っています。",
"enqueued-with-rollout-time": "実行を待機しています。{time} の後に実行されます。",
@@ -1128,7 +1129,7 @@
"rollouts": "ロールアウト",
"force-rollout": "強制展開",
"stage": {
- "stages": "ステージ",
+ "self": "ステージ | ステージ",
"start-stage": "スタートステージ"
}
},
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index b8e02a8720..4ebee8f474 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -287,7 +287,6 @@
"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ỏ",
- "cross-stage-not-supported": "Hoạt động liên giai đoạn không được hỗ trợ",
"no-permission": "Không có quyền thực hiện hành động này",
"scheduled-time": "Thời gian đã lên lịch",
"select-scheduled-time": "Chọn thời gian đã lên lịch",
@@ -314,6 +313,8 @@
}
},
"task-run": {
+ "history": "Lịch sử thực hiện nhiệm vụ",
+ "latest-logs": "Nhật ký mới nhất",
"status": {
"enqueued": "Đang chờ thực thi.",
"enqueued-with-rollout-time": "Đang chờ thực thi sau {time}.",
@@ -1128,7 +1129,7 @@
"rollouts": "Triển khai",
"force-rollout": "Buộc triển khai",
"stage": {
- "stages": "Các giai đoạn",
+ "self": "Giai đoạn | Các giai đoạn",
"start-stage": "Giai đoạn bắt đầu"
}
},
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 5c7eaaf209..f515cb1f3b 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -287,7 +287,6 @@
"no-runnable-tasks": "没有可运行的任务",
"no-skippable-tasks": "没有可跳过的任务",
"no-cancellable-tasks": "没有可取消的任务",
- "cross-stage-not-supported": "不支持跨阶段操作",
"no-permission": "无权限执行该操作",
"scheduled-time": "计划时间",
"select-scheduled-time": "选择计划时间",
@@ -314,6 +313,8 @@
}
},
"task-run": {
+ "history": "执行记录",
+ "latest-logs": "执行日志",
"status": {
"enqueued": "等待执行。",
"enqueued-with-rollout-time": "等待执行,{time}后执行。",
@@ -1128,7 +1129,7 @@
"rollouts": "发布任务",
"force-rollout": "强制发布",
"stage": {
- "stages": "阶段",
+ "self": "阶段 | 阶段",
"start-stage": "开始该阶段"
}
},