@shipfox/client-workflows 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +1 -0
- package/.storybook/preview.css +10 -0
- package/.storybook/preview.tsx +97 -0
- package/.swcrc +42 -0
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +162 -0
- package/LICENSE +21 -0
- package/dist/components/identifier/identifier.d.ts +6 -0
- package/dist/components/identifier/identifier.d.ts.map +1 -0
- package/dist/components/identifier/identifier.js +144 -0
- package/dist/components/identifier/identifier.js.map +1 -0
- package/dist/components/identifier/index.d.ts +2 -0
- package/dist/components/identifier/index.d.ts.map +1 -0
- package/dist/components/identifier/index.js +3 -0
- package/dist/components/identifier/index.js.map +1 -0
- package/dist/components/job-graph/graph-model.d.ts +27 -0
- package/dist/components/job-graph/graph-model.d.ts.map +1 -0
- package/dist/components/job-graph/graph-model.js +107 -0
- package/dist/components/job-graph/graph-model.js.map +1 -0
- package/dist/components/job-graph/index.d.ts +3 -0
- package/dist/components/job-graph/index.d.ts.map +1 -0
- package/dist/components/job-graph/index.js +3 -0
- package/dist/components/job-graph/index.js.map +1 -0
- package/dist/components/job-graph/job-duration-format.d.ts +4 -0
- package/dist/components/job-graph/job-duration-format.d.ts.map +1 -0
- package/dist/components/job-graph/job-duration-format.js +41 -0
- package/dist/components/job-graph/job-duration-format.js.map +1 -0
- package/dist/components/job-graph/job-duration-label.d.ts +5 -0
- package/dist/components/job-graph/job-duration-label.d.ts.map +1 -0
- package/dist/components/job-graph/job-duration-label.js +33 -0
- package/dist/components/job-graph/job-duration-label.js.map +1 -0
- package/dist/components/job-graph/job-graph-content.d.ts +9 -0
- package/dist/components/job-graph/job-graph-content.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph-content.js +181 -0
- package/dist/components/job-graph/job-graph-content.js.map +1 -0
- package/dist/components/job-graph/job-graph-view.d.ts +11 -0
- package/dist/components/job-graph/job-graph-view.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph-view.js +24 -0
- package/dist/components/job-graph/job-graph-view.js.map +1 -0
- package/dist/components/job-graph/job-graph.d.ts +3 -0
- package/dist/components/job-graph/job-graph.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph.js +21 -0
- package/dist/components/job-graph/job-graph.js.map +1 -0
- package/dist/components/job-graph/job-node.d.ts +16 -0
- package/dist/components/job-graph/job-node.d.ts.map +1 -0
- package/dist/components/job-graph/job-node.js +196 -0
- package/dist/components/job-graph/job-node.js.map +1 -0
- package/dist/components/job-graph/types.d.ts +9 -0
- package/dist/components/job-graph/types.d.ts.map +1 -0
- package/dist/components/job-graph/types.js +3 -0
- package/dist/components/job-graph/types.js.map +1 -0
- package/dist/components/step-list/index.d.ts +3 -0
- package/dist/components/step-list/index.d.ts.map +1 -0
- package/dist/components/step-list/index.js +3 -0
- package/dist/components/step-list/index.js.map +1 -0
- package/dist/components/step-list/step-list-model.d.ts +36 -0
- package/dist/components/step-list/step-list-model.d.ts.map +1 -0
- package/dist/components/step-list/step-list-model.js +135 -0
- package/dist/components/step-list/step-list-model.js.map +1 -0
- package/dist/components/step-list/step-list.d.ts +32 -0
- package/dist/components/step-list/step-list.d.ts.map +1 -0
- package/dist/components/step-list/step-list.js +409 -0
- package/dist/components/step-list/step-list.js.map +1 -0
- package/dist/components/workflow-run-duration-label.d.ts +8 -0
- package/dist/components/workflow-run-duration-label.d.ts.map +1 -0
- package/dist/components/workflow-run-duration-label.js +84 -0
- package/dist/components/workflow-run-duration-label.js.map +1 -0
- package/dist/components/workflow-run-list/index.d.ts +2 -0
- package/dist/components/workflow-run-list/index.d.ts.map +1 -0
- package/dist/components/workflow-run-list/index.js +3 -0
- package/dist/components/workflow-run-list/index.js.map +1 -0
- package/dist/components/workflow-run-list/run-display.d.ts +5 -0
- package/dist/components/workflow-run-list/run-display.d.ts.map +1 -0
- package/dist/components/workflow-run-list/run-display.js +19 -0
- package/dist/components/workflow-run-list/run-display.js.map +1 -0
- package/dist/components/workflow-run-list/types.d.ts +21 -0
- package/dist/components/workflow-run-list/types.d.ts.map +1 -0
- package/dist/components/workflow-run-list/types.js +3 -0
- package/dist/components/workflow-run-list/types.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.d.ts +14 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.js +37 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.d.ts +10 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.js +55 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.d.ts +15 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.js +103 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +3 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.js +46 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list.d.ts +3 -0
- package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list.js +20 -0
- package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-row.d.ts +14 -0
- package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-row.js +172 -0
- package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -0
- package/dist/components/workflow-run-summary/index.d.ts +2 -0
- package/dist/components/workflow-run-summary/index.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/index.js +3 -0
- package/dist/components/workflow-run-summary/index.js.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts +9 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js +138 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +20 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.js +252 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts +7 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts.map +1 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.js +84 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.js.map +1 -0
- package/dist/components/workflow-run-view/index.d.ts +3 -0
- package/dist/components/workflow-run-view/index.d.ts.map +1 -0
- package/dist/components/workflow-run-view/index.js +4 -0
- package/dist/components/workflow-run-view/index.js.map +1 -0
- package/dist/components/workflow-run-view/job-card.d.ts +17 -0
- package/dist/components/workflow-run-view/job-card.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-card.js +476 -0
- package/dist/components/workflow-run-view/job-card.js.map +1 -0
- package/dist/components/workflow-run-view/job-execution-switcher.d.ts +10 -0
- package/dist/components/workflow-run-view/job-execution-switcher.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-execution-switcher.js +171 -0
- package/dist/components/workflow-run-view/job-execution-switcher.js.map +1 -0
- package/dist/components/workflow-run-view/job-execution-time-text.d.ts +6 -0
- package/dist/components/workflow-run-view/job-execution-time-text.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-execution-time-text.js +24 -0
- package/dist/components/workflow-run-view/job-execution-time-text.js.map +1 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts +9 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts.map +1 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.js +152 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-selection.d.ts +14 -0
- package/dist/components/workflow-run-view/workflow-run-selection.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-selection.js +56 -0
- package/dist/components/workflow-run-view/workflow-run-selection.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-states.d.ts +12 -0
- package/dist/components/workflow-run-view/workflow-run-states.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-states.js +91 -0
- package/dist/components/workflow-run-view/workflow-run-states.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-view.d.ts +15 -0
- package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-view.js +285 -0
- package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -0
- package/dist/components/workflow-source-panel/index.d.ts +2 -0
- package/dist/components/workflow-source-panel/index.d.ts.map +1 -0
- package/dist/components/workflow-source-panel/index.js +3 -0
- package/dist/components/workflow-source-panel/index.js.map +1 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.d.ts +13 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.d.ts.map +1 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.js +91 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.js.map +1 -0
- package/dist/components/workflow-status/status-visuals.d.ts +12 -0
- package/dist/components/workflow-status/status-visuals.d.ts.map +1 -0
- package/dist/components/workflow-status/status-visuals.js +54 -0
- package/dist/components/workflow-status/status-visuals.js.map +1 -0
- package/dist/components/workflow-status/workflow-status-icon.d.ts +22 -0
- package/dist/components/workflow-status/workflow-status-icon.d.ts.map +1 -0
- package/dist/components/workflow-status/workflow-status-icon.js +100 -0
- package/dist/components/workflow-status/workflow-status-icon.js.map +1 -0
- package/dist/core/entities/job-execution.d.ts +69 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -0
- package/dist/core/entities/job-execution.js +83 -0
- package/dist/core/entities/job-execution.js.map +1 -0
- package/dist/core/entities/job.d.ts +56 -0
- package/dist/core/entities/job.d.ts.map +1 -0
- package/dist/core/entities/job.js +71 -0
- package/dist/core/entities/job.js.map +1 -0
- package/dist/core/entities/step-attempt.d.ts +49 -0
- package/dist/core/entities/step-attempt.d.ts.map +1 -0
- package/dist/core/entities/step-attempt.js +48 -0
- package/dist/core/entities/step-attempt.js.map +1 -0
- package/dist/core/entities/step.d.ts +41 -0
- package/dist/core/entities/step.d.ts.map +1 -0
- package/dist/core/entities/step.js +51 -0
- package/dist/core/entities/step.js.map +1 -0
- package/dist/core/entities/workflow-run-attempt.d.ts +44 -0
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
- package/dist/core/entities/workflow-run-attempt.js +51 -0
- package/dist/core/entities/workflow-run-attempt.js.map +1 -0
- package/dist/core/entities/workflow-run.d.ts +61 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -0
- package/dist/core/entities/workflow-run.js +104 -0
- package/dist/core/entities/workflow-run.js.map +1 -0
- package/dist/core/workflow-run-url-state.d.ts +13 -0
- package/dist/core/workflow-run-url-state.d.ts.map +1 -0
- package/dist/core/workflow-run-url-state.js +43 -0
- package/dist/core/workflow-run-url-state.js.map +1 -0
- package/dist/core/workflow-run.d.ts +13 -0
- package/dist/core/workflow-run.d.ts.map +1 -0
- package/dist/core/workflow-run.js +8 -0
- package/dist/core/workflow-run.js.map +1 -0
- package/dist/env.d.js +2 -0
- package/dist/env.d.js.map +1 -0
- package/dist/feature.d.ts +20 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/feature.js +27 -0
- package/dist/feature.js.map +1 -0
- package/dist/hooks/api/workflow-runs.d.ts +109 -0
- package/dist/hooks/api/workflow-runs.d.ts.map +1 -0
- package/dist/hooks/api/workflow-runs.js +394 -0
- package/dist/hooks/api/workflow-runs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/workflow-run-first-time-use.d.ts +6 -0
- package/dist/pages/workflow-run-first-time-use.d.ts.map +1 -0
- package/dist/pages/workflow-run-first-time-use.js +17 -0
- package/dist/pages/workflow-run-first-time-use.js.map +1 -0
- package/dist/pages/workflow-run-page.d.ts +8 -0
- package/dist/pages/workflow-run-page.d.ts.map +1 -0
- package/dist/pages/workflow-run-page.js +83 -0
- package/dist/pages/workflow-run-page.js.map +1 -0
- package/dist/routes/run-detail.d.ts +8 -0
- package/dist/routes/run-detail.d.ts.map +1 -0
- package/dist/routes/run-detail.js +21 -0
- package/dist/routes/run-detail.js.map +1 -0
- package/dist/routes/runs.d.ts +8 -0
- package/dist/routes/runs.d.ts.map +1 -0
- package/dist/routes/runs.js +20 -0
- package/dist/routes/runs.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +114 -0
- package/src/components/identifier/identifier.tsx +178 -0
- package/src/components/identifier/index.ts +1 -0
- package/src/components/job-graph/graph-model.test.ts +189 -0
- package/src/components/job-graph/graph-model.ts +178 -0
- package/src/components/job-graph/index.ts +2 -0
- package/src/components/job-graph/job-duration-format.ts +54 -0
- package/src/components/job-graph/job-duration-label.tsx +29 -0
- package/src/components/job-graph/job-graph-content.tsx +225 -0
- package/src/components/job-graph/job-graph-view.test.tsx +298 -0
- package/src/components/job-graph/job-graph-view.tsx +45 -0
- package/src/components/job-graph/job-graph.stories.tsx +182 -0
- package/src/components/job-graph/job-graph.tsx +24 -0
- package/src/components/job-graph/job-node.stories.tsx +364 -0
- package/src/components/job-graph/job-node.test.tsx +347 -0
- package/src/components/job-graph/job-node.tsx +202 -0
- package/src/components/job-graph/types.ts +9 -0
- package/src/components/step-list/index.ts +6 -0
- package/src/components/step-list/step-list-model.test.ts +369 -0
- package/src/components/step-list/step-list-model.ts +205 -0
- package/src/components/step-list/step-list.stories.tsx +419 -0
- package/src/components/step-list/step-list.test.tsx +566 -0
- package/src/components/step-list/step-list.tsx +494 -0
- package/src/components/workflow-run-duration-label.tsx +118 -0
- package/src/components/workflow-run-list/index.ts +1 -0
- package/src/components/workflow-run-list/run-display.test.ts +53 -0
- package/src/components/workflow-run-list/run-display.ts +22 -0
- package/src/components/workflow-run-list/types.ts +22 -0
- package/src/components/workflow-run-list/workflow-run-list-content.tsx +58 -0
- package/src/components/workflow-run-list/workflow-run-list-header.tsx +53 -0
- package/src/components/workflow-run-list/workflow-run-list-states.tsx +86 -0
- package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +178 -0
- package/src/components/workflow-run-list/workflow-run-list-view.tsx +57 -0
- package/src/components/workflow-run-list/workflow-run-list.stories.tsx +111 -0
- package/src/components/workflow-run-list/workflow-run-list.tsx +29 -0
- package/src/components/workflow-run-list/workflow-run-row.tsx +176 -0
- package/src/components/workflow-run-summary/index.ts +1 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +230 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.tsx +146 -0
- package/src/components/workflow-run-summary/workflow-run-summary.stories.tsx +414 -0
- package/src/components/workflow-run-summary/workflow-run-summary.test.tsx +354 -0
- package/src/components/workflow-run-summary/workflow-run-summary.tsx +295 -0
- package/src/components/workflow-run-view/agent-config-failure-callout.stories.tsx +140 -0
- package/src/components/workflow-run-view/agent-config-failure-callout.tsx +93 -0
- package/src/components/workflow-run-view/index.ts +2 -0
- package/src/components/workflow-run-view/job-card.stories.tsx +788 -0
- package/src/components/workflow-run-view/job-card.tsx +566 -0
- package/src/components/workflow-run-view/job-execution-switcher.tsx +170 -0
- package/src/components/workflow-run-view/job-execution-time-text.tsx +34 -0
- package/src/components/workflow-run-view/step-attempt-log-panel.test.tsx +290 -0
- package/src/components/workflow-run-view/step-attempt-log-panel.tsx +152 -0
- package/src/components/workflow-run-view/workflow-run-selection.test.ts +280 -0
- package/src/components/workflow-run-view/workflow-run-selection.ts +89 -0
- package/src/components/workflow-run-view/workflow-run-states.tsx +70 -0
- package/src/components/workflow-run-view/workflow-run-view.test.tsx +1214 -0
- package/src/components/workflow-run-view/workflow-run-view.tsx +341 -0
- package/src/components/workflow-source-panel/index.ts +1 -0
- package/src/components/workflow-source-panel/workflow-source-panel.stories.tsx +110 -0
- package/src/components/workflow-source-panel/workflow-source-panel.test.tsx +96 -0
- package/src/components/workflow-source-panel/workflow-source-panel.tsx +136 -0
- package/src/components/workflow-status/status-visuals.test.ts +38 -0
- package/src/components/workflow-status/status-visuals.ts +36 -0
- package/src/components/workflow-status/workflow-status-icon.stories.tsx +90 -0
- package/src/components/workflow-status/workflow-status-icon.tsx +135 -0
- package/src/core/entities/job-execution.ts +139 -0
- package/src/core/entities/job.ts +149 -0
- package/src/core/entities/step-attempt.ts +89 -0
- package/src/core/entities/step.ts +105 -0
- package/src/core/entities/workflow-run-attempt.ts +87 -0
- package/src/core/entities/workflow-run.ts +183 -0
- package/src/core/workflow-run-url-state.ts +61 -0
- package/src/core/workflow-run.test.ts +640 -0
- package/src/core/workflow-run.ts +66 -0
- package/src/env.d.ts +8 -0
- package/src/feature.ts +26 -0
- package/src/hooks/api/workflow-runs.test.tsx +410 -0
- package/src/hooks/api/workflow-runs.ts +485 -0
- package/src/index.ts +45 -0
- package/src/page-harness-budget.test.ts +33 -0
- package/src/pages/workflow-run-first-time-use.tsx +17 -0
- package/src/pages/workflow-run-page.test.tsx +517 -0
- package/src/pages/workflow-run-page.tsx +89 -0
- package/src/routes/run-detail.tsx +15 -0
- package/src/routes/runs.tsx +11 -0
- package/test/fixtures/logs.ts +13 -0
- package/test/fixtures/workflow-run.ts +311 -0
- package/test/pages.tsx +79 -0
- package/test/render.tsx +40 -0
- package/test/setup.ts +3 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vercel.json +8 -0
- package/vitest.config.ts +70 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
JobStatusDto,
|
|
3
|
+
StepAttemptDto,
|
|
4
|
+
WorkflowRunAttemptDto,
|
|
5
|
+
WorkflowRunAttemptsResponseDto,
|
|
6
|
+
WorkflowRunDetailResponseDto,
|
|
7
|
+
WorkflowRunJobDetailDto,
|
|
8
|
+
WorkflowRunJobExecutionDetailDto,
|
|
9
|
+
WorkflowRunListResponseDto,
|
|
10
|
+
WorkflowRunResponseDto,
|
|
11
|
+
WorkflowRunStatusDto,
|
|
12
|
+
WorkflowRunStepDetailDto,
|
|
13
|
+
} from '@shipfox/api-workflows-dto';
|
|
14
|
+
import {
|
|
15
|
+
type Job,
|
|
16
|
+
type Step,
|
|
17
|
+
type StepAttempt,
|
|
18
|
+
toJob,
|
|
19
|
+
toStep,
|
|
20
|
+
toStepAttempt,
|
|
21
|
+
toWorkflowRunDetail,
|
|
22
|
+
toWorkflowRunListItem,
|
|
23
|
+
toWorkflowRunListPage,
|
|
24
|
+
type WorkflowRunDetail,
|
|
25
|
+
type WorkflowRunListItem,
|
|
26
|
+
type WorkflowRunListPage,
|
|
27
|
+
} from '#core/workflow-run.js';
|
|
28
|
+
|
|
29
|
+
const RUN_ID = '11111111-1111-4111-8111-111111111111';
|
|
30
|
+
const RUN_ATTEMPT_ID = '11111111-1111-4111-8111-111111111112';
|
|
31
|
+
const PROJECT_ID = '22222222-2222-4222-8222-222222222222';
|
|
32
|
+
const DEFINITION_ID = '33333333-3333-4333-8333-333333333333';
|
|
33
|
+
const JOB_ID = '44444444-4444-4444-8444-000000000001';
|
|
34
|
+
const JOB_EXECUTION_ID = '77777777-7777-4777-8777-000000000001';
|
|
35
|
+
const STEP_ID = '55555555-5555-4555-8555-000000000001';
|
|
36
|
+
|
|
37
|
+
let runSequence = 0;
|
|
38
|
+
let jobSequence = 0;
|
|
39
|
+
let jobExecutionSequence = 0;
|
|
40
|
+
let stepSequence = 0;
|
|
41
|
+
let attemptSequence = 0;
|
|
42
|
+
|
|
43
|
+
export type JobDtoOverrides = Partial<Omit<WorkflowRunJobDetailDto, 'job_executions'>> & {
|
|
44
|
+
job_executions?: WorkflowRunJobDetailDto['job_executions'];
|
|
45
|
+
steps?: WorkflowRunStepDetailDto[];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type JobDtoBase = Omit<WorkflowRunJobDetailDto, 'job_executions'>;
|
|
49
|
+
|
|
50
|
+
export function workflowRunDto(
|
|
51
|
+
overrides: Partial<WorkflowRunResponseDto> = {},
|
|
52
|
+
): WorkflowRunResponseDto {
|
|
53
|
+
return {
|
|
54
|
+
id: RUN_ID,
|
|
55
|
+
project_id: PROJECT_ID,
|
|
56
|
+
definition_id: DEFINITION_ID,
|
|
57
|
+
name: 'deploy-web',
|
|
58
|
+
status: 'running',
|
|
59
|
+
current_attempt: 1,
|
|
60
|
+
latest_attempt: 1,
|
|
61
|
+
trigger_provider: null,
|
|
62
|
+
trigger_source: 'manual',
|
|
63
|
+
trigger_event: 'fire',
|
|
64
|
+
trigger_payload: {},
|
|
65
|
+
inputs: null,
|
|
66
|
+
source_snapshot: null,
|
|
67
|
+
created_at: '2026-06-21T12:00:00.000Z',
|
|
68
|
+
updated_at: '2026-06-21T12:01:00.000Z',
|
|
69
|
+
started_at: null,
|
|
70
|
+
finished_at: null,
|
|
71
|
+
...overrides,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function workflowRunListItem(
|
|
76
|
+
overrides: Partial<WorkflowRunResponseDto> = {},
|
|
77
|
+
): WorkflowRunListItem {
|
|
78
|
+
return toWorkflowRunListItem(workflowRunDto(overrides));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function workflowRunListResponseDto(
|
|
82
|
+
overrides: Partial<WorkflowRunListResponseDto> = {},
|
|
83
|
+
): WorkflowRunListResponseDto {
|
|
84
|
+
return {
|
|
85
|
+
runs: [workflowRunDto()],
|
|
86
|
+
next_cursor: null,
|
|
87
|
+
filtered_total_count: 1,
|
|
88
|
+
...overrides,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function workflowRunListPage(
|
|
93
|
+
overrides: Partial<WorkflowRunListResponseDto> = {},
|
|
94
|
+
): WorkflowRunListPage {
|
|
95
|
+
return toWorkflowRunListPage(workflowRunListResponseDto(overrides));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function workflowRunDetailDto(
|
|
99
|
+
overrides: Partial<WorkflowRunDetailResponseDto> = {},
|
|
100
|
+
): WorkflowRunDetailResponseDto {
|
|
101
|
+
const {jobs, run_attempt: runAttemptOverride, ...runOverrides} = overrides;
|
|
102
|
+
const run = workflowRunDto(runOverrides);
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
...run,
|
|
106
|
+
latest_attempt: run.latest_attempt,
|
|
107
|
+
run_attempt:
|
|
108
|
+
runAttemptOverride ??
|
|
109
|
+
workflowRunAttemptDto({
|
|
110
|
+
workflow_run_id: run.id,
|
|
111
|
+
attempt: run.current_attempt,
|
|
112
|
+
status: run.status,
|
|
113
|
+
started_at: run.started_at,
|
|
114
|
+
finished_at: run.finished_at,
|
|
115
|
+
}),
|
|
116
|
+
jobs: jobs ?? [],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function workflowRunDetail(
|
|
121
|
+
overrides: Partial<WorkflowRunDetailResponseDto> = {},
|
|
122
|
+
): WorkflowRunDetail {
|
|
123
|
+
return toWorkflowRunDetail(workflowRunDetailDto(overrides));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function workflowRunAttemptDto(
|
|
127
|
+
overrides: Partial<WorkflowRunAttemptDto> = {},
|
|
128
|
+
): WorkflowRunAttemptDto {
|
|
129
|
+
return {
|
|
130
|
+
id: RUN_ATTEMPT_ID,
|
|
131
|
+
workflow_run_id: RUN_ID,
|
|
132
|
+
attempt: 1,
|
|
133
|
+
status: 'running',
|
|
134
|
+
created_at: '2026-06-21T12:00:00.000Z',
|
|
135
|
+
started_at: null,
|
|
136
|
+
finished_at: null,
|
|
137
|
+
rerun_mode: null,
|
|
138
|
+
...overrides,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function runAttemptsResponseDto(
|
|
143
|
+
overrides: Partial<WorkflowRunAttemptsResponseDto> = {},
|
|
144
|
+
): WorkflowRunAttemptsResponseDto {
|
|
145
|
+
return {
|
|
146
|
+
attempts: [workflowRunAttemptDto()],
|
|
147
|
+
...overrides,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function workflowJobDto(overrides: JobDtoOverrides = {}): WorkflowRunJobDetailDto {
|
|
152
|
+
jobSequence += 1;
|
|
153
|
+
const {job_executions, steps, ...jobOverrides} = overrides;
|
|
154
|
+
const key =
|
|
155
|
+
jobOverrides.key ?? (typeof jobOverrides.name === 'string' ? jobOverrides.name : 'build');
|
|
156
|
+
const job: JobDtoBase = {
|
|
157
|
+
id: `44444444-4444-4444-8444-${String(jobSequence).padStart(12, '0')}`,
|
|
158
|
+
run_attempt_id: RUN_ID,
|
|
159
|
+
key,
|
|
160
|
+
name: null,
|
|
161
|
+
mode: 'one_shot',
|
|
162
|
+
status: 'pending',
|
|
163
|
+
status_reason: null,
|
|
164
|
+
carried_over: false,
|
|
165
|
+
listening: null,
|
|
166
|
+
listener_status: 'inactive',
|
|
167
|
+
resolution_reason: null,
|
|
168
|
+
outputs: null,
|
|
169
|
+
dependencies: [],
|
|
170
|
+
position: 0,
|
|
171
|
+
created_at: '2026-06-21T12:00:00.000Z',
|
|
172
|
+
updated_at: '2026-06-21T12:01:00.000Z',
|
|
173
|
+
...jobOverrides,
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
...job,
|
|
178
|
+
job_executions:
|
|
179
|
+
job_executions ?? (steps ? [workflowJobExecutionDto({job_id: job.id, steps})] : []),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function workflowJob(overrides: JobDtoOverrides = {}): Job {
|
|
184
|
+
return toJob(workflowJobDto(overrides));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function workflowJobExecutionDto(
|
|
188
|
+
overrides: Partial<WorkflowRunJobExecutionDetailDto> = {},
|
|
189
|
+
): WorkflowRunJobExecutionDetailDto {
|
|
190
|
+
jobExecutionSequence += 1;
|
|
191
|
+
const id =
|
|
192
|
+
overrides.id ?? `77777777-7777-4777-8777-${String(jobExecutionSequence).padStart(12, '0')}`;
|
|
193
|
+
const {steps: overrideSteps, ...restOverrides} = overrides;
|
|
194
|
+
const steps = overrideSteps?.map((step) => ({...step, job_execution_id: id})) ?? [];
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
id,
|
|
198
|
+
job_id: JOB_ID,
|
|
199
|
+
sequence: 1,
|
|
200
|
+
name: 'build',
|
|
201
|
+
status: 'pending',
|
|
202
|
+
status_reason: null,
|
|
203
|
+
trigger_events: [],
|
|
204
|
+
outputs: null,
|
|
205
|
+
queued_at: null,
|
|
206
|
+
started_at: null,
|
|
207
|
+
finished_at: null,
|
|
208
|
+
timed_out_at: null,
|
|
209
|
+
created_at: '2026-06-21T12:00:00.000Z',
|
|
210
|
+
updated_at: '2026-06-21T12:01:00.000Z',
|
|
211
|
+
steps,
|
|
212
|
+
...restOverrides,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function workflowStepDto(
|
|
217
|
+
overrides: Partial<WorkflowRunStepDetailDto> = {},
|
|
218
|
+
): WorkflowRunStepDetailDto {
|
|
219
|
+
stepSequence += 1;
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
id: `55555555-5555-4555-8555-${String(stepSequence).padStart(12, '0')}`,
|
|
223
|
+
job_execution_id: JOB_EXECUTION_ID,
|
|
224
|
+
key: 'build',
|
|
225
|
+
name: 'build',
|
|
226
|
+
source_location: null,
|
|
227
|
+
status: 'pending',
|
|
228
|
+
type: 'run',
|
|
229
|
+
config: {},
|
|
230
|
+
error: null,
|
|
231
|
+
position: 0,
|
|
232
|
+
current_attempt: 1,
|
|
233
|
+
exit_code: null,
|
|
234
|
+
outputs: null,
|
|
235
|
+
response: null,
|
|
236
|
+
gate_result: null,
|
|
237
|
+
created_at: '2026-06-21T12:00:00.000Z',
|
|
238
|
+
updated_at: '2026-06-21T12:01:00.000Z',
|
|
239
|
+
attempts: [],
|
|
240
|
+
...overrides,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function workflowStep(overrides: Partial<WorkflowRunStepDetailDto> = {}): Step {
|
|
245
|
+
return toStep(workflowStepDto(overrides));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function workflowStepAttemptDto(overrides: Partial<StepAttemptDto> = {}): StepAttemptDto {
|
|
249
|
+
attemptSequence += 1;
|
|
250
|
+
return {
|
|
251
|
+
id: `66666666-6666-4666-8666-${String(attemptSequence).padStart(12, '0')}`,
|
|
252
|
+
step_id: STEP_ID,
|
|
253
|
+
attempt: 1,
|
|
254
|
+
execution_order: attemptSequence,
|
|
255
|
+
status: 'pending',
|
|
256
|
+
exit_code: null,
|
|
257
|
+
output: null,
|
|
258
|
+
outputs: null,
|
|
259
|
+
response: null,
|
|
260
|
+
error: null,
|
|
261
|
+
gate_result: null,
|
|
262
|
+
restart_feedback: null,
|
|
263
|
+
started_at: '2026-06-21T12:00:00.000Z',
|
|
264
|
+
finished_at: null,
|
|
265
|
+
...overrides,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function workflowStepAttempt(overrides: Partial<StepAttemptDto> = {}): StepAttempt {
|
|
270
|
+
return toStepAttempt(workflowStepAttemptDto(overrides), JOB_EXECUTION_ID);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export function sequencedWorkflowRunDto(
|
|
274
|
+
status: WorkflowRunStatusDto,
|
|
275
|
+
name: string,
|
|
276
|
+
minutesAgo: number,
|
|
277
|
+
overrides: Partial<WorkflowRunResponseDto> = {},
|
|
278
|
+
): WorkflowRunResponseDto {
|
|
279
|
+
runSequence += 1;
|
|
280
|
+
return workflowRunDto({
|
|
281
|
+
id: `run-${String(runSequence).padStart(8, '0')}`,
|
|
282
|
+
project_id: 'proj-demo',
|
|
283
|
+
definition_id: 'def-demo',
|
|
284
|
+
name,
|
|
285
|
+
status,
|
|
286
|
+
trigger_provider: status === 'pending' ? null : 'github',
|
|
287
|
+
trigger_source: status === 'pending' ? '' : 'github_acme',
|
|
288
|
+
trigger_event: status === 'pending' ? '' : 'push',
|
|
289
|
+
created_at: new Date(Date.now() - minutesAgo * 120_000).toISOString(),
|
|
290
|
+
updated_at: new Date(Date.now() - minutesAgo * 60_000).toISOString(),
|
|
291
|
+
...overrides,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export function sequencedWorkflowRunListItem(
|
|
296
|
+
status: WorkflowRunStatusDto,
|
|
297
|
+
name: string,
|
|
298
|
+
minutesAgo: number,
|
|
299
|
+
overrides: Partial<WorkflowRunResponseDto> = {},
|
|
300
|
+
): WorkflowRunListItem {
|
|
301
|
+
return toWorkflowRunListItem(sequencedWorkflowRunDto(status, name, minutesAgo, overrides));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function workflowJobWithName(
|
|
305
|
+
name: string,
|
|
306
|
+
overrides: JobDtoOverrides = {},
|
|
307
|
+
): WorkflowRunJobDetailDto {
|
|
308
|
+
return workflowJobDto({name, ...overrides});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export type {JobStatusDto, WorkflowRunStatusDto};
|
package/test/pages.tsx
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {configureApiClient} from '@shipfox/client-api';
|
|
2
|
+
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
|
|
3
|
+
import {
|
|
4
|
+
createMemoryHistory,
|
|
5
|
+
createRootRoute,
|
|
6
|
+
createRoute,
|
|
7
|
+
createRouter,
|
|
8
|
+
Outlet,
|
|
9
|
+
RouterProvider,
|
|
10
|
+
useParams,
|
|
11
|
+
} from '@tanstack/react-router';
|
|
12
|
+
import {type RenderResult, render} from '@testing-library/react';
|
|
13
|
+
import type {ReactElement} from 'react';
|
|
14
|
+
|
|
15
|
+
// The workflow run page navigates with the router (run rows are links and the page redirects
|
|
16
|
+
// to the first run), so the harness mounts the page under a memory router whose route tree
|
|
17
|
+
// carries the `/workspaces/$wid/projects/$pid/runs/$workflowRunId` params the components read. The
|
|
18
|
+
// page is supplied as a factory the detail route calls with the current `workflowRunId`, mirroring
|
|
19
|
+
// the real route wiring so a redirect re-renders the page with the run it landed on.
|
|
20
|
+
export const PROJECT_TEST_WID = '11111111-1111-4111-8111-111111111111';
|
|
21
|
+
|
|
22
|
+
export function jsonResponse(body: unknown, init: ResponseInit = {}) {
|
|
23
|
+
return new Response(JSON.stringify(body), {
|
|
24
|
+
status: 200,
|
|
25
|
+
headers: {'content-type': 'application/json'},
|
|
26
|
+
...init,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function createTestRouter(
|
|
31
|
+
path: string,
|
|
32
|
+
renderPage: (params: {workflowRunId?: string | undefined}) => ReactElement,
|
|
33
|
+
) {
|
|
34
|
+
const rootRoute = createRootRoute({component: Outlet});
|
|
35
|
+
const runsRoute = createRoute({
|
|
36
|
+
getParentRoute: () => rootRoute,
|
|
37
|
+
path: '/workspaces/$wid/projects/$pid/runs',
|
|
38
|
+
component: () => renderPage({}),
|
|
39
|
+
});
|
|
40
|
+
const runDetailRoute = createRoute({
|
|
41
|
+
getParentRoute: () => rootRoute,
|
|
42
|
+
path: '/workspaces/$wid/projects/$pid/runs/$workflowRunId',
|
|
43
|
+
component: function RunDetailRoute() {
|
|
44
|
+
const {workflowRunId} = useParams({strict: false}) as {workflowRunId?: string};
|
|
45
|
+
return renderPage({workflowRunId});
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const modelProviderSettingsRoute = createRoute({
|
|
49
|
+
getParentRoute: () => rootRoute,
|
|
50
|
+
path: '/workspaces/$wid/settings/agents',
|
|
51
|
+
component: () => <div>Agent settings placeholder</div>,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return createRouter({
|
|
55
|
+
history: createMemoryHistory({initialEntries: [path]}),
|
|
56
|
+
routeTree: rootRoute.addChildren([runsRoute, runDetailRoute, modelProviderSettingsRoute]),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function renderProjectPage(
|
|
61
|
+
path: string,
|
|
62
|
+
renderPage: (params: {workflowRunId?: string | undefined}) => ReactElement,
|
|
63
|
+
): RenderResult & {
|
|
64
|
+
queryClient: QueryClient;
|
|
65
|
+
router: ReturnType<typeof createTestRouter>;
|
|
66
|
+
} {
|
|
67
|
+
const queryClient = new QueryClient({defaultOptions: {queries: {retry: false}}});
|
|
68
|
+
const router = createTestRouter(path, renderPage);
|
|
69
|
+
|
|
70
|
+
configureApiClient({baseUrl: 'https://api.example.test'});
|
|
71
|
+
|
|
72
|
+
const result = render(
|
|
73
|
+
<QueryClientProvider client={queryClient}>
|
|
74
|
+
<RouterProvider router={router} />
|
|
75
|
+
</QueryClientProvider>,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return Object.assign(result, {queryClient, router});
|
|
79
|
+
}
|
package/test/render.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createMemoryHistory,
|
|
3
|
+
createRootRoute,
|
|
4
|
+
createRoute,
|
|
5
|
+
createRouter,
|
|
6
|
+
Outlet,
|
|
7
|
+
RouterProvider,
|
|
8
|
+
} from '@tanstack/react-router';
|
|
9
|
+
import {type RenderResult, render} from '@testing-library/react';
|
|
10
|
+
import type {ReactElement} from 'react';
|
|
11
|
+
|
|
12
|
+
function createComponentRouter(element: ReactElement) {
|
|
13
|
+
const rootRoute = createRootRoute({component: Outlet});
|
|
14
|
+
const indexRoute = createRoute({
|
|
15
|
+
getParentRoute: () => rootRoute,
|
|
16
|
+
path: '/',
|
|
17
|
+
component: () => element,
|
|
18
|
+
});
|
|
19
|
+
// Workflow run rows link here; TanStack Router needs the target route to build hrefs.
|
|
20
|
+
const runDetailRoute = createRoute({
|
|
21
|
+
getParentRoute: () => rootRoute,
|
|
22
|
+
path: '/workspaces/$wid/projects/$pid/runs/$workflowRunId',
|
|
23
|
+
component: () => null,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return createRouter({
|
|
27
|
+
history: createMemoryHistory({initialEntries: ['/']}),
|
|
28
|
+
routeTree: rootRoute.addChildren([indexRoute, runDetailRoute]),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function renderWithRouter(
|
|
33
|
+
element: ReactElement,
|
|
34
|
+
): RenderResult & {router: ReturnType<typeof createComponentRouter>} {
|
|
35
|
+
const router = createComponentRouter(element);
|
|
36
|
+
|
|
37
|
+
const result = render(<RouterProvider router={router} />);
|
|
38
|
+
|
|
39
|
+
return Object.assign(result, {router});
|
|
40
|
+
}
|
package/test/setup.ts
ADDED