@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,280 @@
|
|
|
1
|
+
import {
|
|
2
|
+
workflowJobDto,
|
|
3
|
+
workflowJobExecutionDto,
|
|
4
|
+
workflowRunDetail,
|
|
5
|
+
workflowStepAttemptDto,
|
|
6
|
+
workflowStepDto,
|
|
7
|
+
} from '#test/fixtures/workflow-run.js';
|
|
8
|
+
import {resolveWorkflowRunSelection} from './workflow-run-selection.js';
|
|
9
|
+
|
|
10
|
+
describe('resolveWorkflowRunSelection', () => {
|
|
11
|
+
test('selects a valid job without expanding a step', () => {
|
|
12
|
+
const build = workflowJobDto({id: 'job-build', name: 'build'});
|
|
13
|
+
const deploy = workflowJobDto({id: 'job-deploy', name: 'deploy', position: 1});
|
|
14
|
+
const run = workflowRunDetail({jobs: [build, deploy]});
|
|
15
|
+
|
|
16
|
+
const resolved = resolveWorkflowRunSelection({
|
|
17
|
+
run,
|
|
18
|
+
selection: {jobId: 'job-deploy'},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
expect(resolved.job?.id).toBe('job-deploy');
|
|
22
|
+
expect(resolved.step).toBeUndefined();
|
|
23
|
+
expect(resolved.attempt).toBeUndefined();
|
|
24
|
+
expect(resolved.selectedAttemptId).toBeNull();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('selects a step owner job without an explicit job id', () => {
|
|
28
|
+
const attempt = workflowStepAttemptDto({id: 'attempt-1', step_id: 'step-deploy'});
|
|
29
|
+
const step = workflowStepDto({
|
|
30
|
+
id: 'step-deploy',
|
|
31
|
+
current_attempt: 1,
|
|
32
|
+
attempts: [attempt],
|
|
33
|
+
});
|
|
34
|
+
const run = workflowRunDetail({
|
|
35
|
+
jobs: [
|
|
36
|
+
workflowJobDto({id: 'job-build', name: 'build'}),
|
|
37
|
+
workflowJobDto({id: 'job-deploy', name: 'deploy', position: 1, steps: [step]}),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const resolved = resolveWorkflowRunSelection({
|
|
42
|
+
run,
|
|
43
|
+
selection: {stepId: 'step-deploy'},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(resolved.job?.id).toBe('job-deploy');
|
|
47
|
+
expect(resolved.jobExecution?.id).toBeDefined();
|
|
48
|
+
expect(resolved.step?.id).toBe('step-deploy');
|
|
49
|
+
expect(resolved.attempt?.id).toBe('attempt-1');
|
|
50
|
+
expect(resolved.selectedAttemptId).toBe('attempt-1');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('selects a valid job execution within the selected job', () => {
|
|
54
|
+
const firstExecution = workflowJobExecutionDto({
|
|
55
|
+
id: 'execution-1',
|
|
56
|
+
sequence: 1,
|
|
57
|
+
status: 'failed',
|
|
58
|
+
});
|
|
59
|
+
const secondExecution = workflowJobExecutionDto({
|
|
60
|
+
id: 'execution-2',
|
|
61
|
+
sequence: 2,
|
|
62
|
+
status: 'succeeded',
|
|
63
|
+
});
|
|
64
|
+
const run = workflowRunDetail({
|
|
65
|
+
jobs: [
|
|
66
|
+
workflowJobDto({
|
|
67
|
+
id: 'job-build',
|
|
68
|
+
name: 'build',
|
|
69
|
+
job_executions: [firstExecution, secondExecution],
|
|
70
|
+
}),
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const resolved = resolveWorkflowRunSelection({
|
|
75
|
+
run,
|
|
76
|
+
selection: {jobId: 'job-build', jobExecutionId: 'execution-1'},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
expect(resolved.job?.id).toBe('job-build');
|
|
80
|
+
expect(resolved.jobExecution?.id).toBe('execution-1');
|
|
81
|
+
expect(resolved.step).toBeUndefined();
|
|
82
|
+
expect(resolved.selectedAttemptId).toBeNull();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('falls back from an invalid job execution id to the running execution', () => {
|
|
86
|
+
const run = workflowRunDetail({
|
|
87
|
+
jobs: [
|
|
88
|
+
workflowJobDto({
|
|
89
|
+
id: 'job-build',
|
|
90
|
+
name: 'build',
|
|
91
|
+
job_executions: [
|
|
92
|
+
workflowJobExecutionDto({id: 'execution-1', sequence: 1, status: 'failed'}),
|
|
93
|
+
workflowJobExecutionDto({id: 'execution-2', sequence: 2, status: 'running'}),
|
|
94
|
+
],
|
|
95
|
+
}),
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const resolved = resolveWorkflowRunSelection({
|
|
100
|
+
run,
|
|
101
|
+
selection: {jobId: 'job-build', jobExecutionId: 'missing-execution'},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
expect(resolved.jobExecution?.id).toBe('execution-2');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('defaults to the highest sequence when no execution is running', () => {
|
|
108
|
+
const run = workflowRunDetail({
|
|
109
|
+
jobs: [
|
|
110
|
+
workflowJobDto({
|
|
111
|
+
id: 'job-build',
|
|
112
|
+
name: 'build',
|
|
113
|
+
job_executions: [
|
|
114
|
+
workflowJobExecutionDto({id: 'execution-1', sequence: 1, status: 'failed'}),
|
|
115
|
+
workflowJobExecutionDto({id: 'execution-3', sequence: 3, status: 'succeeded'}),
|
|
116
|
+
workflowJobExecutionDto({id: 'execution-2', sequence: 2, status: 'cancelled'}),
|
|
117
|
+
],
|
|
118
|
+
}),
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const resolved = resolveWorkflowRunSelection({
|
|
123
|
+
run,
|
|
124
|
+
selection: {jobId: 'job-build'},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
expect(resolved.jobExecution?.id).toBe('execution-3');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test('uses the exact valid attempt id when present', () => {
|
|
131
|
+
const firstAttempt = workflowStepAttemptDto({
|
|
132
|
+
id: 'attempt-1',
|
|
133
|
+
step_id: 'step-deploy',
|
|
134
|
+
attempt: 1,
|
|
135
|
+
});
|
|
136
|
+
const secondAttempt = workflowStepAttemptDto({
|
|
137
|
+
id: 'attempt-2',
|
|
138
|
+
step_id: 'step-deploy',
|
|
139
|
+
attempt: 2,
|
|
140
|
+
});
|
|
141
|
+
const step = workflowStepDto({
|
|
142
|
+
id: 'step-deploy',
|
|
143
|
+
current_attempt: 1,
|
|
144
|
+
attempts: [firstAttempt, secondAttempt],
|
|
145
|
+
});
|
|
146
|
+
const run = workflowRunDetail({
|
|
147
|
+
jobs: [workflowJobDto({id: 'job-deploy', name: 'deploy', steps: [step]})],
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const resolved = resolveWorkflowRunSelection({
|
|
151
|
+
run,
|
|
152
|
+
selection: {jobId: 'job-deploy', stepId: 'step-deploy', stepAttemptId: 'attempt-2'},
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
expect(resolved.attempt?.id).toBe('attempt-2');
|
|
156
|
+
expect(resolved.selectedAttemptId).toBe('attempt-2');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('lets a valid step override a mismatched job id', () => {
|
|
160
|
+
const step = workflowStepDto({
|
|
161
|
+
id: 'step-deploy',
|
|
162
|
+
attempts: [workflowStepAttemptDto({id: 'attempt-1', step_id: 'step-deploy'})],
|
|
163
|
+
});
|
|
164
|
+
const run = workflowRunDetail({
|
|
165
|
+
jobs: [
|
|
166
|
+
workflowJobDto({id: 'job-build', name: 'build'}),
|
|
167
|
+
workflowJobDto({id: 'job-deploy', name: 'deploy', position: 1, steps: [step]}),
|
|
168
|
+
],
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const resolved = resolveWorkflowRunSelection({
|
|
172
|
+
run,
|
|
173
|
+
selection: {jobId: 'job-build', stepId: 'step-deploy'},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
expect(resolved.job?.id).toBe('job-deploy');
|
|
177
|
+
expect(resolved.step?.id).toBe('step-deploy');
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('falls back from an invalid attempt id to the current attempt', () => {
|
|
181
|
+
const firstAttempt = workflowStepAttemptDto({
|
|
182
|
+
id: 'attempt-1',
|
|
183
|
+
step_id: 'step-deploy',
|
|
184
|
+
attempt: 1,
|
|
185
|
+
});
|
|
186
|
+
const secondAttempt = workflowStepAttemptDto({
|
|
187
|
+
id: 'attempt-2',
|
|
188
|
+
step_id: 'step-deploy',
|
|
189
|
+
attempt: 2,
|
|
190
|
+
});
|
|
191
|
+
const step = workflowStepDto({
|
|
192
|
+
id: 'step-deploy',
|
|
193
|
+
current_attempt: 2,
|
|
194
|
+
attempts: [firstAttempt, secondAttempt],
|
|
195
|
+
});
|
|
196
|
+
const run = workflowRunDetail({
|
|
197
|
+
jobs: [workflowJobDto({id: 'job-deploy', name: 'deploy', steps: [step]})],
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const resolved = resolveWorkflowRunSelection({
|
|
201
|
+
run,
|
|
202
|
+
selection: {stepId: 'step-deploy', stepAttemptId: 'missing-attempt'},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
expect(resolved.attempt?.id).toBe('attempt-2');
|
|
206
|
+
expect(resolved.selectedAttemptId).toBe('attempt-2');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test('falls back to the latest attempt when the current attempt is missing', () => {
|
|
210
|
+
const firstAttempt = workflowStepAttemptDto({
|
|
211
|
+
id: 'attempt-1',
|
|
212
|
+
step_id: 'step-deploy',
|
|
213
|
+
attempt: 1,
|
|
214
|
+
execution_order: 1,
|
|
215
|
+
});
|
|
216
|
+
const thirdAttempt = workflowStepAttemptDto({
|
|
217
|
+
id: 'attempt-3',
|
|
218
|
+
step_id: 'step-deploy',
|
|
219
|
+
attempt: 3,
|
|
220
|
+
execution_order: 3,
|
|
221
|
+
});
|
|
222
|
+
const step = workflowStepDto({
|
|
223
|
+
id: 'step-deploy',
|
|
224
|
+
current_attempt: 2,
|
|
225
|
+
attempts: [firstAttempt, thirdAttempt],
|
|
226
|
+
});
|
|
227
|
+
const run = workflowRunDetail({
|
|
228
|
+
jobs: [workflowJobDto({id: 'job-deploy', name: 'deploy', steps: [step]})],
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const resolved = resolveWorkflowRunSelection({
|
|
232
|
+
run,
|
|
233
|
+
selection: {stepId: 'step-deploy'},
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
expect(resolved.attempt?.id).toBe('attempt-3');
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test('falls back to the first job for invalid job or step ids', () => {
|
|
240
|
+
const run = workflowRunDetail({
|
|
241
|
+
jobs: [
|
|
242
|
+
workflowJobDto({id: 'job-build', name: 'build'}),
|
|
243
|
+
workflowJobDto({id: 'job-deploy', name: 'deploy', position: 1}),
|
|
244
|
+
],
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
const resolved = resolveWorkflowRunSelection({
|
|
248
|
+
run,
|
|
249
|
+
selection: {jobId: 'missing-job', stepId: 'missing-step'},
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
expect(resolved.job?.id).toBe('job-build');
|
|
253
|
+
expect(resolved.step).toBeUndefined();
|
|
254
|
+
expect(resolved.selectedAttemptId).toBeNull();
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
test('handles empty runs and zero-attempt steps', () => {
|
|
258
|
+
const emptyRun = workflowRunDetail({jobs: []});
|
|
259
|
+
const zeroAttemptStep = workflowStepDto({id: 'step-empty', attempts: []});
|
|
260
|
+
const run = workflowRunDetail({
|
|
261
|
+
jobs: [workflowJobDto({id: 'job-build', name: 'build', steps: [zeroAttemptStep]})],
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
const emptyResolved = resolveWorkflowRunSelection({
|
|
265
|
+
run: emptyRun,
|
|
266
|
+
selection: {jobId: 'job-build'},
|
|
267
|
+
});
|
|
268
|
+
const zeroAttemptResolved = resolveWorkflowRunSelection({
|
|
269
|
+
run,
|
|
270
|
+
selection: {stepId: 'step-empty'},
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
expect(emptyResolved.job).toBeUndefined();
|
|
274
|
+
expect(emptyResolved.selectedAttemptId).toBeNull();
|
|
275
|
+
expect(zeroAttemptResolved.job?.id).toBe('job-build');
|
|
276
|
+
expect(zeroAttemptResolved.step?.id).toBe('step-empty');
|
|
277
|
+
expect(zeroAttemptResolved.attempt).toBeUndefined();
|
|
278
|
+
expect(zeroAttemptResolved.selectedAttemptId).toBeNull();
|
|
279
|
+
});
|
|
280
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Job,
|
|
3
|
+
type JobExecution,
|
|
4
|
+
resolveJobExecution,
|
|
5
|
+
type Step,
|
|
6
|
+
type StepAttempt,
|
|
7
|
+
type WorkflowRunDetail,
|
|
8
|
+
} from '#core/workflow-run.js';
|
|
9
|
+
import type {WorkflowRunSelectionInput} from '#core/workflow-run-url-state.js';
|
|
10
|
+
|
|
11
|
+
export interface ResolvedWorkflowRunSelection {
|
|
12
|
+
job: Job | undefined;
|
|
13
|
+
jobExecution: JobExecution | undefined;
|
|
14
|
+
step: Step | undefined;
|
|
15
|
+
attempt: StepAttempt | undefined;
|
|
16
|
+
selectedAttemptId: string | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function resolveWorkflowRunSelection({
|
|
20
|
+
run,
|
|
21
|
+
selection,
|
|
22
|
+
}: {
|
|
23
|
+
run: WorkflowRunDetail;
|
|
24
|
+
selection: WorkflowRunSelectionInput;
|
|
25
|
+
}): ResolvedWorkflowRunSelection {
|
|
26
|
+
const jobById = new Map(run.jobs.map((job) => [job.id, job]));
|
|
27
|
+
const stepMatch = findStep(run, selection.stepId);
|
|
28
|
+
|
|
29
|
+
if (stepMatch) {
|
|
30
|
+
const attempt = resolveStepAttempt(stepMatch.step, selection.stepAttemptId);
|
|
31
|
+
return {
|
|
32
|
+
job: stepMatch.job,
|
|
33
|
+
jobExecution: stepMatch.jobExecution,
|
|
34
|
+
step: stepMatch.step,
|
|
35
|
+
attempt,
|
|
36
|
+
selectedAttemptId: attempt?.id ?? null,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const job = (selection.jobId ? jobById.get(selection.jobId) : undefined) ?? run.jobs.at(0);
|
|
41
|
+
const jobExecution = job ? resolveJobExecution(job, selection.jobExecutionId) : undefined;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
job,
|
|
45
|
+
jobExecution,
|
|
46
|
+
step: undefined,
|
|
47
|
+
attempt: undefined,
|
|
48
|
+
selectedAttemptId: null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function findStep(
|
|
53
|
+
run: WorkflowRunDetail,
|
|
54
|
+
stepId: string | undefined,
|
|
55
|
+
): {job: Job; jobExecution: JobExecution; step: Step} | undefined {
|
|
56
|
+
if (!stepId) return undefined;
|
|
57
|
+
|
|
58
|
+
for (const job of run.jobs) {
|
|
59
|
+
for (const jobExecution of job.jobExecutions) {
|
|
60
|
+
const step = jobExecution.steps.find((candidate) => candidate.id === stepId);
|
|
61
|
+
if (step) return {job, jobExecution, step};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function resolveStepAttempt(step: Step, attemptId: string | undefined): StepAttempt | undefined {
|
|
69
|
+
const attemptById = attemptId
|
|
70
|
+
? step.attempts.find((attempt) => attempt.id === attemptId)
|
|
71
|
+
: undefined;
|
|
72
|
+
if (attemptById) return attemptById;
|
|
73
|
+
|
|
74
|
+
const currentAttempt = step.attempts.find((attempt) => attempt.attempt === step.currentAttempt);
|
|
75
|
+
if (currentAttempt) return currentAttempt;
|
|
76
|
+
|
|
77
|
+
return step.attempts.reduce<StepAttempt | undefined>((latest, attempt) => {
|
|
78
|
+
if (!latest) return attempt;
|
|
79
|
+
return compareAttempts(attempt, latest) > 0 ? attempt : latest;
|
|
80
|
+
}, undefined);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function compareAttempts(left: StepAttempt, right: StepAttempt): number {
|
|
84
|
+
return (
|
|
85
|
+
left.attempt - right.attempt ||
|
|
86
|
+
left.executionOrder - right.executionOrder ||
|
|
87
|
+
left.id.localeCompare(right.id)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type {QueryLoadErrorQuery} from '@shipfox/client-ui';
|
|
2
|
+
import {Button} from '@shipfox/react-ui/button';
|
|
3
|
+
import {Callout} from '@shipfox/react-ui/callout';
|
|
4
|
+
import {EmptyState} from '@shipfox/react-ui/empty-state';
|
|
5
|
+
import {Skeleton} from '@shipfox/react-ui/skeleton';
|
|
6
|
+
import {Text} from '@shipfox/react-ui/typography';
|
|
7
|
+
|
|
8
|
+
export function WorkflowRunSkeleton() {
|
|
9
|
+
return (
|
|
10
|
+
<section
|
|
11
|
+
aria-label="Loading workflow run"
|
|
12
|
+
className="border-b border-border-neutral-base bg-background-subtle-base px-16 py-12"
|
|
13
|
+
>
|
|
14
|
+
<div className="flex min-w-0 flex-wrap items-center gap-x-12 gap-y-8">
|
|
15
|
+
<div className="flex min-w-0 items-center gap-8">
|
|
16
|
+
<Skeleton className="size-8 rounded-full" />
|
|
17
|
+
<Skeleton className="h-24 w-180 rounded-6" />
|
|
18
|
+
</div>
|
|
19
|
+
<Skeleton className="h-24 w-88 rounded-6" />
|
|
20
|
+
<span
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
className="hidden h-20 w-px shrink-0 bg-border-neutral-base sm:block"
|
|
23
|
+
/>
|
|
24
|
+
<Skeleton className="h-20 w-64 rounded-4" />
|
|
25
|
+
<Skeleton className="h-20 w-112 rounded-4" />
|
|
26
|
+
<span className="min-w-0 flex-1" />
|
|
27
|
+
<Skeleton className="h-20 w-88 rounded-4" />
|
|
28
|
+
<Skeleton className="h-20 w-88 rounded-4" />
|
|
29
|
+
</div>
|
|
30
|
+
</section>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function WorkflowRunNotFound() {
|
|
35
|
+
return (
|
|
36
|
+
<EmptyState
|
|
37
|
+
icon="pulseLine"
|
|
38
|
+
title="Run not found"
|
|
39
|
+
description="This run does not exist or is no longer available."
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Slim non-blocking banner shown when a background refetch fails after the run already
|
|
46
|
+
* loaded (active-run polling can hit a transient API error), so the loaded run stays on
|
|
47
|
+
* screen with an inline retry instead of being wiped by a full error placeholder.
|
|
48
|
+
*/
|
|
49
|
+
export function WorkflowRunStaleError({query}: {query: QueryLoadErrorQuery}) {
|
|
50
|
+
return (
|
|
51
|
+
<div className="border-b border-border-neutral-base p-8">
|
|
52
|
+
<Callout role="alert" type="error">
|
|
53
|
+
<div className="flex items-center justify-between gap-8">
|
|
54
|
+
<Text size="xs">Could not refresh this run.</Text>
|
|
55
|
+
<Button
|
|
56
|
+
type="button"
|
|
57
|
+
size="2xs"
|
|
58
|
+
variant="secondary"
|
|
59
|
+
isLoading={query.isFetching}
|
|
60
|
+
onClick={() => {
|
|
61
|
+
void query.refetch();
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
Retry
|
|
65
|
+
</Button>
|
|
66
|
+
</div>
|
|
67
|
+
</Callout>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|