Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore(frontend): task run log extended (#12694)
Liu Ji1ee3946a25dc
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DatabaseSyncCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DatabaseSyncCell.vuenew file mode 100644index 0000000000..40f0725891--- /dev/null+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DatabaseSyncCell.vue@@ -0,0 +1,26 @@+<template>+ <div class="text-sm">+ <div v-if="error" class="text-error">{{ error }}</div>+ <div v-else class="text-control-placeholder">-</div>+ </div>+</template>++<script setup lang="ts">+import { computed } from "vue";+import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";+import type { Sheet } from "@/types/proto/v1/sheet_service";+import type { FlattenLogEntry } from "../common";++const props = defineProps<{+ entry: FlattenLogEntry;+ sheet?: Sheet;+}>();++const error = computed(() => {+ const { type, databaseSync } = props.entry;+ if (type === TaskRunLogEntry_Type.DATABASE_SYNC && databaseSync) {+ return databaseSync.error;+ }+ return "";+});+</script>diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vueindex ffe5b4d82f..6eac2b5ba7 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue@@ -1,6 +1,12 @@<template><AffectedRowsCell v-if="view === 'AFFECTED_ROWS'" v-bind="props" /><ErrorCell v-if="view === 'ERROR'" v-bind="props" />+ <StatusUpdateCell v-if="view === 'STATUS_UPDATE'" v-bind="props" />+ <TransactionControlCell+ v-if="view === 'TRANSACTION_CONTROL'"+ v-bind="props"+ />+ <DatabaseSyncCell v-if="view === 'DATABASE_SYNC'" v-bind="props" /><div v-if="view === 'N/A'" class="text-control-placeholder">-</div></template>@@ -12,7 +18,13 @@ import type { FlattenLogEntry } from "../common";import AffectedRowsCell from "./AffectedRowsCell.vue";import ErrorCell from "./ErrorCell.vue";-type View = "N/A" | "ERROR" | "AFFECTED_ROWS";+type View =+ | "N/A"+ | "ERROR"+ | "AFFECTED_ROWS"+ | "STATUS_UPDATE"+ | "TRANSACTION_CONTROL"+ | "DATABASE_SYNC";const props = defineProps<{entry: FlattenLogEntry;@@ -20,12 +32,14 @@ const props = defineProps<{}>();const view = computed((): View => {- const { entry } = props;- if (- entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE &&- entry.commandExecute- ) {- const { commandExecute } = entry;+ const {+ type,+ commandExecute,+ taskRunStatusUpdate,+ transactionControl,+ databaseSync,+ } = props.entry;+ if (type === TaskRunLogEntry_Type.COMMAND_EXECUTE && commandExecute) {if (!commandExecute.raw.response) {return "N/A";}@@ -39,6 +53,18 @@ const view = computed((): View => {return "AFFECTED_ROWS";}}+ if (+ type === TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE &&+ taskRunStatusUpdate+ ) {+ return "STATUS_UPDATE";+ }+ if (type === TaskRunLogEntry_Type.TRANSACTION_CONTROL && transactionControl) {+ return "TRANSACTION_CONTROL";+ }+ if (type === TaskRunLogEntry_Type.DATABASE_SYNC && databaseSync) {+ return "DATABASE_SYNC";+ }return "N/A";});</script>diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/StatusUpdateCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/StatusUpdateCell.vuenew file mode 100644index 0000000000..d5274324b2--- /dev/null+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/StatusUpdateCell.vue@@ -0,0 +1,39 @@+<template>+ <div class="text-sm">+ <div v-if="status">{{ status }}</div>+ <div v-else class="text-control-placeholder">-</div>+ </div>+</template>++<script setup lang="ts">+import { computed } from "vue";+import { useI18n } from "vue-i18n";+import {+ TaskRunLogEntry_TaskRunStatusUpdate_Status,+ TaskRunLogEntry_Type,+} from "@/types/proto/v1/rollout_service";+import type { FlattenLogEntry } from "../common";++const props = defineProps<{+ entry: FlattenLogEntry;+}>();++const { t } = useI18n();++const status = computed(() => {+ const { type, taskRunStatusUpdate } = props.entry;+ if (+ type === TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE &&+ taskRunStatusUpdate+ ) {+ const { status } = taskRunStatusUpdate;+ if (status === TaskRunLogEntry_TaskRunStatusUpdate_Status.RUNNING_WAITING) {+ return t("issue.task-run.task-run-log.status-update.waiting");+ }+ if (status === TaskRunLogEntry_TaskRunStatusUpdate_Status.RUNNING_RUNNING) {+ return t("issue.task-run.task-run-log.status-update.running");+ }+ }+ return undefined;+});+</script>diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/TransactionControlCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/TransactionControlCell.vuenew file mode 100644index 0000000000..f39071c1f7--- /dev/null+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/TransactionControlCell.vue@@ -0,0 +1,56 @@+<template>+ <div class="text-sm">+ <div v-if="text">{{ text }}</div>+ <div v-else-if="error" class="text-error">{{ error }}</div>+ <div v-else class="text-control-placeholder">-</div>+ </div>+</template>++<script setup lang="ts">+import { computed } from "vue";+import {+ TaskRunLogEntry_TransactionControl_Type,+ TaskRunLogEntry_Type,+} from "@/types/proto/v1/rollout_service";+import type { Sheet } from "@/types/proto/v1/sheet_service";+import type { FlattenLogEntry } from "../common";++const props = defineProps<{+ entry: FlattenLogEntry;+ sheet?: Sheet;+}>();++const text = computed(() => {+ const { type, transactionControl } = props.entry;+ if (type === TaskRunLogEntry_Type.TRANSACTION_CONTROL && transactionControl) {+ if (transactionControl.error) {+ return "";+ }+ if (+ transactionControl.type === TaskRunLogEntry_TransactionControl_Type.BEGIN+ ) {+ return "BEGIN";+ }+ if (+ transactionControl.type === TaskRunLogEntry_TransactionControl_Type.COMMIT+ ) {+ return "COMMIT";+ }+ if (+ transactionControl.type ===+ TaskRunLogEntry_TransactionControl_Type.ROLLBACK+ ) {+ return "ROLLBACK";+ }+ }+ return "";+});++const error = computed(() => {+ const { type, transactionControl } = props.entry;+ if (type === TaskRunLogEntry_Type.TRANSACTION_CONTROL && transactionControl) {+ return transactionControl.error;+ }+ return "";+});+</script>diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DurationCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DurationCell.vueindex 5f6e06720d..0de2e2e1c0 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DurationCell.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DurationCell.vue@@ -1,13 +1,28 @@<template><div class="text-sm">- <div v-if="duration">- {{ humanizeDurationV1(duration) }}- </div>+ <NTooltip v-if="duration && entry.startTime && entry.endTime">+ <template #trigger>+ <span class="cursor-default">{{ humanizeDurationV1(duration) }}</span>+ </template>+ <template #default>+ <div>+ <p>+ Start:+ {{ dayjs(entry.startTime).format("YYYY-MM-DD HH:mm:ss.SSS UTCZZ") }}+ </p>+ <p>+ End:+ {{ dayjs(entry.endTime).format("YYYY-MM-DD HH:mm:ss.SSS UTCZZ") }}+ </p>+ </div>+ </template>+ </NTooltip><div v-else class="text-control-placeholder">-</div></div></template><script setup lang="ts">+import { NTooltip } from "naive-ui";import { computed } from "vue";import { Duration } from "@/types/proto/google/protobuf/duration";import type { FlattenLogEntry } from "./common";diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/LogTimeCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/LogTimeCell.vuenew file mode 100644index 0000000000..9809d21d22--- /dev/null+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/LogTimeCell.vue@@ -0,0 +1,20 @@+<template>+ <div class="text-sm">+ <HumanizeDate v-if="logTime" :date="logTime" format="YYYY-MM-DD HH:mm:ss.SSS UTCZZ" />+ <div v-else class="text-control-placeholder">-</div>+ </div>+</template>++<script setup lang="ts">+import { computed } from "vue";+import HumanizeDate from "@/components/misc/HumanizeDate.vue";+import type { FlattenLogEntry } from "./common";++const props = defineProps<{+ entry: FlattenLogEntry;+}>();++const logTime = computed(() => {+ return props.entry.startTime;+});+</script>diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vueindex 2eacc4083d..78b694633f 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue@@ -23,8 +23,9 @@ import {import { sheetNameOfTaskV1 } from "@/utils";import DetailCell, { detailCellRowSpan } from "./DetailCell";import DurationCell from "./DurationCell.vue";+import LogTimeCell from "./LogTimeCell.vue";import StatementCell from "./StatementCell.vue";-import { type FlattenLogEntry } from "./common";+import { type FlattenLogEntry, displayTaskRunLogEntryType } from "./common";const props = defineProps<{taskRun: TaskRun;@@ -69,8 +70,51 @@ const logEntries = computed(() => {const flattenLogEntries = computed(() => {const flattenEntries: FlattenLogEntry[] = [];logEntries.value.forEach((entry, batch) => {- if (entry.type === TaskRunLogEntry_Type.SCHEMA_DUMP && entry.schemaDump) {- const { schemaDump } = entry;+ const {+ type,+ taskRunStatusUpdate,+ schemaDump,+ commandExecute,+ transactionControl,+ databaseSync,+ } = entry;+ if (+ type === TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE &&+ taskRunStatusUpdate+ ) {+ flattenEntries.push({+ batch,+ serial: 0,+ type: TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE,+ startTime: entry.logTime,+ endTime: undefined,+ taskRunStatusUpdate,+ });+ }+ if (type === TaskRunLogEntry_Type.DATABASE_SYNC && databaseSync) {+ flattenEntries.push({+ batch,+ serial: 0,+ type: TaskRunLogEntry_Type.DATABASE_SYNC,+ startTime: databaseSync.startTime,+ endTime: databaseSync.endTime,+ databaseSync,+ });+ }+ if (+ type === TaskRunLogEntry_Type.TRANSACTION_CONTROL &&+ transactionControl+ ) {+ flattenEntries.push({+ batch,+ serial: 0,+ type: TaskRunLogEntry_Type.TRANSACTION_CONTROL,+ startTime: entry.logTime,+ endTime: undefined,+ transactionControl,+ });+ }+ if (type === TaskRunLogEntry_Type.SCHEMA_DUMP && schemaDump) {flattenEntries.push({batch,serial: 0,@@ -80,15 +124,14 @@ const flattenLogEntries = computed(() => {schemaDump,});}- if (- entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE &&- entry.commandExecute- ) {- const { commandExecute } = entry;+ if (type === TaskRunLogEntry_Type.COMMAND_EXECUTE && commandExecute) {const { response, logTime: startTime } = commandExecute;commandExecute.commandIndexes.forEach((commandIndex, serial) => {let affectedRows = response?.affectedRows;- if (commandExecute.commandIndexes.length === response?.allAffectedRows.length) {+ if (+ commandExecute.commandIndexes.length ===+ response?.allAffectedRows.length+ ) {affectedRows = response?.allAffectedRows[serial] ?? affectedRows;}const endTime = response?.logTime;@@ -143,7 +186,7 @@ const columns = computed(() => {const columns: (DataTableColumn<FlattenLogEntry> & { hide?: boolean })[] = [{key: "batch",- title: () => t("issue.task-run.task-run-log.batch"),+ title: () => "",width: 50,className: "whitespace-nowrap",titleColSpan: splitBatchAndSerialCol ? 2 : 1,@@ -158,7 +201,7 @@ const columns = computed(() => {},{key: "serial",- title: () => "serial",+ title: () => "",width: 50,className: "whitespace-nowrap",hide: !splitBatchAndSerialCol,@@ -172,12 +215,7 @@ const columns = computed(() => {width: 120,className: "whitespace-nowrap",render: (entry) => {- const text =- entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE- ? t("issue.task-run.task-run-log.entry-type.command-execute")- : entry.type === TaskRunLogEntry_Type.SCHEMA_DUMP- ? t("issue.task-run.task-run-log.entry-type.schema-dump")- : "";+ const text = displayTaskRunLogEntryType(entry.type);if (text) {return <span class="text-sm">{text}</span>;}@@ -187,7 +225,7 @@ const columns = computed(() => {{key: "statement",title: () => t("common.statement"),- width: '60%',+ width: "60%",render: (entry) => {return <StatementCell entry={entry} sheet={sheet.value} />;},@@ -195,12 +233,21 @@ const columns = computed(() => {{key: "detail",title: () => t("common.detail"),- width: '40%',+ width: "40%",rowSpan: detailCellRowSpan,render: (entry) => {return <DetailCell entry={entry} sheet={sheet.value} />;},},+ {+ key: "log-time",+ title: () => t("common.time"),+ width: 120,+ rowSpan,+ render: (entry) => {+ return <LogTimeCell entry={entry} />;+ },+ },{key: "duration",title: () => t("common.duration"),diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.tsindex a19ac2d62b..343e887205 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts@@ -1,7 +1,12 @@-import type {- TaskRunLogEntry_CommandExecute,- TaskRunLogEntry_SchemaDump,+import { t } from "@/plugins/i18n";+import {TaskRunLogEntry_Type,+ taskRunLogEntry_TypeToJSON,+ type TaskRunLogEntry_CommandExecute,+ type TaskRunLogEntry_SchemaDump,+ type TaskRunLogEntry_TaskRunStatusUpdate,+ type TaskRunLogEntry_TransactionControl,+ type TaskRunLogEntry_DatabaseSync,} from "@/types/proto/v1/rollout_service";export type FlattenLogEntry = {@@ -16,4 +21,30 @@ export type FlattenLogEntry = {commandIndex: number;affectedRows?: number;};+ taskRunStatusUpdate?: TaskRunLogEntry_TaskRunStatusUpdate;+ transactionControl?: TaskRunLogEntry_TransactionControl;+ databaseSync?: TaskRunLogEntry_DatabaseSync;+};++export const displayTaskRunLogEntryType = (type: TaskRunLogEntry_Type) => {+ if (type === TaskRunLogEntry_Type.COMMAND_EXECUTE) {+ return t("issue.task-run.task-run-log.entry-type.command-execute");+ }+ if (type === TaskRunLogEntry_Type.SCHEMA_DUMP) {+ return t("issue.task-run.task-run-log.entry-type.schema-dump");+ }+ if (type === TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE) {+ return t("issue.task-run.task-run-log.entry-type.task-run-status-update");+ }+ if (type === TaskRunLogEntry_Type.TRANSACTION_CONTROL) {+ return t("issue.task-run.task-run-log.entry-type.transaction-control");+ }+ if (type === TaskRunLogEntry_Type.DATABASE_SYNC) {+ return t("issue.task-run.task-run-log.entry-type.database-sync");+ }++ console.warn(+ `[displayTaskRunLogEntryType] should never reach this line: type=${taskRunLogEntry_TypeToJSON(type)}`+ );+ return "";};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 6611ffe97e..ae833a7ce2 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1242,9 +1242,16 @@"affected-rows": "Affected rows","entry-type": {"command-execute": "Command execute",- "schema-dump": "Schema dump"+ "schema-dump": "Schema dump",+ "task-run-status-update": "Status update",+ "transaction-control": "Transaction control",+ "database-sync": "Database sync"},- "affected-rows-n": "Affected rows: {n}"+ "affected-rows-n": "Affected rows: {n}",+ "status-update": {+ "waiting": "Ready to be executed",+ "running": "Being executed"+ }}},"sql-review": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex a0492a3056..bed526840c 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1242,9 +1242,16 @@"affected-rows": "Filas afectadas","entry-type": {"command-execute": "ejecutar comando",- "schema-dump": "Volcado de esquema"+ "schema-dump": "Volcado de esquema",+ "task-run-status-update": "Actualización de estado",+ "transaction-control": "Control de transacciones",+ "database-sync": "Sincronización de base de datos"},- "affected-rows-n": "Filas afectadas: {n}"+ "affected-rows-n": "Filas afectadas: {n}",+ "status-update": {+ "waiting": "Listo para ser ejecutado",+ "running": "Ser ejecutado"+ }}},"sql-review": {@@ -3600,4 +3607,4 @@"self": "Última actualización"}}-}\ No newline at end of file+}diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 8739c6b49f..a3e133a425 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1242,9 +1242,16 @@"affected-rows": "影響を受ける行","entry-type": {"command-execute": "コマンド実行",- "schema-dump": "スキーマダンプ"+ "schema-dump": "スキーマダンプ",+ "task-run-status-update": "ステータスアップデート",+ "transaction-control": "トランザクション制御",+ "database-sync": "データベースの同期"},- "affected-rows-n": "影響を受ける行: {n}"+ "affected-rows-n": "影響を受ける行: {n}",+ "status-update": {+ "waiting": "実行の準備完了",+ "running": "処刑される"+ }}},"sql-review": {@@ -3600,4 +3607,4 @@"self": "最後の更新"}}-}\ No newline at end of file+}diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex bed88ec72e..e653d9f1ef 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1242,9 +1242,16 @@"affected-rows": "影响行数","entry-type": {"command-execute": "执行指令",- "schema-dump": "导出 schema"+ "schema-dump": "导出 schema",+ "task-run-status-update": "状态更新",+ "transaction-control": "事务控制",+ "database-sync": "数据库同步"},- "affected-rows-n": "影响行数:{n}"+ "affected-rows-n": "影响行数:{n}",+ "status-update": {+ "waiting": "准备就绪,等待执行",+ "running": "开始执行"+ }}},"sql-review": {@@ -3600,4 +3607,4 @@"self": "最后更新"}}-}\ No newline at end of file+}