Skip to content

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

feat(frontend): display task execution time (#5745)

Liu Jib9d7ca15bf04
diff --git a/frontend/src/components/Issue/TaskRunTable.vue b/frontend/src/components/Issue/TaskRunTable.vue
index 88b1bb9724..28695f306d 100644
--- a/frontend/src/components/Issue/TaskRunTable.vue
+++ b/frontend/src/components/Issue/TaskRunTable.vue
@@ -52,13 +52,13 @@
</template>
</BBTableCell>
<!-- Started -->
- <BBTableCell class="table-cell w-12">{{
- humanizeTs(taskRun.createdTs)
- }}</BBTableCell>
+ <BBTableCell class="table-cell w-12">
+ {{ dayjs(taskRun.createdTs * 1000).format("YYYY-MM-DD HH:mm") }}
+ </BBTableCell>
<!-- Ended -->
- <BBTableCell class="table-cell w-12">{{
- humanizeTs(taskRun.updatedTs)
- }}</BBTableCell>
+ <BBTableCell class="table-cell w-12">
+ {{ humanizeDuration(taskRun.updatedTs - taskRun.createdTs) }}
+ </BBTableCell>
</template>
</BBTable>
</template>
@@ -100,7 +100,7 @@ const columnList = computed((): BBTableColumn[] => [
title: t("task.started"),
},
{
- title: t("task.ended"),
+ title: t("task.execution-time"),
},
]);
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 2097fb9026..1265f24fcc 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -334,7 +334,8 @@
"title": "Apply change to all pending tasks?",
"self": "Apply change to all pending tasks",
"current-only": "Only apply change to current task"
- }
+ },
+ "execution-time": "Execution time"
},
"banner": {
"update-license": "Update license",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index aeb8b5ddef..e009e7ee3a 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -332,7 +332,8 @@
"title": "应用到所有未执行任务?",
"self": "应用到所有未执行任务",
"current-only": "只应用到当前任务"
- }
+ },
+ "execution-time": "执行时间"
},
"banner": {
"update-license": "更新证书",
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index c10b81f5b4..6421646039 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -27,6 +27,7 @@ import {
environmentName,
environmentSlug,
humanizeTs,
+ humanizeDuration,
instanceName,
instanceSlug,
connectionSlug,
@@ -126,6 +127,7 @@ app.config.globalProperties.window = window;
app.config.globalProperties.console = console;
app.config.globalProperties.dayjs = dayjs;
app.config.globalProperties.humanizeTs = humanizeTs;
+app.config.globalProperties.humanizeDuration = humanizeDuration;
app.config.globalProperties.isDev = isDev();
app.config.globalProperties.isRelease = isRelease();
app.config.globalProperties.sizeToFit = sizeToFit;
diff --git a/frontend/src/shims-vue-globals.d.ts b/frontend/src/shims-vue-globals.d.ts
index 8b95acc52a..9e0d6c97d6 100644
--- a/frontend/src/shims-vue-globals.d.ts
+++ b/frontend/src/shims-vue-globals.d.ts
@@ -4,6 +4,7 @@ import type {
environmentName,
environmentSlug,
humanizeTs,
+ humanizeDuration,
instanceName,
instanceSlug,
projectName,
@@ -20,6 +21,7 @@ declare module "vue" {
console: Console;
dayjs: typeof dayjs;
humanizeTs: typeof humanizeTs;
+ humanizeDuration: typeof humanizeDuration;
isDev: boolean;
isRelease: boolean;
sizeToFit: typeof sizeToFit;
diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts
index 31a200aa44..447061b0cb 100644
--- a/frontend/src/utils/util.ts
+++ b/frontend/src/utils/util.ts
@@ -33,6 +33,11 @@ export function humanizeTs(ts: number): string {
return time.local().format("MMM D YYYY");
}
+export function humanizeDuration(seconds: number): string {
+ if (seconds <= 1) return "Less than 1s";
+ return `${seconds}s`;
+}
+
export function bytesToString(size: number): string {
const unitList = ["B", "KB", "MB", "GB", "TB"];
let i = 0;