@shipfox/client-workflows 15.0.0 → 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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/components/job-detail/job-detail-header.d.ts +8 -1
- package/dist/components/job-detail/job-detail-header.d.ts.map +1 -1
- package/dist/components/job-detail/job-detail-header.js +25 -12
- package/dist/components/job-detail/job-detail-header.js.map +1 -1
- package/dist/components/job-detail/job-detail-view.d.ts.map +1 -1
- package/dist/components/job-detail/job-detail-view.js +17 -2
- package/dist/components/job-detail/job-detail-view.js.map +1 -1
- package/dist/components/workflow-run-summary/workflow-run-summary.js +1 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -1
- package/dist/components/workflow-run-tabs/index.d.ts +3 -0
- package/dist/components/workflow-run-tabs/index.d.ts.map +1 -1
- package/dist/components/workflow-run-tabs/index.js +3 -0
- 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/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/run-workspace-nav.d.ts +1 -1
- package/dist/components/workflow-run-view/run-workspace-nav.d.ts.map +1 -1
- package/dist/components/workflow-run-view/run-workspace-nav.js +9 -3
- package/dist/components/workflow-run-view/run-workspace-nav.js.map +1 -1
- package/dist/components/workflow-run-view/workflow-run-view.d.ts +1 -3
- package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -1
- package/dist/components/workflow-run-view/workflow-run-view.js +150 -52
- package/dist/components/workflow-run-view/workflow-run-view.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/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/routes/inputs.d.ts +7 -2
- package/dist/routes/inputs.d.ts.map +1 -1
- package/dist/routes/inputs.js +5 -6
- package/dist/routes/inputs.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/components/job-detail/job-detail-header.test.tsx +3 -0
- package/src/components/job-detail/job-detail-header.tsx +30 -5
- package/src/components/job-detail/job-detail-view.stories.tsx +5 -0
- package/src/components/job-detail/job-detail-view.tsx +18 -1
- package/src/components/workflow-run-summary/workflow-run-summary.tsx +1 -1
- package/src/components/workflow-run-tabs/index.ts +3 -0
- 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.stories.tsx +293 -0
- package/src/components/workflow-run-tabs/severity-visuals.ts +37 -0
- package/src/components/workflow-run-view/run-workspace-nav.test.tsx +44 -0
- package/src/components/workflow-run-view/run-workspace-nav.tsx +15 -2
- package/src/components/workflow-run-view/workflow-run-view.test.tsx +246 -20
- package/src/components/workflow-run-view/workflow-run-view.tsx +148 -30
- package/src/core/run-annotation.test.ts +315 -0
- package/src/core/run-annotation.ts +238 -0
- package/src/hooks/api/run-annotation-mapper.ts +30 -0
- package/src/hooks/api/run-annotations.ts +137 -0
- package/src/pages/workflow-job-detail-page.test.tsx +66 -0
- package/src/routes/inputs.ts +7 -2
- package/tsconfig.build.tsbuildinfo +1 -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/core/workflow-run-tabs.ts +0 -8
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RunAnnotationEntry } from '#core/run-annotation.js';
|
|
2
|
+
export interface RunAnnotationItemProps {
|
|
3
|
+
entry: RunAnnotationEntry;
|
|
4
|
+
workspaceSlug?: string | undefined;
|
|
5
|
+
projectSlug?: string | undefined;
|
|
6
|
+
workflowRunId: string;
|
|
7
|
+
runAttempt?: number | undefined;
|
|
8
|
+
/** Deep-link target from `?annotation=`, which takes focus rather than only being scrolled to. */
|
|
9
|
+
selected?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One annotation, and the only place in the product that renders an annotation body.
|
|
13
|
+
*
|
|
14
|
+
* The title is the annotation's `context`, which is what the emitting step named the block.
|
|
15
|
+
* Everything below it exists so a reader can get from a diagnostic back to its cause.
|
|
16
|
+
*/
|
|
17
|
+
export declare function RunAnnotationItem({ entry, workspaceSlug, projectSlug, workflowRunId, runAttempt, selected, }: RunAnnotationItemProps): import("react").JSX.Element;
|
|
18
|
+
/** Stable element id so `?annotation=<id>` can scroll to and highlight one annotation. */
|
|
19
|
+
export declare function annotationElementId(annotationId: string): string;
|
|
20
|
+
//# sourceMappingURL=run-annotation-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-annotation-item.d.ts","sourceRoot":"","sources":["../../../src/components/workflow-run-tabs/run-annotation-item.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAGhE,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,kGAAkG;IAClG,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,UAAU,EACV,QAAgB,GACjB,EAAE,sBAAsB,+BAuExB;AAeD,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AnnotationCard } from '@shipfox/client-ui';
|
|
3
|
+
import { Button } from '@shipfox/react-ui/button';
|
|
4
|
+
import { Icon } from '@shipfox/react-ui/icon';
|
|
5
|
+
import { Text } from '@shipfox/react-ui/typography';
|
|
6
|
+
import { cn } from '@shipfox/react-ui/utils';
|
|
7
|
+
import { Link } from '@tanstack/react-router';
|
|
8
|
+
import { useEffect, useRef } from 'react';
|
|
9
|
+
import { workflowJobSearchParams } from '#routes/inputs.js';
|
|
10
|
+
/**
|
|
11
|
+
* One annotation, and the only place in the product that renders an annotation body.
|
|
12
|
+
*
|
|
13
|
+
* The title is the annotation's `context`, which is what the emitting step named the block.
|
|
14
|
+
* Everything below it exists so a reader can get from a diagnostic back to its cause.
|
|
15
|
+
*/ export function RunAnnotationItem({ entry, workspaceSlug, projectSlug, workflowRunId, runAttempt, selected = false }) {
|
|
16
|
+
const { annotation, origin } = entry;
|
|
17
|
+
const canLink = Boolean(origin && workspaceSlug && projectSlug);
|
|
18
|
+
const itemRef = useRef(null);
|
|
19
|
+
const focusedRef = useRef(false);
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
if (!selected) {
|
|
22
|
+
focusedRef.current = false;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (focusedRef.current) return;
|
|
26
|
+
// A deep link that only scrolls leaves a keyboard or screen-reader user at the document
|
|
27
|
+
// start while the page moves under them.
|
|
28
|
+
focusedRef.current = true;
|
|
29
|
+
itemRef.current?.focus({
|
|
30
|
+
preventScroll: true
|
|
31
|
+
});
|
|
32
|
+
itemRef.current?.scrollIntoView({
|
|
33
|
+
block: 'nearest'
|
|
34
|
+
});
|
|
35
|
+
}, [
|
|
36
|
+
selected
|
|
37
|
+
]);
|
|
38
|
+
return /*#__PURE__*/ _jsx("li", {
|
|
39
|
+
ref: itemRef,
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
"aria-current": selected ? 'true' : undefined,
|
|
42
|
+
className: cn('rounded-8 outline-none focus-visible:shadow-border-interactive-with-active', selected && 'shadow-border-interactive-with-active'),
|
|
43
|
+
children: /*#__PURE__*/ _jsx(AnnotationCard, {
|
|
44
|
+
id: annotationElementId(annotation.id),
|
|
45
|
+
style: annotation.style,
|
|
46
|
+
title: annotation.context,
|
|
47
|
+
titleAs: "h3",
|
|
48
|
+
provenance: /*#__PURE__*/ _jsx(RunAnnotationProvenance, {
|
|
49
|
+
entry: entry
|
|
50
|
+
}),
|
|
51
|
+
body: annotation.body,
|
|
52
|
+
action: canLink && origin ? /*#__PURE__*/ _jsx(Button, {
|
|
53
|
+
asChild: true,
|
|
54
|
+
size: "xs",
|
|
55
|
+
variant: "transparent",
|
|
56
|
+
className: "[@media(pointer:coarse)]:min-h-44",
|
|
57
|
+
children: /*#__PURE__*/ _jsxs(Link, {
|
|
58
|
+
to: "/w/$workspaceSlug/p/$projectSlug/runs/$workflowRunId/jobs/$jobId",
|
|
59
|
+
params: {
|
|
60
|
+
workspaceSlug: workspaceSlug ?? '',
|
|
61
|
+
projectSlug: projectSlug ?? '',
|
|
62
|
+
workflowRunId,
|
|
63
|
+
jobId: origin.jobId
|
|
64
|
+
},
|
|
65
|
+
search: workflowJobSearchParams({
|
|
66
|
+
jobExecutionId: origin.jobExecutionId,
|
|
67
|
+
stepId: origin.stepId,
|
|
68
|
+
stepAttemptId: origin.stepAttemptId,
|
|
69
|
+
runAttempt
|
|
70
|
+
}),
|
|
71
|
+
children: [
|
|
72
|
+
"Open step",
|
|
73
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
74
|
+
name: "arrowRightLine",
|
|
75
|
+
size: 12,
|
|
76
|
+
"aria-hidden": "true"
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
})
|
|
80
|
+
}) : null
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** `job · execution #2 · run tests · attempt 1`, dropping any part the run no longer resolves. */ function RunAnnotationProvenance({ entry }) {
|
|
85
|
+
const parts = [
|
|
86
|
+
entry.jobName,
|
|
87
|
+
entry.executionLabel,
|
|
88
|
+
entry.stepLabel,
|
|
89
|
+
entry.attemptLabel
|
|
90
|
+
].filter((part)=>Boolean(part));
|
|
91
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
92
|
+
as: "p",
|
|
93
|
+
size: "xs",
|
|
94
|
+
className: "min-w-0 break-words font-code text-foreground-neutral-subtle",
|
|
95
|
+
children: parts.join(' · ')
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Stable element id so `?annotation=<id>` can scroll to and highlight one annotation. */ export function annotationElementId(annotationId) {
|
|
99
|
+
return `run-annotation-${annotationId}`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=run-annotation-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/workflow-run-tabs/run-annotation-item.tsx"],"sourcesContent":["import {AnnotationCard} from '@shipfox/client-ui';\nimport {Button} from '@shipfox/react-ui/button';\nimport {Icon} from '@shipfox/react-ui/icon';\nimport {Text} from '@shipfox/react-ui/typography';\nimport {cn} from '@shipfox/react-ui/utils';\nimport {Link} from '@tanstack/react-router';\nimport {useEffect, useRef} from 'react';\nimport type {RunAnnotationEntry} from '#core/run-annotation.js';\nimport {workflowJobSearchParams} from '#routes/inputs.js';\n\nexport interface RunAnnotationItemProps {\n entry: RunAnnotationEntry;\n workspaceSlug?: string | undefined;\n projectSlug?: string | undefined;\n workflowRunId: string;\n runAttempt?: number | undefined;\n /** Deep-link target from `?annotation=`, which takes focus rather than only being scrolled to. */\n selected?: boolean | undefined;\n}\n\n/**\n * One annotation, and the only place in the product that renders an annotation body.\n *\n * The title is the annotation's `context`, which is what the emitting step named the block.\n * Everything below it exists so a reader can get from a diagnostic back to its cause.\n */\nexport function RunAnnotationItem({\n entry,\n workspaceSlug,\n projectSlug,\n workflowRunId,\n runAttempt,\n selected = false,\n}: RunAnnotationItemProps) {\n const {annotation, origin} = entry;\n const canLink = Boolean(origin && workspaceSlug && projectSlug);\n const itemRef = useRef<HTMLLIElement>(null);\n const focusedRef = useRef(false);\n\n useEffect(() => {\n if (!selected) {\n focusedRef.current = false;\n return;\n }\n if (focusedRef.current) return;\n\n // A deep link that only scrolls leaves a keyboard or screen-reader user at the document\n // start while the page moves under them.\n focusedRef.current = true;\n itemRef.current?.focus({preventScroll: true});\n itemRef.current?.scrollIntoView({block: 'nearest'});\n }, [selected]);\n\n return (\n <li\n ref={itemRef}\n tabIndex={-1}\n aria-current={selected ? 'true' : undefined}\n className={cn(\n 'rounded-8 outline-none focus-visible:shadow-border-interactive-with-active',\n selected && 'shadow-border-interactive-with-active',\n )}\n >\n <AnnotationCard\n id={annotationElementId(annotation.id)}\n style={annotation.style}\n title={annotation.context}\n titleAs=\"h3\"\n provenance={<RunAnnotationProvenance entry={entry} />}\n body={annotation.body}\n action={\n canLink && origin ? (\n <Button\n asChild\n size=\"xs\"\n variant=\"transparent\"\n className=\"[@media(pointer:coarse)]:min-h-44\"\n >\n <Link\n to=\"/w/$workspaceSlug/p/$projectSlug/runs/$workflowRunId/jobs/$jobId\"\n params={{\n workspaceSlug: workspaceSlug ?? '',\n projectSlug: projectSlug ?? '',\n workflowRunId,\n jobId: origin.jobId,\n }}\n search={\n workflowJobSearchParams({\n jobExecutionId: origin.jobExecutionId,\n stepId: origin.stepId,\n stepAttemptId: origin.stepAttemptId,\n runAttempt,\n }) as never\n }\n >\n Open step\n <Icon name=\"arrowRightLine\" size={12} aria-hidden=\"true\" />\n </Link>\n </Button>\n ) : null\n }\n />\n </li>\n );\n}\n\n/** `job · execution #2 · run tests · attempt 1`, dropping any part the run no longer resolves. */\nfunction RunAnnotationProvenance({entry}: {entry: RunAnnotationEntry}) {\n const parts = [entry.jobName, entry.executionLabel, entry.stepLabel, entry.attemptLabel].filter(\n (part): part is string => Boolean(part),\n );\n\n return (\n <Text as=\"p\" size=\"xs\" className=\"min-w-0 break-words font-code text-foreground-neutral-subtle\">\n {parts.join(' · ')}\n </Text>\n );\n}\n\n/** Stable element id so `?annotation=<id>` can scroll to and highlight one annotation. */\nexport function annotationElementId(annotationId: string): string {\n return `run-annotation-${annotationId}`;\n}\n"],"names":["AnnotationCard","Button","Icon","Text","cn","Link","useEffect","useRef","workflowJobSearchParams","RunAnnotationItem","entry","workspaceSlug","projectSlug","workflowRunId","runAttempt","selected","annotation","origin","canLink","Boolean","itemRef","focusedRef","current","focus","preventScroll","scrollIntoView","block","li","ref","tabIndex","aria-current","undefined","className","id","annotationElementId","style","title","context","titleAs","provenance","RunAnnotationProvenance","body","action","asChild","size","variant","to","params","jobId","search","jobExecutionId","stepId","stepAttemptId","name","aria-hidden","parts","jobName","executionLabel","stepLabel","attemptLabel","filter","part","as","join","annotationId"],"mappings":";AAAA,SAAQA,cAAc,QAAO,qBAAqB;AAClD,SAAQC,MAAM,QAAO,2BAA2B;AAChD,SAAQC,IAAI,QAAO,yBAAyB;AAC5C,SAAQC,IAAI,QAAO,+BAA+B;AAClD,SAAQC,EAAE,QAAO,0BAA0B;AAC3C,SAAQC,IAAI,QAAO,yBAAyB;AAC5C,SAAQC,SAAS,EAAEC,MAAM,QAAO,QAAQ;AAExC,SAAQC,uBAAuB,QAAO,oBAAoB;AAY1D;;;;;CAKC,GACD,OAAO,SAASC,kBAAkB,EAChCC,KAAK,EACLC,aAAa,EACbC,WAAW,EACXC,aAAa,EACbC,UAAU,EACVC,WAAW,KAAK,EACO;IACvB,MAAM,EAACC,UAAU,EAAEC,MAAM,EAAC,GAAGP;IAC7B,MAAMQ,UAAUC,QAAQF,UAAUN,iBAAiBC;IACnD,MAAMQ,UAAUb,OAAsB;IACtC,MAAMc,aAAad,OAAO;IAE1BD,UAAU;QACR,IAAI,CAACS,UAAU;YACbM,WAAWC,OAAO,GAAG;YACrB;QACF;QACA,IAAID,WAAWC,OAAO,EAAE;QA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,WAAU;kBAC9BuB,MAAMQ,IAAI,CAAC;;AAGlB;AAEA,wFAAwF,GACxF,OAAO,SAAS7B,oBAAoB8B,YAAoB;IACtD,OAAO,CAAC,eAAe,EAAEA,cAAc;AACzC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type QueryLoadErrorQuery } from '@shipfox/client-ui';
|
|
2
|
+
import type { RunAnnotationEntry } from '#core/run-annotation.js';
|
|
3
|
+
export interface RunAnnotationListQuery extends QueryLoadErrorQuery {
|
|
4
|
+
isPending: boolean;
|
|
5
|
+
hasNextPage: boolean;
|
|
6
|
+
isFetchingNextPage: boolean;
|
|
7
|
+
fetchNextPage: () => unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface RunAnnotationListProps {
|
|
10
|
+
query: RunAnnotationListQuery;
|
|
11
|
+
entries: RunAnnotationEntry[] | undefined;
|
|
12
|
+
workflowRunId: string;
|
|
13
|
+
workspaceSlug?: string | undefined;
|
|
14
|
+
projectSlug?: string | undefined;
|
|
15
|
+
runAttempt?: number | undefined;
|
|
16
|
+
/** Name of the job the list is filtered to, used only for empty-state copy. */
|
|
17
|
+
filteredJobName?: string | undefined;
|
|
18
|
+
/** Active severity filter, named in the empty state so the reader knows what to clear. */
|
|
19
|
+
filteredSeverity?: string | undefined;
|
|
20
|
+
filtered: boolean;
|
|
21
|
+
onClearFilters?: (() => void) | undefined;
|
|
22
|
+
/** Annotation id from `?annotation=`, which the matching card scrolls to and focuses. */
|
|
23
|
+
selectedAnnotationId?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The annotations list.
|
|
27
|
+
*
|
|
28
|
+
* Loading, empty, error, and stale are four distinct renderings on purpose: coalescing a failed
|
|
29
|
+
* fetch into an empty result tells a reader their run is clean when the truth is unknown.
|
|
30
|
+
*/
|
|
31
|
+
export declare function RunAnnotationList({ query, entries, workflowRunId, workspaceSlug, projectSlug, runAttempt, filteredJobName, filteredSeverity, filtered, onClearFilters, selectedAnnotationId, }: RunAnnotationListProps): import("react").JSX.Element;
|
|
32
|
+
//# sourceMappingURL=run-annotation-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-annotation-list.d.ts","sourceRoot":"","sources":["../../../src/components/workflow-run-tabs/run-annotation-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAO5E,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAIhE,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,MAAM,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,sBAAsB,CAAC;IAC9B,OAAO,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAC;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,+EAA+E;IAC/E,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1C,yFAAyF;IACzF,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C;AAWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,oBAAoB,GACrB,EAAE,sBAAsB,+BA8ExB"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { QueryLoadError } from '@shipfox/client-ui';
|
|
3
|
+
import { Button } from '@shipfox/react-ui/button';
|
|
4
|
+
import { Callout } from '@shipfox/react-ui/callout';
|
|
5
|
+
import { EmptyState } from '@shipfox/react-ui/empty-state';
|
|
6
|
+
import { Skeleton } from '@shipfox/react-ui/skeleton';
|
|
7
|
+
import { Text } from '@shipfox/react-ui/typography';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { RunAnnotationItem } from './run-annotation-item.js';
|
|
10
|
+
import { RunAnnotationsEmpty } from './run-annotations-empty.js';
|
|
11
|
+
/**
|
|
12
|
+
* How many annotations render at once.
|
|
13
|
+
*
|
|
14
|
+
* A page holds up to 500 rows and each one mounts a Markdown pipeline, so the fetch budget is
|
|
15
|
+
* not a render budget. The window grows on demand and the server page only loads once the
|
|
16
|
+
* reader has actually seen everything already fetched.
|
|
17
|
+
*/ const RENDER_WINDOW = 25;
|
|
18
|
+
/**
|
|
19
|
+
* The annotations list.
|
|
20
|
+
*
|
|
21
|
+
* Loading, empty, error, and stale are four distinct renderings on purpose: coalescing a failed
|
|
22
|
+
* fetch into an empty result tells a reader their run is clean when the truth is unknown.
|
|
23
|
+
*/ export function RunAnnotationList({ query, entries, workflowRunId, workspaceSlug, projectSlug, runAttempt, filteredJobName, filteredSeverity, filtered, onClearFilters, selectedAnnotationId }) {
|
|
24
|
+
const [visibleCount, setVisibleCount] = useState(RENDER_WINDOW);
|
|
25
|
+
// A deep-linked annotation past the window would otherwise be unreachable: it is in the data,
|
|
26
|
+
// absent from the DOM, and nothing on screen says so.
|
|
27
|
+
const selectedIndex = selectedAnnotationId ? entries?.findIndex((entry)=>entry.annotation.id === selectedAnnotationId) ?? -1 : -1;
|
|
28
|
+
const renderCount = Math.max(visibleCount, selectedIndex + 1);
|
|
29
|
+
if (query.isPending) return /*#__PURE__*/ _jsx(RunAnnotationListSkeleton, {});
|
|
30
|
+
if (query.isError && entries === undefined) {
|
|
31
|
+
return /*#__PURE__*/ _jsx(QueryLoadError, {
|
|
32
|
+
query: query,
|
|
33
|
+
subject: "annotations",
|
|
34
|
+
icon: "fileDamageLine"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (entries === undefined) return /*#__PURE__*/ _jsx(RunAnnotationListSkeleton, {});
|
|
38
|
+
const visible = entries.slice(0, renderCount);
|
|
39
|
+
const hiddenCount = entries.length - visible.length;
|
|
40
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
41
|
+
className: "flex min-w-0 flex-col gap-12",
|
|
42
|
+
children: [
|
|
43
|
+
query.isError ? /*#__PURE__*/ _jsx(RunAnnotationStaleError, {
|
|
44
|
+
query: query
|
|
45
|
+
}) : null,
|
|
46
|
+
entries.length === 0 ? filtered ? /*#__PURE__*/ _jsx(RunAnnotationsFilteredEmpty, {
|
|
47
|
+
jobName: filteredJobName,
|
|
48
|
+
severity: filteredSeverity,
|
|
49
|
+
incomplete: query.hasNextPage,
|
|
50
|
+
onClearFilters: onClearFilters
|
|
51
|
+
}) : /*#__PURE__*/ _jsx(RunAnnotationsEmpty, {}) : /*#__PURE__*/ _jsx("ol", {
|
|
52
|
+
className: "flex min-w-0 flex-col gap-12",
|
|
53
|
+
children: visible.map((entry)=>/*#__PURE__*/ _jsx(RunAnnotationItem, {
|
|
54
|
+
entry: entry,
|
|
55
|
+
workspaceSlug: workspaceSlug,
|
|
56
|
+
projectSlug: projectSlug,
|
|
57
|
+
workflowRunId: workflowRunId,
|
|
58
|
+
runAttempt: runAttempt,
|
|
59
|
+
selected: entry.annotation.id === selectedAnnotationId
|
|
60
|
+
}, entry.annotation.id))
|
|
61
|
+
}),
|
|
62
|
+
hiddenCount > 0 ? /*#__PURE__*/ _jsxs(Button, {
|
|
63
|
+
type: "button",
|
|
64
|
+
size: "sm",
|
|
65
|
+
variant: "secondary",
|
|
66
|
+
className: "self-start [@media(pointer:coarse)]:min-h-44",
|
|
67
|
+
onClick: ()=>setVisibleCount((current)=>current + RENDER_WINDOW),
|
|
68
|
+
children: [
|
|
69
|
+
"Show ",
|
|
70
|
+
Math.min(hiddenCount, RENDER_WINDOW),
|
|
71
|
+
" more of ",
|
|
72
|
+
entries.length
|
|
73
|
+
]
|
|
74
|
+
}) : query.hasNextPage ? /*#__PURE__*/ _jsx(Button, {
|
|
75
|
+
type: "button",
|
|
76
|
+
size: "sm",
|
|
77
|
+
variant: "secondary",
|
|
78
|
+
className: "self-start [@media(pointer:coarse)]:min-h-44",
|
|
79
|
+
isLoading: query.isFetchingNextPage,
|
|
80
|
+
onClick: ()=>{
|
|
81
|
+
void query.fetchNextPage();
|
|
82
|
+
},
|
|
83
|
+
children: "Load more annotations"
|
|
84
|
+
}) : null
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Names the filters that are actually active.
|
|
90
|
+
*
|
|
91
|
+
* Blaming severity for a job-only filter sends the reader to change the wrong control, which
|
|
92
|
+
* is worse than saying nothing.
|
|
93
|
+
*/ function filteredEmptyDescription({ jobName, severity, incomplete }) {
|
|
94
|
+
if (incomplete) {
|
|
95
|
+
if (jobName && severity) {
|
|
96
|
+
return `None of the loaded annotations are from ${jobName} at ${severity} severity. Load more annotations to continue searching.`;
|
|
97
|
+
}
|
|
98
|
+
if (jobName) {
|
|
99
|
+
return `None of the loaded annotations are from ${jobName}. Load more annotations to continue searching.`;
|
|
100
|
+
}
|
|
101
|
+
if (severity) {
|
|
102
|
+
return `None of the loaded annotations are at ${severity} severity. Load more annotations to continue searching.`;
|
|
103
|
+
}
|
|
104
|
+
return 'None of the loaded annotations match the current filters. Load more annotations to continue searching.';
|
|
105
|
+
}
|
|
106
|
+
if (jobName && severity) {
|
|
107
|
+
return `This run has annotations, but none from ${jobName} at ${severity} severity.`;
|
|
108
|
+
}
|
|
109
|
+
if (jobName) return `This run has annotations, but none from ${jobName}.`;
|
|
110
|
+
if (severity) return `This run has annotations, but none at ${severity} severity.`;
|
|
111
|
+
return 'This run has annotations, but none match the current filters.';
|
|
112
|
+
}
|
|
113
|
+
function RunAnnotationsFilteredEmpty({ jobName, severity, incomplete, onClearFilters }) {
|
|
114
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
115
|
+
className: "flex flex-col items-center gap-12",
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ _jsx(EmptyState, {
|
|
118
|
+
icon: "fileDamageLine",
|
|
119
|
+
title: incomplete ? 'No matches in loaded annotations' : 'No matching annotations',
|
|
120
|
+
description: filteredEmptyDescription({
|
|
121
|
+
jobName,
|
|
122
|
+
severity,
|
|
123
|
+
incomplete
|
|
124
|
+
})
|
|
125
|
+
}),
|
|
126
|
+
onClearFilters ? /*#__PURE__*/ _jsx(Button, {
|
|
127
|
+
type: "button",
|
|
128
|
+
size: "sm",
|
|
129
|
+
variant: "secondary",
|
|
130
|
+
className: "[@media(pointer:coarse)]:min-h-44",
|
|
131
|
+
onClick: onClearFilters,
|
|
132
|
+
children: "Clear filters"
|
|
133
|
+
}) : null
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A failed poll keeps the annotations already on screen and marks them stale rather than
|
|
139
|
+
* clearing. Polite rather than assertive: the poll runs every 4s and a flapping API would
|
|
140
|
+
* otherwise interrupt a screen reader on every cycle.
|
|
141
|
+
*/ function RunAnnotationStaleError({ query }) {
|
|
142
|
+
return /*#__PURE__*/ _jsx(Callout, {
|
|
143
|
+
role: "status",
|
|
144
|
+
"aria-live": "polite",
|
|
145
|
+
type: "error",
|
|
146
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
147
|
+
className: "flex w-full items-center justify-between gap-8",
|
|
148
|
+
children: [
|
|
149
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
150
|
+
size: "xs",
|
|
151
|
+
children: "Could not refresh annotations."
|
|
152
|
+
}),
|
|
153
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
154
|
+
type: "button",
|
|
155
|
+
size: "2xs",
|
|
156
|
+
variant: "secondary",
|
|
157
|
+
className: "[@media(pointer:coarse)]:min-h-44",
|
|
158
|
+
isLoading: query.isFetching,
|
|
159
|
+
onClick: ()=>{
|
|
160
|
+
void query.refetch();
|
|
161
|
+
},
|
|
162
|
+
children: "Retry"
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const ANNOTATION_SKELETON_ROWS = [
|
|
169
|
+
'first',
|
|
170
|
+
'second',
|
|
171
|
+
'third'
|
|
172
|
+
];
|
|
173
|
+
function RunAnnotationListSkeleton() {
|
|
174
|
+
return /*#__PURE__*/ _jsx("section", {
|
|
175
|
+
"aria-label": "Loading annotations",
|
|
176
|
+
className: "flex flex-col gap-12",
|
|
177
|
+
children: ANNOTATION_SKELETON_ROWS.map((row)=>/*#__PURE__*/ _jsxs("div", {
|
|
178
|
+
className: "flex gap-12 rounded-8 border border-border-neutral-base bg-background-components-base px-12 py-8",
|
|
179
|
+
children: [
|
|
180
|
+
/*#__PURE__*/ _jsx(Skeleton, {
|
|
181
|
+
className: "h-40 w-4 rounded-full"
|
|
182
|
+
}),
|
|
183
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
184
|
+
className: "flex min-w-0 flex-1 flex-col gap-6",
|
|
185
|
+
children: [
|
|
186
|
+
/*#__PURE__*/ _jsx(Skeleton, {
|
|
187
|
+
className: "h-20 w-160 rounded-4"
|
|
188
|
+
}),
|
|
189
|
+
/*#__PURE__*/ _jsx(Skeleton, {
|
|
190
|
+
className: "h-16 w-240 rounded-4"
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ _jsx(Skeleton, {
|
|
193
|
+
className: "h-40 w-full rounded-4"
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
}, row))
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
//# sourceMappingURL=run-annotation-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/workflow-run-tabs/run-annotation-list.tsx"],"sourcesContent":["import {QueryLoadError, type QueryLoadErrorQuery} from '@shipfox/client-ui';\nimport {Button} from '@shipfox/react-ui/button';\nimport {Callout} from '@shipfox/react-ui/callout';\nimport {EmptyState} from '@shipfox/react-ui/empty-state';\nimport {Skeleton} from '@shipfox/react-ui/skeleton';\nimport {Text} from '@shipfox/react-ui/typography';\nimport {useState} from 'react';\nimport type {RunAnnotationEntry} from '#core/run-annotation.js';\nimport {RunAnnotationItem} from './run-annotation-item.js';\nimport {RunAnnotationsEmpty} from './run-annotations-empty.js';\n\nexport interface RunAnnotationListQuery extends QueryLoadErrorQuery {\n isPending: boolean;\n hasNextPage: boolean;\n isFetchingNextPage: boolean;\n fetchNextPage: () => unknown;\n}\n\nexport interface RunAnnotationListProps {\n query: RunAnnotationListQuery;\n entries: RunAnnotationEntry[] | undefined;\n workflowRunId: string;\n workspaceSlug?: string | undefined;\n projectSlug?: string | undefined;\n runAttempt?: number | undefined;\n /** Name of the job the list is filtered to, used only for empty-state copy. */\n filteredJobName?: string | undefined;\n /** Active severity filter, named in the empty state so the reader knows what to clear. */\n filteredSeverity?: string | undefined;\n filtered: boolean;\n onClearFilters?: (() => void) | undefined;\n /** Annotation id from `?annotation=`, which the matching card scrolls to and focuses. */\n selectedAnnotationId?: string | undefined;\n}\n\n/**\n * How many annotations render at once.\n *\n * A page holds up to 500 rows and each one mounts a Markdown pipeline, so the fetch budget is\n * not a render budget. The window grows on demand and the server page only loads once the\n * reader has actually seen everything already fetched.\n */\nconst RENDER_WINDOW = 25;\n\n/**\n * The annotations list.\n *\n * Loading, empty, error, and stale are four distinct renderings on purpose: coalescing a failed\n * fetch into an empty result tells a reader their run is clean when the truth is unknown.\n */\nexport function RunAnnotationList({\n query,\n entries,\n workflowRunId,\n workspaceSlug,\n projectSlug,\n runAttempt,\n filteredJobName,\n filteredSeverity,\n filtered,\n onClearFilters,\n selectedAnnotationId,\n}: RunAnnotationListProps) {\n const [visibleCount, setVisibleCount] = useState(RENDER_WINDOW);\n\n // A deep-linked annotation past the window would otherwise be unreachable: it is in the data,\n // absent from the DOM, and nothing on screen says so.\n const selectedIndex = selectedAnnotationId\n ? (entries?.findIndex((entry) => entry.annotation.id === selectedAnnotationId) ?? -1)\n : -1;\n const renderCount = Math.max(visibleCount, selectedIndex + 1);\n\n if (query.isPending) return <RunAnnotationListSkeleton />;\n\n if (query.isError && entries === undefined) {\n return <QueryLoadError query={query} subject=\"annotations\" icon=\"fileDamageLine\" />;\n }\n\n if (entries === undefined) return <RunAnnotationListSkeleton />;\n\n const visible = entries.slice(0, renderCount);\n const hiddenCount = entries.length - visible.length;\n\n return (\n <div className=\"flex min-w-0 flex-col gap-12\">\n {query.isError ? <RunAnnotationStaleError query={query} /> : null}\n\n {entries.length === 0 ? (\n filtered ? (\n <RunAnnotationsFilteredEmpty\n jobName={filteredJobName}\n severity={filteredSeverity}\n incomplete={query.hasNextPage}\n onClearFilters={onClearFilters}\n />\n ) : (\n <RunAnnotationsEmpty />\n )\n ) : (\n <ol className=\"flex min-w-0 flex-col gap-12\">\n {visible.map((entry) => (\n <RunAnnotationItem\n key={entry.annotation.id}\n entry={entry}\n workspaceSlug={workspaceSlug}\n projectSlug={projectSlug}\n workflowRunId={workflowRunId}\n runAttempt={runAttempt}\n selected={entry.annotation.id === selectedAnnotationId}\n />\n ))}\n </ol>\n )}\n\n {hiddenCount > 0 ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n className=\"self-start [@media(pointer:coarse)]:min-h-44\"\n onClick={() => setVisibleCount((current) => current + RENDER_WINDOW)}\n >\n Show {Math.min(hiddenCount, RENDER_WINDOW)} more of {entries.length}\n </Button>\n ) : query.hasNextPage ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n className=\"self-start [@media(pointer:coarse)]:min-h-44\"\n isLoading={query.isFetchingNextPage}\n onClick={() => {\n void query.fetchNextPage();\n }}\n >\n Load more annotations\n </Button>\n ) : null}\n </div>\n );\n}\n\n/**\n * Names the filters that are actually active.\n *\n * Blaming severity for a job-only filter sends the reader to change the wrong control, which\n * is worse than saying nothing.\n */\nfunction filteredEmptyDescription({\n jobName,\n severity,\n incomplete,\n}: {\n jobName: string | undefined;\n severity: string | undefined;\n incomplete: boolean;\n}): string {\n if (incomplete) {\n if (jobName && severity) {\n return `None of the loaded annotations are from ${jobName} at ${severity} severity. Load more annotations to continue searching.`;\n }\n if (jobName) {\n return `None of the loaded annotations are from ${jobName}. Load more annotations to continue searching.`;\n }\n if (severity) {\n return `None of the loaded annotations are at ${severity} severity. Load more annotations to continue searching.`;\n }\n return 'None of the loaded annotations match the current filters. Load more annotations to continue searching.';\n }\n if (jobName && severity) {\n return `This run has annotations, but none from ${jobName} at ${severity} severity.`;\n }\n if (jobName) return `This run has annotations, but none from ${jobName}.`;\n if (severity) return `This run has annotations, but none at ${severity} severity.`;\n return 'This run has annotations, but none match the current filters.';\n}\n\nfunction RunAnnotationsFilteredEmpty({\n jobName,\n severity,\n incomplete,\n onClearFilters,\n}: {\n jobName: string | undefined;\n severity: string | undefined;\n incomplete: boolean;\n onClearFilters: (() => void) | undefined;\n}) {\n return (\n <div className=\"flex flex-col items-center gap-12\">\n <EmptyState\n icon=\"fileDamageLine\"\n title={incomplete ? 'No matches in loaded annotations' : 'No matching annotations'}\n description={filteredEmptyDescription({jobName, severity, incomplete})}\n />\n {onClearFilters ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n className=\"[@media(pointer:coarse)]:min-h-44\"\n onClick={onClearFilters}\n >\n Clear filters\n </Button>\n ) : null}\n </div>\n );\n}\n\n/**\n * A failed poll keeps the annotations already on screen and marks them stale rather than\n * clearing. Polite rather than assertive: the poll runs every 4s and a flapping API would\n * otherwise interrupt a screen reader on every cycle.\n */\nfunction RunAnnotationStaleError({query}: {query: QueryLoadErrorQuery}) {\n return (\n <Callout role=\"status\" aria-live=\"polite\" type=\"error\">\n <div className=\"flex w-full items-center justify-between gap-8\">\n <Text size=\"xs\">Could not refresh annotations.</Text>\n <Button\n type=\"button\"\n size=\"2xs\"\n variant=\"secondary\"\n className=\"[@media(pointer:coarse)]:min-h-44\"\n isLoading={query.isFetching}\n onClick={() => {\n void query.refetch();\n }}\n >\n Retry\n </Button>\n </div>\n </Callout>\n );\n}\n\nconst ANNOTATION_SKELETON_ROWS = ['first', 'second', 'third'];\n\nfunction RunAnnotationListSkeleton() {\n return (\n <section aria-label=\"Loading annotations\" className=\"flex flex-col gap-12\">\n {ANNOTATION_SKELETON_ROWS.map((row) => (\n <div\n key={row}\n className=\"flex gap-12 rounded-8 border border-border-neutral-base bg-background-components-base px-12 py-8\"\n >\n <Skeleton className=\"h-40 w-4 rounded-full\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-6\">\n <Skeleton className=\"h-20 w-160 rounded-4\" />\n <Skeleton className=\"h-16 w-240 rounded-4\" />\n <Skeleton className=\"h-40 w-full rounded-4\" />\n </div>\n </div>\n ))}\n </section>\n );\n}\n"],"names":["QueryLoadError","Button","Callout","EmptyState","Skeleton","Text","useState","RunAnnotationItem","RunAnnotationsEmpty","RENDER_WINDOW","RunAnnotationList","query","entries","workflowRunId","workspaceSlug","projectSlug","runAttempt","filteredJobName","filteredSeverity","filtered","onClearFilters","selectedAnnotationId","visibleCount","setVisibleCount","selectedIndex","findIndex","entry","annotation","id","renderCount","Math","max","isPending","RunAnnotationListSkeleton","isError","undefined","subject","icon","visible","slice","hiddenCount","length","div","className","RunAnnotationStaleError","RunAnnotationsFilteredEmpty","jobName","severity","incomplete","hasNextPage","ol","map","selected","type","size","variant","onClick","current","min","isLoading","isFetchingNextPage","fetchNextPage","filteredEmptyDescription","title","description","role","aria-live","isFetching","refetch","ANNOTATION_SKELETON_ROWS","section","aria-label","row"],"mappings":";AAAA,SAAQA,cAAc,QAAiC,qBAAqB;AAC5E,SAAQC,MAAM,QAAO,2BAA2B;AAChD,SAAQC,OAAO,QAAO,4BAA4B;AAClD,SAAQC,UAAU,QAAO,gCAAgC;AACzD,SAAQC,QAAQ,QAAO,6BAA6B;AACpD,SAAQC,IAAI,QAAO,+BAA+B;AAClD,SAAQC,QAAQ,QAAO,QAAQ;AAE/B,SAAQC,iBAAiB,QAAO,2BAA2B;AAC3D,SAAQC,mBAAmB,QAAO,6BAA6B;AA0B/D;;;;;;CAMC,GACD,MAAMC,gBAAgB;AAEtB;;;;;CAKC,GACD,OAAO,SAASC,kBAAkB,EAChCC,KAAK,EACLC,OAAO,EACPC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,eAAe,EACfC,gBAAgB,EAChBC,QAAQ,EACRC,cAAc,EACdC,oBAAoB,EACG;IACvB,MAAM,CAACC,cAAcC,gBAAgB,GAAGjB,SAASG;IAEjD,8FAA8F;IAC9F,sDAAsD;IACtD,MAAMe,gBAAgBH,uBACjBT,SAASa,UAAU,CAACC,QAAUA,MAAMC,UAAU,CAACC,EAAE,KAAKP,yBAAyB,CAAC,IACjF,CAAC;IACL,MAAMQ,cAAcC,KAAKC,GAAG,CAACT,cAAcE,gBAAgB;IAE3D,IAAIb,MAAMqB,SAAS,EAAE,qBAAO,KAACC;IAE7B,IAAItB,MAAMuB,OAAO,IAAItB,YAAYuB,WAAW;QAC1C,qBAAO,KAACnC;YAAeW,OAAOA;YAAOyB,SAAQ;YAAcC,MAAK;;IAClE;IAEA,IAAIzB,YAAYuB,WAAW,qBAAO,KAACF;IAEnC,MAAMK,UAAU1B,QAAQ2B,KAAK,CAAC,GAAGV;IACjC,MAAMW,cAAc5B,QAAQ6B,MAAM,GAAGH,QAAQG,MAAM;IAEnD,qBACE,MAACC;QAAIC,WAAU;;YAC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KAACvC;gCAASuC,WAAU;;0CACpB,KAACvC;gCAASuC,WAAU;;;;;eAPjB6B;;AAaf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RunAnnotationSummary } from '#core/
|
|
1
|
+
import type { RunAnnotationSummary } from '#core/run-annotation.js';
|
|
2
2
|
import { type WorkflowRunsSearch } from '#routes/inputs.js';
|
|
3
3
|
export interface RunAnnotationSummaryLineProps {
|
|
4
4
|
summary?: RunAnnotationSummary | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-annotation-summary-line.d.ts","sourceRoot":"","sources":["../../../src/components/workflow-run-tabs/run-annotation-summary-line.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-annotation-summary-line.d.ts","sourceRoot":"","sources":["../../../src/components/workflow-run-tabs/run-annotation-summary-line.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,mBAAmB,CAAC;AAiB3B,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,aAAa,EACb,WAAW,EACX,aAAa,EACb,MAAW,GACZ,EAAE,6BAA6B,sCAsD/B"}
|
|
@@ -1,23 +1,58 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '@shipfox/react-ui/icon';
|
|
2
3
|
import { Text } from '@shipfox/react-ui/typography';
|
|
4
|
+
import { cn } from '@shipfox/react-ui/utils';
|
|
3
5
|
import { Link } from '@tanstack/react-router';
|
|
4
|
-
import {
|
|
6
|
+
import { workflowRunSearchParams } from '#routes/inputs.js';
|
|
5
7
|
import { MetadataSeparator } from '../workflow-run-summary/workflow-run-summary.js';
|
|
8
|
+
import { SEVERITY_ICON, SEVERITY_ICON_TONE } from './severity-visuals.js';
|
|
9
|
+
/**
|
|
10
|
+
* The severities this line names.
|
|
11
|
+
*
|
|
12
|
+
* The line exists so a failing run cannot look clean while the explanation sits behind an
|
|
13
|
+
* inactive section, which makes its subject "what needs attention", not "what happened".
|
|
14
|
+
* `info` and `success` are already inside the total, and repeating them gives "nothing is
|
|
15
|
+
* wrong" the same weight and the same accent as "something failed".
|
|
16
|
+
*/ const ATTENTION_SEVERITIES = [
|
|
17
|
+
'error',
|
|
18
|
+
'warning'
|
|
19
|
+
];
|
|
6
20
|
export function RunAnnotationSummaryLine({ summary, workspaceSlug, projectSlug, workflowRunId, search = {} }) {
|
|
7
|
-
|
|
8
|
-
|
|
21
|
+
// A run with no annotations says so in its empty state; a "0 annotations" line beside it is
|
|
22
|
+
// the same fact twice.
|
|
23
|
+
if (!summary || summary.total === 0) return null;
|
|
24
|
+
const visibleSeverities = ATTENTION_SEVERITIES.filter((severity)=>summary[severity] > 0);
|
|
25
|
+
const totalLabel = countLabel(summary.total, 'annotation', summary.truncated);
|
|
9
26
|
return /*#__PURE__*/ _jsxs("div", {
|
|
10
27
|
className: "flex flex-wrap items-center gap-x-8 gap-y-4 text-foreground-neutral-subtle",
|
|
11
28
|
children: [
|
|
12
|
-
|
|
29
|
+
search.severity && workspaceSlug && projectSlug && workflowRunId ? // The severity filter has no control of its own, so while one is active the total is
|
|
30
|
+
// the way back out. Unfiltered it stays plain text: a link to where you already are
|
|
31
|
+
// is noise.
|
|
32
|
+
/*#__PURE__*/ _jsx(Link, {
|
|
33
|
+
to: "/w/$workspaceSlug/p/$projectSlug/runs/$workflowRunId",
|
|
34
|
+
params: {
|
|
35
|
+
workspaceSlug,
|
|
36
|
+
projectSlug,
|
|
37
|
+
workflowRunId
|
|
38
|
+
},
|
|
39
|
+
search: workflowRunSearchParams({
|
|
40
|
+
...withoutSeverity(search),
|
|
41
|
+
tab: 'annotations'
|
|
42
|
+
}, search),
|
|
43
|
+
"aria-label": `Show all ${totalLabel}`,
|
|
44
|
+
className: "shrink-0 rounded-4 outline-none focus-visible:shadow-border-interactive-with-active",
|
|
45
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
46
|
+
as: "span",
|
|
47
|
+
size: "xs",
|
|
48
|
+
className: "text-foreground-neutral-subtle underline",
|
|
49
|
+
children: totalLabel
|
|
50
|
+
})
|
|
51
|
+
}) : /*#__PURE__*/ _jsx(Text, {
|
|
13
52
|
as: "span",
|
|
14
53
|
size: "xs",
|
|
15
54
|
className: "shrink-0 text-foreground-neutral-subtle",
|
|
16
|
-
children:
|
|
17
|
-
summary.total,
|
|
18
|
-
" ",
|
|
19
|
-
pluralize('annotation', summary.total)
|
|
20
|
-
]
|
|
55
|
+
children: totalLabel
|
|
21
56
|
}),
|
|
22
57
|
visibleSeverities.map((severity)=>/*#__PURE__*/ _jsxs("span", {
|
|
23
58
|
className: "inline-flex shrink-0 items-center gap-8",
|
|
@@ -25,6 +60,7 @@ export function RunAnnotationSummaryLine({ summary, workspaceSlug, projectSlug,
|
|
|
25
60
|
/*#__PURE__*/ _jsx(MetadataSeparator, {}),
|
|
26
61
|
/*#__PURE__*/ _jsx(SeverityLink, {
|
|
27
62
|
count: summary[severity],
|
|
63
|
+
truncated: summary.truncated,
|
|
28
64
|
severity: severity,
|
|
29
65
|
workspaceSlug: workspaceSlug,
|
|
30
66
|
projectSlug: projectSlug,
|
|
@@ -36,18 +72,31 @@ export function RunAnnotationSummaryLine({ summary, workspaceSlug, projectSlug,
|
|
|
36
72
|
]
|
|
37
73
|
});
|
|
38
74
|
}
|
|
39
|
-
function SeverityLink({ count, severity, workspaceSlug, projectSlug, workflowRunId, search }) {
|
|
40
|
-
const label =
|
|
75
|
+
function SeverityLink({ count, truncated, severity, workspaceSlug, projectSlug, workflowRunId, search }) {
|
|
76
|
+
const label = countLabel(count, severity, truncated);
|
|
77
|
+
const content = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
78
|
+
children: [
|
|
79
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
80
|
+
name: SEVERITY_ICON[severity],
|
|
81
|
+
size: 12,
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
className: cn('shrink-0', SEVERITY_ICON_TONE[severity])
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
86
|
+
as: "span",
|
|
87
|
+
size: "xs",
|
|
88
|
+
className: "text-foreground-neutral-subtle",
|
|
89
|
+
children: label
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
41
93
|
if (!workspaceSlug || !projectSlug || !workflowRunId) {
|
|
42
94
|
return /*#__PURE__*/ _jsx("span", {
|
|
43
|
-
className: "
|
|
44
|
-
children:
|
|
95
|
+
className: "inline-flex items-center gap-4",
|
|
96
|
+
children: content
|
|
45
97
|
});
|
|
46
98
|
}
|
|
47
|
-
const searchWithoutAnnotation =
|
|
48
|
-
...search
|
|
49
|
-
};
|
|
50
|
-
delete searchWithoutAnnotation.annotation;
|
|
99
|
+
const searchWithoutAnnotation = withoutAnnotation(search);
|
|
51
100
|
return /*#__PURE__*/ _jsx(Link, {
|
|
52
101
|
to: "/w/$workspaceSlug/p/$projectSlug/runs/$workflowRunId",
|
|
53
102
|
params: {
|
|
@@ -60,12 +109,28 @@ function SeverityLink({ count, severity, workspaceSlug, projectSlug, workflowRun
|
|
|
60
109
|
tab: 'annotations',
|
|
61
110
|
severity
|
|
62
111
|
}, search),
|
|
63
|
-
className: "
|
|
64
|
-
children:
|
|
112
|
+
className: "inline-flex items-center gap-4 rounded-4 outline-none hover:underline focus-visible:shadow-border-interactive-with-active",
|
|
113
|
+
children: content
|
|
65
114
|
});
|
|
66
115
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
116
|
+
/** A selected annotation is stale the moment the list it was chosen from is refiltered. */ function withoutAnnotation(search) {
|
|
117
|
+
const next = {
|
|
118
|
+
...search
|
|
119
|
+
};
|
|
120
|
+
delete next.annotation;
|
|
121
|
+
return next;
|
|
122
|
+
}
|
|
123
|
+
function withoutSeverity(search) {
|
|
124
|
+
const next = withoutAnnotation(search);
|
|
125
|
+
delete next.severity;
|
|
126
|
+
return next;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A truncated read renders `500+ annotations`: the counts are a lower bound once the page budget
|
|
130
|
+
* is hit, and presenting them as exact would understate a run the reader is trying to trust.
|
|
131
|
+
*/ function countLabel(count, word, truncated) {
|
|
132
|
+
const plural = count === 1 && !truncated ? word : `${word}s`;
|
|
133
|
+
return `${count}${truncated ? '+' : ''} ${plural}`;
|
|
69
134
|
}
|
|
70
135
|
|
|
71
136
|
//# sourceMappingURL=run-annotation-summary-line.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/workflow-run-tabs/run-annotation-summary-line.tsx"],"sourcesContent":["import {Text} from '@shipfox/react-ui/typography';\nimport {Link} from '@tanstack/react-router';\nimport type {RunAnnotationSummary} from '#core/
|
|
1
|
+
{"version":3,"sources":["../../../src/components/workflow-run-tabs/run-annotation-summary-line.tsx"],"sourcesContent":["import {Icon} from '@shipfox/react-ui/icon';\nimport {Text} from '@shipfox/react-ui/typography';\nimport {cn} from '@shipfox/react-ui/utils';\nimport {Link} from '@tanstack/react-router';\nimport type {RunAnnotationSummary} from '#core/run-annotation.js';\nimport {\n type WorkflowRunAnnotationSeverity,\n type WorkflowRunsSearch,\n workflowRunSearchParams,\n} from '#routes/inputs.js';\nimport {MetadataSeparator} from '../workflow-run-summary/workflow-run-summary.js';\nimport {SEVERITY_ICON, SEVERITY_ICON_TONE} from './severity-visuals.js';\n\n/**\n * The severities this line names.\n *\n * The line exists so a failing run cannot look clean while the explanation sits behind an\n * inactive section, which makes its subject \"what needs attention\", not \"what happened\".\n * `info` and `success` are already inside the total, and repeating them gives \"nothing is\n * wrong\" the same weight and the same accent as \"something failed\".\n */\nconst ATTENTION_SEVERITIES = [\n 'error',\n 'warning',\n] as const satisfies readonly WorkflowRunAnnotationSeverity[];\n\nexport interface RunAnnotationSummaryLineProps {\n summary?: RunAnnotationSummary | undefined;\n workspaceSlug?: string | undefined;\n projectSlug?: string | undefined;\n workflowRunId?: string | undefined;\n search?: WorkflowRunsSearch | undefined;\n}\n\nexport function RunAnnotationSummaryLine({\n summary,\n workspaceSlug,\n projectSlug,\n workflowRunId,\n search = {},\n}: RunAnnotationSummaryLineProps) {\n // A run with no annotations says so in its empty state; a \"0 annotations\" line beside it is\n // the same fact twice.\n if (!summary || summary.total === 0) return null;\n\n const visibleSeverities = ATTENTION_SEVERITIES.filter((severity) => summary[severity] > 0);\n\n const totalLabel = countLabel(summary.total, 'annotation', summary.truncated);\n\n return (\n <div className=\"flex flex-wrap items-center gap-x-8 gap-y-4 text-foreground-neutral-subtle\">\n {search.severity && workspaceSlug && projectSlug && workflowRunId ? (\n // The severity filter has no control of its own, so while one is active the total is\n // the way back out. Unfiltered it stays plain text: a link to where you already are\n // is noise.\n <Link\n to=\"/w/$workspaceSlug/p/$projectSlug/runs/$workflowRunId\"\n params={{workspaceSlug, projectSlug, workflowRunId}}\n search={\n workflowRunSearchParams(\n {...withoutSeverity(search), tab: 'annotations'},\n search,\n ) as never\n }\n aria-label={`Show all ${totalLabel}`}\n className=\"shrink-0 rounded-4 outline-none focus-visible:shadow-border-interactive-with-active\"\n >\n {/* Underlined rather than accented: the escape hatch has to read as a link without\n becoming the loudest thing on a line whose job is to be scannable. */}\n <Text as=\"span\" size=\"xs\" className=\"text-foreground-neutral-subtle underline\">\n {totalLabel}\n </Text>\n </Link>\n ) : (\n <Text as=\"span\" size=\"xs\" className=\"shrink-0 text-foreground-neutral-subtle\">\n {totalLabel}\n </Text>\n )}\n {visibleSeverities.map((severity) => (\n <span key={severity} className=\"inline-flex shrink-0 items-center gap-8\">\n <MetadataSeparator />\n <SeverityLink\n count={summary[severity]}\n truncated={summary.truncated}\n severity={severity}\n workspaceSlug={workspaceSlug}\n projectSlug={projectSlug}\n workflowRunId={workflowRunId}\n search={search}\n />\n </span>\n ))}\n </div>\n );\n}\n\nfunction SeverityLink({\n count,\n truncated,\n severity,\n workspaceSlug,\n projectSlug,\n workflowRunId,\n search,\n}: {\n count: number;\n truncated: boolean;\n severity: WorkflowRunAnnotationSeverity;\n workspaceSlug?: string | undefined;\n projectSlug?: string | undefined;\n workflowRunId?: string | undefined;\n search: WorkflowRunsSearch;\n}) {\n const label = countLabel(count, severity, truncated);\n const content = (\n <>\n <Icon\n name={SEVERITY_ICON[severity]}\n size={12}\n aria-hidden=\"true\"\n className={cn('shrink-0', SEVERITY_ICON_TONE[severity])}\n />\n <Text as=\"span\" size=\"xs\" className=\"text-foreground-neutral-subtle\">\n {label}\n </Text>\n </>\n );\n\n if (!workspaceSlug || !projectSlug || !workflowRunId) {\n return <span className=\"inline-flex items-center gap-4\">{content}</span>;\n }\n\n const searchWithoutAnnotation = withoutAnnotation(search);\n\n return (\n <Link\n to=\"/w/$workspaceSlug/p/$projectSlug/runs/$workflowRunId\"\n params={{workspaceSlug, projectSlug, workflowRunId}}\n search={\n workflowRunSearchParams(\n {...searchWithoutAnnotation, tab: 'annotations', severity},\n search,\n ) as never\n }\n className=\"inline-flex items-center gap-4 rounded-4 outline-none hover:underline focus-visible:shadow-border-interactive-with-active\"\n >\n {content}\n </Link>\n );\n}\n\n/** A selected annotation is stale the moment the list it was chosen from is refiltered. */\nfunction withoutAnnotation(search: WorkflowRunsSearch): WorkflowRunsSearch {\n const next = {...search};\n delete next.annotation;\n return next;\n}\n\nfunction withoutSeverity(search: WorkflowRunsSearch): WorkflowRunsSearch {\n const next = withoutAnnotation(search);\n delete next.severity;\n return next;\n}\n\n/**\n * A truncated read renders `500+ annotations`: the counts are a lower bound once the page budget\n * is hit, and presenting them as exact would understate a run the reader is trying to trust.\n */\nfunction countLabel(count: number, word: string, truncated: boolean): string {\n const plural = count === 1 && !truncated ? word : `${word}s`;\n return `${count}${truncated ? '+' : ''} ${plural}`;\n}\n"],"names":["Icon","Text","cn","Link","workflowRunSearchParams","MetadataSeparator","SEVERITY_ICON","SEVERITY_ICON_TONE","ATTENTION_SEVERITIES","RunAnnotationSummaryLine","summary","workspaceSlug","projectSlug","workflowRunId","search","total","visibleSeverities","filter","severity","totalLabel","countLabel","truncated","div","className","to","params","withoutSeverity","tab","aria-label","as","size","map","span","SeverityLink","count","label","content","name","aria-hidden","searchWithoutAnnotation","withoutAnnotation","next","annotation","word","plural"],"mappings":";AAAA,SAAQA,IAAI,QAAO,yBAAyB;AAC5C,SAAQC,IAAI,QAAO,+BAA+B;AAClD,SAAQC,EAAE,QAAO,0BAA0B;AAC3C,SAAQC,IAAI,QAAO,yBAAyB;AAE5C,SAGEC,uBAAuB,QAClB,oBAAoB;AAC3B,SAAQC,iBAAiB,QAAO,kDAAkD;AAClF,SAAQC,aAAa,EAAEC,kBAAkB,QAAO,wBAAwB;AAExE;;;;;;;CAOC,GACD,MAAMC,uBAAuB;IAC3B;IACA;CACD;AAUD,OAAO,SAASC,yBAAyB,EACvCC,OAAO,EACPC,aAAa,EACbC,WAAW,EACXC,aAAa,EACbC,SAAS,CAAC,CAAC,EACmB;IAC9B,4FAA4F;IAC5F,uBAAuB;IACvB,IAAI,CAACJ,WAAWA,QAAQK,KAAK,KAAK,GAAG,OAAO;IAE5C,MAAMC,oBAAoBR,qBAAqBS,MAAM,CAAC,CAACC,WAAaR,OAAO,CAACQ,SAAS,GAAG;IAExF,MAAMC,aAAaC,WAAWV,QAAQK,KAAK,EAAE,cAAcL,QAAQW,SAAS;IAE5E,qBACE,MAACC;QAAIC,WAAU;;YACZT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