Files
HartOMat/frontend/src/api/workflows.ts
T
Hartmut 1409be171c feat(phase7.3): workflow editor pipeline step nodes
- GET /api/workflows/pipeline-steps: returns all StepName enum values
  with category (input|processing|rendering|output) + descriptions;
  registered before /{workflow_id} to avoid path collision
- frontend/src/api/workflows.ts: getPipelineSteps(), PipelineStep
  and PipelineStepsResponse interfaces
- WorkflowEditor: PipelineStepsPanel showing steps grouped by category
  with collapsible accordion sections
- ConfigSidepanel: "Pipeline Step" select dropdown binds any node to a
  StepName; selected step description shown below dropdown
- Active workflow indicator: green dot next to is_active=true entries
- Improved empty state with descriptive copy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 20:24:17 +01:00

99 lines
2.7 KiB
TypeScript

import api from './client'
export interface WorkflowDefinition {
id: string
name: string
output_type_id: string | null
config: WorkflowConfig
is_active: boolean
created_at: string
}
export interface WorkflowConfig {
type: 'still' | 'turntable' | 'multi_angle' | 'still_with_exports' | 'custom'
params: WorkflowParams
nodes?: WorkflowNode[]
}
export interface WorkflowParams {
render_engine?: 'cycles' | 'eevee'
samples?: number
resolution?: [number, number]
fps?: number
duration_s?: number
angles?: number[]
}
export interface WorkflowNode {
id: string
type: string
position: { x: number; y: number }
data: Record<string, unknown>
}
export interface WorkflowCreate {
name: string
output_type_id?: string | null
config: WorkflowConfig
is_active?: boolean
}
export interface WorkflowRun {
id: string
workflow_def_id: string | null
order_line_id: string | null
celery_task_id: string | null
status: 'pending' | 'running' | 'completed' | 'failed'
started_at: string | null
completed_at: string | null
error_message: string | null
created_at: string
node_results: WorkflowNodeResult[]
}
export interface WorkflowNodeResult {
id: string
node_name: string
status: string
output: Record<string, unknown> | null
log: string | null
duration_s: number | null
created_at: string
}
export const getWorkflows = (): Promise<WorkflowDefinition[]> =>
api.get('/workflows').then(r => r.data)
export const getWorkflow = (id: string): Promise<WorkflowDefinition> =>
api.get(`/workflows/${id}`).then(r => r.data)
export const createWorkflow = (data: WorkflowCreate): Promise<WorkflowDefinition> =>
api.post('/workflows', data).then(r => r.data)
export const updateWorkflow = (id: string, data: Partial<WorkflowCreate>): Promise<WorkflowDefinition> =>
api.put(`/workflows/${id}`, data).then(r => r.data)
export const deleteWorkflow = (id: string): Promise<void> =>
api.delete(`/workflows/${id}`).then(() => undefined)
export const getWorkflowRuns = (workflowId: string): Promise<WorkflowRun[]> =>
api.get(`/workflows/${workflowId}/runs`).then(r => r.data)
// ─── Pipeline Steps ───────────────────────────────────────────────────────────
export type StepCategory = 'input' | 'processing' | 'rendering' | 'output'
export interface PipelineStep {
name: string
label: string
category: StepCategory
description: string
}
export interface PipelineStepsResponse {
steps: PipelineStep[]
}
export const getPipelineSteps = (): Promise<PipelineStepsResponse> =>
api.get('/workflows/pipeline-steps').then(r => r.data)