Skip to content

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

refactor(frontend): improve RolloutView v2 maintainability (#18298)

boojack832144bfe60f
diff --git a/frontend/src/components/IssueV1/logic/rollout.ts b/frontend/src/components/IssueV1/logic/rollout.ts
index e18bf9998b..dd4183d08a 100644
--- a/frontend/src/components/IssueV1/logic/rollout.ts
+++ b/frontend/src/components/IssueV1/logic/rollout.ts
@@ -85,14 +85,16 @@ export const isTaskFinished = (task: Task): boolean => {
export const semanticTaskType = (type: Task_Type) => {
switch (type) {
case Task_Type.DATABASE_CREATE:
- return t("db.create");
+ return t("task.type.database-create");
case Task_Type.DATABASE_MIGRATE:
- // Ghost mode is indicated via spec.enableGhost, shown separately as a tag
- return t("issue.title.change-database");
+ return t("task.type.migrate");
case Task_Type.DATABASE_SDL:
- return "SDL";
+ return t("task.type.database-sdl");
case Task_Type.DATABASE_EXPORT:
- return t("issue.title.export-data");
+ return t("task.type.database-export");
+ case Task_Type.GENERAL:
+ return t("task.type.general");
+ default:
+ return "";
}
- return type.toString();
};
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/LatestTaskRunInfo.vue b/frontend/src/components/Plan/components/RolloutView/v2/LatestTaskRunInfo.vue
new file mode 100644
index 0000000000..b26fce9fdb
--- /dev/null
+++ b/frontend/src/components/Plan/components/RolloutView/v2/LatestTaskRunInfo.vue
@@ -0,0 +1,180 @@
+<template>
+ <div class="space-y-2">
+ <!-- Line 1: Title + Status + Timestamp + Metadata -->
+ <div class="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
+ <!-- Title -->
+ <span class="font-medium text-gray-700 shrink-0">{{
+ t("task-run.latest")
+ }}</span>
+ <span class="text-gray-300">·</span>
+ <!-- Status badge -->
+ <span class="flex items-center gap-x-1 shrink-0" :class="statusClass">
+ <component
+ :is="statusIcon"
+ class="w-4 h-4"
+ :class="{ 'animate-spin': taskStatus === Task_Status.RUNNING }"
+ />
+ <span>{{ statusText }}</span>
+ </span>
+ <span class="text-gray-300">·</span>
+ <!-- Timestamp -->
+ <span class="text-gray-500 shrink-0">
+ <Timestamp :timestamp="taskRun.updateTime" />
+ </span>
+ <!-- Metadata items -->
+ <template v-if="executorEmail">
+ <span class="text-gray-300">·</span>
+ <NTooltip>
+ <template #trigger>
+ <span class="flex items-center gap-x-1 text-gray-500 min-w-0 cursor-default">
+ <UserIcon class="w-3.5 h-3.5 shrink-0" />
+ <span class="truncate">{{ executorEmail }}</span>
+ </span>
+ </template>
+ {{ t("task.executed-by") }}
+ </NTooltip>
+ </template>
+ <template v-if="duration">
+ <span class="text-gray-300">·</span>
+ <NTooltip>
+ <template #trigger>
+ <span class="flex items-center gap-x-1 text-gray-500 shrink-0 cursor-default">
+ <ClockIcon class="w-3.5 h-3.5" />
+ {{ duration }}
+ </span>
+ </template>
+ {{ t("common.duration") }}
+ </NTooltip>
+ </template>
+ <template v-if="affectedRowsDisplay">
+ <span class="text-gray-300">·</span>
+ <NTooltip>
+ <template #trigger>
+ <span class="flex items-center gap-x-1 text-gray-500 shrink-0 cursor-default">
+ <RowsIcon class="w-3.5 h-3.5" />
+ {{ affectedRowsDisplay }}
+ </span>
+ </template>
+ {{ t("task.affected-rows") }}
+ </NTooltip>
+ </template>
+ </div>
+
+ <!-- Line 2: Task run logs -->
+ <TaskRunLogEntries
+ v-if="summary.latestEntries.length > 0"
+ :entries="summary.latestEntries"
+ :sheet="sheet"
+ class="pt-1"
+ />
+ </div>
+</template>
+
+<script lang="ts" setup>
+import {
+ CheckCircle2Icon,
+ CircleDotIcon,
+ ClockIcon,
+ LoaderCircleIcon,
+ Rows3Icon as RowsIcon,
+ UserIcon,
+ XCircleIcon,
+} from "lucide-vue-next";
+import { NTooltip } from "naive-ui";
+import type { Component } from "vue";
+import { computed } from "vue";
+import { useI18n } from "vue-i18n";
+import Timestamp from "@/components/misc/Timestamp.vue";
+import type { Task, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
+import { useTaskRunLogSummary } from "./composables/useTaskRunLogSummary";
+import TaskRunLogEntries from "./TaskRunLogEntries.vue";
+
+// Types
+interface StatusConfig {
+ icon: Component;
+ class: string;
+ textKey: string;
+}
+
+// Default status config
+const DEFAULT_STATUS_CONFIG: StatusConfig = {
+ icon: CircleDotIcon,
+ class: "text-gray-500",
+ textKey: "common.unknown",
+};
+
+// Constants
+const STATUS_CONFIG: Partial<Record<Task_Status, StatusConfig>> = {
+ [Task_Status.FAILED]: {
+ icon: XCircleIcon,
+ class: "text-red-600",
+ textKey: "common.failed",
+ },
+ [Task_Status.RUNNING]: {
+ icon: LoaderCircleIcon,
+ class: "text-blue-600",
+ textKey: "common.running",
+ },
+ [Task_Status.DONE]: {
+ icon: CheckCircle2Icon,
+ class: "text-green-600",
+ textKey: "common.success",
+ },
+ [Task_Status.PENDING]: {
+ icon: CircleDotIcon,
+ class: "text-gray-500",
+ textKey: "common.pending",
+ },
+ [Task_Status.SKIPPED]: {
+ icon: CircleDotIcon,
+ class: "text-gray-500",
+ textKey: "common.skipped",
+ },
+ [Task_Status.CANCELED]: {
+ icon: CircleDotIcon,
+ class: "text-gray-500",
+ textKey: "common.canceled",
+ },
+ [Task_Status.NOT_STARTED]: {
+ icon: CircleDotIcon,
+ class: "text-gray-500",
+ textKey: "common.pending",
+ },
+};
+
+// Props
+const props = defineProps<{
+ task: Task;
+ taskRun: TaskRun;
+ sheet?: Sheet;
+ executorEmail?: string;
+ duration?: string;
+}>();
+
+const { t } = useI18n();
+
+// Status display
+const taskStatus = computed(() => props.task.status);
+
+const statusConfig = computed(() => {
+ return STATUS_CONFIG[taskStatus.value] ?? DEFAULT_STATUS_CONFIG;
+});
+const statusIcon = computed(() => statusConfig.value.icon);
+const statusClass = computed(() => statusConfig.value.class);
+const statusText = computed(() => t(statusConfig.value.textKey));
+
+// Fetch and summarize task run log
+const { summary } = useTaskRunLogSummary(
+ () => props.taskRun,
+ () => true
+);
+
+const affectedRowsDisplay = computed(() => {
+ if (!summary.value.hasAffectedRows) return "";
+ const rows = summary.value.totalAffectedRows;
+ if (rows <= BigInt(0)) return "";
+ return `${rows.toLocaleString()} row${rows === BigInt(1) ? "" : "s"}`;
+});
+</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskItem.vue b/frontend/src/components/Plan/components/RolloutView/v2/TaskItem.vue
index 2097850950..f3ba34d263 100644
--- a/frontend/src/components/Plan/components/RolloutView/v2/TaskItem.vue
+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskItem.vue
@@ -85,13 +85,21 @@
</button>
</div>
- <!-- Collapsed: contextual status line (error/skip only) -->
+ <!-- Collapsed: contextual status line (time + error/skip) -->
<div
- v-if="!isExpanded && collapsedStatusText"
- class="text-xs truncate mt-1"
- :class="task.status === Task_Status.FAILED ? 'text-red-600' : 'text-gray-500 italic'"
+ v-if="!isExpanded && (latestTaskRun?.createTime || collapsedStatusText)"
+ class="flex items-center gap-x-2 text-xs mt-1"
>
- {{ collapsedStatusText }}
+ <NTag v-if="latestTaskRun?.createTime" size="tiny" round>
+ <Timestamp :timestamp="latestTaskRun.createTime" />
+ </NTag>
+ <span
+ v-if="collapsedStatusText"
+ class="truncate"
+ :class="task.status === Task_Status.FAILED ? 'text-red-600' : 'text-gray-500 italic'"
+ >
+ {{ collapsedStatusText }}
+ </span>
</div>
<!-- Task metadata - expanded only -->
@@ -100,8 +108,6 @@
<div class="flex items-center justify-between gap-x-2">
<div class="flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-gray-600">
<span>{{ t("common.type") }}: {{ taskTypeDisplay }}</span>
- <span v-if="executorEmail" class="text-gray-400">·</span>
- <span v-if="executorEmail">{{ t("task.executed-by") }}: {{ executorEmail }}</span>
<template v-if="timingType === 'scheduled'">
<span class="text-gray-400">·</span>
<ScheduledTimeIndicator
@@ -109,12 +115,6 @@
:label="t('task.scheduled-time')"
/>
</template>
- <template v-else-if="timingDisplay">
- <span class="text-gray-400">·</span>
- <span>{{ t("common.duration") }}: {{ timingDisplay }}</span>
- </template>
- <span v-if="affectedRowsDisplay" class="text-gray-400">·</span>
- <span v-if="affectedRowsDisplay">{{ t("task.affected-rows") }}: {{ affectedRowsDisplay }}</span>
</div>
<!-- Quick action buttons -->
<div v-if="hasActions" class="flex items-center gap-x-2 shrink-0">
@@ -188,46 +188,14 @@
</div>
<!-- Latest Task Run Info -->
- <div v-if="latestTaskRun">
- <div class="flex items-center gap-x-2 mb-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>
-
- <!-- Error message for failed tasks -->
- <div v-if="task.status === Task_Status.FAILED && latestTaskRun.detail" class="mb-2 p-2 bg-red-50 border border-red-200 rounded">
- <div class="text-sm text-red-600 whitespace-pre-wrap">
- {{ latestTaskRun.detail }}
- </div>
- </div>
-
- <!-- Waiting message for pending tasks -->
- <div v-else-if="waitingMessage" class="mb-2 p-2 bg-blue-50 border border-blue-200 rounded">
- <div class="text-sm text-blue-700 flex items-center gap-x-1">
- <span>⏳</span>
- <span>{{ waitingMessage }}</span>
- </div>
- </div>
-
- <!-- Success message with result summary -->
- <div v-else-if="task.status === Task_Status.DONE">
- <div class="flex items-center gap-x-2 text-sm text-green-700 mb-1">
- <span>✓</span>
- <span>{{ t("common.success") }}</span>
- <span v-if="resultSummary" class="text-gray-600">· {{ resultSummary }}</span>
- </div>
- </div>
-
- <!-- Default detail display for other statuses -->
- <div v-else-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>
+ <LatestTaskRunInfo
+ v-if="latestTaskRun"
+ :task="task"
+ :task-run="latestTaskRun"
+ :sheet="taskSheet"
+ :executor-email="executorEmail"
+ :duration="timingType !== 'scheduled' ? timingDisplay : undefined"
+ />
</div>
</div>
@@ -265,14 +233,16 @@ import { usePlanContextWithRollout } from "@/components/Plan";
import DatabaseDisplay from "@/components/Plan/components/common/DatabaseDisplay.vue";
import TaskRolloutActionPanel from "@/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue";
import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
-import { taskRunNamePrefix } from "@/store";
+import { taskRunNamePrefix, useSheetV1Store } from "@/store";
import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
+import { sheetNameOfTaskV1 } from "@/utils";
import { useTaskActions } from "./composables/useTaskActions";
import { useTaskDisplay } from "./composables/useTaskDisplay";
-import { useTaskRunSummary } from "./composables/useTaskRunSummary";
+import { useTaskRunLogSummary } from "./composables/useTaskRunLogSummary";
import { useTaskStatement } from "./composables/useTaskStatement";
import { useTaskTiming } from "./composables/useTaskTiming";
+import LatestTaskRunInfo from "./LatestTaskRunInfo.vue";
import ScheduledTimeIndicator from "./ScheduledTimeIndicator.vue";
const props = withDefaults(
@@ -331,6 +301,14 @@ const { loading, displayedStatement, isStatementTruncated } = useTaskStatement(
() => props.isExpanded
);
+// Get sheet for extracting individual commands in log display
+const sheetStore = useSheetV1Store();
+const taskSheet = computed(() => {
+ const sheetName = sheetNameOfTaskV1(props.task);
+ if (!sheetName) return undefined;
+ return sheetStore.getSheetByName(sheetName);
+});
+
const latestTaskRun = computed(() => {
const taskRunsForTask = allTaskRuns.value.filter((run) =>
run.name.startsWith(`${props.task.name}/${taskRunNamePrefix}`)
@@ -343,14 +321,15 @@ const { timingDisplay, timingType, scheduledTime } = useTaskTiming(
() => latestTaskRun.value
);
-const { totalAffectedRows } = useTaskRunSummary(
+const { summary: taskRunLogSummary } = useTaskRunLogSummary(
() => latestTaskRun.value,
() => props.isExpanded
);
const affectedRowsDisplay = computed(() => {
- const rows = totalAffectedRows.value;
- if (rows === undefined) return "";
+ if (!taskRunLogSummary.value.hasAffectedRows) return "";
+ const rows = taskRunLogSummary.value.totalAffectedRows;
+ if (rows <= BigInt(0)) return "";
return `${rows.toLocaleString()} row${rows === BigInt(1) ? "" : "s"}`;
});
@@ -358,8 +337,6 @@ const affectedRowsDisplay = computed(() => {
const {
taskTypeDisplay,
executorEmail,
- resultSummary,
- waitingMessage,
collapsedContextInfo,
collapsedStatusText,
} = useTaskDisplay(
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogEntries.vue b/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogEntries.vue
new file mode 100644
index 0000000000..7059ab3028
--- /dev/null
+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogEntries.vue
@@ -0,0 +1,240 @@
+<template>
+ <NVirtualList
+ v-if="entries.length > 0"
+ :items="entries"
+ :item-size="20"
+ item-resizable
+ class="w-full font-mono text-xs bg-gray-50 border border-gray-200 rounded p-2 max-h-48"
+ >
+ <template #default="{ item: entry }">
+ <div class="flex items-start gap-x-2 py-0.5">
+ <span class="text-gray-400 shrink-0">{{
+ formatLogTime(entry.logTime)
+ }}</span>
+ <span class="shrink-0" :class="getLogLevelClass(entry)"
+ >[{{ getLogLevel(entry) }}]</span
+ >
+ <span class="text-blue-600 shrink-0">{{
+ getEntryTypeLabel(entry)
+ }}</span>
+ <span :class="getLogDetailClass(entry)">{{
+ getEntryDetail(entry)
+ }}</span>
+ </div>
+ </template>
+ </NVirtualList>
+</template>
+
+<script lang="ts" setup>
+import type { Timestamp as PbTimestamp } from "@bufbuild/protobuf/wkt";
+import { NVirtualList } from "naive-ui";
+import { getDateForPbTimestampProtoEs } from "@/types";
+import type { TaskRunLogEntry } from "@/types/proto-es/v1/rollout_service_pb";
+import {
+ TaskRunLogEntry_TaskRunStatusUpdate_Status,
+ TaskRunLogEntry_TransactionControl_Type,
+ TaskRunLogEntry_Type,
+} from "@/types/proto-es/v1/rollout_service_pb";
+import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
+import { extractSheetCommandByIndex } from "@/utils";
+
+// Types
+type LogLevel = "ERR" | "WRN" | "INF";
+
+// Constants
+const LOG_LEVEL_CONFIG: Record<
+ LogLevel,
+ { levelClass: string; detailClass: string }
+> = {
+ ERR: { levelClass: "text-red-600", detailClass: "text-red-700" },
+ WRN: { levelClass: "text-yellow-600", detailClass: "text-yellow-700" },
+ INF: { levelClass: "text-green-600", detailClass: "text-gray-600" },
+};
+
+const ENTRY_TYPE_LABELS: Partial<Record<TaskRunLogEntry_Type, string>> = {
+ [TaskRunLogEntry_Type.COMMAND_EXECUTE]: "EXEC",
+ [TaskRunLogEntry_Type.SCHEMA_DUMP]: "DUMP",
+ [TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE]: "STATUS",
+ [TaskRunLogEntry_Type.TRANSACTION_CONTROL]: "TXN",
+ [TaskRunLogEntry_Type.DATABASE_SYNC]: "SYNC",
+ [TaskRunLogEntry_Type.PRIOR_BACKUP]: "BACKUP",
+ [TaskRunLogEntry_Type.COMPUTE_DIFF]: "DIFF",
+ [TaskRunLogEntry_Type.RETRY_INFO]: "RETRY",
+};
+
+const TXN_TYPE_LABELS: Partial<
+ Record<TaskRunLogEntry_TransactionControl_Type, string>
+> = {
+ [TaskRunLogEntry_TransactionControl_Type.BEGIN]: "BEGIN",
+ [TaskRunLogEntry_TransactionControl_Type.COMMIT]: "COMMIT",
+ [TaskRunLogEntry_TransactionControl_Type.ROLLBACK]: "ROLLBACK",
+};
+
+// Props
+const props = defineProps<{
+ entries: TaskRunLogEntry[];
+ sheet?: Sheet;
+}>();
+
+// Log display utilities
+const formatLogTime = (timestamp: PbTimestamp | undefined): string => {
+ if (!timestamp) return "--:--:--.---";
+ const date = getDateForPbTimestampProtoEs(timestamp);
+ if (!date) return "--:--:--.---";
+ return (
+ [
+ date.getHours().toString().padStart(2, "0"),
+ date.getMinutes().toString().padStart(2, "0"),
+ date.getSeconds().toString().padStart(2, "0"),
+ ].join(":") +
+ "." +
+ date.getMilliseconds().toString().padStart(3, "0")
+ );
+};
+
+const getLogLevel = (entry: TaskRunLogEntry): LogLevel => {
+ switch (entry.type) {
+ case TaskRunLogEntry_Type.COMMAND_EXECUTE:
+ if (entry.commandExecute?.response?.error) return "ERR";
+ break;
+ case TaskRunLogEntry_Type.TRANSACTION_CONTROL:
+ if (entry.transactionControl?.error) return "ERR";
+ if (
+ entry.transactionControl?.type ===
+ TaskRunLogEntry_TransactionControl_Type.ROLLBACK
+ ) {
+ return "WRN";
+ }
+ break;
+ case TaskRunLogEntry_Type.SCHEMA_DUMP:
+ if (entry.schemaDump?.error) return "ERR";
+ break;
+ case TaskRunLogEntry_Type.DATABASE_SYNC:
+ if (entry.databaseSync?.error) return "ERR";
+ break;
+ case TaskRunLogEntry_Type.PRIOR_BACKUP:
+ if (entry.priorBackup?.error) return "ERR";
+ break;
+ case TaskRunLogEntry_Type.RETRY_INFO:
+ return "WRN";
+ case TaskRunLogEntry_Type.COMPUTE_DIFF:
+ if (entry.computeDiff?.error) return "ERR";
+ break;
+ }
+ return "INF";
+};
+
+const getLogLevelClass = (entry: TaskRunLogEntry): string => {
+ return LOG_LEVEL_CONFIG[getLogLevel(entry)].levelClass;
+};
+
+const getLogDetailClass = (entry: TaskRunLogEntry): string => {
+ return LOG_LEVEL_CONFIG[getLogLevel(entry)].detailClass;
+};
+
+const getEntryTypeLabel = (entry: TaskRunLogEntry): string => {
+ return ENTRY_TYPE_LABELS[entry.type] ?? "LOG";
+};
+
+// Entry detail handlers
+const truncate = (str: string, maxLen: number): string => {
+ return str.length <= maxLen ? str : str.substring(0, maxLen) + "...";
+};
+
+const getCommandExecuteDetail = (entry: TaskRunLogEntry): string => {
+ const cmd = entry.commandExecute;
+ if (!cmd) return "";
+
+ // If error, show error message only
+ if (cmd.response?.error) {
+ return cmd.response.error;
+ }
+
+ // Try to get the actual statement
+ let statement: string | undefined;
+ if (cmd.statement) {
+ statement = cmd.statement;
+ } else if (cmd.commandIndexes.length > 0 && props.sheet) {
+ statement = extractSheetCommandByIndex(props.sheet, cmd.commandIndexes[0]);
+ }
+
+ if (statement) {
+ const stmt = statement.trim().replace(/\s+/g, " ");
+ return truncate(stmt, 60);
+ }
+
+ return "-";
+};
+
+const getTransactionControlDetail = (entry: TaskRunLogEntry): string => {
+ const txn = entry.transactionControl;
+ if (!txn) return "";
+ const typeStr = TXN_TYPE_LABELS[txn.type] ?? "";
+ return txn.error ? `${typeStr} error: ${txn.error}` : typeStr;
+};
+
+const getProgressDetail = (
+ data: { error?: string; startTime?: unknown; endTime?: unknown } | undefined,
+ progressText: string
+): string => {
+ if (!data) return "";
+ if (data.error) return data.error;
+ if (data.startTime && data.endTime) return "completed";
+ return progressText;
+};
+
+const getStatusUpdateDetail = (entry: TaskRunLogEntry): string => {
+ const status = entry.taskRunStatusUpdate;
+ if (!status) return "";
+ switch (status.status) {
+ case TaskRunLogEntry_TaskRunStatusUpdate_Status.RUNNING_WAITING:
+ return "waiting to execute";
+ case TaskRunLogEntry_TaskRunStatusUpdate_Status.RUNNING_RUNNING:
+ return "executing";
+ default:
+ return "status changed";
+ }
+};
+
+const getPriorBackupDetail = (entry: TaskRunLogEntry): string => {
+ const backup = entry.priorBackup;
+ if (!backup) return "";
+ if (backup.error) return backup.error;
+ const items = backup.priorBackupDetail?.items;
+ if (items?.length) {
+ return `completed (${items.length} tables backed up)`;
+ }
+ if (backup.startTime && backup.endTime) return "completed";
+ return "backing up...";
+};
+
+const getRetryInfoDetail = (entry: TaskRunLogEntry): string => {
+ const retry = entry.retryInfo;
+ if (!retry) return "";
+ const attempt = `attempt ${retry.retryCount}/${retry.maximumRetries}`;
+ return retry.error ? `${attempt} - ${retry.error}` : attempt;
+};
+
+const getEntryDetail = (entry: TaskRunLogEntry): string => {
+ switch (entry.type) {
+ case TaskRunLogEntry_Type.COMMAND_EXECUTE:
+ return getCommandExecuteDetail(entry);
+ case TaskRunLogEntry_Type.TRANSACTION_CONTROL:
+ return getTransactionControlDetail(entry);
+ case TaskRunLogEntry_Type.SCHEMA_DUMP:
+ return getProgressDetail(entry.schemaDump, "dumping...");
+ case TaskRunLogEntry_Type.DATABASE_SYNC:
+ return getProgressDetail(entry.databaseSync, "syncing...");
+ case TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE:
+ return getStatusUpdateDetail(entry);
+ case TaskRunLogEntry_Type.PRIOR_BACKUP:
+ return getPriorBackupDetail(entry);
+ case TaskRunLogEntry_Type.RETRY_INFO:
+ return getRetryInfoDetail(entry);
+ case TaskRunLogEntry_Type.COMPUTE_DIFF:
+ return getProgressDetail(entry.computeDiff, "computing...");
+ default:
+ return "";
+ }
+};
+</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageStatus.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageStatus.ts
index b019061c05..ecf72d8443 100644
--- a/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageStatus.ts
+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useStageStatus.ts
@@ -9,7 +9,7 @@ export interface UseStageStatusReturn {
/**
* Composable for computing stage status based on its tasks
- * Priority order follows TASK_STATUS_FILTERS: FAILED > RUNNING > PENDING > NOT_STARTED > CANCELED > SKIPPED > DONE
+ * Priority order follows TASK_STATUS_FILTERS: RUNNING > FAILED > PENDING > NOT_STARTED > CANCELED > DONE > SKIPPED
*/
export const useStageStatus = (
stage: ComputedRef<Stage> | Stage,
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskDisplay.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskDisplay.ts
index c914c9be70..9c397abbba 100644
--- a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskDisplay.ts
+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskDisplay.ts
@@ -9,8 +9,6 @@ const MAX_ERROR_PREVIEW_LENGTH = 100;
export interface UseTaskDisplayReturn {
taskTypeDisplay: ComputedRef<string>;
executorEmail: ComputedRef<string>;
- resultSummary: ComputedRef<string>;
- waitingMessage: ComputedRef<string>;
collapsedContextInfo: ComputedRef<string>;
collapsedStatusText: ComputedRef<string>;
}
@@ -50,40 +48,6 @@ export const useTaskDisplay = (
return match?.[1] || "";
});
- const resultSummary = computed(() => {
- const taskRun = latestTaskRun();
- if (!taskRun) return "";
-
- if (taskRun.schemaVersion) {
- return t("task.result.schema-version", {
- version: taskRun.schemaVersion,
- });
- }
- if (taskRun.exportArchiveStatus) {
- return t("task.result.export-archive-ready");
- }
- return "";
- });
-
- const waitingMessage = computed(() => {
- const taskRun = latestTaskRun();
- if (!taskRun || task().status !== Task_Status.PENDING) return "";
-
- const cause = taskRun.schedulerInfo?.waitingCause?.cause;
- if (!cause) return "";
-
- switch (cause.case) {
- case "connectionLimit":
- return t("task.waiting.connection-limit");
- case "parallelTasksLimit":
- return t("task.waiting.parallel-tasks-limit");
- case "task":
- return t("task.waiting.blocking-task");
- default:
- return "";
- }
- });
-
// Collapsed view: contextual info (duration, affected rows for completed tasks)
const collapsedContextInfo = computed(() => {
if (task().status !== Task_Status.DONE) return "";
@@ -119,8 +83,6 @@ export const useTaskDisplay = (
return {
taskTypeDisplay,
executorEmail,
- resultSummary,
- waitingMessage,
collapsedContextInfo,
collapsedStatusText,
};
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskRunLogSummary.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskRunLogSummary.ts
new file mode 100644
index 0000000000..0c6d7b465d
--- /dev/null
+++ b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskRunLogSummary.ts
@@ -0,0 +1,85 @@
+import type { ComputedRef, MaybeRefOrGetter } from "vue";
+import { computed, ref, toValue, watch } from "vue";
+import { useTaskRunLogStore } from "@/store/modules/v1/taskRunLog";
+import type {
+ TaskRun,
+ TaskRunLog,
+ TaskRunLogEntry,
+} from "@/types/proto-es/v1/rollout_service_pb";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
+
+export interface TaskRunLogSummary {
+ totalAffectedRows: bigint;
+ hasAffectedRows: boolean;
+ latestEntries: TaskRunLogEntry[];
+}
+
+export interface UseTaskRunLogSummaryReturn {
+ taskRunLog: ComputedRef<TaskRunLog | undefined>;
+ summary: ComputedRef<TaskRunLogSummary>;
+ isLoading: ComputedRef<boolean>;
+}
+
+/**
+ * Composable for fetching and summarizing task run logs.
+ * Provides affected rows count and log entries.
+ * Data is cached in the store, so multiple calls with the same taskRun are efficient.
+ */
+export const useTaskRunLogSummary = (
+ taskRun: MaybeRefOrGetter<TaskRun | undefined>,
+ shouldFetch: MaybeRefOrGetter<boolean>
+): UseTaskRunLogSummaryReturn => {
+ const taskRunLogStore = useTaskRunLogStore();
+ const isLoading = ref(false);
+
+ watch(
+ [() => toValue(taskRun)?.name, () => toValue(shouldFetch)],
+ async ([taskRunName, fetch]) => {
+ if (fetch && taskRunName) {
+ isLoading.value = true;
+ try {
+ await taskRunLogStore.fetchTaskRunLog(taskRunName);
+ } finally {
+ isLoading.value = false;
+ }
+ }
+ },
+ { immediate: true }
+ );
+
+ const taskRunLog = computed(() => {
+ const run = toValue(taskRun);
+ if (!run?.name) return undefined;
+ return taskRunLogStore.getTaskRunLog(run.name);
+ });
+
+ const summary = computed((): TaskRunLogSummary => {
+ const log = taskRunLog.value;
+ const result: TaskRunLogSummary = {
+ totalAffectedRows: BigInt(0),
+ hasAffectedRows: false,
+ latestEntries: [],
+ };
+
+ if (!log?.entries?.length) return result;
+
+ for (const entry of log.entries) {
+ if (entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE) {
+ const affectedRows = entry.commandExecute?.response?.affectedRows;
+ if (affectedRows !== undefined) {
+ result.totalAffectedRows += affectedRows;
+ result.hasAffectedRows = true;
+ }
+ }
+ }
+
+ result.latestEntries = [...log.entries].reverse();
+ return result;
+ });
+
+ return {
+ taskRunLog,
+ summary,
+ isLoading: computed(() => isLoading.value),
+ };
+};
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskRunSummary.ts b/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskRunSummary.ts
deleted file mode 100644
index 12a6fde49b..0000000000
--- a/frontend/src/components/Plan/components/RolloutView/v2/composables/useTaskRunSummary.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import type { ComputedRef } from "vue";
-import { computed, ref, watch } from "vue";
-import { useTaskRunLogStore } from "@/store/modules/v1/taskRunLog";
-import type { TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
-import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
-
-export interface UseTaskRunSummaryReturn {
- totalAffectedRows: ComputedRef<bigint | undefined>;
- isLoadingLog: ComputedRef<boolean>;
-}
-
-export const useTaskRunSummary = (
- latestTaskRun: () => TaskRun | undefined,
- isExpanded: () => boolean
-): UseTaskRunSummaryReturn => {
- const taskRunLogStore = useTaskRunLogStore();
- const isLoadingLog = ref(false);
-
- // Fetch log when expanded and has task run
- watch(
- [() => latestTaskRun()?.name, isExpanded],
- async ([taskRunName, expanded]) => {
- if (expanded && taskRunName) {
- isLoadingLog.value = true;
- try {
- await taskRunLogStore.fetchTaskRunLog(taskRunName);
- } finally {
- isLoadingLog.value = false;
- }
- }
- },
- { immediate: true }
- );
-
- const taskRunLog = computed(() => {
- const taskRun = latestTaskRun();
- if (!taskRun?.name) return undefined;
- return taskRunLogStore.getTaskRunLog(taskRun.name);
- });
-
- const totalAffectedRows = computed((): bigint | undefined => {
- const log = taskRunLog.value;
- if (!log?.entries?.length) return undefined;
-
- let total = BigInt(0);
- let hasAffectedRows = false;
-
- for (const entry of log.entries) {
- if (entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE) {
- const response = entry.commandExecute?.response;
- if (response?.affectedRows !== undefined) {
- total += response.affectedRows;
- hasAffectedRows = true;
- }
- }
- }
-
- return hasAffectedRows ? total : undefined;
- });
-
- return {
- totalAffectedRows,
- isLoadingLog: computed(() => isLoadingLog.value),
- };
-};
diff --git a/frontend/src/components/Plan/constants/task.ts b/frontend/src/components/Plan/constants/task.ts
index 2e267db28b..60302df8ba 100644
--- a/frontend/src/components/Plan/constants/task.ts
+++ b/frontend/src/components/Plan/constants/task.ts
@@ -6,6 +6,6 @@ export const TASK_STATUS_FILTERS: Task_Status[] = [
Task_Status.PENDING,
Task_Status.NOT_STARTED,
Task_Status.CANCELED,
- Task_Status.SKIPPED,
Task_Status.DONE,
+ Task_Status.SKIPPED,
];
diff --git a/frontend/src/components/misc/Timestamp.vue b/frontend/src/components/misc/Timestamp.vue
index 939c75f82c..88a823d051 100644
--- a/frontend/src/components/misc/Timestamp.vue
+++ b/frontend/src/components/misc/Timestamp.vue
@@ -1,17 +1,17 @@
<template>
- <NTooltip v-if="hasValidTimestamp" :disabled="!showTooltip">
+ <NTooltip v-if="hasValidTimestamp" :disabled="!showTooltip" class="text-sm">
<template #trigger>
- <span class="text-sm text-control-light" :class="customClass">
+ <span class="text-control-light" :class="customClass">
{{ humanizedTime }}
</span>
</template>
<template #default>
- <div class="text-sm whitespace-nowrap">
+ <div class="whitespace-nowrap">
{{ fullDateTime }}
</div>
</template>
</NTooltip>
- <span v-else class="text-sm text-control-light" :class="customClass">
+ <span v-else class="text-control-light" :class="customClass">
{{ fallbackText }}
</span>
</template>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index f0dea76343..58eb1cf71e 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -344,15 +344,6 @@
},
"executed-by": "Executed by",
"affected-rows": "Affected rows",
- "result": {
- "schema-version": "Schema: {version}",
- "export-archive-ready": "Archive: Ready for download"
- },
- "waiting": {
- "connection-limit": "Waiting for available connections",
- "parallel-tasks-limit": "Waiting for other tasks to complete",
- "blocking-task": "Waiting for another task"
- },
"type": {
"database-create": "Create Database",
"migrate": "Migrate",
@@ -366,7 +357,6 @@
"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}.",
@@ -1271,7 +1261,6 @@
"start-to-sync-schema": "Start to sync schema",
"failed-to-sync-schema": "Failed to sync schema",
"successfully-synced-schema": "Successfully synced schema",
- "create": "Create database",
"procedures": "Procedures",
"partitions": "Partitions",
"packages": "Packages",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 5868c51d04..b0efee1609 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -344,15 +344,6 @@
},
"executed-by": "Ejecutado por",
"affected-rows": "Filas afectadas",
- "result": {
- "schema-version": "Esquema: {version}",
- "export-archive-ready": "Archivo: Listo para descargar"
- },
- "waiting": {
- "connection-limit": "Esperando conexiones disponibles",
- "parallel-tasks-limit": "Esperando a que se completen otras tareas",
- "blocking-task": "Esperando otra tarea"
- },
"type": {
"database-create": "Crear base de datos",
"migrate": "Migrar",
@@ -366,7 +357,6 @@
"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.",
@@ -1271,7 +1261,6 @@
"start-to-sync-schema": "Comenzar a sincronizar el esquema",
"failed-to-sync-schema": "No se pudo sincronizar el esquema",
"successfully-synced-schema": "Esquema sincronizado correctamente",
- "create": "Crear base de datos",
"procedures": "Trámites",
"partitions": "Particiones",
"packages": "Paquetes",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index a796247040..233abe7022 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -344,15 +344,6 @@
},
"executed-by": "実行者",
"affected-rows": "影響を受けた行数",
- "result": {
- "schema-version": "スキーマ: {version}",
- "export-archive-ready": "アーカイブ: ダウンロード可能"
- },
- "waiting": {
- "connection-limit": "利用可能な接続を待機しています",
- "parallel-tasks-limit": "他のタスクが完了するのを待っています",
- "blocking-task": "別のタスクを待っています"
- },
"type": {
"database-create": "データベース作成",
"migrate": "マイグレーション",
@@ -366,7 +357,6 @@
"history": "タスク実行履歴",
"latest-logs": "最新のログ",
"latest": "最新の実行",
- "no-detail": "実行の詳細は不明です",
"status": {
"enqueued": "処刑を待っています。",
"enqueued-with-rollout-time": "実行を待機しています。{time} の後に実行されます。",
@@ -1271,7 +1261,6 @@
"start-to-sync-schema": "スキーマの同期を開始します",
"failed-to-sync-schema": "スキーマの同期に失敗しました",
"successfully-synced-schema": "スキーマの同期が完了しました",
- "create": "データベースの作成",
"procedures": "ストアドプロシージャ",
"partitions": "パーティション",
"packages": "パッケージ",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index fbc3715652..456b0c16e7 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -344,15 +344,6 @@
},
"executed-by": "Được thực hiện bởi",
"affected-rows": "Hàng bị ảnh hưởng",
- "result": {
- "schema-version": "Sơ đồ: {version}",
- "export-archive-ready": "Lưu trữ: Sẵn sàng để tải xuống"
- },
- "waiting": {
- "connection-limit": "Đang chờ kết nối khả dụng",
- "parallel-tasks-limit": "Đang chờ các tác vụ khác hoàn thành",
- "blocking-task": "Đang chờ nhiệm vụ khác"
- },
"type": {
"database-create": "Tạo cơ sở dữ liệu",
"migrate": "Di chuyển",
@@ -366,7 +357,6 @@
"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}.",
@@ -1271,7 +1261,6 @@
"start-to-sync-schema": "Bắt đầu đồng bộ hóa lược đồ",
"failed-to-sync-schema": "Không đồng bộ hóa được lược đồ",
"successfully-synced-schema": "Đã đồng bộ hóa lược đồ thành công",
- "create": "Tạo cơ sở dữ liệu",
"procedures": "Thủ tục",
"partitions": "Phân vùng",
"packages": "Gói",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index b099db05bc..c5e31efec2 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -344,15 +344,6 @@
},
"executed-by": "执行者",
"affected-rows": "影响行数",
- "result": {
- "schema-version": "版本: {version}",
- "export-archive-ready": "归档: 可下载"
- },
- "waiting": {
- "connection-limit": "等待可用连接",
- "parallel-tasks-limit": "等待其他任务完成",
- "blocking-task": "等待另一个任务"
- },
"type": {
"database-create": "创建数据库",
"migrate": "变更",
@@ -366,7 +357,6 @@
"history": "执行记录",
"latest-logs": "执行日志",
"latest": "最新执行",
- "no-detail": "暂无执行详情",
"status": {
"enqueued": "等待执行。",
"enqueued-with-rollout-time": "等待执行,{time}后执行。",
@@ -1271,7 +1261,6 @@
"start-to-sync-schema": "开始同步 schema",
"failed-to-sync-schema": "同步 schema 失败",
"successfully-synced-schema": "Schema 同步完成",
- "create": "创建数据库",
"procedures": "存储过程",
"partitions": "分区",
"packages": "包",
diff --git a/frontend/src/store/modules/v1/taskRunLog.ts b/frontend/src/store/modules/v1/taskRunLog.ts
index 027fe2a55a..8b300e463b 100644
--- a/frontend/src/store/modules/v1/taskRunLog.ts
+++ b/frontend/src/store/modules/v1/taskRunLog.ts
@@ -20,7 +20,6 @@ export const useTaskRunLogStore = defineStore("taskRunLog", () => {
// Return empty log if not found
const emptyLog = create(TaskRunLogSchema, {});
- taskRunLogByName.set(taskRunName, emptyLog);
return emptyLog;
};