Skip to content

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

feat: show task run log error (#11984)

Liu Ji0367a293d488
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/AffectedRowsCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/AffectedRowsCell.vue
similarity index 80%
rename from frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/AffectedRowsCell.vue
rename to frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/AffectedRowsCell.vue
index 00ba10a21d..2cc14906ae 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/AffectedRowsCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/AffectedRowsCell.vue
@@ -1,6 +1,10 @@
<template>
<div class="text-sm">
- <div v-if="!isNaN(affectedRows)">{{ affectedRows }}</div>
+ <div v-if="!isNaN(affectedRows)">
+ {{
+ $t("issue.task-run.task-run-log.affected-rows-n", { n: affectedRows })
+ }}
+ </div>
<div v-else class="text-control-placeholder">-</div>
</div>
</template>
@@ -9,7 +13,7 @@
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";
+import type { FlattenLogEntry } from "../common";
const props = defineProps<{
entry: FlattenLogEntry;
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue
new file mode 100644
index 0000000000..ffe5b4d82f
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue
@@ -0,0 +1,44 @@
+<template>
+ <AffectedRowsCell v-if="view === 'AFFECTED_ROWS'" v-bind="props" />
+ <ErrorCell v-if="view === 'ERROR'" v-bind="props" />
+ <div v-if="view === 'N/A'" class="text-control-placeholder">-</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";
+import AffectedRowsCell from "./AffectedRowsCell.vue";
+import ErrorCell from "./ErrorCell.vue";
+
+type View = "N/A" | "ERROR" | "AFFECTED_ROWS";
+
+const props = defineProps<{
+ entry: FlattenLogEntry;
+ sheet?: Sheet;
+}>();
+
+const view = computed((): View => {
+ const { entry } = props;
+ if (
+ entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE &&
+ entry.commandExecute
+ ) {
+ const { commandExecute } = entry;
+ if (!commandExecute.raw.response) {
+ return "N/A";
+ }
+ if (commandExecute.raw.response.error) {
+ return "ERROR";
+ }
+ if (typeof commandExecute.affectedRows !== "undefined") {
+ return "AFFECTED_ROWS";
+ }
+ if (typeof commandExecute.raw.response.affectedRows !== "undefined") {
+ return "AFFECTED_ROWS";
+ }
+ }
+ return "N/A";
+});
+</script>
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/ErrorCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/ErrorCell.vue
new file mode 100644
index 0000000000..57181c0623
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/ErrorCell.vue
@@ -0,0 +1,28 @@
+<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 { FlattenLogEntry } from "../common";
+
+const props = defineProps<{
+ entry: FlattenLogEntry;
+}>();
+
+const error = computed(() => {
+ const { entry } = props;
+ if (
+ entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE &&
+ entry.commandExecute
+ ) {
+ const exec = entry.commandExecute;
+ return exec.raw.response?.error;
+ }
+ return undefined;
+});
+</script>
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/common.ts b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/common.ts
new file mode 100644
index 0000000000..9c4c6b292e
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/common.ts
@@ -0,0 +1,24 @@
+import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import type { FlattenLogEntry } from "../common";
+
+export const detailCellRowSpan = (entry: FlattenLogEntry) => {
+ if (
+ entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE &&
+ entry.commandExecute
+ ) {
+ const { commandExecute } = entry;
+ if (typeof commandExecute.affectedRows !== "undefined") {
+ // Has detailed affectedRows for each command
+ return 1;
+ }
+ if (!commandExecute.raw.response) {
+ // Not finished yet, combine several rows
+ return commandExecute.raw.commandIndexes.length;
+ }
+ if (commandExecute.raw.response.error) {
+ // Error, combine several rows
+ return commandExecute.raw.commandIndexes.length;
+ }
+ }
+ return 1;
+};
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/index.ts b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/index.ts
new file mode 100644
index 0000000000..856e40b84a
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/index.ts
@@ -0,0 +1,5 @@
+import DetailCell from "./DetailCell.vue";
+
+export * from "./common";
+
+export default DetailCell;
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
index 50f0a0b1ff..7616acf0e3 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
@@ -21,7 +21,7 @@ import {
TaskRunLogEntry_Type,
} from "@/types/proto/v1/rollout_service";
import { sheetNameOfTaskV1 } from "@/utils";
-import AffectedRowsCell from "./AffectedRowsCell.vue";
+import DetailCell, { detailCellRowSpan } from "./DetailCell";
import DurationCell from "./DurationCell.vue";
import StatementCell from "./StatementCell.vue";
import { type FlattenLogEntry } from "./common";
@@ -184,16 +184,18 @@ const columns = computed(() => {
{
key: "statement",
title: () => t("common.statement"),
+ width: '60%',
render: (entry) => {
return <StatementCell entry={entry} sheet={sheet.value} />;
},
},
{
- key: "affected-rows",
- title: () => t("issue.task-run.task-run-log.affected-rows"),
- width: 120,
+ key: "detail",
+ title: () => t("common.detail"),
+ width: '40%',
+ rowSpan: detailCellRowSpan,
render: (entry) => {
- return <AffectedRowsCell entry={entry} sheet={sheet.value} />;
+ return <DetailCell entry={entry} sheet={sheet.value} />;
},
},
{
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index da8b52d9a1..0cf02c6f4b 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1204,7 +1204,8 @@
"entry-type": {
"command-execute": "Command execute",
"schema-dump": "Schema dump"
- }
+ },
+ "affected-rows-n": "Affected rows: {n}"
}
}
},
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 8fef770dc9..1ed2b06e1b 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1204,7 +1204,8 @@
"entry-type": {
"command-execute": "ejecutar comando",
"schema-dump": "Volcado de esquema"
- }
+ },
+ "affected-rows-n": "Filas afectadas: {n}"
}
}
},
@@ -3503,4 +3504,4 @@
"drop-partition-with-subpartitions-confirm": "También eliminará todas sus subparticiones."
}
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 1a75ed861c..5bba80080a 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1204,7 +1204,8 @@
"entry-type": {
"command-execute": "コマンド実行",
"schema-dump": "スキーマダンプ"
- }
+ },
+ "affected-rows-n": "影響を受ける行: {n}"
}
}
},
@@ -3503,4 +3504,4 @@
"drop-partition-with-subpartitions-confirm": "すべてのサブパーティションが同時に削除されます。"
}
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 5ea816a00c..285aa62aaf 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1204,7 +1204,8 @@
"entry-type": {
"command-execute": "Thực thi lệnh",
"schema-dump": "Kết xuất lược đồ"
- }
+ },
+ "affected-rows-n": "Các hàng bị ảnh hưởng: {n}"
}
}
},
@@ -3503,4 +3504,4 @@
"drop-partition-with-subpartitions-confirm": "Cũng sẽ bỏ tất cả các phân vùng của nó."
}
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 60b3c03d7d..eb7ee4e65b 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1204,7 +1204,8 @@
"entry-type": {
"command-execute": "执行指令",
"schema-dump": "导出 schema"
- }
+ },
+ "affected-rows-n": "影响行数:{n}"
}
}
},
@@ -3503,4 +3504,4 @@
"drop-partition-with-subpartitions-confirm": "将会同时删除其所有子分区。"
}
}
-}
\ No newline at end of file
+}