Skip to content

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

Add status icon and invoker to the task run table

天舟147fa1cc70d5
diff --git a/backend/server/task.go b/backend/server/task.go
index 2ac0b2a527..a0e47fef48 100644
--- a/backend/server/task.go
+++ b/backend/server/task.go
@@ -118,6 +118,18 @@ func (s *Server) ComposeTaskRelationship(ctx context.Context, task *api.Task, in
return err
}
+ for _, taskRun := range task.TaskRunList {
+ taskRun.Creator, err = s.ComposePrincipalById(context.Background(), taskRun.CreatorId, includeList)
+ if err != nil {
+ return err
+ }
+
+ taskRun.Updater, err = s.ComposePrincipalById(context.Background(), taskRun.UpdaterId, includeList)
+ if err != nil {
+ return err
+ }
+ }
+
task.Database, err = s.ComposeDatabaseById(context.Background(), task.DatabaseId, includeList)
if err != nil {
return err
diff --git a/frontend/src/bbkit/BBTable/BBTable.vue b/frontend/src/bbkit/BBTable/BBTable.vue
index 15462cf37d..a571bc5b0e 100644
--- a/frontend/src/bbkit/BBTable/BBTable.vue
+++ b/frontend/src/bbkit/BBTable/BBTable.vue
@@ -7,7 +7,13 @@
v-for="(column, index) in columnList"
:key="index"
scope="col"
- class="py-2 text-left text-xs font-medium text-gray-500 tracking-wider"
+ class="
+ py-2
+ text-left text-xs
+ font-medium
+ text-gray-500
+ tracking-wider
+ "
:class="index == 0 ? 'pl-4' : 'pl-2'"
>
{{ column.title }}
@@ -21,7 +27,16 @@
<th
v-if="!compactSection || sectionDataSource.length > 1"
:colspan="columnList.length"
- class="text-left pl-4 pt-4 pb-2 py-text-base leading-6 font-medium text-gray-900"
+ class="
+ text-left
+ pl-4
+ pt-4
+ pb-2
+ py-text-base
+ leading-6
+ font-medium
+ text-gray-900
+ "
>
<template v-if="section.link">
<router-link :to="section.link" class="normal-link">
diff --git a/frontend/src/components/TaskRunTable.vue b/frontend/src/components/TaskRunTable.vue
index 964d28e8d3..d1e0ec46c5 100644
--- a/frontend/src/components/TaskRunTable.vue
+++ b/frontend/src/components/TaskRunTable.vue
@@ -8,13 +8,87 @@
:rowClickable="false"
>
<template v-slot:body="{ rowData: taskRun }">
- <BBTableCell :leftPadding="4" class="w-8">
- {{ taskRun.status }}
+ <BBTableCell :leftPadding="4" class="table-cell w-24">
+ <div class="flex flex-row space-x-2">
+ <div
+ class="
+ relative
+ w-5
+ h-5
+ flex flex-shrink-0
+ items-center
+ justify-center
+ rounded-full
+ select-none
+ "
+ :class="statusIconClass(taskRun.status)"
+ >
+ <template v-if="taskRun.status == 'RUNNING'">
+ <span
+ class="h-2.5 w-2.5 bg-blue-600 rounded-full"
+ style="
+ animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
+ "
+ aria-hidden="true"
+ ></span>
+ </template>
+ <template v-else-if="taskRun.status == 'DONE'">
+ <svg
+ class="w-5 h-5"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 20 20"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ </template>
+ <template v-else-if="taskRun.status == 'FAILED'">
+ <span class="text-white font-medium text-base" aria-hidden="true"
+ >!</span
+ >
+ </template>
+ <template v-else-if="taskRun.status == 'CANCELED'">
+ <svg
+ class="w-5 h-5"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ xmlns="http://www.w3.org/2000/svg"
+ aria-hidden="true"
+ >
+ >
+ <path
+ fill-rule="evenodd"
+ d="M3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
+ clip-rule="evenodd"
+ ></path></svg
+ ></template>
+ </div>
+ <div class="flex items-center capitalize">
+ {{ taskRun.status.toLowerCase() }}
+ </div>
+ </div>
</BBTableCell>
- <BBTableCell class="w-16">
+ <BBTableCell class="table-cell w-16">
+ <div class="flex flex-row items-center space-x-2">
+ <BBAvatar :username="taskRun.creator.name" :size="'small'" />
+ <div class="flex flex-col">
+ <div class="flex flex-row items-center space-x-2">
+ <router-link :to="`/u/${taskRun.creator.id}`"
+ >{{ taskRun.creator.name }}
+ </router-link>
+ </div>
+ </div>
+ </div>
+ </BBTableCell>
+ <BBTableCell class="table-cell w-16">
{{ humanizeTs(taskRun.createdTs) }}
</BBTableCell>
- <BBTableCell class="w-16">
+ <BBTableCell class="table-cell w-16">
{{ humanizeTs(taskRun.updatedTs) }}
</BBTableCell>
</template>
@@ -24,12 +98,15 @@
<script lang="ts">
import { PropType } from "vue";
import { BBTableColumn } from "../bbkit/types";
-import { TaskRun } from "../types";
+import { TaskRun, TaskRunStatus } from "../types";
const columnList: BBTableColumn[] = [
{
title: "Status",
},
+ {
+ title: "Invoker",
+ },
{
title: "Started",
},
@@ -48,8 +125,22 @@ export default {
},
},
setup(props, ctx) {
+ const statusIconClass = (status: TaskRunStatus) => {
+ switch (status) {
+ case "RUNNING":
+ return "bg-white border-2 border-blue-600 text-blue-600";
+ case "DONE":
+ return "bg-success text-white";
+ case "FAILED":
+ return "bg-error text-white";
+ case "CANCELED":
+ return "bg-white border-2 border-gray-400 text-gray-400";
+ }
+ };
+
return {
columnList,
+ statusIconClass,
};
},
};