@shipfox/client-workflows 4.0.0 → 6.0.1
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +68 -0
- package/dist/components/workflow-run-list/types.d.ts +12 -0
- package/dist/components/workflow-run-list/types.d.ts.map +1 -1
- package/dist/components/workflow-run-list/types.js.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +1 -1
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list-view.js +32 -11
- package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list.d.ts +1 -1
- package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -1
- package/dist/components/workflow-run-list/workflow-run-list.js +7 -2
- package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -1
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +2 -3
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -1
- package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -1
- package/dist/components/workflow-run-view/job-card.d.ts.map +1 -1
- package/dist/components/workflow-run-view/job-card.js +9 -8
- package/dist/components/workflow-run-view/job-card.js.map +1 -1
- package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -1
- package/dist/core/entities/job-execution.d.ts +11 -6
- package/dist/core/entities/job-execution.d.ts.map +1 -1
- package/dist/core/entities/job-execution.js +0 -19
- package/dist/core/entities/job-execution.js.map +1 -1
- package/dist/core/entities/job.d.ts +32 -10
- package/dist/core/entities/job.d.ts.map +1 -1
- package/dist/core/entities/job.js +0 -22
- package/dist/core/entities/job.js.map +1 -1
- package/dist/core/entities/step-attempt.d.ts +28 -3
- package/dist/core/entities/step-attempt.d.ts.map +1 -1
- package/dist/core/entities/step-attempt.js +0 -17
- package/dist/core/entities/step-attempt.js.map +1 -1
- package/dist/core/entities/step.d.ts +6 -6
- package/dist/core/entities/step.d.ts.map +1 -1
- package/dist/core/entities/step.js +19 -49
- package/dist/core/entities/step.js.map +1 -1
- package/dist/core/entities/workflow-run-attempt.d.ts +0 -2
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -1
- package/dist/core/entities/workflow-run-attempt.js +0 -12
- package/dist/core/entities/workflow-run-attempt.js.map +1 -1
- package/dist/core/entities/workflow-run.d.ts +6 -7
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js +1 -67
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/core/workflow-run.d.ts +9 -9
- package/dist/core/workflow-run.d.ts.map +1 -1
- package/dist/core/workflow-run.js +6 -6
- package/dist/core/workflow-run.js.map +1 -1
- package/dist/feature.d.ts +23 -0
- package/dist/feature.d.ts.map +1 -1
- package/dist/feature.js +22 -9
- package/dist/feature.js.map +1 -1
- package/dist/hooks/api/workflow-run-mapper.d.ts +12 -0
- package/dist/hooks/api/workflow-run-mapper.d.ts.map +1 -0
- package/dist/hooks/api/workflow-run-mapper.js +207 -0
- package/dist/hooks/api/workflow-run-mapper.js.map +1 -0
- package/dist/hooks/api/workflow-runs.d.ts +25 -55
- package/dist/hooks/api/workflow-runs.d.ts.map +1 -1
- package/dist/hooks/api/workflow-runs.js +95 -51
- package/dist/hooks/api/workflow-runs.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/pages/project-workflows-page.d.ts +4 -0
- package/dist/pages/project-workflows-page.d.ts.map +1 -0
- package/dist/pages/project-workflows-page.js +479 -0
- package/dist/pages/project-workflows-page.js.map +1 -0
- package/dist/pages/workflow-run-page.d.ts +3 -1
- package/dist/pages/workflow-run-page.d.ts.map +1 -1
- package/dist/pages/workflow-run-page.js +21 -14
- package/dist/pages/workflow-run-page.js.map +1 -1
- package/dist/routes/inputs.d.ts +22 -0
- package/dist/routes/inputs.d.ts.map +1 -0
- package/dist/routes/inputs.js +76 -0
- package/dist/routes/inputs.js.map +1 -0
- package/dist/routes/run-detail.d.ts +2 -0
- package/dist/routes/run-detail.d.ts.map +1 -1
- package/dist/routes/run-detail.js +6 -6
- package/dist/routes/run-detail.js.map +1 -1
- package/dist/routes/runs.d.ts +2 -0
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +6 -6
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/workflows.d.ts +5 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/routes/workflows.js +14 -0
- package/dist/routes/workflows.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +13 -12
- package/src/components/workflow-run-list/types.ts +6 -0
- package/src/components/workflow-run-list/workflow-run-list-view.tsx +27 -11
- package/src/components/workflow-run-list/workflow-run-list.tsx +6 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +5 -6
- package/src/components/workflow-run-summary/workflow-run-summary.tsx +3 -3
- package/src/components/workflow-run-view/job-card.tsx +20 -11
- package/src/components/workflow-run-view/workflow-run-view.test.tsx +3 -3
- package/src/components/workflow-run-view/workflow-run-view.tsx +2 -2
- package/src/core/entities/job-execution.ts +12 -28
- package/src/core/entities/job.ts +44 -45
- package/src/core/entities/step-attempt.ts +9 -20
- package/src/core/entities/step.ts +38 -66
- package/src/core/entities/workflow-run-attempt.ts +0 -14
- package/src/core/entities/workflow-run.ts +8 -86
- package/src/core/workflow-run.test.ts +13 -11
- package/src/core/workflow-run.ts +8 -13
- package/src/feature.ts +24 -10
- package/src/hooks/api/workflow-run-mapper.ts +246 -0
- package/src/hooks/api/workflow-runs.test.tsx +57 -59
- package/src/hooks/api/workflow-runs.ts +187 -88
- package/src/index.ts +5 -0
- package/src/page-harness-budget.test.ts +1 -0
- package/src/pages/project-workflows-page.test.tsx +247 -0
- package/src/pages/project-workflows-page.tsx +448 -0
- package/src/pages/workflow-run-page.test.tsx +4 -2
- package/src/pages/workflow-run-page.tsx +22 -17
- package/src/routes/inputs.test.ts +22 -0
- package/src/routes/inputs.ts +58 -0
- package/src/routes/run-detail.tsx +12 -8
- package/src/routes/runs.tsx +11 -4
- package/src/routes/workflows.tsx +10 -0
- package/test/fixtures/workflow-run.ts +9 -7
- package/test/pages.tsx +48 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/vercel.json +5 -0
package/src/routes/runs.tsx
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {defineRoute} from '@shipfox/client-shell/runtime';
|
|
2
|
-
import {useParams} from '@tanstack/react-router';
|
|
1
|
+
import {defineRoute, useRouteParams, useRouteSearch} from '@shipfox/client-shell/runtime';
|
|
3
2
|
import {WorkflowRunPage} from '#pages/workflow-run-page.js';
|
|
3
|
+
import {validateWorkflowRunsSearch, workflowRouteParams} from './inputs.js';
|
|
4
4
|
|
|
5
5
|
export default defineRoute({
|
|
6
6
|
staticData: {layout: 'full-bleed'},
|
|
7
|
+
validateSearch: validateWorkflowRunsSearch,
|
|
7
8
|
component: () => {
|
|
8
|
-
const {wid, pid} =
|
|
9
|
-
return
|
|
9
|
+
const {wid, pid} = useRouteParams(workflowRouteParams);
|
|
10
|
+
return (
|
|
11
|
+
<WorkflowRunPage
|
|
12
|
+
workspaceId={wid}
|
|
13
|
+
projectId={pid}
|
|
14
|
+
search={useRouteSearch(validateWorkflowRunsSearch)}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
10
17
|
},
|
|
11
18
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {defineRoute, useRouteParams} from '@shipfox/client-shell/runtime';
|
|
2
|
+
import {ProjectWorkflowsPage} from '#pages/project-workflows-page.js';
|
|
3
|
+
import {workflowRouteParams} from './inputs.js';
|
|
4
|
+
|
|
5
|
+
export default defineRoute({
|
|
6
|
+
component: () => {
|
|
7
|
+
const {pid} = useRouteParams(workflowRouteParams);
|
|
8
|
+
return <ProjectWorkflowsPage projectId={pid} />;
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -11,20 +11,22 @@ import type {
|
|
|
11
11
|
WorkflowRunStatusDto,
|
|
12
12
|
WorkflowRunStepDetailDto,
|
|
13
13
|
} from '@shipfox/api-workflows-dto';
|
|
14
|
+
import type {
|
|
15
|
+
Job,
|
|
16
|
+
Step,
|
|
17
|
+
StepAttempt,
|
|
18
|
+
WorkflowRunDetail,
|
|
19
|
+
WorkflowRunListItem,
|
|
20
|
+
WorkflowRunListPage,
|
|
21
|
+
} from '#core/workflow-run.js';
|
|
14
22
|
import {
|
|
15
|
-
type Job,
|
|
16
|
-
type Step,
|
|
17
|
-
type StepAttempt,
|
|
18
23
|
toJob,
|
|
19
24
|
toStep,
|
|
20
25
|
toStepAttempt,
|
|
21
26
|
toWorkflowRunDetail,
|
|
22
27
|
toWorkflowRunListItem,
|
|
23
28
|
toWorkflowRunListPage,
|
|
24
|
-
|
|
25
|
-
type WorkflowRunListItem,
|
|
26
|
-
type WorkflowRunListPage,
|
|
27
|
-
} from '#core/workflow-run.js';
|
|
29
|
+
} from '#hooks/api/workflow-run-mapper.js';
|
|
28
30
|
|
|
29
31
|
const RUN_ID = '11111111-1111-4111-8111-111111111111';
|
|
30
32
|
const RUN_ATTEMPT_ID = '11111111-1111-4111-8111-111111111112';
|
package/test/pages.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {configureApiClient} from '@shipfox/client-api';
|
|
2
|
+
import {type AuthState, authStateAtom} from '@shipfox/client-shell/runtime';
|
|
3
|
+
import {Toaster} from '@shipfox/react-ui/toast';
|
|
2
4
|
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
|
|
3
5
|
import {
|
|
4
6
|
createMemoryHistory,
|
|
@@ -8,9 +10,12 @@ import {
|
|
|
8
10
|
Outlet,
|
|
9
11
|
RouterProvider,
|
|
10
12
|
useParams,
|
|
13
|
+
useSearch,
|
|
11
14
|
} from '@tanstack/react-router';
|
|
12
15
|
import {type RenderResult, render} from '@testing-library/react';
|
|
16
|
+
import {createStore, Provider as JotaiProvider} from 'jotai';
|
|
13
17
|
import type {ReactElement} from 'react';
|
|
18
|
+
import {validateWorkflowRunsSearch} from '#routes/inputs.js';
|
|
14
19
|
|
|
15
20
|
// The workflow run page navigates with the router (run rows are links and the page redirects
|
|
16
21
|
// to the first run), so the harness mounts the page under a memory router whose route tree
|
|
@@ -19,6 +24,15 @@ import type {ReactElement} from 'react';
|
|
|
19
24
|
// the real route wiring so a redirect re-renders the page with the run it landed on.
|
|
20
25
|
export const PROJECT_TEST_WID = '11111111-1111-4111-8111-111111111111';
|
|
21
26
|
|
|
27
|
+
// Pages that render components depending on `useActiveWorkspace()` (e.g. the project source
|
|
28
|
+
// strip) need an authenticated workspace matching `$wid` in the atom `client-shell/runtime`
|
|
29
|
+
// reads. A fixed membership id is fine here: nothing in these tests asserts on it.
|
|
30
|
+
const authState: AuthState = {
|
|
31
|
+
status: 'authenticated',
|
|
32
|
+
token: 'token',
|
|
33
|
+
workspaces: [{id: PROJECT_TEST_WID, name: 'Acme', membershipId: 'm-1'}],
|
|
34
|
+
};
|
|
35
|
+
|
|
22
36
|
export function jsonResponse(body: unknown, init: ResponseInit = {}) {
|
|
23
37
|
return new Response(JSON.stringify(body), {
|
|
24
38
|
status: 200,
|
|
@@ -29,22 +43,37 @@ export function jsonResponse(body: unknown, init: ResponseInit = {}) {
|
|
|
29
43
|
|
|
30
44
|
function createTestRouter(
|
|
31
45
|
path: string,
|
|
32
|
-
renderPage: (params: {
|
|
46
|
+
renderPage: (params: {
|
|
47
|
+
workflowRunId?: string | undefined;
|
|
48
|
+
search: ReturnType<typeof validateWorkflowRunsSearch>;
|
|
49
|
+
}) => ReactElement,
|
|
33
50
|
) {
|
|
34
51
|
const rootRoute = createRootRoute({component: Outlet});
|
|
35
52
|
const runsRoute = createRoute({
|
|
36
53
|
getParentRoute: () => rootRoute,
|
|
37
54
|
path: '/workspaces/$wid/projects/$pid/runs',
|
|
38
|
-
component: ()
|
|
55
|
+
component: function RunsRoute() {
|
|
56
|
+
return renderPage({
|
|
57
|
+
search: validateWorkflowRunsSearch(useSearch({strict: false}) as Record<string, unknown>),
|
|
58
|
+
});
|
|
59
|
+
},
|
|
39
60
|
});
|
|
40
61
|
const runDetailRoute = createRoute({
|
|
41
62
|
getParentRoute: () => rootRoute,
|
|
42
63
|
path: '/workspaces/$wid/projects/$pid/runs/$workflowRunId',
|
|
43
64
|
component: function RunDetailRoute() {
|
|
44
65
|
const {workflowRunId} = useParams({strict: false}) as {workflowRunId?: string};
|
|
45
|
-
return renderPage({
|
|
66
|
+
return renderPage({
|
|
67
|
+
workflowRunId,
|
|
68
|
+
search: validateWorkflowRunsSearch(useSearch({strict: false}) as Record<string, unknown>),
|
|
69
|
+
});
|
|
46
70
|
},
|
|
47
71
|
});
|
|
72
|
+
const workflowsRoute = createRoute({
|
|
73
|
+
getParentRoute: () => rootRoute,
|
|
74
|
+
path: '/workspaces/$wid/projects/$pid/workflows',
|
|
75
|
+
component: () => renderPage({search: {}}),
|
|
76
|
+
});
|
|
48
77
|
const modelProviderSettingsRoute = createRoute({
|
|
49
78
|
getParentRoute: () => rootRoute,
|
|
50
79
|
path: '/workspaces/$wid/settings/agents',
|
|
@@ -53,25 +82,38 @@ function createTestRouter(
|
|
|
53
82
|
|
|
54
83
|
return createRouter({
|
|
55
84
|
history: createMemoryHistory({initialEntries: [path]}),
|
|
56
|
-
routeTree: rootRoute.addChildren([
|
|
85
|
+
routeTree: rootRoute.addChildren([
|
|
86
|
+
runsRoute,
|
|
87
|
+
runDetailRoute,
|
|
88
|
+
workflowsRoute,
|
|
89
|
+
modelProviderSettingsRoute,
|
|
90
|
+
]),
|
|
57
91
|
});
|
|
58
92
|
}
|
|
59
93
|
|
|
60
94
|
export function renderProjectPage(
|
|
61
95
|
path: string,
|
|
62
|
-
renderPage: (params: {
|
|
96
|
+
renderPage: (params: {
|
|
97
|
+
workflowRunId?: string | undefined;
|
|
98
|
+
search: ReturnType<typeof validateWorkflowRunsSearch>;
|
|
99
|
+
}) => ReactElement,
|
|
63
100
|
): RenderResult & {
|
|
64
101
|
queryClient: QueryClient;
|
|
65
102
|
router: ReturnType<typeof createTestRouter>;
|
|
66
103
|
} {
|
|
67
104
|
const queryClient = new QueryClient({defaultOptions: {queries: {retry: false}}});
|
|
68
105
|
const router = createTestRouter(path, renderPage);
|
|
106
|
+
const store = createStore();
|
|
107
|
+
store.set(authStateAtom, authState);
|
|
69
108
|
|
|
70
109
|
configureApiClient({baseUrl: 'https://api.example.test'});
|
|
71
110
|
|
|
72
111
|
const result = render(
|
|
73
112
|
<QueryClientProvider client={queryClient}>
|
|
74
|
-
<
|
|
113
|
+
<JotaiProvider store={store}>
|
|
114
|
+
<RouterProvider router={router} />
|
|
115
|
+
<Toaster />
|
|
116
|
+
</JotaiProvider>
|
|
75
117
|
</QueryClientProvider>,
|
|
76
118
|
);
|
|
77
119
|
|