@shipfox/client-workflows 14.0.1 → 16.0.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/preview.css +4 -0
- package/.storybook/preview.tsx +7 -2
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +42 -0
- package/dist/components/job-detail/agent-config-failure-callout.d.ts.map +1 -0
- package/dist/components/{workflow-run-view → job-detail}/agent-config-failure-callout.js +2 -2
- package/dist/components/job-detail/agent-config-failure-callout.js.map +1 -0
- package/dist/components/job-detail/job-detail-header.d.ts +15 -0
- package/dist/components/job-detail/job-detail-header.d.ts.map +1 -0
- package/dist/components/job-detail/job-detail-header.js +124 -0
- package/dist/components/job-detail/job-detail-header.js.map +1 -0
- package/dist/components/job-detail/job-detail-view.d.ts +16 -0
- package/dist/components/job-detail/job-detail-view.d.ts.map +1 -0
- package/dist/components/job-detail/job-detail-view.js +420 -0
- package/dist/components/job-detail/job-detail-view.js.map +1 -0
- package/dist/components/job-detail/job-empty-states.d.ts +10 -0
- package/dist/components/job-detail/job-empty-states.d.ts.map +1 -0
- package/dist/components/job-detail/job-empty-states.js +195 -0
- package/dist/components/job-detail/job-empty-states.js.map +1 -0
- package/dist/components/job-detail/job-execution-switcher.d.ts.map +1 -0
- package/dist/components/job-detail/job-execution-switcher.js.map +1 -0
- package/dist/components/job-detail/job-execution-time-text.d.ts.map +1 -0
- package/dist/components/job-detail/job-execution-time-text.js.map +1 -0
- package/dist/components/job-detail/job-selection.d.ts +24 -0
- package/dist/components/job-detail/job-selection.d.ts.map +1 -0
- package/dist/components/job-detail/job-selection.js +66 -0
- package/dist/components/job-detail/job-selection.js.map +1 -0
- package/dist/components/job-detail/step-attempt-log-panel.d.ts +15 -0
- package/dist/components/job-detail/step-attempt-log-panel.d.ts.map +1 -0
- package/dist/components/{workflow-run-view → job-detail}/step-attempt-log-panel.js +61 -16
- package/dist/components/job-detail/step-attempt-log-panel.js.map +1 -0
- package/dist/components/job-graph/job-graph-content.js +1 -1
- package/dist/components/job-graph/job-graph-content.js.map +1 -1
- package/dist/components/step-list/step-list-model.js +2 -2
- package/dist/components/step-list/step-list-model.js.map +1 -1
- package/dist/components/step-list/step-list.d.ts +1 -0
- package/dist/components/step-list/step-list.d.ts.map +1 -1
- package/dist/components/step-list/step-list.js +29 -4
- package/dist/components/step-list/step-list.js.map +1 -1
- package/dist/components/workflow-run-duration-label.d.ts +9 -4
- package/dist/components/workflow-run-duration-label.d.ts.map +1 -1
- package/dist/components/workflow-run-duration-label.js +27 -7
- package/dist/components/workflow-run-duration-label.js.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-row.js +6 -5
- package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -1
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -1
- package/dist/components/workflow-run-summary/workflow-run-summary.js +69 -64
- package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -1
- package/dist/components/workflow-run-tabs/index.d.ts +3 -3
- package/dist/components/workflow-run-tabs/index.d.ts.map +1 -1
- package/dist/components/workflow-run-tabs/index.js +3 -3
- package/dist/components/workflow-run-tabs/index.js.map +1 -1
- package/dist/components/workflow-run-tabs/run-annotation-count-chip.d.ts +16 -0
- package/dist/components/workflow-run-tabs/run-annotation-count-chip.d.ts.map +1 -0
- package/dist/components/workflow-run-tabs/run-annotation-count-chip.js +50 -0
- package/dist/components/workflow-run-tabs/run-annotation-count-chip.js.map +1 -0
- package/dist/components/workflow-run-tabs/run-annotation-item.d.ts +20 -0
- package/dist/components/workflow-run-tabs/run-annotation-item.d.ts.map +1 -0
- package/dist/components/workflow-run-tabs/run-annotation-item.js +102 -0
- package/dist/components/workflow-run-tabs/run-annotation-item.js.map +1 -0
- package/dist/components/workflow-run-tabs/run-annotation-list.d.ts +32 -0
- package/dist/components/workflow-run-tabs/run-annotation-list.d.ts.map +1 -0
- package/dist/components/workflow-run-tabs/run-annotation-list.js +202 -0
- package/dist/components/workflow-run-tabs/run-annotation-list.js.map +1 -0
- package/dist/components/workflow-run-tabs/run-annotation-summary-line.d.ts +1 -1
- package/dist/components/workflow-run-tabs/run-annotation-summary-line.d.ts.map +1 -1
- package/dist/components/workflow-run-tabs/run-annotation-summary-line.js +87 -22
- package/dist/components/workflow-run-tabs/run-annotation-summary-line.js.map +1 -1
- package/dist/components/workflow-run-tabs/run-annotations-empty.d.ts +3 -1
- package/dist/components/workflow-run-tabs/run-annotations-empty.d.ts.map +1 -1
- package/dist/components/workflow-run-tabs/run-annotations-empty.js +2 -2
- package/dist/components/workflow-run-tabs/run-annotations-empty.js.map +1 -1
- package/dist/components/workflow-run-tabs/severity-visuals.d.ts +20 -0
- package/dist/components/workflow-run-tabs/severity-visuals.d.ts.map +1 -0
- package/dist/components/workflow-run-tabs/severity-visuals.js +31 -0
- package/dist/components/workflow-run-tabs/severity-visuals.js.map +1 -0
- package/dist/components/workflow-run-view/index.d.ts +0 -1
- package/dist/components/workflow-run-view/index.d.ts.map +1 -1
- package/dist/components/workflow-run-view/index.js +0 -1
- package/dist/components/workflow-run-view/index.js.map +1 -1
- package/dist/components/workflow-run-view/run-workspace-nav.d.ts +20 -0
- package/dist/components/workflow-run-view/run-workspace-nav.d.ts.map +1 -0
- package/dist/components/workflow-run-view/run-workspace-nav.js +277 -0
- package/dist/components/workflow-run-view/run-workspace-nav.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-selection.d.ts.map +1 -1
- package/dist/components/workflow-run-view/workflow-run-selection.js +1 -14
- package/dist/components/workflow-run-view/workflow-run-selection.js.map +1 -1
- package/dist/components/workflow-run-view/workflow-run-view.d.ts +10 -10
- package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -1
- package/dist/components/workflow-run-view/workflow-run-view.js +351 -239
- package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -1
- package/dist/components/workflow-status/status-visuals.d.ts.map +1 -1
- package/dist/components/workflow-status/status-visuals.js +10 -2
- package/dist/components/workflow-status/status-visuals.js.map +1 -1
- package/dist/components/workflow-status/workflow-status-icon.d.ts +3 -1
- package/dist/components/workflow-status/workflow-status-icon.d.ts.map +1 -1
- package/dist/components/workflow-status/workflow-status-icon.js +13 -2
- package/dist/components/workflow-status/workflow-status-icon.js.map +1 -1
- package/dist/core/entities/job-execution.d.ts +9 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -1
- package/dist/core/entities/job-execution.js +13 -3
- package/dist/core/entities/job-execution.js.map +1 -1
- package/dist/core/entities/job.d.ts.map +1 -1
- package/dist/core/entities/step-attempt.d.ts.map +1 -1
- package/dist/core/entities/step.d.ts +2 -0
- package/dist/core/entities/step.d.ts.map +1 -1
- package/dist/core/entities/step.js +13 -0
- package/dist/core/entities/step.js.map +1 -1
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.d.ts +56 -1
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js +98 -0
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/core/run-annotation.d.ts +73 -0
- package/dist/core/run-annotation.d.ts.map +1 -0
- package/dist/core/run-annotation.js +125 -0
- package/dist/core/run-annotation.js.map +1 -0
- package/dist/core/workflow-run.d.ts +4 -4
- package/dist/core/workflow-run.d.ts.map +1 -1
- package/dist/core/workflow-run.js +3 -3
- package/dist/core/workflow-run.js.map +1 -1
- package/dist/feature.d.ts +20 -16
- package/dist/feature.d.ts.map +1 -1
- package/dist/feature.js +5 -0
- package/dist/feature.js.map +1 -1
- package/dist/hooks/api/run-annotation-mapper.d.ts +10 -0
- package/dist/hooks/api/run-annotation-mapper.d.ts.map +1 -0
- package/dist/hooks/api/run-annotation-mapper.js +22 -0
- package/dist/hooks/api/run-annotation-mapper.js.map +1 -0
- package/dist/hooks/api/run-annotations.d.ts +25 -0
- package/dist/hooks/api/run-annotations.d.ts.map +1 -0
- package/dist/hooks/api/run-annotations.js +78 -0
- package/dist/hooks/api/run-annotations.js.map +1 -0
- package/dist/hooks/api/workflow-runs.d.ts +5 -3
- package/dist/hooks/api/workflow-runs.d.ts.map +1 -1
- package/dist/hooks/api/workflow-runs.js +5 -4
- package/dist/hooks/api/workflow-runs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pages/workflow-job-detail-page.d.ts +11 -0
- package/dist/pages/workflow-job-detail-page.d.ts.map +1 -0
- package/dist/pages/workflow-job-detail-page.js +66 -0
- package/dist/pages/workflow-job-detail-page.js.map +1 -0
- package/dist/pages/workflow-run-detail-page.d.ts.map +1 -1
- package/dist/pages/workflow-run-detail-page.js +4 -37
- package/dist/pages/workflow-run-detail-page.js.map +1 -1
- package/dist/routes/inputs.d.ts +52 -34
- package/dist/routes/inputs.d.ts.map +1 -1
- package/dist/routes/inputs.js +74 -43
- package/dist/routes/inputs.js.map +1 -1
- package/dist/routes/job-detail.d.ts +10 -0
- package/dist/routes/job-detail.d.ts.map +1 -0
- package/dist/routes/job-detail.js +27 -0
- package/dist/routes/job-detail.js.map +1 -0
- package/dist/routes/project-route.d.ts +1 -1
- package/dist/routes/run-detail.d.ts.map +1 -1
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/workflows.d.ts.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/components/{workflow-run-view → job-detail}/agent-config-failure-callout.stories.tsx +1 -1
- package/src/components/{workflow-run-view → job-detail}/agent-config-failure-callout.tsx +2 -2
- package/src/components/job-detail/job-detail-header.test.tsx +34 -0
- package/src/components/job-detail/job-detail-header.tsx +136 -0
- package/src/components/job-detail/job-detail-view.stories.tsx +531 -0
- package/src/components/job-detail/job-detail-view.tsx +467 -0
- package/src/components/job-detail/job-empty-states.test.ts +27 -0
- package/src/components/job-detail/job-empty-states.tsx +248 -0
- package/src/components/job-detail/job-selection.test.ts +188 -0
- package/src/components/job-detail/job-selection.ts +96 -0
- package/src/components/{workflow-run-view → job-detail}/step-attempt-log-panel.test.tsx +32 -9
- package/src/components/{workflow-run-view → job-detail}/step-attempt-log-panel.tsx +52 -18
- package/src/components/job-graph/job-graph-content.tsx +1 -1
- package/src/components/step-list/step-list-model.test.ts +1 -1
- package/src/components/step-list/step-list-model.ts +2 -2
- package/src/components/step-list/step-list.stories.tsx +1 -1
- package/src/components/step-list/step-list.test.tsx +33 -0
- package/src/components/step-list/step-list.tsx +40 -9
- package/src/components/workflow-run-duration-label.tsx +50 -12
- package/src/components/workflow-run-list/workflow-run-row.tsx +6 -4
- package/src/components/workflow-run-summary/workflow-run-summary.stories.tsx +38 -0
- package/src/components/workflow-run-summary/workflow-run-summary.test.tsx +79 -5
- package/src/components/workflow-run-summary/workflow-run-summary.tsx +56 -60
- package/src/components/workflow-run-tabs/index.ts +3 -3
- package/src/components/workflow-run-tabs/run-annotation-count-chip.tsx +63 -0
- package/src/components/workflow-run-tabs/run-annotation-item.tsx +123 -0
- package/src/components/workflow-run-tabs/run-annotation-list.tsx +258 -0
- package/src/components/workflow-run-tabs/run-annotation-summary-line.test.tsx +77 -3
- package/src/components/workflow-run-tabs/run-annotation-summary-line.tsx +92 -17
- package/src/components/workflow-run-tabs/run-annotations-empty.tsx +6 -2
- package/src/components/workflow-run-tabs/run-annotations.stories.tsx +293 -0
- package/src/components/workflow-run-tabs/severity-visuals.ts +37 -0
- package/src/components/workflow-run-view/index.ts +0 -1
- package/src/components/workflow-run-view/run-workspace-nav.test.tsx +286 -0
- package/src/components/workflow-run-view/run-workspace-nav.tsx +314 -0
- package/src/components/workflow-run-view/workflow-run-selection.ts +1 -23
- package/src/components/workflow-run-view/workflow-run-view.test.tsx +237 -1085
- package/src/components/workflow-run-view/workflow-run-view.tsx +450 -323
- package/src/components/workflow-status/status-visuals.ts +5 -2
- package/src/components/workflow-status/workflow-status-icon.stories.tsx +1 -0
- package/src/components/workflow-status/workflow-status-icon.tsx +26 -1
- package/src/core/entities/job-execution.ts +17 -2
- package/src/core/entities/step.ts +26 -0
- package/src/core/entities/workflow-run-display.test.ts +159 -0
- package/src/core/entities/workflow-run.ts +139 -1
- package/src/core/run-annotation.test.ts +315 -0
- package/src/core/run-annotation.ts +238 -0
- package/src/core/workflow-run.ts +16 -1
- package/src/feature.ts +5 -0
- package/src/hooks/api/run-annotation-mapper.ts +30 -0
- package/src/hooks/api/run-annotations.ts +137 -0
- package/src/hooks/api/workflow-runs.ts +6 -2
- package/src/index.ts +1 -0
- package/src/page-harness-budget.test.ts +1 -0
- package/src/pages/workflow-job-detail-page.test.tsx +605 -0
- package/src/pages/workflow-job-detail-page.tsx +84 -0
- package/src/pages/workflow-run-detail-page.tsx +3 -43
- package/src/pages/workflow-run-pages.test.tsx +77 -332
- package/src/routes/inputs.test.ts +56 -6
- package/src/routes/inputs.ts +71 -19
- package/src/routes/job-detail.tsx +29 -0
- package/test/pages.tsx +25 -3
- package/test/render.tsx +6 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/components/workflow-run-tabs/run-jobs-list.d.ts +0 -18
- package/dist/components/workflow-run-tabs/run-jobs-list.d.ts.map +0 -1
- package/dist/components/workflow-run-tabs/run-jobs-list.js +0 -107
- package/dist/components/workflow-run-tabs/run-jobs-list.js.map +0 -1
- package/dist/components/workflow-run-tabs/run-tab-count.d.ts +0 -6
- package/dist/components/workflow-run-tabs/run-tab-count.d.ts.map +0 -1
- package/dist/components/workflow-run-tabs/run-tab-count.js +0 -27
- package/dist/components/workflow-run-tabs/run-tab-count.js.map +0 -1
- package/dist/components/workflow-run-tabs/run-tab-strip.d.ts +0 -8
- package/dist/components/workflow-run-tabs/run-tab-strip.d.ts.map +0 -1
- package/dist/components/workflow-run-tabs/run-tab-strip.js +0 -82
- package/dist/components/workflow-run-tabs/run-tab-strip.js.map +0 -1
- package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts.map +0 -1
- package/dist/components/workflow-run-view/agent-config-failure-callout.js.map +0 -1
- package/dist/components/workflow-run-view/job-card.d.ts +0 -17
- package/dist/components/workflow-run-view/job-card.d.ts.map +0 -1
- package/dist/components/workflow-run-view/job-card.js +0 -496
- package/dist/components/workflow-run-view/job-card.js.map +0 -1
- package/dist/components/workflow-run-view/job-execution-switcher.d.ts.map +0 -1
- package/dist/components/workflow-run-view/job-execution-switcher.js.map +0 -1
- package/dist/components/workflow-run-view/job-execution-time-text.d.ts.map +0 -1
- package/dist/components/workflow-run-view/job-execution-time-text.js.map +0 -1
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts +0 -9
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts.map +0 -1
- package/dist/components/workflow-run-view/step-attempt-log-panel.js.map +0 -1
- package/dist/core/workflow-run-tabs.d.ts +0 -9
- package/dist/core/workflow-run-tabs.d.ts.map +0 -1
- package/dist/core/workflow-run-tabs.js +0 -3
- package/dist/core/workflow-run-tabs.js.map +0 -1
- package/src/components/workflow-run-tabs/run-jobs-list.tsx +0 -151
- package/src/components/workflow-run-tabs/run-tab-count.tsx +0 -28
- package/src/components/workflow-run-tabs/run-tab-strip.stories.tsx +0 -52
- package/src/components/workflow-run-tabs/run-tab-strip.test.tsx +0 -117
- package/src/components/workflow-run-tabs/run-tab-strip.tsx +0 -97
- package/src/components/workflow-run-view/job-card.stories.tsx +0 -789
- package/src/components/workflow-run-view/job-card.test.tsx +0 -115
- package/src/components/workflow-run-view/job-card.tsx +0 -614
- package/src/core/workflow-run-tabs.ts +0 -8
- /package/dist/components/{workflow-run-view → job-detail}/agent-config-failure-callout.d.ts +0 -0
- /package/dist/components/{workflow-run-view → job-detail}/job-execution-switcher.d.ts +0 -0
- /package/dist/components/{workflow-run-view → job-detail}/job-execution-switcher.js +0 -0
- /package/dist/components/{workflow-run-view → job-detail}/job-execution-time-text.d.ts +0 -0
- /package/dist/components/{workflow-run-view → job-detail}/job-execution-time-text.js +0 -0
- /package/src/components/{workflow-run-view → job-detail}/job-execution-switcher.tsx +0 -0
- /package/src/components/{workflow-run-view → job-detail}/job-execution-time-text.tsx +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {READ_ANNOTATIONS_MAX_LIMIT, readAnnotationsResponseSchema} from '@shipfox/annotations-dto';
|
|
2
|
+
import {checkedApiRequest} from '@shipfox/client-api';
|
|
3
|
+
import {
|
|
4
|
+
type InfiniteData,
|
|
5
|
+
infiniteQueryOptions,
|
|
6
|
+
type UseInfiniteQueryOptions,
|
|
7
|
+
useInfiniteQuery,
|
|
8
|
+
} from '@tanstack/react-query';
|
|
9
|
+
import {useMemo} from 'react';
|
|
10
|
+
import {
|
|
11
|
+
type RunAnnotationRecord,
|
|
12
|
+
type RunAnnotationSummary,
|
|
13
|
+
summarizeRunAnnotations,
|
|
14
|
+
} from '#core/run-annotation.js';
|
|
15
|
+
import {type RunAnnotationPage, toRunAnnotationPage} from './run-annotation-mapper.js';
|
|
16
|
+
|
|
17
|
+
/** Matches the run detail poll, so annotations and run state never disagree by more than a tick. */
|
|
18
|
+
const ACTIVE_POLL_MS = 4_000;
|
|
19
|
+
|
|
20
|
+
export const runAnnotationsQueryKeys = {
|
|
21
|
+
all: ['run-annotations'] as const,
|
|
22
|
+
list: (workflowRunId: string, runAttempt?: number | undefined) =>
|
|
23
|
+
[...runAnnotationsQueryKeys.all, 'list', workflowRunId, runAttempt ?? null] as const,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type RunAnnotationsQueryKey =
|
|
27
|
+
| ReturnType<typeof runAnnotationsQueryKeys.list>
|
|
28
|
+
| readonly ['run-annotations', 'list'];
|
|
29
|
+
|
|
30
|
+
type RunAnnotationsQueryOptions = UseInfiniteQueryOptions<
|
|
31
|
+
RunAnnotationPage,
|
|
32
|
+
Error,
|
|
33
|
+
InfiniteData<RunAnnotationPage, string | undefined>,
|
|
34
|
+
RunAnnotationsQueryKey,
|
|
35
|
+
string | undefined
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
async function listRunAnnotations({
|
|
39
|
+
workflowRunId,
|
|
40
|
+
runAttempt,
|
|
41
|
+
cursor,
|
|
42
|
+
signal,
|
|
43
|
+
}: {
|
|
44
|
+
workflowRunId: string;
|
|
45
|
+
runAttempt: number;
|
|
46
|
+
cursor?: string | undefined;
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}): Promise<RunAnnotationPage> {
|
|
49
|
+
const params = new URLSearchParams({
|
|
50
|
+
workflow_run_id: workflowRunId,
|
|
51
|
+
attempt: String(runAttempt),
|
|
52
|
+
limit: String(READ_ANNOTATIONS_MAX_LIMIT),
|
|
53
|
+
});
|
|
54
|
+
if (cursor) params.set('cursor', cursor);
|
|
55
|
+
|
|
56
|
+
return toRunAnnotationPage(
|
|
57
|
+
await checkedApiRequest(readAnnotationsResponseSchema, `/annotations?${params.toString()}`, {
|
|
58
|
+
signal,
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface RunAnnotationsQueryInput {
|
|
64
|
+
workflowRunId: string | undefined;
|
|
65
|
+
runAttempt: number | undefined;
|
|
66
|
+
/** Poll while the run attempt is non-terminal, then settle. */
|
|
67
|
+
live?: boolean | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function runAnnotationsQueryOptions({
|
|
71
|
+
workflowRunId,
|
|
72
|
+
runAttempt,
|
|
73
|
+
live = false,
|
|
74
|
+
}: RunAnnotationsQueryInput): RunAnnotationsQueryOptions {
|
|
75
|
+
const enabled = Boolean(workflowRunId) && runAttempt !== undefined;
|
|
76
|
+
|
|
77
|
+
// Polling stops once the reader has paged past the first page: the cursor bounding page 2 was
|
|
78
|
+
// computed from page 1's last row, so a refetch that shifts that boundary can drop a range of
|
|
79
|
+
// annotations into a between-pages gap.
|
|
80
|
+
return infiniteQueryOptions({
|
|
81
|
+
queryKey: workflowRunId
|
|
82
|
+
? runAnnotationsQueryKeys.list(workflowRunId, runAttempt)
|
|
83
|
+
: ([...runAnnotationsQueryKeys.all, 'list'] as const),
|
|
84
|
+
enabled,
|
|
85
|
+
initialPageParam: undefined as string | undefined,
|
|
86
|
+
queryFn: ({pageParam, signal}) =>
|
|
87
|
+
listRunAnnotations({
|
|
88
|
+
workflowRunId: workflowRunId ?? '',
|
|
89
|
+
runAttempt: runAttempt ?? 1,
|
|
90
|
+
cursor: pageParam,
|
|
91
|
+
signal,
|
|
92
|
+
}),
|
|
93
|
+
getNextPageParam: (lastPage) => lastPage.nextCursor ?? undefined,
|
|
94
|
+
staleTime: 2_000,
|
|
95
|
+
refetchOnWindowFocus: true,
|
|
96
|
+
refetchInterval: (query) => {
|
|
97
|
+
if (!live) return false;
|
|
98
|
+
const pages = query.state.data?.pages;
|
|
99
|
+
return pages && pages.length > 1 ? false : ACTIVE_POLL_MS;
|
|
100
|
+
},
|
|
101
|
+
refetchIntervalInBackground: false,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface RunAnnotationsQueryResult {
|
|
106
|
+
query: ReturnType<
|
|
107
|
+
typeof useInfiniteQuery<
|
|
108
|
+
RunAnnotationPage,
|
|
109
|
+
Error,
|
|
110
|
+
InfiniteData<RunAnnotationPage, string | undefined>,
|
|
111
|
+
RunAnnotationsQueryKey,
|
|
112
|
+
string | undefined
|
|
113
|
+
>
|
|
114
|
+
>;
|
|
115
|
+
/** `undefined` until the first page resolves, so counts never render a speculative zero. */
|
|
116
|
+
annotations: RunAnnotationRecord[] | undefined;
|
|
117
|
+
summary: RunAnnotationSummary | undefined;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function useRunAnnotationsQuery(input: RunAnnotationsQueryInput): RunAnnotationsQueryResult {
|
|
121
|
+
const query = useInfiniteQuery(runAnnotationsQueryOptions(input));
|
|
122
|
+
const pages = query.data?.pages;
|
|
123
|
+
|
|
124
|
+
const annotations = useMemo(
|
|
125
|
+
() => (pages ? pages.flatMap((page) => page.annotations) : undefined),
|
|
126
|
+
[pages],
|
|
127
|
+
);
|
|
128
|
+
const summary = useMemo(
|
|
129
|
+
() =>
|
|
130
|
+
annotations
|
|
131
|
+
? summarizeRunAnnotations(annotations, {truncated: pages?.at(-1)?.hasMore ?? false})
|
|
132
|
+
: undefined,
|
|
133
|
+
[annotations, pages],
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
return {query, annotations, summary};
|
|
137
|
+
}
|
|
@@ -507,19 +507,23 @@ export function useWorkflowRunQuery(workflowRunId: string | undefined) {
|
|
|
507
507
|
export function useWorkflowRunAttemptQuery({
|
|
508
508
|
workflowRunId,
|
|
509
509
|
runAttempt,
|
|
510
|
+
enabled = true,
|
|
510
511
|
}: {
|
|
511
512
|
workflowRunId: string | undefined;
|
|
512
513
|
runAttempt?: number | undefined;
|
|
514
|
+
enabled?: boolean | undefined;
|
|
513
515
|
}) {
|
|
514
|
-
return useQuery(workflowRunQueryOptions({workflowRunId, runAttempt}));
|
|
516
|
+
return useQuery(workflowRunQueryOptions({workflowRunId, runAttempt, enabled}));
|
|
515
517
|
}
|
|
516
518
|
|
|
517
519
|
export function workflowRunQueryOptions({
|
|
518
520
|
workflowRunId,
|
|
519
521
|
runAttempt,
|
|
522
|
+
enabled = true,
|
|
520
523
|
}: {
|
|
521
524
|
workflowRunId: string | undefined;
|
|
522
525
|
runAttempt?: number | undefined;
|
|
526
|
+
enabled?: boolean | undefined;
|
|
523
527
|
}): WorkflowRunDetailQueryOptions {
|
|
524
528
|
// Poll a non-terminal run so the open run detail stays live (same cadence as the run
|
|
525
529
|
// list); stop once the run is terminal.
|
|
@@ -527,7 +531,7 @@ export function workflowRunQueryOptions({
|
|
|
527
531
|
queryKey: workflowRunId
|
|
528
532
|
? workflowRunsQueryKeys.detail(workflowRunId, runAttempt)
|
|
529
533
|
: ([...workflowRunsQueryKeys.all, 'detail'] as const),
|
|
530
|
-
enabled: Boolean(workflowRunId),
|
|
534
|
+
enabled: Boolean(workflowRunId) && enabled,
|
|
531
535
|
queryFn: ({signal}) => getWorkflowRun({workflowRunId: workflowRunId ?? '', runAttempt, signal}),
|
|
532
536
|
staleTime: 2_000,
|
|
533
537
|
refetchOnWindowFocus: true,
|
package/src/index.ts
CHANGED
|
@@ -51,5 +51,6 @@ export {
|
|
|
51
51
|
workflowRunsQueryKeys,
|
|
52
52
|
} from './hooks/api/workflow-runs.js';
|
|
53
53
|
export {ProjectWorkflowsPage} from './pages/project-workflows-page.js';
|
|
54
|
+
export {WorkflowJobDetailPage} from './pages/workflow-job-detail-page.js';
|
|
54
55
|
export {WorkflowRunDetailPage} from './pages/workflow-run-detail-page.js';
|
|
55
56
|
export {WorkflowRunsPage} from './pages/workflow-run-list-page.js';
|
|
@@ -8,6 +8,7 @@ const PAGE_HARNESS_ALLOWLIST = [
|
|
|
8
8
|
'src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx',
|
|
9
9
|
'src/components/workflow-run-view/workflow-run-view.test.tsx',
|
|
10
10
|
'src/pages/project-workflows-page.test.tsx',
|
|
11
|
+
'src/pages/workflow-job-detail-page.test.tsx',
|
|
11
12
|
'src/pages/workflow-run-pages.test.tsx',
|
|
12
13
|
];
|
|
13
14
|
|