feat(ui): improve workflow runs history

This commit is contained in:
Fu Diwei 2025-01-19 06:15:38 +08:00
parent 5b613bcf84
commit c0dc9b1882
3 changed files with 16 additions and 8 deletions

View File

@ -42,12 +42,12 @@ const WorkflowRunDetailDrawer = ({ data, loading, trigger, ...props }: WorkflowR
<div className="mt-4 rounded-md bg-black p-4 text-stone-200">
<div className="flex flex-col space-y-3">
{data!.logs.map((item, i) => {
{data!.logs?.map((item, i) => {
return (
<div key={i} className="flex flex-col space-y-2">
<div>{item.nodeName}</div>
<div className="flex flex-col space-y-1">
{item.outputs.map((output, j) => {
{item.outputs?.map((output, j) => {
return (
<div key={j} className="flex space-x-2 text-sm" style={{ wordBreak: "break-word" }}>
<div className="whitespace-nowrap">[{dayjs(output.time).format("YYYY-MM-DD HH:mm:ss")}]</div>

View File

@ -6,8 +6,8 @@ export interface WorkflowRunModel extends BaseModel {
trigger: string;
startedAt: ISO8601String;
endedAt: ISO8601String;
logs: WorkflowRunLog[];
error: string;
logs?: WorkflowRunLog[];
error?: string;
expand?: {
workflowId?: WorkflowModel;
};
@ -16,15 +16,15 @@ export interface WorkflowRunModel extends BaseModel {
export type WorkflowRunLog = {
nodeId: string;
nodeName: string;
outputs: WorkflowRunLogOutput[];
error: string;
outputs?: WorkflowRunLogOutput[];
error?: string;
};
export type WorkflowRunLogOutput = {
time: ISO8601String;
title: string;
content: string;
error: string;
error?: string;
};
export const WORKFLOW_RUN_STATUSES = Object.freeze({

View File

@ -7,6 +7,7 @@ import {
DeleteOutlined as DeleteOutlinedIcon,
EditOutlined as EditOutlinedIcon,
PlusOutlined as PlusOutlinedIcon,
SyncOutlined as SyncOutlinedIcon,
} from "@ant-design/icons";
import { PageHeader } from "@ant-design/pro-components";
@ -159,7 +160,14 @@ const WorkflowList = () => {
title: t("workflow.props.last_run_at"),
render: (_, record) => {
if (record.lastRunId) {
if (record.lastRunStatus === WORKFLOW_RUN_STATUSES.SUCCEEDED) {
if (record.lastRunStatus === WORKFLOW_RUN_STATUSES.RUNNING) {
return (
<Space>
<Badge status="processing" count={<SyncOutlinedIcon style={{ color: themeToken.colorInfo }} />} />
<Typography.Text>{dayjs(record.lastRunTime!).format("YYYY-MM-DD HH:mm:ss")}</Typography.Text>
</Space>
);
} else if (record.lastRunStatus === WORKFLOW_RUN_STATUSES.SUCCEEDED) {
return (
<Space>
<Badge status="success" count={<CheckCircleOutlinedIcon style={{ color: themeToken.colorSuccess }} />} />