@shipfox/client-workflows 22.0.0 → 22.0.2

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.
Files changed (33) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +24 -0
  3. package/dist/components/job-detail/job-execution-time-text.d.ts.map +1 -1
  4. package/dist/components/job-detail/job-execution-time-text.js +2 -15
  5. package/dist/components/job-detail/job-execution-time-text.js.map +1 -1
  6. package/dist/components/job-graph/job-duration-format.js +1 -1
  7. package/dist/components/job-graph/job-duration-format.js.map +1 -1
  8. package/dist/components/workflow-run-list/workflow-run-list-content.d.ts.map +1 -1
  9. package/dist/components/workflow-run-list/workflow-run-list-content.js +9 -15
  10. package/dist/components/workflow-run-list/workflow-run-list-content.js.map +1 -1
  11. package/dist/components/workflow-run-list/workflow-run-list-states.d.ts.map +1 -1
  12. package/dist/components/workflow-run-list/workflow-run-list-states.js +36 -39
  13. package/dist/components/workflow-run-list/workflow-run-list-states.js.map +1 -1
  14. package/dist/components/workflow-run-list/workflow-run-list-view.js +1 -1
  15. package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -1
  16. package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -1
  17. package/dist/components/workflow-run-list/workflow-run-row.js +9 -13
  18. package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -1
  19. package/dist/pages/project-workflows-page.js +11 -14
  20. package/dist/pages/project-workflows-page.js.map +1 -1
  21. package/dist/tsconfig.test.tsbuildinfo +1 -1
  22. package/package.json +7 -7
  23. package/src/components/job-detail/job-execution-time-text.test.ts +46 -0
  24. package/src/components/job-detail/job-execution-time-text.tsx +2 -23
  25. package/src/components/job-graph/job-duration-format.ts +1 -1
  26. package/src/components/workflow-run-list/workflow-run-list-content.tsx +4 -9
  27. package/src/components/workflow-run-list/workflow-run-list-states.tsx +36 -39
  28. package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +5 -0
  29. package/src/components/workflow-run-list/workflow-run-list-view.tsx +1 -1
  30. package/src/components/workflow-run-list/workflow-run-row.tsx +7 -10
  31. package/src/pages/project-workflows-page.test.tsx +14 -4
  32. package/src/pages/project-workflows-page.tsx +7 -10
  33. package/tsconfig.build.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/client-workflows",
3
3
  "license": "MIT",
4
- "version": "22.0.0",
4
+ "version": "22.0.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -30,13 +30,13 @@
30
30
  "@shipfox/annotations-dto": "12.3.0",
31
31
  "@shipfox/api-definitions-dto": "12.3.0",
32
32
  "@shipfox/api-workflows-dto": "13.0.0",
33
- "@shipfox/client-logs": "22.0.0",
34
33
  "@shipfox/client-api": "6.0.1",
35
- "@shipfox/client-projects": "22.0.0",
36
- "@shipfox/client-shell": "22.0.0",
37
- "@shipfox/client-triggers": "22.0.0",
38
- "@shipfox/react-ui": "2.1.0",
39
- "@shipfox/client-ui": "22.0.0"
34
+ "@shipfox/client-logs": "22.0.2",
35
+ "@shipfox/client-projects": "22.0.2",
36
+ "@shipfox/client-shell": "22.0.2",
37
+ "@shipfox/client-triggers": "22.0.2",
38
+ "@shipfox/client-ui": "22.0.2",
39
+ "@shipfox/react-ui": "2.1.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tanstack/react-query": "^5.101.0",
@@ -0,0 +1,46 @@
1
+ import {formatJobExecutionTime} from './job-execution-time-text.js';
2
+
3
+ const FROM_ISO = '2026-08-15T08:51:00.000Z';
4
+ const FROM_MS = Date.parse(FROM_ISO);
5
+
6
+ describe('formatJobExecutionTime', () => {
7
+ afterEach(() => {
8
+ vi.useRealTimers();
9
+ });
10
+
11
+ test.each([
12
+ [999, '0s'],
13
+ [37_999, '37s'],
14
+ [60_000, '1m 00s'],
15
+ [124_999, '2m 04s'],
16
+ [3_780_999, '1h 03m'],
17
+ ])('formats a live %i ms timer as %s', (elapsedMs, expected) => {
18
+ vi.useFakeTimers();
19
+ vi.setSystemTime(FROM_MS + elapsedMs);
20
+
21
+ const result = formatJobExecutionTime({
22
+ state: 'live',
23
+ fromIso: FROM_ISO,
24
+ });
25
+
26
+ expect(result).toBe(expected);
27
+ });
28
+
29
+ test('falls back to zero seconds for an invalid live timestamp', () => {
30
+ const result = formatJobExecutionTime({state: 'live', fromIso: 'not-a-date'});
31
+
32
+ expect(result).toBe('0s');
33
+ });
34
+
35
+ test.each([
36
+ [{seconds: 37}, '37s'],
37
+ [{minutes: 1}, '1m 00s'],
38
+ [{minutes: 2, seconds: 4}, '2m 04s'],
39
+ [{hours: 1}, '1h 00m'],
40
+ [{hours: 1, minutes: 3}, '1h 03m'],
41
+ ])('formats a fixed timer consistently as %s', (elapsed, expected) => {
42
+ const result = formatJobExecutionTime({state: 'fixed', elapsed});
43
+
44
+ expect(result).toBe(expected);
45
+ });
46
+ });
@@ -1,6 +1,6 @@
1
1
  import {useTimeTick} from '@shipfox/react-ui/time-ticker';
2
- import {formatDuration} from '@shipfox/react-ui/utils';
3
2
  import type {JobExecutionTime} from '#core/workflow-run.js';
3
+ import {formatJobExecutionTimeLabel} from '../job-graph/job-duration-format.js';
4
4
 
5
5
  export function JobExecutionTimeText({time}: {time: JobExecutionTime}) {
6
6
  useTimeTick();
@@ -9,26 +9,5 @@ export function JobExecutionTimeText({time}: {time: JobExecutionTime}) {
9
9
  }
10
10
 
11
11
  export function formatJobExecutionTime(time: JobExecutionTime): string {
12
- if (time.state === 'live') {
13
- return formatDuration(Date.now() - Date.parse(time.fromIso));
14
- }
15
-
16
- return formatElapsedDuration(time.elapsed);
17
- }
18
-
19
- function formatElapsedDuration(duration: {
20
- days?: number | undefined;
21
- hours?: number | undefined;
22
- minutes?: number | undefined;
23
- seconds?: number | undefined;
24
- }): string {
25
- const days = duration.days ?? 0;
26
- const hours = duration.hours ?? 0;
27
- const minutes = duration.minutes ?? 0;
28
- const seconds = duration.seconds ?? 0;
29
-
30
- if (days > 0) return hours > 0 ? `${days}d ${hours}h` : `${days}d`;
31
- if (hours > 0) return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
32
- if (minutes > 0) return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
33
- return `${seconds}s`;
12
+ return formatJobExecutionTimeLabel(time);
34
13
  }
@@ -8,7 +8,7 @@ import type {
8
8
  export function formatJobExecutionTimeLabel(time: JobExecutionTime): string {
9
9
  switch (time.state) {
10
10
  case 'live':
11
- return humanDuration(time.fromIso);
11
+ return humanDuration(time.fromIso) || '0s';
12
12
  case 'fixed':
13
13
  return formatFixedDurationLabel(time.elapsed);
14
14
  default: {
@@ -1,5 +1,4 @@
1
1
  import {QueryLoadError} from '@shipfox/client-ui';
2
- import {Panel} from '@shipfox/react-ui/panel';
3
2
  import type {WorkflowRunListItem} from '#core/workflow-run.js';
4
3
  import type {WorkflowRunListQuery} from './types.js';
5
4
  import {
@@ -53,18 +52,14 @@ export function WorkflowRunListContent({
53
52
  const showNoMatches = hasLoaded && runs.length === 0 && !showEmptyState;
54
53
 
55
54
  return (
56
- <div className="min-h-0 flex-1 overflow-y-auto">
55
+ <>
57
56
  {isPending ? <WorkflowRunListSkeleton /> : null}
58
57
  {!isPending ? (
59
- <Panel>
60
- <QueryLoadError query={query} subject="workflow runs" icon="pulseLine" variant="panel" />
61
- </Panel>
58
+ <QueryLoadError query={query} subject="workflow runs" icon="pulseLine" variant="panel" />
62
59
  ) : null}
63
60
  {!isPending && refreshFailed ? <WorkflowRunListStaleError query={query} /> : null}
64
61
  {showEmptyState ? (
65
- <Panel>
66
- <WorkflowRunListEmpty workspaceSlug={workspaceSlug} projectSlug={projectSlug} />
67
- </Panel>
62
+ <WorkflowRunListEmpty workspaceSlug={workspaceSlug} projectSlug={projectSlug} />
68
63
  ) : null}
69
64
  {showNoMatches ? (
70
65
  <WorkflowRunListNoMatches
@@ -86,6 +81,6 @@ export function WorkflowRunListContent({
86
81
  />
87
82
  </>
88
83
  ) : null}
89
- </div>
84
+ </>
90
85
  );
91
86
  }
@@ -2,7 +2,6 @@ import type {QueryLoadErrorQuery} from '@shipfox/client-ui';
2
2
  import {Button} from '@shipfox/react-ui/button';
3
3
  import {Callout} from '@shipfox/react-ui/callout';
4
4
  import {EmptyState} from '@shipfox/react-ui/empty-state';
5
- import {Panel} from '@shipfox/react-ui/panel';
6
5
  import {Skeleton} from '@shipfox/react-ui/skeleton';
7
6
  import {Text} from '@shipfox/react-ui/typography';
8
7
  import {Link} from '@tanstack/react-router';
@@ -16,7 +15,7 @@ const SKELETON_ROW_COUNT = 8;
16
15
  */
17
16
  export function WorkflowRunListSkeleton() {
18
17
  return (
19
- <Panel role="status" aria-label="Loading runs" className="@container divide-y">
18
+ <div role="status" aria-label="Loading runs" className="@container divide-y">
20
19
  {Array.from({length: SKELETON_ROW_COUNT}).map((_, index) => (
21
20
  <div
22
21
  // biome-ignore lint/suspicious/noArrayIndexKey: skeleton row, stable position
@@ -30,7 +29,7 @@ export function WorkflowRunListSkeleton() {
30
29
  <Skeleton className="h-12 w-48" />
31
30
  </div>
32
31
  ))}
33
- </Panel>
32
+ </div>
34
33
  );
35
34
  }
36
35
 
@@ -114,43 +113,41 @@ export function WorkflowRunListNoMatches({
114
113
  onLoadMore?: () => void;
115
114
  }) {
116
115
  return (
117
- <Panel>
118
- <div className="flex flex-col gap-inline">
119
- {isFetchNextPageError ? (
120
- <Callout role="alert" type="error">
121
- Could not load more workflow runs. Try again to continue searching older runs.
122
- </Callout>
123
- ) : null}
124
- <EmptyState
125
- icon="filterOffLine"
126
- title={hasNextPage ? 'No matches in loaded history' : 'No matching runs'}
127
- description={
128
- hasNextPage
129
- ? 'No loaded run matches these filters. Load more to search further back.'
130
- : 'No run matches these filters.'
131
- }
132
- action={
133
- <div className="flex flex-wrap justify-center gap-inline">
134
- {hasNextPage && onLoadMore ? (
135
- <Button
136
- type="button"
137
- size="sm"
138
- variant="primary"
139
- isLoading={isFetchingNextPage}
140
- onClick={onLoadMore}
141
- >
142
- Load more runs
143
- </Button>
144
- ) : null}
145
- <Button type="button" size="sm" variant="secondary" onClick={onClear}>
146
- Show all runs
116
+ <div className="flex flex-col gap-inline">
117
+ {isFetchNextPageError ? (
118
+ <Callout role="alert" type="error">
119
+ Could not load more workflow runs. Try again to continue searching older runs.
120
+ </Callout>
121
+ ) : null}
122
+ <EmptyState
123
+ icon="filterOffLine"
124
+ title={hasNextPage ? 'No matches in loaded history' : 'No matching runs'}
125
+ description={
126
+ hasNextPage
127
+ ? 'No loaded run matches these filters. Load more to search further back.'
128
+ : 'No run matches these filters.'
129
+ }
130
+ action={
131
+ <div className="flex flex-wrap justify-center gap-inline">
132
+ {hasNextPage && onLoadMore ? (
133
+ <Button
134
+ type="button"
135
+ size="sm"
136
+ variant="primary"
137
+ isLoading={isFetchingNextPage}
138
+ onClick={onLoadMore}
139
+ >
140
+ Load more runs
147
141
  </Button>
148
- </div>
149
- }
150
- variant="panel"
151
- />
152
- </div>
153
- </Panel>
142
+ ) : null}
143
+ <Button type="button" size="sm" variant="secondary" onClick={onClear}>
144
+ Show all runs
145
+ </Button>
146
+ </div>
147
+ }
148
+ variant="panel"
149
+ />
150
+ </div>
154
151
  );
155
152
  }
156
153
 
@@ -48,6 +48,7 @@ describe('WorkflowRunListView', () => {
48
48
  const body = panel?.querySelector<HTMLElement>('[data-slot="panel-body"]');
49
49
 
50
50
  expect(panel).not.toBeNull();
51
+ expect(document.querySelectorAll('[data-slot="panel"]')).toHaveLength(1);
51
52
  expect(header).not.toBeNull();
52
53
  expect(body).not.toBeNull();
53
54
  expect(within(header as HTMLElement).getByLabelText('Search runs')).toBeInTheDocument();
@@ -204,6 +205,7 @@ describe('WorkflowRunListView', () => {
204
205
  renderListView([], {query: loadedQuery({isPending: true, data: undefined})});
205
206
 
206
207
  expect(await screen.findByLabelText('Loading runs')).toBeInTheDocument();
208
+ expect(document.querySelectorAll('[data-slot="panel"]')).toHaveLength(1);
207
209
  expect(screen.queryByText('No runs yet')).not.toBeInTheDocument();
208
210
  });
209
211
 
@@ -217,6 +219,7 @@ describe('WorkflowRunListView', () => {
217
219
  renderListView([]);
218
220
 
219
221
  expect(await screen.findByText('No runs yet')).toBeInTheDocument();
222
+ expect(document.querySelectorAll('[data-slot="panel"]')).toHaveLength(1);
220
223
  expect(screen.getByRole('link', {name: 'View workflows'})).toBeInTheDocument();
221
224
  expect(screen.queryByRole('button', {name: 'Show all runs'})).not.toBeInTheDocument();
222
225
  });
@@ -228,6 +231,7 @@ describe('WorkflowRunListView', () => {
228
231
  await user.type(await screen.findByLabelText('Search runs'), 'no-such-run');
229
232
 
230
233
  expect(screen.getByText('No matching runs')).toBeInTheDocument();
234
+ expect(document.querySelectorAll('[data-slot="panel"]')).toHaveLength(1);
231
235
  expect(screen.queryByText('No runs yet')).not.toBeInTheDocument();
232
236
  expect(screen.getByRole('button', {name: 'Show all runs'})).toBeInTheDocument();
233
237
  });
@@ -248,6 +252,7 @@ describe('WorkflowRunListView', () => {
248
252
  });
249
253
 
250
254
  expect(await screen.findByLabelText('Search runs')).toBeInTheDocument();
255
+ expect(document.querySelectorAll('[data-slot="panel"]')).toHaveLength(1);
251
256
  expect(screen.queryByText('No runs yet')).not.toBeInTheDocument();
252
257
  expect(screen.queryByText('No matching runs')).not.toBeInTheDocument();
253
258
  });
@@ -77,7 +77,7 @@ export function WorkflowRunListView({
77
77
  hasActiveFilters={hasActiveFilters}
78
78
  />
79
79
  </PanelHeader>
80
- <PanelBody className="min-h-0 flex-1">
80
+ <PanelBody className="min-h-0 flex-1 overflow-y-auto">
81
81
  <WorkflowRunListContent
82
82
  query={query}
83
83
  totalRuns={runs.length}
@@ -1,6 +1,5 @@
1
1
  import {TriggerSourceIcon} from '@shipfox/client-triggers';
2
2
  import {Icon, type IconName} from '@shipfox/react-ui/icon';
3
- import {Panel} from '@shipfox/react-ui/panel';
4
3
  import {RelativeTime} from '@shipfox/react-ui/relative-time';
5
4
  import {Tooltip, TooltipContent, TooltipTrigger} from '@shipfox/react-ui/tooltip';
6
5
  import {Code, Text} from '@shipfox/react-ui/typography';
@@ -38,15 +37,13 @@ export function WorkflowRunRowList({
38
37
  // A container, not the viewport, drives the row's breakpoints. What a row can afford is its
39
38
  // own width; keying off the viewport would keep the job strip hidden on a wide screen or
40
39
  // crush it on a narrow one.
41
- <Panel className="@container">
42
- <ul className="divide-y divide-border-neutral-base">
43
- {runs.map((run) => (
44
- <li key={run.id}>
45
- <WorkflowRunRow run={run} workspaceSlug={workspaceSlug} projectSlug={projectSlug} />
46
- </li>
47
- ))}
48
- </ul>
49
- </Panel>
40
+ <ul className="@container divide-y divide-border-neutral-base">
41
+ {runs.map((run) => (
42
+ <li key={run.id}>
43
+ <WorkflowRunRow run={run} workspaceSlug={workspaceSlug} projectSlug={projectSlug} />
44
+ </li>
45
+ ))}
46
+ </ul>
50
47
  );
51
48
  }
52
49
 
@@ -12,15 +12,25 @@ const PROJECT_ID = '44444444-4444-4444-8444-444444444444';
12
12
  const CONNECTION_ID = '33333333-3333-4333-8333-333333333333';
13
13
 
14
14
  describe('ProjectWorkflowsPage', () => {
15
- test('renders workflow definitions and the source strip', async () => {
15
+ test('renders workflow definitions and their panel regions', async () => {
16
16
  configureApiClient({fetchImpl: createProjectDetailFetch()});
17
17
 
18
18
  renderWorkflowsPage();
19
19
 
20
- expect(await screen.findByRole('heading', {name: 'Workflows'})).toBeInTheDocument();
21
- expect(screen.getAllByText('Deploy production')[0]).toBeInTheDocument();
20
+ expect((await screen.findAllByText('Deploy production'))[0]).toBeInTheDocument();
21
+ expect(screen.getByRole('heading', {name: 'Workflows'})).toHaveClass('sr-only');
22
+ expect(
23
+ screen.queryByText('Synced workflow definitions for this project source.'),
24
+ ).not.toBeInTheDocument();
22
25
  expect(screen.getAllByText('.shipfox/workflows/deploy.yml')[0]).toBeInTheDocument();
23
- expect(screen.getByRole('region', {name: 'Project source'})).toBeInTheDocument();
26
+ const sourcePanel = screen
27
+ .getByRole('region', {name: 'Project source'})
28
+ .closest('[data-slot="panel"]');
29
+ const definitionsPanel = screen.getByRole('region', {name: 'Workflow definitions'});
30
+ expect(sourcePanel).toBeInTheDocument();
31
+ expect(definitionsPanel).toBeInTheDocument();
32
+ expect(sourcePanel).not.toBe(definitionsPanel);
33
+ expect(screen.getByRole('table').closest('[data-slot="panel"]')).toBe(definitionsPanel);
24
34
  // Source strip resolves connection display_name from the integrations
25
35
  // workspace cache; external_repository_id renders as a Code chip.
26
36
  expect(await screen.findByText('Acme GitHub')).toBeInTheDocument();
@@ -68,6 +68,10 @@ function ProjectWorkflowsPageInner({projectId}: {projectId: string}) {
68
68
 
69
69
  return (
70
70
  <div className="flex w-full flex-col gap-section">
71
+ <Header variant="h1" className="sr-only">
72
+ Workflows
73
+ </Header>
74
+
71
75
  {projectQuery.isPending ? (
72
76
  <div className="flex flex-col gap-cluster">
73
77
  <Skeleton className="h-28 w-1/3" />
@@ -89,13 +93,6 @@ function ProjectWorkflowsPageInner({projectId}: {projectId: string}) {
89
93
 
90
94
  {projectQuery.data ? (
91
95
  <>
92
- <header className="flex flex-col gap-tight">
93
- <Header variant="h2">Workflows</Header>
94
- <Text size="sm" className="text-foreground-neutral-muted">
95
- Synced workflow definitions for this project source.
96
- </Text>
97
- </header>
98
-
99
96
  <SourceStrip
100
97
  connectionId={projectQuery.data.source.connectionId}
101
98
  externalRepositoryId={projectQuery.data.source.externalRepositoryId}
@@ -181,7 +178,7 @@ function WorkflowDefinitionsList({
181
178
 
182
179
  if (isError && definitions.length === 0) {
183
180
  return (
184
- <Panel>
181
+ <Panel role="region" aria-label="Workflow definitions">
185
182
  <LoadErrorState
186
183
  title="Couldn't load workflows"
187
184
  description="Definitions could not be loaded. Source metadata remains visible."
@@ -195,7 +192,7 @@ function WorkflowDefinitionsList({
195
192
 
196
193
  if (definitions.length === 0) {
197
194
  return (
198
- <Panel>
195
+ <Panel role="region" aria-label="Workflow definitions">
199
196
  <WorkflowEmptyState sync={sync} />
200
197
  </Panel>
201
198
  );
@@ -203,7 +200,7 @@ function WorkflowDefinitionsList({
203
200
 
204
201
  return (
205
202
  <>
206
- <Panel>
203
+ <Panel role="region" aria-label="Workflow definitions">
207
204
  <div className="hidden md:block">
208
205
  <Table>
209
206
  <TableHeader>