chore: clean up workflow logging

This commit is contained in:
Ben Beckford 2026-08-10 21:40:05 -07:00
parent f294b690fb
commit 8e8e7e799c
6 changed files with 21 additions and 18 deletions

View file

@ -16197,7 +16197,7 @@
},
"/workflows/{id}/logs": {
"get": {
"description": "Retrieve a workflow details without ids, default values, etc.",
"description": "Retrieve logs of a workflows runs by ID",
"operationId": "getWorkflowLogs",
"parameters": [
{
@ -16271,7 +16271,7 @@
"api_key": []
}
],
"summary": "Retrieve a workflow",
"summary": "Retrieve workflow logs",
"tags": [
"Workflows"
],
@ -28037,6 +28037,9 @@
"properties": {
"at": {
"description": "Workflow run date/time",
"example": "2024-01-01T00:00:00.000Z",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
"type": "string"
},
"id": {

View file

@ -7088,7 +7088,7 @@ export function updateWorkflow({ id, workflowUpdateDto }: {
})));
}
/**
* Retrieve a workflow
* Retrieve workflow logs
*/
export function getWorkflowLogs({ before, id, limit, result }: {
before?: string;

View file

@ -119,8 +119,8 @@ export class WorkflowController {
@Get(':id/logs')
@Authenticated({ permission: Permission.WorkflowLogs })
@Endpoint({
summary: 'Retrieve a workflow',
description: 'Retrieve a workflow details without ids, default values, etc.',
summary: 'Retrieve workflow logs',
description: 'Retrieve logs of a workflows runs by ID',
history: HistoryBuilder.v3(),
})
getWorkflowLogs(

View file

@ -86,7 +86,7 @@ const WorkflowShareResponseSchema = z
const WorkflowLogEntrySchema = z
.object({
id: z.uuidv4().describe('Workflow log entry ID'),
at: z.string().describe('Workflow run date/time'),
at: isoDatetimeToDate.describe('Workflow run date/time'),
result: WorkflowResultSchema.describe('Workflow run result'),
triggerDataId: z.uuid().optional().describe('Workflow trigger data ID'),
lastStep: z

View file

@ -89,7 +89,7 @@ export class WorkflowService extends BaseService {
const logs = await this.workflowRepository.getLogs(id, dto);
return logs.map((entry) => ({
id: entry.id,
at: entry.createdAt.toISOString(),
at: entry.createdAt,
result: entry.error ? WorkflowResult.Error : entry.halted ? WorkflowResult.Halted : WorkflowResult.Completed,
triggerDataId: entry.triggerDataId ?? undefined,
lastStep: entry.step

View file

@ -31,20 +31,20 @@
let { workflow, onClose }: Props = $props();
let entries: WorkflowLogEntryDto[] = $state([]);
let placeholder: HTMLElement | undefined = $state();
let filter: WorkflowResult | undefined = $state();
let before: string | undefined = $state();
let placeholder = $state<HTMLElement>();
let filter = $state<WorkflowResult>();
let before = $state<string>();
let hasNext = $state(true);
let loading = $state(false);
const setLogging = (logging: boolean) =>
handleUpdateWorkflow(workflow.id, { logging }).then((success) => {
if (!success) {
return;
}
workflow = { ...workflow, logging };
reset();
});
const setLogging = async (logging: boolean) => {
const success = await handleUpdateWorkflow(workflow.id, { logging });
if (!success) {
return;
}
workflow = { ...workflow, logging };
reset();
};
const reset = () => {
entries = [];