mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-10 16:05:58 +00:00
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
967 B
TypeScript
34 lines
967 B
TypeScript
import type { FlowStatusModule } from '$lib/gen'
|
|
import type { GraphModuleState } from '../model'
|
|
|
|
export function getStraightLinePath({ sourceX, sourceY, targetY }) {
|
|
return `M${sourceX},${sourceY} L${sourceX},${targetY - 100}`
|
|
}
|
|
|
|
export function computeBorderStatus(
|
|
branchIndex: number,
|
|
type: 'branchone' | 'branchall',
|
|
graphModuleState: GraphModuleState | undefined
|
|
): FlowStatusModule['type'] | undefined {
|
|
if (type === 'branchone') {
|
|
const branchChosen = graphModuleState?.branchChosen
|
|
|
|
if (branchChosen === branchIndex) {
|
|
return graphModuleState?.type
|
|
}
|
|
} else {
|
|
let flow_jobs_success = graphModuleState?.flow_jobs_success
|
|
if (!flow_jobs_success) {
|
|
// No run yet: leave the branch border neutral instead of forcing a highlight.
|
|
return undefined
|
|
} else {
|
|
let status = flow_jobs_success?.[branchIndex]
|
|
if (status == undefined) {
|
|
return 'WaitingForExecutor'
|
|
} else {
|
|
return status ? 'Success' : 'Failure'
|
|
}
|
|
}
|
|
}
|
|
}
|