@brickkit/cli 0.11.0 → 0.12.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/dashboard-dist/CollapsiblePanel-CbUysOp5.js +2 -0
- package/dashboard-dist/CompositeRoot-D4sRkYq3.js +1 -0
- package/dashboard-dist/Geist-Variable.woff2 +0 -0
- package/dashboard-dist/GeistMono-Variable.woff2 +0 -0
- package/dashboard-dist/PopoverPopup-CiI2avT_.js +1 -0
- package/dashboard-dist/api-reference-B-bZRtNV.js +265 -0
- package/dashboard-dist/app.css +2 -2
- package/dashboard-dist/app.js +11 -11
- package/dashboard-dist/ccount-CcG1m-Yh.js +1 -0
- package/dashboard-dist/client-BJJtVSVr.js +1 -0
- package/dashboard-dist/core-Z7NJFk0K.js +1 -0
- package/dashboard-dist/docs-Dpfc0wJb.js +4 -0
- package/dashboard-dist/docs.css +1 -1
- package/dashboard-dist/kit.js +1 -1
- package/dashboard-dist/popover-BzejBolB.js +1 -0
- package/dist/app-entry2.js +2 -3
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +173 -12
- package/dist/bin.js.map +1 -1
- package/dist/client-contract-file2.js +1 -2
- package/dist/client-contract2.js +6 -4
- package/dist/client-contract2.js.map +1 -1
- package/dist/compiler.d.ts +1 -2
- package/dist/compiler.js +1 -1
- package/dist/compiler2.js +3 -4
- package/dist/config.js +5 -7
- package/dist/config.js.map +1 -1
- package/dist/dashboard-extension.d.ts +0 -2
- package/dist/dashboard.d.ts +4 -134
- package/dist/dev-reporter.d.ts +0 -2
- package/dist/dev-reporter.js +1 -2
- package/dist/dev-telemetry-store.js +9 -19
- package/dist/dev-telemetry-store.js.map +1 -1
- package/dist/dev-telemetry.js +3 -4
- package/dist/dev-telemetry.js.map +1 -1
- package/dist/dev-worker.js +1 -2
- package/dist/emit.d.ts +0 -2
- package/dist/index.d.ts +7 -17
- package/dist/index.js +3 -4
- package/dist/lint/oxlint.d.ts +0 -2
- package/dist/lint/oxlint.js +1 -2
- package/dist/plugin.d.ts +0 -6
- package/dist/plugin.js +2 -4
- package/dist/plugin.js.map +1 -1
- package/dist/presets.js +3 -7
- package/dist/presets.js.map +1 -1
- package/dist/runner.js +5 -9
- package/dist/runner.js.map +1 -1
- package/dist/vite.d.ts +0 -2
- package/dist/vite.js +5 -7
- package/dist/vite.js.map +1 -1
- package/dist/workflows.d.ts +0 -2
- package/dist/workflows2.js +2 -3
- package/inspector-dist/client/assets/api.rpc-BvRk9kiK.js +0 -0
- package/inspector-dist/client/assets/api.stream._streamId-BvRk9kiK.js +0 -0
- package/inspector-dist/client/assets/app-CCzpuUz_.css +2 -0
- package/inspector-dist/client/assets/dist-BK8w6xOr.js +3930 -0
- package/inspector-dist/client/assets/dist-CG2aVufI.js +197 -0
- package/inspector-dist/client/assets/entry.client-D9jbgmTR.js +9391 -0
- package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-DYVdwGy2.js +34 -0
- package/inspector-dist/client/assets/home-CyjkvtII.js +2883 -0
- package/inspector-dist/client/assets/jsx-runtime-CPEah4WQ.js +7084 -0
- package/inspector-dist/client/assets/manifest-ba30b52d.js +1 -0
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-Dy6IVqPy.js +1 -0
- package/inspector-dist/client/assets/root-8BMab1lL.css +2 -0
- package/inspector-dist/client/assets/root-DX9wtogx.js +332 -0
- package/inspector-dist/client/assets/run-detail-C69EJGql.js +1549 -0
- package/inspector-dist/client/assets/tabs-B6B88IjT.js +75692 -0
- package/inspector-dist/client/assets/tabs-L5XKzOpP.css +1 -0
- package/inspector-dist/client/assets/world-config-context-C3BqXPIv.js +30 -0
- package/inspector-dist/client/assets/zstd-browser-decoder-ByUgcY9H.js +41 -0
- package/inspector-dist/server/assets/app-WoDoT62X.js +100155 -0
- package/inspector-dist/server/assets/chunk-RLXIAIE6-CbvDIAEa.js +42977 -0
- package/inspector-dist/server/assets/dist-BRxZSWUN.js +1140 -0
- package/inspector-dist/server/assets/dist-CQnQcIJg.js +199 -0
- package/inspector-dist/server/assets/dist-DqRd9pyS.js +1644 -0
- package/inspector-dist/server/assets/dist-qR-969AD.js +10327 -0
- package/inspector-dist/server/assets/encryption-_PuklZNX.js +888 -0
- package/inspector-dist/server/assets/event-metadata-BVakQJ_y.js +147 -0
- package/inspector-dist/server/assets/functions-CImcpqNl.js +1172 -0
- package/inspector-dist/server/assets/global-singleton-CPirHxFh.js +82 -0
- package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-fPMB_t7F.js +36 -0
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-bADXySE3.js +3 -0
- package/inspector-dist/server/assets/parse-D9Vvgzt9.js +471 -0
- package/inspector-dist/server/assets/rolldown-runtime-CLg409Sh.js +44 -0
- package/inspector-dist/server/assets/serialization-format-DDtsVTU1.js +478 -0
- package/inspector-dist/server/assets/token-BW4GdQZh.js +62 -0
- package/inspector-dist/server/assets/token-D6FXdkJT.js +57 -0
- package/inspector-dist/server/assets/token-util-BoNmi-wE.js +457 -0
- package/inspector-dist/server/assets/wrapper-wiqsGXcE.js +3626 -0
- package/inspector-dist/server/assets/ws-transport-DV7oG4mL.js +29478 -0
- package/inspector-dist/server/assets/zstd-browser-decoder-Cswf0KO6.js +40 -0
- package/inspector-dist/server/index.js +2 -57
- package/package.json +29 -28
- package/vite-client.d.ts +1 -1
- package/dashboard-dist/CollapsiblePanel-BX79_W-b.js +0 -2
- package/dashboard-dist/CompositeRoot-xzybXjnx.js +0 -1
- package/dashboard-dist/PopoverPopup-CvlmC7EL.js +0 -1
- package/dashboard-dist/api-reference-BcAYVYwJ.js +0 -260
- package/dashboard-dist/core-BGO9JZ1r.js +0 -1
- package/dashboard-dist/docs-DHikPD2v.js +0 -4
- package/dashboard-dist/popover-DG498XHH.js +0 -1
- package/dist/bin.d.ts.map +0 -1
- package/dist/dashboard-extension.d.ts.map +0 -1
- package/dist/dev-reporter.d.ts.map +0 -1
- package/dist/emit.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lint/oxlint.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/vite.d.ts.map +0 -1
- package/dist/workflows.d.ts.map +0 -1
- package/inspector-dist/client/assets/api.rpc-l0sNRNKZ.js +0 -1
- package/inspector-dist/client/assets/api.stream._streamId-l0sNRNKZ.js +0 -1
- package/inspector-dist/client/assets/app-CvoGgWcV.css +0 -1
- package/inspector-dist/client/assets/entry.client-BJ6G3n5t.js +0 -11697
- package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-C-3wZnxf.js +0 -19
- package/inspector-dist/client/assets/home-CSKAS4P2.js +0 -4979
- package/inspector-dist/client/assets/index-DECCyMR0.js +0 -4482
- package/inspector-dist/client/assets/index-Dot7CgrA.js +0 -9837
- package/inspector-dist/client/assets/index-HqNj_XIX.js +0 -200
- package/inspector-dist/client/assets/manifest-139c9319.js +0 -1
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-DC0K8uTy.js +0 -58626
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-F88p7PFX.css +0 -1
- package/inspector-dist/client/assets/root-BMHd_XHz.css +0 -1
- package/inspector-dist/client/assets/root-cbi6iYwg.js +0 -305
- package/inspector-dist/client/assets/run-detail-CWoGxu_0.css +0 -1
- package/inspector-dist/client/assets/run-detail-Cc7tSGNq.js +0 -6237
- package/inspector-dist/client/assets/world-config-context-BAD1QCrR.js +0 -26
- package/inspector-dist/client/assets/zstd-browser-decoder-BQoRpP7L.js +0 -28
- package/inspector-dist/server/assets/app-DUP5RybL.js +0 -174880
- package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-D2g4hL2-.js +0 -71
- package/inspector-dist/server/assets/index-BfLBLRRi.js +0 -204
- package/inspector-dist/server/assets/index-BzrGWk7J.js +0 -1164
- package/inspector-dist/server/assets/index-D71yP6AL.js +0 -191
- package/inspector-dist/server/assets/index-wGSWRns3.js +0 -1296
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-DsvuKoEV.js +0 -58
- package/inspector-dist/server/assets/token-ClUZZwXl.js +0 -95
- package/inspector-dist/server/assets/token-util-DSxMZ6nI.js +0 -33
- package/inspector-dist/server/assets/wrapper-B3vstpCO.js +0 -67
- package/inspector-dist/server/assets/zstd-browser-decoder-Dn82m2BU.js +0 -77
|
@@ -0,0 +1,2883 @@
|
|
|
1
|
+
import { D as useLocation, F as require_react, M as withComponentProps, O as useNavigate, P as require_react_dom, R as __toESM, j as useSearchParams, r as Link, t as require_jsx_runtime } from "./jsx-runtime-CPEah4WQ.js";
|
|
2
|
+
import { $ as useCallbackRef, $t as parseWorkflowName, B as Portal, Bt as ErrorBoundary, C as useLoadMoreOnScroll, Ct as useHookActions, Dt as TooltipTrigger, E as getErrorTitle, Et as TooltipContent, F as DropdownMenuItem, G as useSize, Gt as Copy, H as PopperAnchor, Ht as X, I as DropdownMenuTrigger, Jt as ChevronUp, K as useId, Kt as CircleX, L as ReactRemoveScroll, N as DropdownMenu, P as DropdownMenuContent, Qt as createLucideIcon, R as hideOthers, S as useWorkflowHooks, St as ResolveHookDropdownItem, T as getErrorMessage, Tt as Tooltip, U as PopperContent, V as Popper, Vt as Zap, W as createPopperScope, Wt as Ellipsis, X as useFocusGuards, Xt as ChevronDown, Yt as ChevronRight, Z as DismissableLayer, Zt as Check, at as useLayoutEffect2, c as Skeleton, ct as composeEventHandlers, d as bulkCancelRuns, dt as AlertTitle, et as useDirection, g as resumeHook, h as reenqueueRun, i as TabsTrigger, it as useControllableState, j as fetchRun, k as fetchEvents, kt as Button, l as RelativeTime, lt as Alert, n as TabsContent, nt as Primitive, o as RunActionsDropdownItems, ot as createContextScope, p as fetchHookToken, pt as cn, q as FocusScope, qt as CircleAlert, r as TabsList, rt as createSlot, s as StatusBadge, st as useComposedRefs, t as Tabs, tt as createCollection, u as CopyableText, ut as AlertDescription, w as useWorkflowRunsInfinite, xt as HookResolveModalWrapper, z as Presence } from "./tabs-B6B88IjT.js";
|
|
3
|
+
import { n as toast } from "./dist-BK8w6xOr.js";
|
|
4
|
+
import { n as useServerConfig } from "./world-config-context-C3BqXPIv.js";
|
|
5
|
+
/**
|
|
6
|
+
* @license lucide-react v0.575.0 - ISC
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the ISC license.
|
|
9
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/
|
|
11
|
+
var ArrowDownAZ = createLucideIcon("arrow-down-a-z", [
|
|
12
|
+
["path", {
|
|
13
|
+
d: "m3 16 4 4 4-4",
|
|
14
|
+
key: "1co6wj"
|
|
15
|
+
}],
|
|
16
|
+
["path", {
|
|
17
|
+
d: "M7 20V4",
|
|
18
|
+
key: "1yoxec"
|
|
19
|
+
}],
|
|
20
|
+
["path", {
|
|
21
|
+
d: "M20 8h-5",
|
|
22
|
+
key: "1vsyxs"
|
|
23
|
+
}],
|
|
24
|
+
["path", {
|
|
25
|
+
d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10",
|
|
26
|
+
key: "ag13bf"
|
|
27
|
+
}],
|
|
28
|
+
["path", {
|
|
29
|
+
d: "M15 14h5l-5 6h5",
|
|
30
|
+
key: "ur5jdg"
|
|
31
|
+
}]
|
|
32
|
+
]);
|
|
33
|
+
/**
|
|
34
|
+
* @license lucide-react v0.575.0 - ISC
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the ISC license.
|
|
37
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/
|
|
39
|
+
var ArrowUpAZ = createLucideIcon("arrow-up-a-z", [
|
|
40
|
+
["path", {
|
|
41
|
+
d: "m3 8 4-4 4 4",
|
|
42
|
+
key: "11wl7u"
|
|
43
|
+
}],
|
|
44
|
+
["path", {
|
|
45
|
+
d: "M7 4v16",
|
|
46
|
+
key: "1glfcx"
|
|
47
|
+
}],
|
|
48
|
+
["path", {
|
|
49
|
+
d: "M20 8h-5",
|
|
50
|
+
key: "1vsyxs"
|
|
51
|
+
}],
|
|
52
|
+
["path", {
|
|
53
|
+
d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10",
|
|
54
|
+
key: "ag13bf"
|
|
55
|
+
}],
|
|
56
|
+
["path", {
|
|
57
|
+
d: "M15 14h5l-5 6h5",
|
|
58
|
+
key: "ur5jdg"
|
|
59
|
+
}]
|
|
60
|
+
]);
|
|
61
|
+
/**
|
|
62
|
+
* @license lucide-react v0.575.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/
|
|
67
|
+
var ChevronLeft = createLucideIcon("chevron-left", [["path", {
|
|
68
|
+
d: "m15 18-6-6 6-6",
|
|
69
|
+
key: "1wnfg3"
|
|
70
|
+
}]]);
|
|
71
|
+
/**
|
|
72
|
+
* @license lucide-react v0.575.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/
|
|
77
|
+
var LoaderCircle = createLucideIcon("loader-circle", [["path", {
|
|
78
|
+
d: "M21 12a9 9 0 1 1-6.219-8.56",
|
|
79
|
+
key: "13zald"
|
|
80
|
+
}]]);
|
|
81
|
+
/**
|
|
82
|
+
* @license lucide-react v0.575.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/
|
|
87
|
+
var Minus = createLucideIcon("minus", [["path", {
|
|
88
|
+
d: "M5 12h14",
|
|
89
|
+
key: "1ays0h"
|
|
90
|
+
}]]);
|
|
91
|
+
/**
|
|
92
|
+
* @license lucide-react v0.575.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/
|
|
97
|
+
var RefreshCw = createLucideIcon("refresh-cw", [
|
|
98
|
+
["path", {
|
|
99
|
+
d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",
|
|
100
|
+
key: "v9h5vc"
|
|
101
|
+
}],
|
|
102
|
+
["path", {
|
|
103
|
+
d: "M21 3v5h-5",
|
|
104
|
+
key: "1q7to0"
|
|
105
|
+
}],
|
|
106
|
+
["path", {
|
|
107
|
+
d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",
|
|
108
|
+
key: "3uifl3"
|
|
109
|
+
}],
|
|
110
|
+
["path", {
|
|
111
|
+
d: "M8 16H3v5",
|
|
112
|
+
key: "1cv678"
|
|
113
|
+
}]
|
|
114
|
+
]);
|
|
115
|
+
// app/components/ui/card.tsx
|
|
116
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
117
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
118
|
+
var Card = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
119
|
+
ref,
|
|
120
|
+
className: cn("rounded-lg border bg-card text-card-foreground shadow-sm", className),
|
|
121
|
+
...props
|
|
122
|
+
}));
|
|
123
|
+
Card.displayName = "Card";
|
|
124
|
+
var CardHeader = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
125
|
+
ref,
|
|
126
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
127
|
+
...props
|
|
128
|
+
}));
|
|
129
|
+
CardHeader.displayName = "CardHeader";
|
|
130
|
+
var CardTitle = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
131
|
+
ref,
|
|
132
|
+
className: cn("text-2xl font-semibold leading-none tracking-tight", className),
|
|
133
|
+
...props
|
|
134
|
+
}));
|
|
135
|
+
CardTitle.displayName = "CardTitle";
|
|
136
|
+
var CardDescription = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
137
|
+
ref,
|
|
138
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
139
|
+
...props
|
|
140
|
+
}));
|
|
141
|
+
CardDescription.displayName = "CardDescription";
|
|
142
|
+
var CardContent = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
143
|
+
ref,
|
|
144
|
+
className: cn("p-6 pt-0", className),
|
|
145
|
+
...props
|
|
146
|
+
}));
|
|
147
|
+
CardContent.displayName = "CardContent";
|
|
148
|
+
var CardFooter = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
149
|
+
ref,
|
|
150
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
151
|
+
...props
|
|
152
|
+
}));
|
|
153
|
+
CardFooter.displayName = "CardFooter";
|
|
154
|
+
// app/components/ui/docs-link.tsx
|
|
155
|
+
/**
|
|
156
|
+
* A styled link component for documentation links.
|
|
157
|
+
* Automatically prepends the docs base URL if a relative path is provided.
|
|
158
|
+
*/
|
|
159
|
+
var DocsLink = import_react.forwardRef(({ className, href, children, ...props }, ref) => {
|
|
160
|
+
const fullHref = href.startsWith("http") ? href : `https://workflow-sdk.dev/docs/${href.replace(/^\//, "")}`;
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
162
|
+
to: fullHref,
|
|
163
|
+
className: cn("font-medium underline underline-offset-4 transition-colors", className),
|
|
164
|
+
style: { color: "var(--ds-blue-600)" },
|
|
165
|
+
target: "_blank",
|
|
166
|
+
rel: "noopener noreferrer",
|
|
167
|
+
ref,
|
|
168
|
+
...props,
|
|
169
|
+
children
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
DocsLink.displayName = "DocsLink";
|
|
173
|
+
// app/components/ui/table.tsx
|
|
174
|
+
var Table = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
175
|
+
className: "relative w-full overflow-auto",
|
|
176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", {
|
|
177
|
+
ref,
|
|
178
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
179
|
+
...props
|
|
180
|
+
})
|
|
181
|
+
}));
|
|
182
|
+
Table.displayName = "Table";
|
|
183
|
+
var TableHeader = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", {
|
|
184
|
+
ref,
|
|
185
|
+
className: cn("[&_tr]:border-b", className),
|
|
186
|
+
...props
|
|
187
|
+
}));
|
|
188
|
+
TableHeader.displayName = "TableHeader";
|
|
189
|
+
var TableBody = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", {
|
|
190
|
+
ref,
|
|
191
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
192
|
+
...props
|
|
193
|
+
}));
|
|
194
|
+
TableBody.displayName = "TableBody";
|
|
195
|
+
var TableFooter = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tfoot", {
|
|
196
|
+
ref,
|
|
197
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
198
|
+
...props
|
|
199
|
+
}));
|
|
200
|
+
TableFooter.displayName = "TableFooter";
|
|
201
|
+
var TableRow = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", {
|
|
202
|
+
ref,
|
|
203
|
+
className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
204
|
+
...props
|
|
205
|
+
}));
|
|
206
|
+
TableRow.displayName = "TableRow";
|
|
207
|
+
var TableHead = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
208
|
+
ref,
|
|
209
|
+
className: cn("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", className),
|
|
210
|
+
...props
|
|
211
|
+
}));
|
|
212
|
+
TableHead.displayName = "TableHead";
|
|
213
|
+
var TableCell = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
214
|
+
ref,
|
|
215
|
+
className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className),
|
|
216
|
+
...props
|
|
217
|
+
}));
|
|
218
|
+
TableCell.displayName = "TableCell";
|
|
219
|
+
var TableCaption = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", {
|
|
220
|
+
ref,
|
|
221
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
222
|
+
...props
|
|
223
|
+
}));
|
|
224
|
+
TableCaption.displayName = "TableCaption";
|
|
225
|
+
// app/components/display-utils/hook-token-cell.tsx
|
|
226
|
+
/**
|
|
227
|
+
* Renders a hook's secret token as a masked, copy-on-demand cell.
|
|
228
|
+
*
|
|
229
|
+
* The token is not present in hook list rows — it is fetched one hook at a
|
|
230
|
+
* time (via `fetchHookToken`) only when the user clicks to copy it. This keeps
|
|
231
|
+
* the secret out of bulk list responses while preserving the copy affordance.
|
|
232
|
+
*/
|
|
233
|
+
function HookTokenCell({ env, runId, hookId }) {
|
|
234
|
+
const [status, setStatus] = (0, import_react.useState)("idle");
|
|
235
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
236
|
+
const handleCopy = async (e) => {
|
|
237
|
+
e.stopPropagation();
|
|
238
|
+
if (status === "loading") return;
|
|
239
|
+
setStatus("loading");
|
|
240
|
+
setError(null);
|
|
241
|
+
try {
|
|
242
|
+
const token = await fetchHookToken(env, runId, hookId);
|
|
243
|
+
await navigator.clipboard.writeText(token);
|
|
244
|
+
setStatus("copied");
|
|
245
|
+
setTimeout(() => setStatus("idle"), 2e3);
|
|
246
|
+
} catch (err) {
|
|
247
|
+
console.error("Failed to copy hook token:", err);
|
|
248
|
+
setError("Failed to copy token");
|
|
249
|
+
setStatus("idle");
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
253
|
+
className: "relative group/copy inline-block",
|
|
254
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
255
|
+
className: "text-muted-foreground",
|
|
256
|
+
children: "••••••••••••"
|
|
257
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
258
|
+
asChild: true,
|
|
259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
260
|
+
type: "button",
|
|
261
|
+
onClick: handleCopy,
|
|
262
|
+
disabled: status === "loading",
|
|
263
|
+
className: "absolute right-0 top-1/2 -translate-y-1/2 opacity-0 group-hover/copy:opacity-100 transition-opacity bg-background/80 backdrop-blur-sm p-1 rounded",
|
|
264
|
+
"aria-label": "Copy token",
|
|
265
|
+
children: status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-3 w-3 text-muted-foreground animate-spin" }) : status === "copied" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "h-3 w-3 text-muted-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
266
|
+
})
|
|
267
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: error ? error : status === "copied" ? "Copied!" : status === "loading" ? "Fetching token…" : "Copy token" }) })] })]
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
// app/components/display-utils/table-skeleton.tsx
|
|
271
|
+
function TableSkeleton({ rows = 10, variant = "runs" }) {
|
|
272
|
+
const renderRow = (i) => {
|
|
273
|
+
switch (variant) {
|
|
274
|
+
case "runs": return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
275
|
+
className: "grid grid-cols-[1fr_1.5fr_0.8fr_1fr_1fr_40px] items-center gap-4 py-3 px-4",
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-3/4" }),
|
|
278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-4/5" }),
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
280
|
+
className: "flex flex-col gap-1",
|
|
281
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3 w-14" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-2 w-8" })]
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3 w-3/4" }),
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3 w-3/4" }),
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-6 w-6 rounded" })
|
|
286
|
+
]
|
|
287
|
+
}, `skeleton-row-${i}`);
|
|
288
|
+
case "hooks": return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
289
|
+
className: "grid grid-cols-[1.2fr_1.2fr_0.8fr_1fr_0.5fr_40px] items-center gap-4 py-3 px-4",
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-4/5" }),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-4/5" }),
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-3/4" }),
|
|
294
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3 w-3/4" }),
|
|
295
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-8" }),
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-6 w-6 rounded" })
|
|
297
|
+
]
|
|
298
|
+
}, `skeleton-row-${i}`);
|
|
299
|
+
case "workflows": return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
300
|
+
className: "grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4",
|
|
301
|
+
children: [
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-3/4" }),
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-4/5" }),
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-5 w-16 rounded-full mx-auto" })
|
|
305
|
+
]
|
|
306
|
+
}, `skeleton-row-${i}`);
|
|
307
|
+
default: return null;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
const renderHeader = () => {
|
|
311
|
+
switch (variant) {
|
|
312
|
+
case "runs": return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
313
|
+
className: "grid grid-cols-[1fr_1.5fr_0.8fr_1fr_1fr_40px] items-center gap-4 py-3 px-4 border-b",
|
|
314
|
+
children: [
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-20" }),
|
|
316
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-14" }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-12" }),
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-14" }),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-20" }),
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-6" })
|
|
321
|
+
]
|
|
322
|
+
});
|
|
323
|
+
case "hooks": return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
324
|
+
className: "grid grid-cols-[1.2fr_1.2fr_0.8fr_1fr_0.5fr_40px] items-center gap-4 py-3 px-4 border-b",
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-16" }),
|
|
327
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-14" }),
|
|
328
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-12" }),
|
|
329
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-14" }),
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-20" }),
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-6" })
|
|
332
|
+
]
|
|
333
|
+
});
|
|
334
|
+
case "workflows": return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
335
|
+
className: "grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4 border-b",
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-20" }),
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-10" }),
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-4 w-12 mx-auto" })
|
|
340
|
+
]
|
|
341
|
+
});
|
|
342
|
+
default: return null;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
346
|
+
className: "overflow-hidden mt-4 bg-background",
|
|
347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardContent, {
|
|
348
|
+
className: "p-0",
|
|
349
|
+
children: [renderHeader(), Array.from({ length: rows }, (_, i) => renderRow(i))]
|
|
350
|
+
})
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
// app/components/hooks-table.tsx
|
|
354
|
+
/**
|
|
355
|
+
* HooksTable - Displays hooks with server-side pagination.
|
|
356
|
+
* Uses the PaginatingTable pattern similar to RunsTable.
|
|
357
|
+
* Fetches invocation counts in the background for each hook.
|
|
358
|
+
*
|
|
359
|
+
* World configuration is read from server-side environment variables.
|
|
360
|
+
* The env object passed to server actions is empty - the server uses process.env.
|
|
361
|
+
*/
|
|
362
|
+
function HooksTable({ runId, onHookClick, selectedHookId }) {
|
|
363
|
+
const [lastRefreshTime, setLastRefreshTime] = (0, import_react.useState)(() => /* @__PURE__ */ new Date());
|
|
364
|
+
const env = (0, import_react.useMemo)(() => ({}), []);
|
|
365
|
+
const { data, error, nextPage, previousPage, hasNextPage, hasPreviousPage, refresh, pageInfo } = useWorkflowHooks(env, {
|
|
366
|
+
runId,
|
|
367
|
+
sortOrder: "desc"
|
|
368
|
+
});
|
|
369
|
+
const hookActions = useHookActions({
|
|
370
|
+
onResolve: async (hook, payload) => {
|
|
371
|
+
const token = await fetchHookToken(env, hook.runId, hook.hookId);
|
|
372
|
+
await resumeHook(env, token, payload);
|
|
373
|
+
},
|
|
374
|
+
callbacks: { onSuccess: refresh }
|
|
375
|
+
});
|
|
376
|
+
const loading = data.isLoading;
|
|
377
|
+
const hooks = data.data ?? [];
|
|
378
|
+
const onRefresh = () => {
|
|
379
|
+
setLastRefreshTime(() => /* @__PURE__ */ new Date());
|
|
380
|
+
refresh();
|
|
381
|
+
};
|
|
382
|
+
const [invocationData, setInvocationData] = (0, import_react.useState)(/* @__PURE__ */ new Map());
|
|
383
|
+
(0, import_react.useEffect)(() => {
|
|
384
|
+
if (!hooks.length || !runId) return;
|
|
385
|
+
const fetchInvocations = async () => {
|
|
386
|
+
const initialData = /* @__PURE__ */ new Map();
|
|
387
|
+
for (const hook of hooks) initialData.set(hook.hookId, {
|
|
388
|
+
count: 0,
|
|
389
|
+
hasMore: false,
|
|
390
|
+
loading: true
|
|
391
|
+
});
|
|
392
|
+
setInvocationData(initialData);
|
|
393
|
+
try {
|
|
394
|
+
const serverResult = await fetchEvents(env, runId, {
|
|
395
|
+
sortOrder: "asc",
|
|
396
|
+
limit: 1e3
|
|
397
|
+
});
|
|
398
|
+
if (!serverResult.success) {
|
|
399
|
+
setInvocationData((prev) => {
|
|
400
|
+
const updated = new Map(prev);
|
|
401
|
+
for (const hook of hooks) updated.set(hook.hookId, {
|
|
402
|
+
count: 0,
|
|
403
|
+
hasMore: false,
|
|
404
|
+
loading: false
|
|
405
|
+
});
|
|
406
|
+
return updated;
|
|
407
|
+
});
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const allEvents = serverResult.data.data;
|
|
411
|
+
const hookIds = new Set(hooks.map((h) => h.hookId));
|
|
412
|
+
const counts = /* @__PURE__ */ new Map();
|
|
413
|
+
for (const event of allEvents) if (event.eventType === "hook_received" && event.correlationId && hookIds.has(event.correlationId)) counts.set(event.correlationId, (counts.get(event.correlationId) ?? 0) + 1);
|
|
414
|
+
setInvocationData((prev) => {
|
|
415
|
+
const updated = new Map(prev);
|
|
416
|
+
for (const hook of hooks) updated.set(hook.hookId, {
|
|
417
|
+
count: counts.get(hook.hookId) ?? 0,
|
|
418
|
+
hasMore: serverResult.data.hasMore,
|
|
419
|
+
loading: false
|
|
420
|
+
});
|
|
421
|
+
return updated;
|
|
422
|
+
});
|
|
423
|
+
} catch {
|
|
424
|
+
setInvocationData((prev) => {
|
|
425
|
+
const updated = new Map(prev);
|
|
426
|
+
for (const hook of hooks) updated.set(hook.hookId, {
|
|
427
|
+
count: 0,
|
|
428
|
+
hasMore: false,
|
|
429
|
+
loading: false
|
|
430
|
+
});
|
|
431
|
+
return updated;
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
fetchInvocations();
|
|
436
|
+
}, [
|
|
437
|
+
hooks,
|
|
438
|
+
env,
|
|
439
|
+
runId
|
|
440
|
+
]);
|
|
441
|
+
const renderInvocationCount = (hook) => {
|
|
442
|
+
const data = invocationData.get(hook.hookId);
|
|
443
|
+
if (!data || data.loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
444
|
+
className: "text-muted-foreground text-xs",
|
|
445
|
+
children: "..."
|
|
446
|
+
});
|
|
447
|
+
if (data.count instanceof Error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
448
|
+
className: "text-muted-foreground",
|
|
449
|
+
children: "Error"
|
|
450
|
+
});
|
|
451
|
+
if (data.count === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
452
|
+
className: "text-muted-foreground",
|
|
453
|
+
children: "0"
|
|
454
|
+
});
|
|
455
|
+
const displayText = data.hasMore ? `${data.count}+` : `${data.count}`;
|
|
456
|
+
if (data.hasMore) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
457
|
+
asChild: true,
|
|
458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
459
|
+
className: "font-semibold cursor-help",
|
|
460
|
+
children: displayText
|
|
461
|
+
})
|
|
462
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, {
|
|
463
|
+
className: "max-w-xs",
|
|
464
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
465
|
+
className: "text-xs",
|
|
466
|
+
children: "Showing first 100 invocations. There may be more."
|
|
467
|
+
})
|
|
468
|
+
})] });
|
|
469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
470
|
+
className: "font-semibold",
|
|
471
|
+
children: displayText
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HookResolveModalWrapper, { hookActions }),
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
477
|
+
className: "flex items-center justify-between",
|
|
478
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
479
|
+
className: "flex items-end gap-2",
|
|
480
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
481
|
+
className: "text-sm text-muted-foreground",
|
|
482
|
+
children: "Last refreshed"
|
|
483
|
+
}), lastRefreshTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, {
|
|
484
|
+
date: lastRefreshTime,
|
|
485
|
+
className: "text-sm text-muted-foreground",
|
|
486
|
+
type: "distance"
|
|
487
|
+
})]
|
|
488
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
489
|
+
className: "flex items-center gap-4",
|
|
490
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
491
|
+
asChild: true,
|
|
492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
493
|
+
variant: "secondary",
|
|
494
|
+
size: "small",
|
|
495
|
+
onClick: onRefresh,
|
|
496
|
+
disabled: loading,
|
|
497
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshCw, { className: loading ? "animate-spin" : "" }), "Refresh"]
|
|
498
|
+
})
|
|
499
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Note that this resets pages" })] })
|
|
500
|
+
})]
|
|
501
|
+
}),
|
|
502
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
|
|
503
|
+
variant: "destructive",
|
|
504
|
+
children: [
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "h-4 w-4" }),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: getErrorTitle(error, "Error loading hooks") }),
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDescription, { children: getErrorMessage(error) })
|
|
508
|
+
]
|
|
509
|
+
}) : !loading && (!hooks || hooks.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
510
|
+
className: "text-center py-8 text-muted-foreground",
|
|
511
|
+
children: [
|
|
512
|
+
"No active hooks found. ",
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocsLink, {
|
|
515
|
+
href: "https://workflow-sdk.dev/docs/api-reference/workflow/create-hook",
|
|
516
|
+
children: "Learn how to create a hook"
|
|
517
|
+
})
|
|
518
|
+
]
|
|
519
|
+
}) : loading && !data?.data ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableSkeleton, { variant: "hooks" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
520
|
+
className: "overflow-hidden mt-4 bg-background",
|
|
521
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardContent, {
|
|
522
|
+
className: "p-0 max-h-[calc(100vh-280px)] overflow-auto",
|
|
523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, { children: [
|
|
524
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
525
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
526
|
+
children: "Hook ID"
|
|
527
|
+
}),
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
529
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
530
|
+
children: "Run ID"
|
|
531
|
+
}),
|
|
532
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
533
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
534
|
+
children: "Token"
|
|
535
|
+
}),
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
537
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
538
|
+
children: "Created"
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
541
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
542
|
+
children: "Invocations"
|
|
543
|
+
}),
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, { className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10" })
|
|
545
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, { children: hooks.map((hook) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, {
|
|
546
|
+
className: "cursor-pointer group relative",
|
|
547
|
+
onClick: () => onHookClick(hook.hookId, hook.runId),
|
|
548
|
+
"data-selected": hook.hookId === selectedHookId,
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
551
|
+
className: "font-mono text-xs py-2",
|
|
552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyableText, {
|
|
553
|
+
text: hook.hookId,
|
|
554
|
+
overlay: true,
|
|
555
|
+
children: hook.hookId
|
|
556
|
+
})
|
|
557
|
+
}),
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
559
|
+
className: "font-mono text-xs py-2",
|
|
560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyableText, {
|
|
561
|
+
text: hook.runId,
|
|
562
|
+
overlay: true,
|
|
563
|
+
children: hook.runId
|
|
564
|
+
})
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
567
|
+
className: "font-mono text-xs py-2",
|
|
568
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HookTokenCell, {
|
|
569
|
+
env,
|
|
570
|
+
runId: hook.runId,
|
|
571
|
+
hookId: hook.hookId
|
|
572
|
+
})
|
|
573
|
+
}),
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
575
|
+
className: "py-2 text-muted-foreground text-xs",
|
|
576
|
+
children: hook.createdAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: hook.createdAt }) : "-"
|
|
577
|
+
}),
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
579
|
+
className: "py-2",
|
|
580
|
+
children: renderInvocationCount(hook)
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
583
|
+
className: "py-2",
|
|
584
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, {
|
|
585
|
+
asChild: true,
|
|
586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
587
|
+
variant: "tertiary",
|
|
588
|
+
size: "small",
|
|
589
|
+
shape: "square",
|
|
590
|
+
"aria-label": "Hook actions",
|
|
591
|
+
onClick: (e) => e.stopPropagation(),
|
|
592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ellipsis, { className: "h-4 w-4" })
|
|
593
|
+
})
|
|
594
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuContent, {
|
|
595
|
+
align: "end",
|
|
596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolveHookDropdownItem, {
|
|
597
|
+
hook,
|
|
598
|
+
stopPropagation: true,
|
|
599
|
+
onResolveClick: hookActions.openResolveModal,
|
|
600
|
+
DropdownMenuItem
|
|
601
|
+
})
|
|
602
|
+
})] })
|
|
603
|
+
})
|
|
604
|
+
]
|
|
605
|
+
}, hook.hookId)) })] })
|
|
606
|
+
})
|
|
607
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
608
|
+
className: "flex items-center justify-between mt-4",
|
|
609
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
610
|
+
className: "text-sm text-muted-foreground",
|
|
611
|
+
children: pageInfo
|
|
612
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
613
|
+
className: "flex gap-2 items-center",
|
|
614
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
615
|
+
variant: "secondary",
|
|
616
|
+
size: "small",
|
|
617
|
+
onClick: previousPage,
|
|
618
|
+
disabled: !hasPreviousPage,
|
|
619
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronLeft, {}), "Previous"]
|
|
620
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
621
|
+
variant: "secondary",
|
|
622
|
+
size: "small",
|
|
623
|
+
onClick: nextPage,
|
|
624
|
+
disabled: !hasNextPage,
|
|
625
|
+
children: ["Next", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, {})]
|
|
626
|
+
})]
|
|
627
|
+
})]
|
|
628
|
+
})] })
|
|
629
|
+
] });
|
|
630
|
+
}
|
|
631
|
+
// ../../node_modules/.bun/@radix-ui+number@1.1.3/node_modules/@radix-ui/number/dist/index.mjs
|
|
632
|
+
var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1);
|
|
633
|
+
var __defProp$2 = Object.defineProperty;
|
|
634
|
+
var __name$2 = (target, value) => __defProp$2(target, "name", {
|
|
635
|
+
value,
|
|
636
|
+
configurable: true
|
|
637
|
+
});
|
|
638
|
+
function clamp(value, [min, max]) {
|
|
639
|
+
return Math.min(max, Math.max(min, value));
|
|
640
|
+
}
|
|
641
|
+
__name$2(clamp, "clamp");
|
|
642
|
+
// ../../node_modules/.bun/@radix-ui+react-visually-hidden@1.2.13+a68cb332b68cb125/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
|
|
643
|
+
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
644
|
+
position: "absolute",
|
|
645
|
+
border: 0,
|
|
646
|
+
width: 1,
|
|
647
|
+
height: 1,
|
|
648
|
+
padding: 0,
|
|
649
|
+
margin: -1,
|
|
650
|
+
overflow: "hidden",
|
|
651
|
+
clip: "rect(0, 0, 0, 0)",
|
|
652
|
+
whiteSpace: "nowrap",
|
|
653
|
+
wordWrap: "normal"
|
|
654
|
+
});
|
|
655
|
+
// ../../node_modules/.bun/@radix-ui+react-select@2.4.1+a68cb332b68cb125/node_modules/@radix-ui/react-select/dist/index.mjs
|
|
656
|
+
var __defProp$1 = Object.defineProperty;
|
|
657
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", {
|
|
658
|
+
value,
|
|
659
|
+
configurable: true
|
|
660
|
+
});
|
|
661
|
+
var Position = {
|
|
662
|
+
ItemAligned: "item-aligned",
|
|
663
|
+
Popper: "popper"
|
|
664
|
+
};
|
|
665
|
+
var Direction = {
|
|
666
|
+
LTR: "ltr",
|
|
667
|
+
RTL: "rtl"
|
|
668
|
+
};
|
|
669
|
+
var OPEN_KEYS = [
|
|
670
|
+
" ",
|
|
671
|
+
"Enter",
|
|
672
|
+
"ArrowUp",
|
|
673
|
+
"ArrowDown"
|
|
674
|
+
];
|
|
675
|
+
var SELECTION_KEYS = [" ", "Enter"];
|
|
676
|
+
var SELECT_NAME = "Select";
|
|
677
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);
|
|
678
|
+
var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [createCollectionScope, createPopperScope]);
|
|
679
|
+
var usePopperScope = createPopperScope();
|
|
680
|
+
var [SelectProviderImpl, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
681
|
+
var [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME);
|
|
682
|
+
function SelectProvider(props) {
|
|
683
|
+
const { __scopeSelect, children, open: openProp, defaultOpen, onOpenChange, value: valueProp, defaultValue, onValueChange, dir, name, autoComplete, disabled, required, form, internal_do_not_use_render } = props;
|
|
684
|
+
const popperScope = usePopperScope(__scopeSelect);
|
|
685
|
+
const [trigger, setTrigger] = import_react.useState(null);
|
|
686
|
+
const [valueNode, setValueNode] = import_react.useState(null);
|
|
687
|
+
const [valueNodeHasChildren, setValueNodeHasChildren] = import_react.useState(false);
|
|
688
|
+
const direction = useDirection(dir);
|
|
689
|
+
const [open, setOpen] = useControllableState({
|
|
690
|
+
prop: openProp,
|
|
691
|
+
defaultProp: defaultOpen ?? false,
|
|
692
|
+
onChange: onOpenChange,
|
|
693
|
+
caller: SELECT_NAME
|
|
694
|
+
});
|
|
695
|
+
const [value, setValue] = useControllableState({
|
|
696
|
+
prop: valueProp,
|
|
697
|
+
defaultProp: defaultValue,
|
|
698
|
+
onChange: onValueChange,
|
|
699
|
+
caller: SELECT_NAME
|
|
700
|
+
});
|
|
701
|
+
const triggerPointerDownPosRef = import_react.useRef(null);
|
|
702
|
+
const hasConsumerStoppedPropagationRef = import_react.useRef(false);
|
|
703
|
+
const [userSelection, setUserSelection] = import_react.useState(null);
|
|
704
|
+
const handleUserSelect = /* @__PURE__ */ __name$1((nextValue) => {
|
|
705
|
+
setUserSelection({
|
|
706
|
+
value: nextValue,
|
|
707
|
+
hasConsumerStoppedPropagation: hasConsumerStoppedPropagationRef.current
|
|
708
|
+
});
|
|
709
|
+
setValue(nextValue);
|
|
710
|
+
}, "handleUserSelect");
|
|
711
|
+
const initialValueRef = import_react.useRef(value);
|
|
712
|
+
import_react.useEffect(() => {
|
|
713
|
+
const associatedForm = form ? trigger?.ownerDocument.getElementById(form) : trigger?.form;
|
|
714
|
+
if (associatedForm instanceof HTMLFormElement) {
|
|
715
|
+
const reset = /* @__PURE__ */ __name$1(() => setValue(initialValueRef.current), "reset");
|
|
716
|
+
associatedForm.addEventListener("reset", reset);
|
|
717
|
+
return () => associatedForm.removeEventListener("reset", reset);
|
|
718
|
+
}
|
|
719
|
+
}, [
|
|
720
|
+
form,
|
|
721
|
+
trigger,
|
|
722
|
+
setValue
|
|
723
|
+
]);
|
|
724
|
+
const isFormControl = trigger ? !!form || !!trigger.closest("form") : true;
|
|
725
|
+
const [nativeOptionsSet, setNativeOptionsSet] = import_react.useState(/* @__PURE__ */ new Set());
|
|
726
|
+
const contentId = useId();
|
|
727
|
+
const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";");
|
|
728
|
+
const handleNativeOptionAdd = import_react.useCallback((option) => {
|
|
729
|
+
setNativeOptionsSet((prev) => new Set(prev).add(option));
|
|
730
|
+
}, []);
|
|
731
|
+
const handleNativeOptionRemove = import_react.useCallback((option) => {
|
|
732
|
+
setNativeOptionsSet((prev) => {
|
|
733
|
+
const optionsSet = new Set(prev);
|
|
734
|
+
optionsSet.delete(option);
|
|
735
|
+
return optionsSet;
|
|
736
|
+
});
|
|
737
|
+
}, []);
|
|
738
|
+
const context = {
|
|
739
|
+
required,
|
|
740
|
+
trigger,
|
|
741
|
+
onTriggerChange: setTrigger,
|
|
742
|
+
valueNode,
|
|
743
|
+
onValueNodeChange: setValueNode,
|
|
744
|
+
valueNodeHasChildren,
|
|
745
|
+
onValueNodeHasChildrenChange: setValueNodeHasChildren,
|
|
746
|
+
contentId,
|
|
747
|
+
value,
|
|
748
|
+
onValueChange: setValue,
|
|
749
|
+
hasConsumerStoppedPropagationRef,
|
|
750
|
+
userSelection,
|
|
751
|
+
onUserSelect: handleUserSelect,
|
|
752
|
+
open,
|
|
753
|
+
onOpenChange: setOpen,
|
|
754
|
+
dir: direction,
|
|
755
|
+
triggerPointerDownPosRef,
|
|
756
|
+
disabled,
|
|
757
|
+
name,
|
|
758
|
+
autoComplete,
|
|
759
|
+
form,
|
|
760
|
+
nativeOptions: nativeOptionsSet,
|
|
761
|
+
nativeSelectKey,
|
|
762
|
+
isFormControl
|
|
763
|
+
};
|
|
764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Popper, {
|
|
765
|
+
...popperScope,
|
|
766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectProviderImpl, {
|
|
767
|
+
scope: __scopeSelect,
|
|
768
|
+
...context,
|
|
769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, {
|
|
770
|
+
scope: __scopeSelect,
|
|
771
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectNativeOptionsProvider, {
|
|
772
|
+
scope: __scopeSelect,
|
|
773
|
+
onNativeOptionAdd: handleNativeOptionAdd,
|
|
774
|
+
onNativeOptionRemove: handleNativeOptionRemove,
|
|
775
|
+
children: isFunction$1(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
|
776
|
+
})
|
|
777
|
+
})
|
|
778
|
+
})
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
__name$1(SelectProvider, "SelectProvider");
|
|
782
|
+
var Select$1 = /* @__PURE__ */ __name$1((props) => {
|
|
783
|
+
const { __scopeSelect, children, ...providerProps } = props;
|
|
784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectProvider, {
|
|
785
|
+
__scopeSelect,
|
|
786
|
+
...providerProps,
|
|
787
|
+
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [children, isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectBubbleInput, { __scopeSelect }) : null] })
|
|
788
|
+
});
|
|
789
|
+
}, "Select");
|
|
790
|
+
var TRIGGER_NAME$1 = "SelectTrigger";
|
|
791
|
+
var SelectTrigger$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectTrigger2(props, forwardedRef) {
|
|
792
|
+
const { __scopeSelect, disabled = false, ...triggerProps } = props;
|
|
793
|
+
const popperScope = usePopperScope(__scopeSelect);
|
|
794
|
+
const context = useSelectContext(TRIGGER_NAME$1, __scopeSelect);
|
|
795
|
+
const isDisabled = context.disabled || disabled;
|
|
796
|
+
const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
797
|
+
const getItems = useCollection(__scopeSelect);
|
|
798
|
+
const pointerTypeRef = import_react.useRef("touch");
|
|
799
|
+
const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {
|
|
800
|
+
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
801
|
+
const nextItem = findNextItem(enabledItems, search, enabledItems.find((item) => item.value === context.value));
|
|
802
|
+
if (nextItem !== void 0) context.onUserSelect(nextItem.value);
|
|
803
|
+
});
|
|
804
|
+
const handleOpen = /* @__PURE__ */ __name$1((pointerEvent) => {
|
|
805
|
+
if (!isDisabled) {
|
|
806
|
+
context.onOpenChange(true);
|
|
807
|
+
resetTypeahead();
|
|
808
|
+
}
|
|
809
|
+
if (pointerEvent) context.triggerPointerDownPosRef.current = {
|
|
810
|
+
x: Math.round(pointerEvent.pageX),
|
|
811
|
+
y: Math.round(pointerEvent.pageY)
|
|
812
|
+
};
|
|
813
|
+
}, "handleOpen");
|
|
814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperAnchor, {
|
|
815
|
+
asChild: true,
|
|
816
|
+
...popperScope,
|
|
817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.button, {
|
|
818
|
+
type: "button",
|
|
819
|
+
role: "combobox",
|
|
820
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
821
|
+
"aria-expanded": context.open,
|
|
822
|
+
"aria-required": context.required,
|
|
823
|
+
"aria-autocomplete": "none",
|
|
824
|
+
dir: context.dir,
|
|
825
|
+
"data-state": context.open ? "open" : "closed",
|
|
826
|
+
disabled: isDisabled,
|
|
827
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
828
|
+
"data-placeholder": shouldShowPlaceholder(context.value) ? "" : void 0,
|
|
829
|
+
...triggerProps,
|
|
830
|
+
ref: composedRefs,
|
|
831
|
+
onClick: composeEventHandlers(triggerProps.onClick, (event) => {
|
|
832
|
+
event.currentTarget.focus();
|
|
833
|
+
if (pointerTypeRef.current !== "mouse") handleOpen(event);
|
|
834
|
+
}),
|
|
835
|
+
onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
836
|
+
pointerTypeRef.current = event.pointerType;
|
|
837
|
+
const target = event.target;
|
|
838
|
+
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
839
|
+
if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse") {
|
|
840
|
+
handleOpen(event);
|
|
841
|
+
event.preventDefault();
|
|
842
|
+
}
|
|
843
|
+
}),
|
|
844
|
+
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
845
|
+
const isTypingAhead = searchRef.current !== "";
|
|
846
|
+
if (!(event.ctrlKey || event.altKey || event.metaKey) && event.key.length === 1) {
|
|
847
|
+
context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
848
|
+
handleTypeaheadSearch(event.key);
|
|
849
|
+
}
|
|
850
|
+
if (isTypingAhead && event.key === " ") return;
|
|
851
|
+
if (OPEN_KEYS.includes(event.key)) {
|
|
852
|
+
handleOpen();
|
|
853
|
+
event.preventDefault();
|
|
854
|
+
}
|
|
855
|
+
})
|
|
856
|
+
})
|
|
857
|
+
});
|
|
858
|
+
}, "SelectTrigger"));
|
|
859
|
+
var VALUE_NAME = "SelectValue";
|
|
860
|
+
var SelectValue$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectValue2(props, forwardedRef) {
|
|
861
|
+
const { __scopeSelect, className, style, children, placeholder = "", ...valueProps } = props;
|
|
862
|
+
const context = useSelectContext(VALUE_NAME, __scopeSelect);
|
|
863
|
+
const { onValueNodeHasChildrenChange } = context;
|
|
864
|
+
const hasChildren = children !== void 0;
|
|
865
|
+
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
866
|
+
useLayoutEffect2(() => {
|
|
867
|
+
onValueNodeHasChildrenChange(hasChildren);
|
|
868
|
+
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
869
|
+
const showPlaceholder = shouldShowPlaceholder(context.value);
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
871
|
+
...valueProps,
|
|
872
|
+
asChild: showPlaceholder ? false : valueProps.asChild,
|
|
873
|
+
ref: composedRefs,
|
|
874
|
+
style: { pointerEvents: "none" },
|
|
875
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: showPlaceholder ? placeholder : children }, showPlaceholder ? "placeholder" : "value")
|
|
876
|
+
});
|
|
877
|
+
}, "SelectValue"));
|
|
878
|
+
var SelectIcon = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectIcon2(props, forwardedRef) {
|
|
879
|
+
const { __scopeSelect, children, ...iconProps } = props;
|
|
880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
881
|
+
"aria-hidden": true,
|
|
882
|
+
...iconProps,
|
|
883
|
+
ref: forwardedRef,
|
|
884
|
+
children: children || "▼"
|
|
885
|
+
});
|
|
886
|
+
}, "SelectIcon"));
|
|
887
|
+
var [PortalProvider, usePortalContext] = createSelectContext("SelectPortal", { forceMount: void 0 });
|
|
888
|
+
var SelectPortal = /* @__PURE__ */ __name$1((props) => {
|
|
889
|
+
const { __scopeSelect, forceMount, ...portalProps } = props;
|
|
890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, {
|
|
891
|
+
scope: props.__scopeSelect,
|
|
892
|
+
forceMount,
|
|
893
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal, {
|
|
894
|
+
asChild: true,
|
|
895
|
+
...portalProps
|
|
896
|
+
})
|
|
897
|
+
});
|
|
898
|
+
}, "SelectPortal");
|
|
899
|
+
var CONTENT_NAME = "SelectContent";
|
|
900
|
+
var SelectContent$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectContent2(props, forwardedRef) {
|
|
901
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeSelect);
|
|
902
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
903
|
+
const context = useSelectContext(CONTENT_NAME, props.__scopeSelect);
|
|
904
|
+
const [fragment, setFragment] = import_react.useState();
|
|
905
|
+
useLayoutEffect2(() => {
|
|
906
|
+
setFragment(new DocumentFragment());
|
|
907
|
+
}, []);
|
|
908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Presence, {
|
|
909
|
+
present: forceMount || context.open,
|
|
910
|
+
children: ({ present }) => present ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentImpl, {
|
|
911
|
+
...contentProps,
|
|
912
|
+
ref: forwardedRef
|
|
913
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentFragment, {
|
|
914
|
+
...contentProps,
|
|
915
|
+
fragment
|
|
916
|
+
})
|
|
917
|
+
});
|
|
918
|
+
}, "SelectContent"));
|
|
919
|
+
var SelectContentFragment = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectContentFragment2(props, forwardedRef) {
|
|
920
|
+
const { __scopeSelect, children, fragment } = props;
|
|
921
|
+
if (!fragment) return null;
|
|
922
|
+
return import_react_dom.createPortal(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentProvider, {
|
|
923
|
+
scope: __scopeSelect,
|
|
924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, {
|
|
925
|
+
scope: __scopeSelect,
|
|
926
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
927
|
+
ref: forwardedRef,
|
|
928
|
+
children
|
|
929
|
+
})
|
|
930
|
+
})
|
|
931
|
+
}), fragment);
|
|
932
|
+
}, "SelectContentFragment"));
|
|
933
|
+
var CONTENT_MARGIN = 10;
|
|
934
|
+
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME);
|
|
935
|
+
var Slot = createSlot("SelectContent.RemoveScroll");
|
|
936
|
+
var SelectContentImpl = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectContentImpl2(props, forwardedRef) {
|
|
937
|
+
const { __scopeSelect } = props;
|
|
938
|
+
const { position = Position.ItemAligned, onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, side, sideOffset, align, alignOffset, arrowPadding, collisionBoundary, collisionPadding, sticky, hideWhenDetached, avoidCollisions, ...contentProps } = props;
|
|
939
|
+
const context = useSelectContext(CONTENT_NAME, __scopeSelect);
|
|
940
|
+
const [content, setContent] = import_react.useState(null);
|
|
941
|
+
const [viewport, setViewport] = import_react.useState(null);
|
|
942
|
+
const composedRefs = useComposedRefs(forwardedRef, setContent);
|
|
943
|
+
const [selectedItem, setSelectedItem] = import_react.useState(null);
|
|
944
|
+
const [selectedItemText, setSelectedItemText] = import_react.useState(null);
|
|
945
|
+
const getItems = useCollection(__scopeSelect);
|
|
946
|
+
const [isPositioned, setIsPositioned] = import_react.useState(false);
|
|
947
|
+
const firstValidItemFoundRef = import_react.useRef(false);
|
|
948
|
+
const firstItemFoundRef = import_react.useRef(false);
|
|
949
|
+
const firstItemTextFoundRef = import_react.useRef(false);
|
|
950
|
+
import_react.useEffect(() => {
|
|
951
|
+
if (content) return hideOthers(content);
|
|
952
|
+
}, [content]);
|
|
953
|
+
useFocusGuards();
|
|
954
|
+
const focusFirst = import_react.useCallback((candidates) => {
|
|
955
|
+
const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);
|
|
956
|
+
const [lastItem] = restItems.slice(-1);
|
|
957
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
958
|
+
for (const candidate of candidates) {
|
|
959
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
960
|
+
candidate?.scrollIntoView({ block: "nearest" });
|
|
961
|
+
if (candidate === firstItem && viewport) viewport.scrollTop = 0;
|
|
962
|
+
if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;
|
|
963
|
+
candidate?.focus();
|
|
964
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
965
|
+
}
|
|
966
|
+
}, [getItems, viewport]);
|
|
967
|
+
const focusSelectedItem = import_react.useCallback(() => focusFirst([selectedItem, content]), [
|
|
968
|
+
focusFirst,
|
|
969
|
+
selectedItem,
|
|
970
|
+
content
|
|
971
|
+
]);
|
|
972
|
+
import_react.useEffect(() => {
|
|
973
|
+
if (isPositioned) focusSelectedItem();
|
|
974
|
+
}, [isPositioned, focusSelectedItem]);
|
|
975
|
+
const { onOpenChange, triggerPointerDownPosRef } = context;
|
|
976
|
+
import_react.useEffect(() => {
|
|
977
|
+
if (content) {
|
|
978
|
+
let pointerMoveDelta = {
|
|
979
|
+
x: 0,
|
|
980
|
+
y: 0
|
|
981
|
+
};
|
|
982
|
+
const handlePointerMove = /* @__PURE__ */ __name$1((event) => {
|
|
983
|
+
pointerMoveDelta = {
|
|
984
|
+
x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)),
|
|
985
|
+
y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0))
|
|
986
|
+
};
|
|
987
|
+
}, "handlePointerMove");
|
|
988
|
+
const handlePointerUp = /* @__PURE__ */ __name$1((event) => {
|
|
989
|
+
if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) event.preventDefault();
|
|
990
|
+
else if (!event.composedPath().includes(content)) onOpenChange(false);
|
|
991
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
992
|
+
triggerPointerDownPosRef.current = null;
|
|
993
|
+
}, "handlePointerUp");
|
|
994
|
+
if (triggerPointerDownPosRef.current !== null) {
|
|
995
|
+
document.addEventListener("pointermove", handlePointerMove);
|
|
996
|
+
document.addEventListener("pointerup", handlePointerUp, {
|
|
997
|
+
capture: true,
|
|
998
|
+
once: true
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
return () => {
|
|
1002
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
1003
|
+
document.removeEventListener("pointerup", handlePointerUp, { capture: true });
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
}, [
|
|
1007
|
+
content,
|
|
1008
|
+
onOpenChange,
|
|
1009
|
+
triggerPointerDownPosRef
|
|
1010
|
+
]);
|
|
1011
|
+
import_react.useEffect(() => {
|
|
1012
|
+
const close = /* @__PURE__ */ __name$1(() => onOpenChange(false), "close");
|
|
1013
|
+
window.addEventListener("blur", close);
|
|
1014
|
+
window.addEventListener("resize", close);
|
|
1015
|
+
return () => {
|
|
1016
|
+
window.removeEventListener("blur", close);
|
|
1017
|
+
window.removeEventListener("resize", close);
|
|
1018
|
+
};
|
|
1019
|
+
}, [onOpenChange]);
|
|
1020
|
+
const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {
|
|
1021
|
+
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
1022
|
+
const nextItem = findNextItem(enabledItems, search, enabledItems.find((item) => item.ref.current === document.activeElement));
|
|
1023
|
+
if (nextItem) setTimeout(() => nextItem.ref.current?.focus());
|
|
1024
|
+
});
|
|
1025
|
+
const itemRefCallback = import_react.useCallback((node, value, disabled) => {
|
|
1026
|
+
const isFirstItem = !firstItemFoundRef.current;
|
|
1027
|
+
if (isFirstItem) firstItemFoundRef.current = true;
|
|
1028
|
+
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
1029
|
+
if (context.value !== void 0 && context.value === value || isFirstValidItem) {
|
|
1030
|
+
setSelectedItem(node);
|
|
1031
|
+
if (isFirstValidItem) firstValidItemFoundRef.current = true;
|
|
1032
|
+
} else if (isFirstItem) setSelectedItem(node);
|
|
1033
|
+
}, [context.value]);
|
|
1034
|
+
const handleItemLeave = import_react.useCallback(() => content?.focus(), [content]);
|
|
1035
|
+
const itemTextRefCallback = import_react.useCallback((node, value, disabled) => {
|
|
1036
|
+
if (!node) return;
|
|
1037
|
+
const isFirstItem = !firstItemTextFoundRef.current;
|
|
1038
|
+
if (isFirstItem) firstItemTextFoundRef.current = true;
|
|
1039
|
+
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
1040
|
+
if (context.value !== void 0 && context.value === value || isFirstValidItem) setSelectedItemText(node);
|
|
1041
|
+
else if (isFirstItem) setSelectedItemText(node);
|
|
1042
|
+
}, [context.value]);
|
|
1043
|
+
const SelectPosition = position === Position.Popper ? SelectPopperPosition : SelectItemAlignedPosition;
|
|
1044
|
+
const popperContentProps = SelectPosition === SelectPopperPosition ? {
|
|
1045
|
+
side,
|
|
1046
|
+
sideOffset,
|
|
1047
|
+
align,
|
|
1048
|
+
alignOffset,
|
|
1049
|
+
arrowPadding,
|
|
1050
|
+
collisionBoundary,
|
|
1051
|
+
collisionPadding,
|
|
1052
|
+
sticky,
|
|
1053
|
+
hideWhenDetached,
|
|
1054
|
+
avoidCollisions
|
|
1055
|
+
} : {};
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentProvider, {
|
|
1057
|
+
scope: __scopeSelect,
|
|
1058
|
+
content,
|
|
1059
|
+
viewport,
|
|
1060
|
+
onViewportChange: setViewport,
|
|
1061
|
+
itemRefCallback,
|
|
1062
|
+
selectedItem,
|
|
1063
|
+
onItemLeave: handleItemLeave,
|
|
1064
|
+
itemTextRefCallback,
|
|
1065
|
+
focusSelectedItem,
|
|
1066
|
+
selectedItemText,
|
|
1067
|
+
position,
|
|
1068
|
+
isPositioned,
|
|
1069
|
+
searchRef,
|
|
1070
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReactRemoveScroll, {
|
|
1071
|
+
as: Slot,
|
|
1072
|
+
allowPinchZoom: true,
|
|
1073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FocusScope, {
|
|
1074
|
+
asChild: true,
|
|
1075
|
+
trapped: context.open,
|
|
1076
|
+
onMountAutoFocus: (event) => {
|
|
1077
|
+
event.preventDefault();
|
|
1078
|
+
},
|
|
1079
|
+
onUnmountAutoFocus: composeEventHandlers(onCloseAutoFocus, (event) => {
|
|
1080
|
+
context.trigger?.focus({ preventScroll: true });
|
|
1081
|
+
event.preventDefault();
|
|
1082
|
+
}),
|
|
1083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DismissableLayer, {
|
|
1084
|
+
asChild: true,
|
|
1085
|
+
disableOutsidePointerEvents: true,
|
|
1086
|
+
onEscapeKeyDown,
|
|
1087
|
+
onPointerDownOutside,
|
|
1088
|
+
onFocusOutside: (event) => event.preventDefault(),
|
|
1089
|
+
onDismiss: () => context.onOpenChange(false),
|
|
1090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPosition, {
|
|
1091
|
+
role: "listbox",
|
|
1092
|
+
id: context.contentId,
|
|
1093
|
+
"data-state": context.open ? "open" : "closed",
|
|
1094
|
+
dir: context.dir,
|
|
1095
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
1096
|
+
...contentProps,
|
|
1097
|
+
...popperContentProps,
|
|
1098
|
+
onPlaced: () => setIsPositioned(true),
|
|
1099
|
+
ref: composedRefs,
|
|
1100
|
+
style: {
|
|
1101
|
+
display: "flex",
|
|
1102
|
+
flexDirection: "column",
|
|
1103
|
+
outline: "none",
|
|
1104
|
+
...contentProps.style
|
|
1105
|
+
},
|
|
1106
|
+
onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {
|
|
1107
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
1108
|
+
if (event.key === "Tab") event.preventDefault();
|
|
1109
|
+
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
1110
|
+
if ([
|
|
1111
|
+
"ArrowUp",
|
|
1112
|
+
"ArrowDown",
|
|
1113
|
+
"Home",
|
|
1114
|
+
"End"
|
|
1115
|
+
].includes(event.key)) {
|
|
1116
|
+
let candidateNodes = getItems().filter((item) => !item.disabled).map((item) => item.ref.current);
|
|
1117
|
+
if (["ArrowUp", "End"].includes(event.key)) candidateNodes = candidateNodes.slice().reverse();
|
|
1118
|
+
if (["ArrowUp", "ArrowDown"].includes(event.key)) {
|
|
1119
|
+
const currentElement = event.target;
|
|
1120
|
+
const currentIndex = candidateNodes.indexOf(currentElement);
|
|
1121
|
+
candidateNodes = candidateNodes.slice(currentIndex + 1);
|
|
1122
|
+
}
|
|
1123
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
1124
|
+
event.preventDefault();
|
|
1125
|
+
}
|
|
1126
|
+
})
|
|
1127
|
+
})
|
|
1128
|
+
})
|
|
1129
|
+
})
|
|
1130
|
+
})
|
|
1131
|
+
});
|
|
1132
|
+
}, "SelectContentImpl"));
|
|
1133
|
+
var SelectItemAlignedPosition = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectItemAlignedPosition2(props, forwardedRef) {
|
|
1134
|
+
const { __scopeSelect, onPlaced, ...popperProps } = props;
|
|
1135
|
+
const context = useSelectContext(CONTENT_NAME, __scopeSelect);
|
|
1136
|
+
const contentContext = useSelectContentContext(CONTENT_NAME, __scopeSelect);
|
|
1137
|
+
const [contentWrapper, setContentWrapper] = import_react.useState(null);
|
|
1138
|
+
const [content, setContent] = import_react.useState(null);
|
|
1139
|
+
const composedRefs = useComposedRefs(forwardedRef, setContent);
|
|
1140
|
+
const getItems = useCollection(__scopeSelect);
|
|
1141
|
+
const shouldExpandOnScrollRef = import_react.useRef(false);
|
|
1142
|
+
const shouldRepositionRef = import_react.useRef(true);
|
|
1143
|
+
const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;
|
|
1144
|
+
const position = import_react.useCallback(() => {
|
|
1145
|
+
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
1146
|
+
const triggerRect = context.trigger.getBoundingClientRect();
|
|
1147
|
+
const contentRect = content.getBoundingClientRect();
|
|
1148
|
+
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
1149
|
+
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
1150
|
+
if (context.dir !== Direction.RTL) {
|
|
1151
|
+
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
1152
|
+
const left = valueNodeRect.left - itemTextOffset;
|
|
1153
|
+
const leftDelta = triggerRect.left - left;
|
|
1154
|
+
const minContentWidth = triggerRect.width + leftDelta;
|
|
1155
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
1156
|
+
const rightEdge = window.innerWidth - CONTENT_MARGIN;
|
|
1157
|
+
const clampedLeft = clamp(left, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, rightEdge - contentWidth)]);
|
|
1158
|
+
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
1159
|
+
contentWrapper.style.left = clampedLeft + "px";
|
|
1160
|
+
} else {
|
|
1161
|
+
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
1162
|
+
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
1163
|
+
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
1164
|
+
const minContentWidth = triggerRect.width + rightDelta;
|
|
1165
|
+
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
1166
|
+
const leftEdge = window.innerWidth - CONTENT_MARGIN;
|
|
1167
|
+
const clampedRight = clamp(right, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, leftEdge - contentWidth)]);
|
|
1168
|
+
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
1169
|
+
contentWrapper.style.right = clampedRight + "px";
|
|
1170
|
+
}
|
|
1171
|
+
const items = getItems();
|
|
1172
|
+
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
1173
|
+
const itemsHeight = viewport.scrollHeight;
|
|
1174
|
+
const contentStyles = window.getComputedStyle(content);
|
|
1175
|
+
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
1176
|
+
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
1177
|
+
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
1178
|
+
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
1179
|
+
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth;
|
|
1180
|
+
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
1181
|
+
const viewportStyles = window.getComputedStyle(viewport);
|
|
1182
|
+
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
1183
|
+
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
1184
|
+
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;
|
|
1185
|
+
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
1186
|
+
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
1187
|
+
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
1188
|
+
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
1189
|
+
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
1190
|
+
if (contentTopToItemMiddle <= topEdgeToTriggerMiddle) {
|
|
1191
|
+
const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current;
|
|
1192
|
+
contentWrapper.style.bottom = "0px";
|
|
1193
|
+
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
1194
|
+
const height = contentTopToItemMiddle + Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
1195
|
+
contentWrapper.style.height = height + "px";
|
|
1196
|
+
} else {
|
|
1197
|
+
const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current;
|
|
1198
|
+
contentWrapper.style.top = "0px";
|
|
1199
|
+
const height = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight) + itemMiddleToContentBottom;
|
|
1200
|
+
contentWrapper.style.height = height + "px";
|
|
1201
|
+
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
1202
|
+
}
|
|
1203
|
+
contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;
|
|
1204
|
+
contentWrapper.style.minHeight = minContentHeight + "px";
|
|
1205
|
+
contentWrapper.style.maxHeight = availableHeight + "px";
|
|
1206
|
+
onPlaced?.();
|
|
1207
|
+
requestAnimationFrame(() => shouldExpandOnScrollRef.current = true);
|
|
1208
|
+
}
|
|
1209
|
+
}, [
|
|
1210
|
+
getItems,
|
|
1211
|
+
context.trigger,
|
|
1212
|
+
context.valueNode,
|
|
1213
|
+
contentWrapper,
|
|
1214
|
+
content,
|
|
1215
|
+
viewport,
|
|
1216
|
+
selectedItem,
|
|
1217
|
+
selectedItemText,
|
|
1218
|
+
context.dir,
|
|
1219
|
+
onPlaced
|
|
1220
|
+
]);
|
|
1221
|
+
useLayoutEffect2(() => position(), [position]);
|
|
1222
|
+
const [contentZIndex, setContentZIndex] = import_react.useState();
|
|
1223
|
+
useLayoutEffect2(() => {
|
|
1224
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
1225
|
+
}, [content]);
|
|
1226
|
+
const handleScrollButtonChange = import_react.useCallback((node) => {
|
|
1227
|
+
if (node && shouldRepositionRef.current === true) {
|
|
1228
|
+
position();
|
|
1229
|
+
focusSelectedItem?.();
|
|
1230
|
+
shouldRepositionRef.current = false;
|
|
1231
|
+
}
|
|
1232
|
+
}, [position, focusSelectedItem]);
|
|
1233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewportProvider, {
|
|
1234
|
+
scope: __scopeSelect,
|
|
1235
|
+
contentWrapper,
|
|
1236
|
+
shouldExpandOnScrollRef,
|
|
1237
|
+
onScrollButtonChange: handleScrollButtonChange,
|
|
1238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1239
|
+
ref: setContentWrapper,
|
|
1240
|
+
style: {
|
|
1241
|
+
display: "flex",
|
|
1242
|
+
flexDirection: "column",
|
|
1243
|
+
position: "fixed",
|
|
1244
|
+
zIndex: contentZIndex
|
|
1245
|
+
},
|
|
1246
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
1247
|
+
...popperProps,
|
|
1248
|
+
ref: composedRefs,
|
|
1249
|
+
style: {
|
|
1250
|
+
boxSizing: "border-box",
|
|
1251
|
+
maxHeight: "100%",
|
|
1252
|
+
...popperProps.style
|
|
1253
|
+
}
|
|
1254
|
+
})
|
|
1255
|
+
})
|
|
1256
|
+
});
|
|
1257
|
+
}, "SelectItemAlignedPosition"));
|
|
1258
|
+
var SelectPopperPosition = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectPopperPosition2(props, forwardedRef) {
|
|
1259
|
+
const { __scopeSelect, align = "start", collisionPadding = CONTENT_MARGIN, ...popperProps } = props;
|
|
1260
|
+
const popperScope = usePopperScope(__scopeSelect);
|
|
1261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperContent, {
|
|
1262
|
+
...popperScope,
|
|
1263
|
+
...popperProps,
|
|
1264
|
+
ref: forwardedRef,
|
|
1265
|
+
align,
|
|
1266
|
+
collisionPadding,
|
|
1267
|
+
style: {
|
|
1268
|
+
boxSizing: "border-box",
|
|
1269
|
+
...popperProps.style,
|
|
1270
|
+
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1271
|
+
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
1272
|
+
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
1273
|
+
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1274
|
+
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1275
|
+
}
|
|
1276
|
+
});
|
|
1277
|
+
}, "SelectPopperPosition"));
|
|
1278
|
+
var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME, {});
|
|
1279
|
+
var VIEWPORT_NAME = "SelectViewport";
|
|
1280
|
+
var SelectViewport = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectViewport2(props, forwardedRef) {
|
|
1281
|
+
const { __scopeSelect, nonce, ...viewportProps } = props;
|
|
1282
|
+
const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect);
|
|
1283
|
+
const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect);
|
|
1284
|
+
const composedRefs = useComposedRefs(forwardedRef, contentContext.onViewportChange);
|
|
1285
|
+
const prevScrollTopRef = import_react.useRef(0);
|
|
1286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
|
|
1287
|
+
dangerouslySetInnerHTML: { __html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}` },
|
|
1288
|
+
nonce
|
|
1289
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, {
|
|
1290
|
+
scope: __scopeSelect,
|
|
1291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
1292
|
+
"data-radix-select-viewport": "",
|
|
1293
|
+
role: "presentation",
|
|
1294
|
+
...viewportProps,
|
|
1295
|
+
ref: composedRefs,
|
|
1296
|
+
style: {
|
|
1297
|
+
position: "relative",
|
|
1298
|
+
flex: 1,
|
|
1299
|
+
overflow: "hidden auto",
|
|
1300
|
+
...viewportProps.style
|
|
1301
|
+
},
|
|
1302
|
+
onScroll: composeEventHandlers(viewportProps.onScroll, (event) => {
|
|
1303
|
+
const viewport = event.currentTarget;
|
|
1304
|
+
const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;
|
|
1305
|
+
if (shouldExpandOnScrollRef?.current && contentWrapper) {
|
|
1306
|
+
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
1307
|
+
if (scrolledBy > 0) {
|
|
1308
|
+
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
1309
|
+
const cssMinHeight = parseFloat(contentWrapper.style.minHeight);
|
|
1310
|
+
const cssHeight = parseFloat(contentWrapper.style.height);
|
|
1311
|
+
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
1312
|
+
if (prevHeight < availableHeight) {
|
|
1313
|
+
const nextHeight = prevHeight + scrolledBy;
|
|
1314
|
+
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
1315
|
+
const heightDiff = nextHeight - clampedNextHeight;
|
|
1316
|
+
contentWrapper.style.height = clampedNextHeight + "px";
|
|
1317
|
+
if (contentWrapper.style.bottom === "0px") {
|
|
1318
|
+
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;
|
|
1319
|
+
contentWrapper.style.justifyContent = "flex-end";
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
prevScrollTopRef.current = viewport.scrollTop;
|
|
1325
|
+
})
|
|
1326
|
+
})
|
|
1327
|
+
})] });
|
|
1328
|
+
}, "SelectViewport"));
|
|
1329
|
+
var [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext("SelectGroup");
|
|
1330
|
+
var LABEL_NAME = "SelectLabel";
|
|
1331
|
+
var SelectLabel$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectLabel2(props, forwardedRef) {
|
|
1332
|
+
const { __scopeSelect, ...labelProps } = props;
|
|
1333
|
+
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
1334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
1335
|
+
id: groupContext.id,
|
|
1336
|
+
...labelProps,
|
|
1337
|
+
ref: forwardedRef
|
|
1338
|
+
});
|
|
1339
|
+
}, "SelectLabel"));
|
|
1340
|
+
var ITEM_NAME = "SelectItem";
|
|
1341
|
+
var [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);
|
|
1342
|
+
var SelectItem$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectItem2(props, forwardedRef) {
|
|
1343
|
+
const { __scopeSelect, value, disabled = false, textValue: textValueProp, ...itemProps } = props;
|
|
1344
|
+
const context = useSelectContext(ITEM_NAME, __scopeSelect);
|
|
1345
|
+
const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);
|
|
1346
|
+
const isSelected = context.value === value;
|
|
1347
|
+
const [textValue, setTextValue] = import_react.useState(textValueProp ?? "");
|
|
1348
|
+
const [isFocused, setIsFocused] = import_react.useState(false);
|
|
1349
|
+
const handleItemRefCallback = useCallbackRef((node) => contentContext.itemRefCallback?.(node, value, disabled));
|
|
1350
|
+
const composedRefs = useComposedRefs(forwardedRef, handleItemRefCallback);
|
|
1351
|
+
const textId = useId();
|
|
1352
|
+
const pointerTypeRef = import_react.useRef("touch");
|
|
1353
|
+
function handleSelect(event) {
|
|
1354
|
+
context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
1355
|
+
context.onUserSelect(value);
|
|
1356
|
+
context.onOpenChange(false);
|
|
1357
|
+
}
|
|
1358
|
+
__name$1(handleSelect, "handleSelect");
|
|
1359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemContextProvider, {
|
|
1360
|
+
scope: __scopeSelect,
|
|
1361
|
+
value,
|
|
1362
|
+
disabled,
|
|
1363
|
+
textId,
|
|
1364
|
+
isSelected,
|
|
1365
|
+
onItemTextChange: import_react.useCallback((node) => {
|
|
1366
|
+
setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? "").trim());
|
|
1367
|
+
}, []),
|
|
1368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.ItemSlot, {
|
|
1369
|
+
scope: __scopeSelect,
|
|
1370
|
+
value,
|
|
1371
|
+
disabled,
|
|
1372
|
+
textValue,
|
|
1373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
1374
|
+
role: "option",
|
|
1375
|
+
"aria-labelledby": textId,
|
|
1376
|
+
"data-highlighted": isFocused ? "" : void 0,
|
|
1377
|
+
"aria-selected": isSelected && isFocused,
|
|
1378
|
+
"data-state": isSelected ? "checked" : "unchecked",
|
|
1379
|
+
"aria-disabled": disabled || void 0,
|
|
1380
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1381
|
+
tabIndex: disabled ? void 0 : -1,
|
|
1382
|
+
...itemProps,
|
|
1383
|
+
ref: composedRefs,
|
|
1384
|
+
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
1385
|
+
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
1386
|
+
onClick: composeEventHandlers(itemProps.onClick, (event) => {
|
|
1387
|
+
if (disabled) return;
|
|
1388
|
+
if (pointerTypeRef.current !== "mouse") handleSelect(event);
|
|
1389
|
+
}),
|
|
1390
|
+
onPointerUp: composeEventHandlers(itemProps.onPointerUp, (event) => {
|
|
1391
|
+
if (disabled) return;
|
|
1392
|
+
if (pointerTypeRef.current === "mouse") handleSelect(event);
|
|
1393
|
+
}),
|
|
1394
|
+
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
1395
|
+
pointerTypeRef.current = event.pointerType;
|
|
1396
|
+
}),
|
|
1397
|
+
onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
1398
|
+
pointerTypeRef.current = event.pointerType;
|
|
1399
|
+
if (disabled) contentContext.onItemLeave?.();
|
|
1400
|
+
else if (pointerTypeRef.current === "mouse") event.currentTarget.focus({ preventScroll: true });
|
|
1401
|
+
}),
|
|
1402
|
+
onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
1403
|
+
if (event.currentTarget === document.activeElement) contentContext.onItemLeave?.();
|
|
1404
|
+
}),
|
|
1405
|
+
onKeyDown: composeEventHandlers(itemProps.onKeyDown, (event) => {
|
|
1406
|
+
if (disabled || event.target !== event.currentTarget) return;
|
|
1407
|
+
if (contentContext.searchRef?.current !== "" && event.key === " ") return;
|
|
1408
|
+
if (SELECTION_KEYS.includes(event.key)) handleSelect(event);
|
|
1409
|
+
if (event.key === " ") event.preventDefault();
|
|
1410
|
+
})
|
|
1411
|
+
})
|
|
1412
|
+
})
|
|
1413
|
+
});
|
|
1414
|
+
}, "SelectItem"));
|
|
1415
|
+
var ITEM_TEXT_NAME = "SelectItemText";
|
|
1416
|
+
var SelectItemText = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectItemText2(props, forwardedRef) {
|
|
1417
|
+
const { __scopeSelect, className, style, ...itemTextProps } = props;
|
|
1418
|
+
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
1419
|
+
const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
1420
|
+
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
1421
|
+
const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
1422
|
+
const [itemTextNode, setItemTextNode] = import_react.useState(null);
|
|
1423
|
+
const handleItemTextRefCallback = useCallbackRef((node) => contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled));
|
|
1424
|
+
const composedRefs = useComposedRefs(forwardedRef, setItemTextNode, itemContext.onItemTextChange, handleItemTextRefCallback);
|
|
1425
|
+
const textContent = itemTextNode?.textContent;
|
|
1426
|
+
const nativeOption = import_react.useMemo(() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
1427
|
+
value: itemContext.value,
|
|
1428
|
+
disabled: itemContext.disabled,
|
|
1429
|
+
children: textContent
|
|
1430
|
+
}, itemContext.value), [
|
|
1431
|
+
itemContext.disabled,
|
|
1432
|
+
itemContext.value,
|
|
1433
|
+
textContent
|
|
1434
|
+
]);
|
|
1435
|
+
const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;
|
|
1436
|
+
useLayoutEffect2(() => {
|
|
1437
|
+
onNativeOptionAdd(nativeOption);
|
|
1438
|
+
return () => onNativeOptionRemove(nativeOption);
|
|
1439
|
+
}, [
|
|
1440
|
+
onNativeOptionAdd,
|
|
1441
|
+
onNativeOptionRemove,
|
|
1442
|
+
nativeOption
|
|
1443
|
+
]);
|
|
1444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
1445
|
+
id: itemContext.textId,
|
|
1446
|
+
...itemTextProps,
|
|
1447
|
+
ref: composedRefs
|
|
1448
|
+
}), itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren && !shouldShowPlaceholder(context.value) ? import_react_dom.createPortal(itemTextProps.children, context.valueNode) : null] });
|
|
1449
|
+
}, "SelectItemText"));
|
|
1450
|
+
var ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
1451
|
+
var SelectItemIndicator = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectItemIndicator2(props, forwardedRef) {
|
|
1452
|
+
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
1453
|
+
return useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect).isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
1454
|
+
"aria-hidden": true,
|
|
1455
|
+
...itemIndicatorProps,
|
|
1456
|
+
ref: forwardedRef
|
|
1457
|
+
}) : null;
|
|
1458
|
+
}, "SelectItemIndicator"));
|
|
1459
|
+
var SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
|
|
1460
|
+
var SelectScrollUpButton$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectScrollUpButton2(props, forwardedRef) {
|
|
1461
|
+
const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
1462
|
+
const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
1463
|
+
const [canScrollUp, setCanScrollUp] = import_react.useState(false);
|
|
1464
|
+
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
1465
|
+
useLayoutEffect2(() => {
|
|
1466
|
+
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1467
|
+
let handleScroll2 = function() {
|
|
1468
|
+
const canScrollUp2 = viewport.scrollTop > 0;
|
|
1469
|
+
setCanScrollUp(canScrollUp2);
|
|
1470
|
+
};
|
|
1471
|
+
__name$1(handleScroll2, "handleScroll");
|
|
1472
|
+
const viewport = contentContext.viewport;
|
|
1473
|
+
handleScroll2();
|
|
1474
|
+
viewport.addEventListener("scroll", handleScroll2);
|
|
1475
|
+
return () => viewport.removeEventListener("scroll", handleScroll2);
|
|
1476
|
+
}
|
|
1477
|
+
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
1478
|
+
return canScrollUp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollButtonImpl, {
|
|
1479
|
+
...props,
|
|
1480
|
+
ref: composedRefs,
|
|
1481
|
+
onAutoScroll: () => {
|
|
1482
|
+
const { viewport, selectedItem } = contentContext;
|
|
1483
|
+
if (viewport && selectedItem) viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;
|
|
1484
|
+
}
|
|
1485
|
+
}) : null;
|
|
1486
|
+
}, "SelectScrollUpButton"));
|
|
1487
|
+
var SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
|
|
1488
|
+
var SelectScrollDownButton$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectScrollDownButton2(props, forwardedRef) {
|
|
1489
|
+
const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
1490
|
+
const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
1491
|
+
const [canScrollDown, setCanScrollDown] = import_react.useState(false);
|
|
1492
|
+
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
1493
|
+
useLayoutEffect2(() => {
|
|
1494
|
+
if (contentContext.viewport && contentContext.isPositioned) {
|
|
1495
|
+
let handleScroll2 = function() {
|
|
1496
|
+
const maxScroll = viewport.scrollHeight - viewport.clientHeight;
|
|
1497
|
+
const canScrollDown2 = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
1498
|
+
setCanScrollDown(canScrollDown2);
|
|
1499
|
+
};
|
|
1500
|
+
__name$1(handleScroll2, "handleScroll");
|
|
1501
|
+
const viewport = contentContext.viewport;
|
|
1502
|
+
handleScroll2();
|
|
1503
|
+
viewport.addEventListener("scroll", handleScroll2);
|
|
1504
|
+
return () => viewport.removeEventListener("scroll", handleScroll2);
|
|
1505
|
+
}
|
|
1506
|
+
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
1507
|
+
return canScrollDown ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollButtonImpl, {
|
|
1508
|
+
...props,
|
|
1509
|
+
ref: composedRefs,
|
|
1510
|
+
onAutoScroll: () => {
|
|
1511
|
+
const { viewport, selectedItem } = contentContext;
|
|
1512
|
+
if (viewport && selectedItem) viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
1513
|
+
}
|
|
1514
|
+
}) : null;
|
|
1515
|
+
}, "SelectScrollDownButton"));
|
|
1516
|
+
var SelectScrollButtonImpl = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectScrollButtonImpl2(props, forwardedRef) {
|
|
1517
|
+
const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;
|
|
1518
|
+
const contentContext = useSelectContentContext("SelectScrollButton", __scopeSelect);
|
|
1519
|
+
const autoScrollTimerRef = import_react.useRef(null);
|
|
1520
|
+
const getItems = useCollection(__scopeSelect);
|
|
1521
|
+
const clearAutoScrollTimer = import_react.useCallback(() => {
|
|
1522
|
+
if (autoScrollTimerRef.current !== null) {
|
|
1523
|
+
window.clearInterval(autoScrollTimerRef.current);
|
|
1524
|
+
autoScrollTimerRef.current = null;
|
|
1525
|
+
}
|
|
1526
|
+
}, []);
|
|
1527
|
+
import_react.useEffect(() => {
|
|
1528
|
+
return () => clearAutoScrollTimer();
|
|
1529
|
+
}, [clearAutoScrollTimer]);
|
|
1530
|
+
useLayoutEffect2(() => {
|
|
1531
|
+
getItems().find((item) => item.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
1532
|
+
}, [getItems]);
|
|
1533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
1534
|
+
"aria-hidden": true,
|
|
1535
|
+
...scrollIndicatorProps,
|
|
1536
|
+
ref: forwardedRef,
|
|
1537
|
+
style: {
|
|
1538
|
+
flexShrink: 0,
|
|
1539
|
+
...scrollIndicatorProps.style
|
|
1540
|
+
},
|
|
1541
|
+
onPointerDown: composeEventHandlers(scrollIndicatorProps.onPointerDown, () => {
|
|
1542
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1543
|
+
}),
|
|
1544
|
+
onPointerMove: composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {
|
|
1545
|
+
contentContext.onItemLeave?.();
|
|
1546
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1547
|
+
}),
|
|
1548
|
+
onPointerLeave: composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {
|
|
1549
|
+
clearAutoScrollTimer();
|
|
1550
|
+
})
|
|
1551
|
+
});
|
|
1552
|
+
}, "SelectScrollButtonImpl"));
|
|
1553
|
+
var SelectSeparator$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectSeparator2(props, forwardedRef) {
|
|
1554
|
+
const { __scopeSelect, ...separatorProps } = props;
|
|
1555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
1556
|
+
"aria-hidden": true,
|
|
1557
|
+
...separatorProps,
|
|
1558
|
+
ref: forwardedRef
|
|
1559
|
+
});
|
|
1560
|
+
}, "SelectSeparator"));
|
|
1561
|
+
var BUBBLE_INPUT_NAME$1 = "SelectBubbleInput";
|
|
1562
|
+
var SelectBubbleInput = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function SelectBubbleInput2({ __scopeSelect, ...props }, forwardedRef) {
|
|
1563
|
+
const context = useSelectContext(BUBBLE_INPUT_NAME$1, __scopeSelect);
|
|
1564
|
+
const { value, onValueChange, required, disabled, name, autoComplete, form, userSelection } = context;
|
|
1565
|
+
const { nativeOptions, nativeSelectKey } = context;
|
|
1566
|
+
const ref = import_react.useRef(null);
|
|
1567
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
1568
|
+
const selectValue = value ?? "";
|
|
1569
|
+
const prevValueRef = import_react.useRef(selectValue);
|
|
1570
|
+
const handledUserSelectionRef = import_react.useRef(userSelection);
|
|
1571
|
+
const isDispatchingUserSelectionRef = import_react.useRef(false);
|
|
1572
|
+
const hasEmptyValueOption = Array.from(nativeOptions).some((option) => (option.props.value ?? "") === "");
|
|
1573
|
+
import_react.useEffect(() => {
|
|
1574
|
+
const select = ref.current;
|
|
1575
|
+
if (!select) return;
|
|
1576
|
+
const selectProto = window.HTMLSelectElement.prototype;
|
|
1577
|
+
const setValue = Object.getOwnPropertyDescriptor(selectProto, "value").set;
|
|
1578
|
+
const isNewUserSelection = userSelection !== null && userSelection !== handledUserSelectionRef.current;
|
|
1579
|
+
handledUserSelectionRef.current = userSelection;
|
|
1580
|
+
const valueChanged = prevValueRef.current !== selectValue;
|
|
1581
|
+
prevValueRef.current = selectValue;
|
|
1582
|
+
const isUserInteraction = isNewUserSelection && valueChanged;
|
|
1583
|
+
if (isNewUserSelection && !valueChanged && userSelection.value !== selectValue && !userSelection.hasConsumerStoppedPropagation && setValue) {
|
|
1584
|
+
isDispatchingUserSelectionRef.current = true;
|
|
1585
|
+
try {
|
|
1586
|
+
setValue.call(select, userSelection.value);
|
|
1587
|
+
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1588
|
+
} finally {
|
|
1589
|
+
isDispatchingUserSelectionRef.current = false;
|
|
1590
|
+
setValue.call(select, selectValue);
|
|
1591
|
+
}
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
const bubbles = isUserInteraction && !userSelection.hasConsumerStoppedPropagation;
|
|
1595
|
+
if (valueChanged && setValue) {
|
|
1596
|
+
const event = new Event("change", { bubbles });
|
|
1597
|
+
setValue.call(select, selectValue);
|
|
1598
|
+
select.dispatchEvent(event);
|
|
1599
|
+
}
|
|
1600
|
+
}, [selectValue, userSelection]);
|
|
1601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Primitive.select, {
|
|
1602
|
+
"aria-hidden": true,
|
|
1603
|
+
required,
|
|
1604
|
+
tabIndex: -1,
|
|
1605
|
+
name,
|
|
1606
|
+
autoComplete,
|
|
1607
|
+
disabled,
|
|
1608
|
+
form,
|
|
1609
|
+
onChange: (event) => {
|
|
1610
|
+
if (!isDispatchingUserSelectionRef.current) onValueChange(event.target.value);
|
|
1611
|
+
},
|
|
1612
|
+
...props,
|
|
1613
|
+
style: {
|
|
1614
|
+
...VISUALLY_HIDDEN_STYLES,
|
|
1615
|
+
...props.style
|
|
1616
|
+
},
|
|
1617
|
+
ref: composedRefs,
|
|
1618
|
+
defaultValue: selectValue,
|
|
1619
|
+
children: [shouldShowPlaceholder(value) && !hasEmptyValueOption ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "" }) : null, Array.from(nativeOptions)]
|
|
1620
|
+
}, nativeSelectKey);
|
|
1621
|
+
}, "SelectBubbleInput"));
|
|
1622
|
+
function isFunction$1(value) {
|
|
1623
|
+
return typeof value === "function";
|
|
1624
|
+
}
|
|
1625
|
+
__name$1(isFunction$1, "isFunction");
|
|
1626
|
+
function shouldShowPlaceholder(value) {
|
|
1627
|
+
return value === "" || value === void 0;
|
|
1628
|
+
}
|
|
1629
|
+
__name$1(shouldShowPlaceholder, "shouldShowPlaceholder");
|
|
1630
|
+
function useTypeaheadSearch(onSearchChange) {
|
|
1631
|
+
const handleSearchChange = useCallbackRef(onSearchChange);
|
|
1632
|
+
const searchRef = import_react.useRef("");
|
|
1633
|
+
const timerRef = import_react.useRef(0);
|
|
1634
|
+
const handleTypeaheadSearch = import_react.useCallback((key) => {
|
|
1635
|
+
const search = searchRef.current + key;
|
|
1636
|
+
handleSearchChange(search);
|
|
1637
|
+
function updateSearch(value) {
|
|
1638
|
+
searchRef.current = value;
|
|
1639
|
+
window.clearTimeout(timerRef.current);
|
|
1640
|
+
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
1641
|
+
}
|
|
1642
|
+
__name$1(updateSearch, "updateSearch");
|
|
1643
|
+
updateSearch(search);
|
|
1644
|
+
}, [handleSearchChange]);
|
|
1645
|
+
const resetTypeahead = import_react.useCallback(() => {
|
|
1646
|
+
searchRef.current = "";
|
|
1647
|
+
window.clearTimeout(timerRef.current);
|
|
1648
|
+
}, []);
|
|
1649
|
+
import_react.useEffect(() => {
|
|
1650
|
+
return () => window.clearTimeout(timerRef.current);
|
|
1651
|
+
}, []);
|
|
1652
|
+
return [
|
|
1653
|
+
searchRef,
|
|
1654
|
+
handleTypeaheadSearch,
|
|
1655
|
+
resetTypeahead
|
|
1656
|
+
];
|
|
1657
|
+
}
|
|
1658
|
+
__name$1(useTypeaheadSearch, "useTypeaheadSearch");
|
|
1659
|
+
function findNextItem(items, search, currentItem) {
|
|
1660
|
+
const normalizedSearch = search.length > 1 && Array.from(search).every((char) => char === search[0]) ? search[0] : search;
|
|
1661
|
+
const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;
|
|
1662
|
+
let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));
|
|
1663
|
+
if (normalizedSearch.length === 1) wrappedItems = wrappedItems.filter((v) => v !== currentItem);
|
|
1664
|
+
const nextItem = wrappedItems.find((item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase()));
|
|
1665
|
+
return nextItem !== currentItem ? nextItem : void 0;
|
|
1666
|
+
}
|
|
1667
|
+
__name$1(findNextItem, "findNextItem");
|
|
1668
|
+
function wrapArray(array, startIndex) {
|
|
1669
|
+
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
1670
|
+
}
|
|
1671
|
+
__name$1(wrapArray, "wrapArray");
|
|
1672
|
+
// app/components/ui/select.tsx
|
|
1673
|
+
var Select = Select$1;
|
|
1674
|
+
var SelectValue = SelectValue$1;
|
|
1675
|
+
var SelectTrigger = import_react.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectTrigger$1, {
|
|
1676
|
+
ref,
|
|
1677
|
+
className: cn("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className),
|
|
1678
|
+
...props,
|
|
1679
|
+
children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectIcon, {
|
|
1680
|
+
asChild: true,
|
|
1681
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
1682
|
+
})]
|
|
1683
|
+
}));
|
|
1684
|
+
SelectTrigger.displayName = SelectTrigger$1.displayName;
|
|
1685
|
+
var SelectScrollUpButton = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollUpButton$1, {
|
|
1686
|
+
ref,
|
|
1687
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1688
|
+
...props,
|
|
1689
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronUp, { className: "h-4 w-4" })
|
|
1690
|
+
}));
|
|
1691
|
+
SelectScrollUpButton.displayName = SelectScrollUpButton$1.displayName;
|
|
1692
|
+
var SelectScrollDownButton = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollDownButton$1, {
|
|
1693
|
+
ref,
|
|
1694
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1695
|
+
...props,
|
|
1696
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "h-4 w-4" })
|
|
1697
|
+
}));
|
|
1698
|
+
SelectScrollDownButton.displayName = SelectScrollDownButton$1.displayName;
|
|
1699
|
+
var SelectContent = import_react.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectContent$1, {
|
|
1700
|
+
ref,
|
|
1701
|
+
className: cn("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
1702
|
+
position,
|
|
1703
|
+
...props,
|
|
1704
|
+
children: [
|
|
1705
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollUpButton, {}),
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectViewport, {
|
|
1707
|
+
className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
|
|
1708
|
+
children
|
|
1709
|
+
}),
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollDownButton, {})
|
|
1711
|
+
]
|
|
1712
|
+
}) }));
|
|
1713
|
+
SelectContent.displayName = SelectContent$1.displayName;
|
|
1714
|
+
var SelectLabel = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectLabel$1, {
|
|
1715
|
+
ref,
|
|
1716
|
+
className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
|
|
1717
|
+
...props
|
|
1718
|
+
}));
|
|
1719
|
+
SelectLabel.displayName = SelectLabel$1.displayName;
|
|
1720
|
+
var SelectItem = import_react.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectItem$1, {
|
|
1721
|
+
ref,
|
|
1722
|
+
className: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
1723
|
+
...props,
|
|
1724
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1725
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
1726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "h-4 w-4" }) })
|
|
1727
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemText, { children })]
|
|
1728
|
+
}));
|
|
1729
|
+
SelectItem.displayName = SelectItem$1.displayName;
|
|
1730
|
+
var SelectSeparator = import_react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectSeparator$1, {
|
|
1731
|
+
ref,
|
|
1732
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
1733
|
+
...props
|
|
1734
|
+
}));
|
|
1735
|
+
SelectSeparator.displayName = SelectSeparator$1.displayName;
|
|
1736
|
+
// app/lib/bulk-cancel-ui.ts
|
|
1737
|
+
/**
|
|
1738
|
+
* Choose the toast severity for a completed bulk-cancel request.
|
|
1739
|
+
*
|
|
1740
|
+
* `already_cancelled` is an idempotent success, so it counts toward the
|
|
1741
|
+
* success total — a batch that another caller had already cancelled is not an
|
|
1742
|
+
* error. The error toast is reserved for the case where nothing succeeded;
|
|
1743
|
+
* a genuine problem (failed / not-found / not-cancellable) alongside some
|
|
1744
|
+
* success is a warning.
|
|
1745
|
+
*/
|
|
1746
|
+
function bulkCancelToastSeverity(summary) {
|
|
1747
|
+
const succeeded = summary.cancelled + summary.alreadyCancelled;
|
|
1748
|
+
const hadProblem = summary.failed + summary.notCancellable + summary.notFound > 0;
|
|
1749
|
+
if (succeeded === 0) return "error";
|
|
1750
|
+
if (hadProblem) return "warning";
|
|
1751
|
+
return "success";
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Whether a run should stay selected after a bulk-cancel batch. Retryable
|
|
1755
|
+
* failures are kept selected so the user can retry them without reselecting;
|
|
1756
|
+
* every terminal outcome (cancelled, already-cancelled, not-cancellable,
|
|
1757
|
+
* not-found, and non-retryable failures) is cleared.
|
|
1758
|
+
*/
|
|
1759
|
+
function shouldRetainSelectionAfterBulkCancel(result) {
|
|
1760
|
+
return result.outcome === "failed" && result.retryable;
|
|
1761
|
+
}
|
|
1762
|
+
// app/lib/client/listing-window.ts
|
|
1763
|
+
var windows = /* @__PURE__ */ new Map();
|
|
1764
|
+
function createWindow(periodMs) {
|
|
1765
|
+
const end = Date.now();
|
|
1766
|
+
return {
|
|
1767
|
+
startTime: new Date(end - periodMs).toISOString(),
|
|
1768
|
+
endTime: new Date(end).toISOString()
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* The frozen window for a period, creating it on first use. Subsequent calls
|
|
1773
|
+
* (including from a remounted component) return the same window until
|
|
1774
|
+
* `advanceListingWindow` replaces it.
|
|
1775
|
+
*/
|
|
1776
|
+
function getListingWindow(periodId, periodMs) {
|
|
1777
|
+
let window = windows.get(periodId);
|
|
1778
|
+
if (!window) {
|
|
1779
|
+
window = createWindow(periodMs);
|
|
1780
|
+
windows.set(periodId, window);
|
|
1781
|
+
}
|
|
1782
|
+
return window;
|
|
1783
|
+
}
|
|
1784
|
+
/** Slide the period's window forward to now (explicit refresh/reload). */
|
|
1785
|
+
function advanceListingWindow(periodId, periodMs) {
|
|
1786
|
+
const window = createWindow(periodMs);
|
|
1787
|
+
windows.set(periodId, window);
|
|
1788
|
+
return window;
|
|
1789
|
+
}
|
|
1790
|
+
// app/lib/hooks/use-table-selection.ts
|
|
1791
|
+
/**
|
|
1792
|
+
* Hook for managing table row selection state.
|
|
1793
|
+
* Provides a consistent interface for multi-select functionality across different tables.
|
|
1794
|
+
*/
|
|
1795
|
+
function useTableSelection({ getItemId }) {
|
|
1796
|
+
const [selectedIds, setSelectedIds] = (0, import_react.useState)(/* @__PURE__ */ new Set());
|
|
1797
|
+
const isSelected = (0, import_react.useCallback)((item) => selectedIds.has(getItemId(item)), [selectedIds, getItemId]);
|
|
1798
|
+
const toggleSelection = (0, import_react.useCallback)((item) => {
|
|
1799
|
+
const id = getItemId(item);
|
|
1800
|
+
setSelectedIds((prev) => {
|
|
1801
|
+
const next = new Set(prev);
|
|
1802
|
+
if (next.has(id)) next.delete(id);
|
|
1803
|
+
else next.add(id);
|
|
1804
|
+
return next;
|
|
1805
|
+
});
|
|
1806
|
+
}, [getItemId]);
|
|
1807
|
+
const selectAll = (0, import_react.useCallback)((items) => {
|
|
1808
|
+
setSelectedIds(new Set(items.map(getItemId)));
|
|
1809
|
+
}, [getItemId]);
|
|
1810
|
+
const clearSelection = (0, import_react.useCallback)(() => {
|
|
1811
|
+
setSelectedIds(/* @__PURE__ */ new Set());
|
|
1812
|
+
}, []);
|
|
1813
|
+
const isAllSelected = (0, import_react.useCallback)((items) => {
|
|
1814
|
+
if (items.length === 0) return false;
|
|
1815
|
+
return items.every((item) => selectedIds.has(getItemId(item)));
|
|
1816
|
+
}, [selectedIds, getItemId]);
|
|
1817
|
+
const isSomeSelected = (0, import_react.useCallback)((items) => {
|
|
1818
|
+
if (items.length === 0) return false;
|
|
1819
|
+
const someSelected = items.some((item) => selectedIds.has(getItemId(item)));
|
|
1820
|
+
const allSelected = items.every((item) => selectedIds.has(getItemId(item)));
|
|
1821
|
+
return someSelected && !allSelected;
|
|
1822
|
+
}, [selectedIds, getItemId]);
|
|
1823
|
+
const toggleSelectAll = (0, import_react.useCallback)((items) => {
|
|
1824
|
+
if (isAllSelected(items)) clearSelection();
|
|
1825
|
+
else selectAll(items);
|
|
1826
|
+
}, [
|
|
1827
|
+
isAllSelected,
|
|
1828
|
+
clearSelection,
|
|
1829
|
+
selectAll
|
|
1830
|
+
]);
|
|
1831
|
+
const selectById = (0, import_react.useCallback)((id) => {
|
|
1832
|
+
setSelectedIds((prev) => {
|
|
1833
|
+
const next = new Set(prev);
|
|
1834
|
+
next.add(id);
|
|
1835
|
+
return next;
|
|
1836
|
+
});
|
|
1837
|
+
}, []);
|
|
1838
|
+
const deselectById = (0, import_react.useCallback)((id) => {
|
|
1839
|
+
setSelectedIds((prev) => {
|
|
1840
|
+
const next = new Set(prev);
|
|
1841
|
+
next.delete(id);
|
|
1842
|
+
return next;
|
|
1843
|
+
});
|
|
1844
|
+
}, []);
|
|
1845
|
+
const selectionCount = selectedIds.size;
|
|
1846
|
+
return (0, import_react.useMemo)(() => ({
|
|
1847
|
+
selectedIds,
|
|
1848
|
+
isSelected,
|
|
1849
|
+
toggleSelection,
|
|
1850
|
+
selectAll,
|
|
1851
|
+
clearSelection,
|
|
1852
|
+
toggleSelectAll,
|
|
1853
|
+
selectionCount,
|
|
1854
|
+
isAllSelected,
|
|
1855
|
+
isSomeSelected,
|
|
1856
|
+
selectById,
|
|
1857
|
+
deselectById
|
|
1858
|
+
}), [
|
|
1859
|
+
selectedIds,
|
|
1860
|
+
isSelected,
|
|
1861
|
+
toggleSelection,
|
|
1862
|
+
selectAll,
|
|
1863
|
+
clearSelection,
|
|
1864
|
+
toggleSelectAll,
|
|
1865
|
+
selectionCount,
|
|
1866
|
+
isAllSelected,
|
|
1867
|
+
isSomeSelected,
|
|
1868
|
+
selectById,
|
|
1869
|
+
deselectById
|
|
1870
|
+
]);
|
|
1871
|
+
}
|
|
1872
|
+
// app/lib/run-replay.ts
|
|
1873
|
+
function getRunReplayDisabledReason(run, runIdentityLoading) {
|
|
1874
|
+
if (runIdentityLoading) return "Loading run identity...";
|
|
1875
|
+
if (!run) return "Unable to verify whether this run can be replayed.";
|
|
1876
|
+
if (run.executionContext?.dynamicWorkflow) return "Dynamic runs cannot be replayed as a new run.";
|
|
1877
|
+
}
|
|
1878
|
+
// app/components/display-utils/selection-bar.tsx
|
|
1879
|
+
/**
|
|
1880
|
+
* A floating bar that appears when items are selected in a table.
|
|
1881
|
+
* Shows selection count and provides actions for bulk operations.
|
|
1882
|
+
*/
|
|
1883
|
+
function SelectionBar({ selectionCount, onClearSelection, actions, itemLabel = "items", className }) {
|
|
1884
|
+
if (selectionCount === 0) return null;
|
|
1885
|
+
const label = selectionCount === 1 ? itemLabel.replace(/s$/, "") : itemLabel;
|
|
1886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1887
|
+
className: cn("fixed bottom-6 left-1/2 -translate-x-1/2 z-50", "flex items-center gap-3 px-4 py-2.5 rounded-lg", "bg-primary text-primary-foreground shadow-lg", "animate-in fade-in slide-in-from-bottom-4 duration-200", className),
|
|
1888
|
+
children: [
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
1890
|
+
className: "text-sm font-medium",
|
|
1891
|
+
children: [
|
|
1892
|
+
selectionCount,
|
|
1893
|
+
" ",
|
|
1894
|
+
label,
|
|
1895
|
+
" selected"
|
|
1896
|
+
]
|
|
1897
|
+
}),
|
|
1898
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1899
|
+
className: "flex items-center gap-2 border-l border-primary-foreground/20 pl-3",
|
|
1900
|
+
children: actions
|
|
1901
|
+
}),
|
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
1903
|
+
variant: "tertiary",
|
|
1904
|
+
size: "small",
|
|
1905
|
+
className: "h-7 px-2 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",
|
|
1906
|
+
onClick: onClearSelection,
|
|
1907
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "h-4 w-4" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1908
|
+
className: "sr-only",
|
|
1909
|
+
children: "Clear selection"
|
|
1910
|
+
})]
|
|
1911
|
+
})
|
|
1912
|
+
]
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
// ../../node_modules/.bun/@radix-ui+react-checkbox@1.4.1+a68cb332b68cb125/node_modules/@radix-ui/react-checkbox/dist/index.mjs
|
|
1916
|
+
var __defProp = Object.defineProperty;
|
|
1917
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
1918
|
+
value,
|
|
1919
|
+
configurable: true
|
|
1920
|
+
});
|
|
1921
|
+
var CHECKBOX_NAME = "Checkbox";
|
|
1922
|
+
var [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);
|
|
1923
|
+
var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
|
|
1924
|
+
function CheckboxProvider(props) {
|
|
1925
|
+
const { __scopeCheckbox, checked: checkedProp, children, defaultChecked, disabled, form, name, onCheckedChange, required, value = "on", internal_do_not_use_render } = props;
|
|
1926
|
+
const [checked, setChecked] = useControllableState({
|
|
1927
|
+
prop: checkedProp,
|
|
1928
|
+
defaultProp: defaultChecked ?? false,
|
|
1929
|
+
onChange: onCheckedChange,
|
|
1930
|
+
caller: CHECKBOX_NAME
|
|
1931
|
+
});
|
|
1932
|
+
const [control, setControl] = import_react.useState(null);
|
|
1933
|
+
const [bubbleInput, setBubbleInput] = import_react.useState(null);
|
|
1934
|
+
const [userClick, setUserClick] = import_react.useState(null);
|
|
1935
|
+
const isFormControl = control ? !!form || !!control.closest("form") : true;
|
|
1936
|
+
const context = {
|
|
1937
|
+
checked,
|
|
1938
|
+
disabled,
|
|
1939
|
+
setChecked,
|
|
1940
|
+
control,
|
|
1941
|
+
setControl,
|
|
1942
|
+
name,
|
|
1943
|
+
form,
|
|
1944
|
+
value,
|
|
1945
|
+
userClick,
|
|
1946
|
+
onUserClick: setUserClick,
|
|
1947
|
+
required,
|
|
1948
|
+
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
|
|
1949
|
+
isFormControl,
|
|
1950
|
+
bubbleInput,
|
|
1951
|
+
setBubbleInput
|
|
1952
|
+
};
|
|
1953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxProviderImpl, {
|
|
1954
|
+
scope: __scopeCheckbox,
|
|
1955
|
+
...context,
|
|
1956
|
+
children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
__name(CheckboxProvider, "CheckboxProvider");
|
|
1960
|
+
var TRIGGER_NAME = "CheckboxTrigger";
|
|
1961
|
+
var CheckboxTrigger = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function CheckboxTrigger2({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) {
|
|
1962
|
+
const { control, value, disabled, checked, required, setControl, setChecked, onUserClick, isFormControl, bubbleInput } = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
|
|
1963
|
+
const composedRefs = useComposedRefs(forwardedRef, setControl);
|
|
1964
|
+
const initialCheckedStateRef = import_react.useRef(checked);
|
|
1965
|
+
import_react.useEffect(() => {
|
|
1966
|
+
const form = control?.form;
|
|
1967
|
+
if (form) {
|
|
1968
|
+
const reset = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), "reset");
|
|
1969
|
+
form.addEventListener("reset", reset);
|
|
1970
|
+
return () => form.removeEventListener("reset", reset);
|
|
1971
|
+
}
|
|
1972
|
+
}, [control, setChecked]);
|
|
1973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.button, {
|
|
1974
|
+
type: "button",
|
|
1975
|
+
role: "checkbox",
|
|
1976
|
+
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
|
|
1977
|
+
"aria-required": required,
|
|
1978
|
+
"data-state": getState(checked),
|
|
1979
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1980
|
+
disabled,
|
|
1981
|
+
value,
|
|
1982
|
+
...checkboxProps,
|
|
1983
|
+
ref: composedRefs,
|
|
1984
|
+
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
1985
|
+
if (event.key === "Enter") event.preventDefault();
|
|
1986
|
+
}),
|
|
1987
|
+
onClick: composeEventHandlers(onClick, (event) => {
|
|
1988
|
+
const hasConsumerStoppedPropagation = event.isPropagationStopped();
|
|
1989
|
+
onUserClick({
|
|
1990
|
+
requestedChecked: isIndeterminate(checked) ? true : !checked,
|
|
1991
|
+
hasConsumerStoppedPropagation
|
|
1992
|
+
});
|
|
1993
|
+
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
|
|
1994
|
+
if (bubbleInput && isFormControl) {
|
|
1995
|
+
if (!hasConsumerStoppedPropagation) event.stopPropagation();
|
|
1996
|
+
}
|
|
1997
|
+
})
|
|
1998
|
+
});
|
|
1999
|
+
}, "CheckboxTrigger"));
|
|
2000
|
+
var Checkbox$1 = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function Checkbox2(props, forwardedRef) {
|
|
2001
|
+
const { __scopeCheckbox, name, checked, defaultChecked, required, disabled, value, onCheckedChange, form, ...checkboxProps } = props;
|
|
2002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxProvider, {
|
|
2003
|
+
__scopeCheckbox,
|
|
2004
|
+
checked,
|
|
2005
|
+
defaultChecked,
|
|
2006
|
+
disabled,
|
|
2007
|
+
required,
|
|
2008
|
+
onCheckedChange,
|
|
2009
|
+
name,
|
|
2010
|
+
form,
|
|
2011
|
+
value,
|
|
2012
|
+
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxTrigger, {
|
|
2013
|
+
...checkboxProps,
|
|
2014
|
+
ref: forwardedRef,
|
|
2015
|
+
__scopeCheckbox
|
|
2016
|
+
}), isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxBubbleInput, { __scopeCheckbox })] })
|
|
2017
|
+
});
|
|
2018
|
+
}, "Checkbox"));
|
|
2019
|
+
var INDICATOR_NAME = "CheckboxIndicator";
|
|
2020
|
+
var CheckboxIndicator = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function CheckboxIndicator2(props, forwardedRef) {
|
|
2021
|
+
const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
|
|
2022
|
+
const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
|
|
2023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Presence, {
|
|
2024
|
+
present: forceMount || isIndeterminate(context.checked) || context.checked === true,
|
|
2025
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
2026
|
+
"data-state": getState(context.checked),
|
|
2027
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
2028
|
+
...indicatorProps,
|
|
2029
|
+
ref: forwardedRef,
|
|
2030
|
+
style: {
|
|
2031
|
+
pointerEvents: "none",
|
|
2032
|
+
...props.style
|
|
2033
|
+
}
|
|
2034
|
+
})
|
|
2035
|
+
});
|
|
2036
|
+
}, "CheckboxIndicator"));
|
|
2037
|
+
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
|
|
2038
|
+
var CheckboxBubbleInput = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function CheckboxBubbleInput2({ __scopeCheckbox, onClick, ...props }, forwardedRef) {
|
|
2039
|
+
const { control, userClick, checked, defaultChecked, required, disabled, name, value, form, bubbleInput, setBubbleInput } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
|
|
2040
|
+
const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
|
|
2041
|
+
const controlSize = useSize(control);
|
|
2042
|
+
const shouldStopClickPropagationRef = import_react.useRef(false);
|
|
2043
|
+
const prevCheckedRef = import_react.useRef(checked);
|
|
2044
|
+
const handledUserClickRef = import_react.useRef(userClick);
|
|
2045
|
+
const pendingUserClickRef = import_react.useRef(null);
|
|
2046
|
+
import_react.useEffect(() => {
|
|
2047
|
+
const input = bubbleInput;
|
|
2048
|
+
if (!input) return;
|
|
2049
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
2050
|
+
const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
|
|
2051
|
+
if (!setChecked) return;
|
|
2052
|
+
const checkedChanged = prevCheckedRef.current !== checked;
|
|
2053
|
+
prevCheckedRef.current = checked;
|
|
2054
|
+
const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;
|
|
2055
|
+
handledUserClickRef.current = userClick;
|
|
2056
|
+
if (isNewUserClick) {
|
|
2057
|
+
pendingUserClickRef.current = checkedChanged ? null : userClick;
|
|
2058
|
+
if (checkedChanged) {
|
|
2059
|
+
input.indeterminate = isIndeterminate(checked);
|
|
2060
|
+
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
|
2061
|
+
}
|
|
2062
|
+
input.dispatchEvent(new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation }));
|
|
2063
|
+
} else if (checkedChanged) {
|
|
2064
|
+
const pendingUserClick = pendingUserClickRef.current;
|
|
2065
|
+
pendingUserClickRef.current = null;
|
|
2066
|
+
const isPendingUserChange = pendingUserClick?.requestedChecked === checked;
|
|
2067
|
+
shouldStopClickPropagationRef.current = true;
|
|
2068
|
+
input.indeterminate = isIndeterminate(checked);
|
|
2069
|
+
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
|
2070
|
+
input.dispatchEvent(new Event("click", { bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation) }));
|
|
2071
|
+
shouldStopClickPropagationRef.current = false;
|
|
2072
|
+
}
|
|
2073
|
+
}, [
|
|
2074
|
+
bubbleInput,
|
|
2075
|
+
checked,
|
|
2076
|
+
userClick
|
|
2077
|
+
]);
|
|
2078
|
+
const defaultCheckedRef = import_react.useRef(isIndeterminate(checked) ? false : checked);
|
|
2079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.input, {
|
|
2080
|
+
type: "checkbox",
|
|
2081
|
+
"aria-hidden": true,
|
|
2082
|
+
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
|
|
2083
|
+
required,
|
|
2084
|
+
disabled,
|
|
2085
|
+
name,
|
|
2086
|
+
value,
|
|
2087
|
+
form,
|
|
2088
|
+
...props,
|
|
2089
|
+
tabIndex: -1,
|
|
2090
|
+
ref: composedRefs,
|
|
2091
|
+
onClick: composeEventHandlers(onClick, (event) => {
|
|
2092
|
+
if (shouldStopClickPropagationRef.current) event.stopPropagation();
|
|
2093
|
+
}),
|
|
2094
|
+
style: {
|
|
2095
|
+
...props.style,
|
|
2096
|
+
...controlSize,
|
|
2097
|
+
position: "absolute",
|
|
2098
|
+
pointerEvents: "none",
|
|
2099
|
+
opacity: 0,
|
|
2100
|
+
margin: 0,
|
|
2101
|
+
transform: "translateX(-100%)"
|
|
2102
|
+
}
|
|
2103
|
+
});
|
|
2104
|
+
}, "CheckboxBubbleInput"));
|
|
2105
|
+
function isFunction(value) {
|
|
2106
|
+
return typeof value === "function";
|
|
2107
|
+
}
|
|
2108
|
+
__name(isFunction, "isFunction");
|
|
2109
|
+
function isIndeterminate(checked) {
|
|
2110
|
+
return checked === "indeterminate";
|
|
2111
|
+
}
|
|
2112
|
+
__name(isIndeterminate, "isIndeterminate");
|
|
2113
|
+
function getState(checked) {
|
|
2114
|
+
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
2115
|
+
}
|
|
2116
|
+
__name(getState, "getState");
|
|
2117
|
+
// app/components/ui/checkbox.tsx
|
|
2118
|
+
var Checkbox = import_react.forwardRef(({ className, checked, indeterminate, onCheckedChange, ...props }, ref) => {
|
|
2119
|
+
const id = import_react.useId();
|
|
2120
|
+
const checkboxId = props.id ?? id;
|
|
2121
|
+
const checkedState = indeterminate ? "indeterminate" : checked ?? false;
|
|
2122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
2123
|
+
htmlFor: checkboxId,
|
|
2124
|
+
className: "p-2 -m-2 inline-flex items-center justify-center cursor-pointer",
|
|
2125
|
+
onClick: (e) => e.stopPropagation(),
|
|
2126
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
2127
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox$1, {
|
|
2128
|
+
ref,
|
|
2129
|
+
id: checkboxId,
|
|
2130
|
+
checked: checkedState,
|
|
2131
|
+
onCheckedChange: (state) => {
|
|
2132
|
+
onCheckedChange?.(state === true);
|
|
2133
|
+
},
|
|
2134
|
+
className: cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", "data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", "data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", className),
|
|
2135
|
+
...props,
|
|
2136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicator, {
|
|
2137
|
+
className: "flex items-center justify-center text-current",
|
|
2138
|
+
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Minus, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "h-3.5 w-3.5" })
|
|
2139
|
+
})
|
|
2140
|
+
})
|
|
2141
|
+
});
|
|
2142
|
+
});
|
|
2143
|
+
Checkbox.displayName = "Checkbox";
|
|
2144
|
+
// app/components/runs-table.tsx
|
|
2145
|
+
function RunActionsDropdownContentInner({ env, runId, runStatus, onSuccess }) {
|
|
2146
|
+
const [events, setEvents] = (0, import_react.useState)(void 0);
|
|
2147
|
+
const [eventsLoading, setEventsLoading] = (0, import_react.useState)(true);
|
|
2148
|
+
const [run, setRun] = (0, import_react.useState)(void 0);
|
|
2149
|
+
const [runIdentityLoading, setRunIdentityLoading] = (0, import_react.useState)(true);
|
|
2150
|
+
const status = run?.status || runStatus;
|
|
2151
|
+
(0, import_react.useEffect)(() => {
|
|
2152
|
+
setRun(void 0);
|
|
2153
|
+
setRunIdentityLoading(true);
|
|
2154
|
+
fetchRun(env, runId, "none").then((runResult) => {
|
|
2155
|
+
if (runResult.success) setRun(runResult.data);
|
|
2156
|
+
}).catch((err) => {
|
|
2157
|
+
console.error("Failed to fetch run:", err);
|
|
2158
|
+
}).finally(() => {
|
|
2159
|
+
setRunIdentityLoading(false);
|
|
2160
|
+
});
|
|
2161
|
+
setEvents(void 0);
|
|
2162
|
+
setEventsLoading(true);
|
|
2163
|
+
fetchEvents(env, runId, {
|
|
2164
|
+
limit: 1e3,
|
|
2165
|
+
sortOrder: "desc"
|
|
2166
|
+
}).then((eventsResult) => {
|
|
2167
|
+
if (eventsResult.success) setEvents(eventsResult.data.data);
|
|
2168
|
+
}).catch((err) => {
|
|
2169
|
+
console.error("Failed to fetch events:", err);
|
|
2170
|
+
}).finally(() => {
|
|
2171
|
+
setEventsLoading(false);
|
|
2172
|
+
});
|
|
2173
|
+
}, [env, runId]);
|
|
2174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunActionsDropdownItems, {
|
|
2175
|
+
env,
|
|
2176
|
+
runId,
|
|
2177
|
+
runStatus: status,
|
|
2178
|
+
events,
|
|
2179
|
+
eventsLoading,
|
|
2180
|
+
replayDisabledReason: getRunReplayDisabledReason(run, runIdentityLoading),
|
|
2181
|
+
stopPropagation: true,
|
|
2182
|
+
callbacks: { onSuccess }
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
function LazyDropdownMenu({ env, runId, runStatus, onSuccess }) {
|
|
2186
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
2187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu, {
|
|
2188
|
+
open: isOpen,
|
|
2189
|
+
onOpenChange: setIsOpen,
|
|
2190
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, {
|
|
2191
|
+
asChild: true,
|
|
2192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
2193
|
+
variant: "tertiary",
|
|
2194
|
+
size: "small",
|
|
2195
|
+
shape: "square",
|
|
2196
|
+
"aria-label": "Run actions",
|
|
2197
|
+
onClick: (e) => e.stopPropagation(),
|
|
2198
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ellipsis, { className: "h-4 w-4" })
|
|
2199
|
+
})
|
|
2200
|
+
}), isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuContent, {
|
|
2201
|
+
align: "end",
|
|
2202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunActionsDropdownContentInner, {
|
|
2203
|
+
env,
|
|
2204
|
+
runId,
|
|
2205
|
+
runStatus,
|
|
2206
|
+
onSuccess
|
|
2207
|
+
})
|
|
2208
|
+
})]
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
var statusMap = {
|
|
2212
|
+
pending: {
|
|
2213
|
+
label: "Pending",
|
|
2214
|
+
color: "bg-neutral-600 dark:bg-neutral-400"
|
|
2215
|
+
},
|
|
2216
|
+
running: {
|
|
2217
|
+
label: "Running",
|
|
2218
|
+
color: "bg-blue-600 dark:bg-blue-400"
|
|
2219
|
+
},
|
|
2220
|
+
completed: {
|
|
2221
|
+
label: "Completed",
|
|
2222
|
+
color: "bg-green-600 dark:bg-green-400"
|
|
2223
|
+
},
|
|
2224
|
+
failed: {
|
|
2225
|
+
label: "Failed",
|
|
2226
|
+
color: "bg-red-600 dark:bg-red-400"
|
|
2227
|
+
},
|
|
2228
|
+
cancelled: {
|
|
2229
|
+
label: "Cancelled",
|
|
2230
|
+
color: "bg-gray-600 dark:bg-gray-400"
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2233
|
+
var HOUR_MS = 36e5;
|
|
2234
|
+
var DAY_MS = 24 * HOUR_MS;
|
|
2235
|
+
/**
|
|
2236
|
+
* Listing-window presets, mirroring front's workflows o11y period picker.
|
|
2237
|
+
* The selected preset is sent to the backend as an explicit
|
|
2238
|
+
* startTime/endTime window so the analytics scan stays bounded. Presets
|
|
2239
|
+
* longer than the plan's observability lookback are disabled in the picker
|
|
2240
|
+
* (the backend would reject them with 402 observability-upgrade-required).
|
|
2241
|
+
*/
|
|
2242
|
+
var PERIOD_PRESETS = [
|
|
2243
|
+
{
|
|
2244
|
+
id: "1h",
|
|
2245
|
+
label: "Last hour",
|
|
2246
|
+
ms: HOUR_MS
|
|
2247
|
+
},
|
|
2248
|
+
{
|
|
2249
|
+
id: "6h",
|
|
2250
|
+
label: "Last 6 hours",
|
|
2251
|
+
ms: 6 * HOUR_MS
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
id: "24h",
|
|
2255
|
+
label: "Last 24 hours",
|
|
2256
|
+
ms: DAY_MS
|
|
2257
|
+
},
|
|
2258
|
+
{
|
|
2259
|
+
id: "3d",
|
|
2260
|
+
label: "Last 3 days",
|
|
2261
|
+
ms: 3 * DAY_MS
|
|
2262
|
+
},
|
|
2263
|
+
{
|
|
2264
|
+
id: "7d",
|
|
2265
|
+
label: "Last 7 days",
|
|
2266
|
+
ms: 7 * DAY_MS
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
id: "30d",
|
|
2270
|
+
label: "Last 30 days",
|
|
2271
|
+
ms: 30 * DAY_MS
|
|
2272
|
+
}
|
|
2273
|
+
];
|
|
2274
|
+
var DEFAULT_PERIOD = "24h";
|
|
2275
|
+
function isPeriodId(value) {
|
|
2276
|
+
return PERIOD_PRESETS.some((preset) => preset.id === value);
|
|
2277
|
+
}
|
|
2278
|
+
function useWorkflowFilter() {
|
|
2279
|
+
const navigate = useNavigate();
|
|
2280
|
+
const { pathname } = useLocation();
|
|
2281
|
+
const [searchParams] = useSearchParams();
|
|
2282
|
+
return (0, import_react.useCallback)((value) => {
|
|
2283
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
2284
|
+
if (value === "all") {
|
|
2285
|
+
params.delete("workflow");
|
|
2286
|
+
params.delete("status");
|
|
2287
|
+
} else params.set("workflow", value);
|
|
2288
|
+
navigate(`${pathname}?${params.toString()}`);
|
|
2289
|
+
}, [
|
|
2290
|
+
navigate,
|
|
2291
|
+
pathname,
|
|
2292
|
+
searchParams
|
|
2293
|
+
]);
|
|
2294
|
+
}
|
|
2295
|
+
function useStatusFilter() {
|
|
2296
|
+
const navigate = useNavigate();
|
|
2297
|
+
const { pathname } = useLocation();
|
|
2298
|
+
const [searchParams] = useSearchParams();
|
|
2299
|
+
return (0, import_react.useCallback)((value) => {
|
|
2300
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
2301
|
+
if (value === "all") params.delete("status");
|
|
2302
|
+
else params.set("status", value);
|
|
2303
|
+
navigate(`${pathname}?${params.toString()}`);
|
|
2304
|
+
}, [
|
|
2305
|
+
navigate,
|
|
2306
|
+
pathname,
|
|
2307
|
+
searchParams
|
|
2308
|
+
]);
|
|
2309
|
+
}
|
|
2310
|
+
function usePeriodFilter() {
|
|
2311
|
+
const navigate = useNavigate();
|
|
2312
|
+
const { pathname } = useLocation();
|
|
2313
|
+
const [searchParams] = useSearchParams();
|
|
2314
|
+
return (0, import_react.useCallback)((value) => {
|
|
2315
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
2316
|
+
if (value === DEFAULT_PERIOD) params.delete("period");
|
|
2317
|
+
else params.set("period", value);
|
|
2318
|
+
navigate(`${pathname}?${params.toString()}`);
|
|
2319
|
+
}, [
|
|
2320
|
+
navigate,
|
|
2321
|
+
pathname,
|
|
2322
|
+
searchParams
|
|
2323
|
+
]);
|
|
2324
|
+
}
|
|
2325
|
+
function FilterControls({ workflowNameFilter, status, seenWorkflowNames, sortOrder, loading, period, showPeriodPicker, planWindowMs, planUpgradeAvailable, onWorkflowChange, onStatusChange, onPeriodChange, onSortToggle, onRefresh, lastRefreshTime }) {
|
|
2326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2327
|
+
className: "flex items-center justify-between",
|
|
2328
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2329
|
+
className: "flex items-end gap-2",
|
|
2330
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
2331
|
+
className: "text-sm text-muted-foreground",
|
|
2332
|
+
children: "Last refreshed"
|
|
2333
|
+
}), lastRefreshTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, {
|
|
2334
|
+
date: lastRefreshTime,
|
|
2335
|
+
className: "text-sm text-muted-foreground",
|
|
2336
|
+
type: "distance"
|
|
2337
|
+
})]
|
|
2338
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2339
|
+
className: "flex items-center gap-4",
|
|
2340
|
+
children: [
|
|
2341
|
+
showPeriodPicker && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
2342
|
+
asChild: true,
|
|
2343
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, {
|
|
2344
|
+
value: period,
|
|
2345
|
+
onValueChange: onPeriodChange,
|
|
2346
|
+
disabled: loading,
|
|
2347
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, {
|
|
2348
|
+
className: "w-[150px] h-9",
|
|
2349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Time window" })
|
|
2350
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { children: PERIOD_PRESETS.map((preset) => {
|
|
2351
|
+
const beyondPlan = planWindowMs !== void 0 && preset.ms > planWindowMs;
|
|
2352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, {
|
|
2353
|
+
value: preset.id,
|
|
2354
|
+
disabled: beyondPlan,
|
|
2355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2356
|
+
className: "flex items-center gap-2",
|
|
2357
|
+
children: [preset.label, beyondPlan && planUpgradeAvailable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
2358
|
+
className: "text-xs text-muted-foreground",
|
|
2359
|
+
children: "Observability Plus"
|
|
2360
|
+
})]
|
|
2361
|
+
})
|
|
2362
|
+
}, preset.id);
|
|
2363
|
+
}) })]
|
|
2364
|
+
}) })
|
|
2365
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: planUpgradeAvailable ? "Time window for the runs list. Longer windows require Observability Plus." : "Time window for the runs list" })] }),
|
|
2366
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, {
|
|
2367
|
+
value: workflowNameFilter ?? "all",
|
|
2368
|
+
onValueChange: onWorkflowChange,
|
|
2369
|
+
disabled: loading,
|
|
2370
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, {
|
|
2371
|
+
className: "w-[180px] h-9",
|
|
2372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Filter by workflow" })
|
|
2373
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectContent, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, {
|
|
2374
|
+
value: "all",
|
|
2375
|
+
children: "All Workflows"
|
|
2376
|
+
}), Array.from(seenWorkflowNames).sort().map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, {
|
|
2377
|
+
value: name,
|
|
2378
|
+
children: parseWorkflowName(name)?.shortName || name
|
|
2379
|
+
}, name))] })]
|
|
2380
|
+
}),
|
|
2381
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
2382
|
+
asChild: true,
|
|
2383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, {
|
|
2384
|
+
value: status || "all",
|
|
2385
|
+
onValueChange: onStatusChange,
|
|
2386
|
+
disabled: loading,
|
|
2387
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, {
|
|
2388
|
+
className: "w-[140px] h-9",
|
|
2389
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Filter by status" })
|
|
2390
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectContent, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, {
|
|
2391
|
+
value: "all",
|
|
2392
|
+
children: "Any status"
|
|
2393
|
+
}), Object.entries(statusMap).map(([status, { label, color }]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, {
|
|
2394
|
+
value: status,
|
|
2395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2396
|
+
className: "flex items-center",
|
|
2397
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${color} size-1.5 rounded-full mr-2` }), label]
|
|
2398
|
+
})
|
|
2399
|
+
}, status))] })]
|
|
2400
|
+
}) })
|
|
2401
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Filter runs by status" })] }),
|
|
2402
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
2403
|
+
asChild: true,
|
|
2404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
2405
|
+
variant: "secondary",
|
|
2406
|
+
size: "small",
|
|
2407
|
+
onClick: onSortToggle,
|
|
2408
|
+
disabled: loading,
|
|
2409
|
+
children: [sortOrder === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowDownAZ, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpAZ, { className: "h-4 w-4" }), sortOrder === "desc" ? "Newest" : "Oldest"]
|
|
2410
|
+
})
|
|
2411
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: sortOrder === "desc" ? "Showing newest first" : "Showing oldest first" })] }),
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
2413
|
+
asChild: true,
|
|
2414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
2415
|
+
variant: "secondary",
|
|
2416
|
+
size: "small",
|
|
2417
|
+
onClick: onRefresh,
|
|
2418
|
+
disabled: loading,
|
|
2419
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshCw, { className: loading ? "animate-spin" : "" }), "Refresh"]
|
|
2420
|
+
})
|
|
2421
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Note that this resets pages" })] })
|
|
2422
|
+
]
|
|
2423
|
+
})]
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
/**
|
|
2427
|
+
* RunsTable - Displays workflow runs with server-side pagination.
|
|
2428
|
+
* Uses the PaginatingTable pattern: fetches data for each page as needed from the server.
|
|
2429
|
+
* The table and fetching behavior are intertwined - pagination controls trigger new API calls.
|
|
2430
|
+
*
|
|
2431
|
+
* World configuration is read from server-side environment variables.
|
|
2432
|
+
* The env object passed to server actions is empty - the server uses process.env.
|
|
2433
|
+
*/
|
|
2434
|
+
function RunsTable({ onRunClick }) {
|
|
2435
|
+
const [searchParams] = useSearchParams();
|
|
2436
|
+
const handleWorkflowFilter = useWorkflowFilter();
|
|
2437
|
+
const handleStatusFilter = useStatusFilter();
|
|
2438
|
+
const { serverConfig } = useServerConfig();
|
|
2439
|
+
const rawStatus = searchParams.get("status");
|
|
2440
|
+
const validStatuses = Object.keys(statusMap);
|
|
2441
|
+
const status = rawStatus === "all" || rawStatus && validStatuses.includes(rawStatus) ? rawStatus : void 0;
|
|
2442
|
+
const workflowNameFilter = searchParams.get("workflow");
|
|
2443
|
+
const rawPeriod = searchParams.get("period");
|
|
2444
|
+
const period = isPeriodId(rawPeriod) ? rawPeriod : DEFAULT_PERIOD;
|
|
2445
|
+
const periodPreset = PERIOD_PRESETS.find((preset) => preset.id === period) ?? PERIOD_PRESETS[2];
|
|
2446
|
+
const handlePeriodFilter = usePeriodFilter();
|
|
2447
|
+
const [sortOrder, setSortOrder] = (0, import_react.useState)("desc");
|
|
2448
|
+
const [lastRefreshTime, setLastRefreshTime] = (0, import_react.useState)(() => /* @__PURE__ */ new Date());
|
|
2449
|
+
const [hasLoadedOnce, setHasLoadedOnce] = (0, import_react.useState)(false);
|
|
2450
|
+
const env = (0, import_react.useMemo)(() => ({}), []);
|
|
2451
|
+
const isLocal = serverConfig.backendId === "local" || serverConfig.backendId === "@workflow/world-local";
|
|
2452
|
+
const localDataDirPath = serverConfig.displayInfo?.["local.dataDirPath"];
|
|
2453
|
+
const localShortName = serverConfig.displayInfo?.["local.shortName"];
|
|
2454
|
+
const [seenWorkflowNames, setSeenWorkflowNames] = (0, import_react.useState)(/* @__PURE__ */ new Set());
|
|
2455
|
+
const isVercelBackend = serverConfig.backendId?.includes("vercel") ?? false;
|
|
2456
|
+
const [listingWindow, setListingWindow] = (0, import_react.useState)(() => isVercelBackend ? getListingWindow(period, periodPreset.ms) : void 0);
|
|
2457
|
+
(0, import_react.useEffect)(() => {
|
|
2458
|
+
setListingWindow(isVercelBackend ? getListingWindow(period, periodPreset.ms) : void 0);
|
|
2459
|
+
}, [
|
|
2460
|
+
isVercelBackend,
|
|
2461
|
+
period,
|
|
2462
|
+
periodPreset.ms
|
|
2463
|
+
]);
|
|
2464
|
+
const refreshListingWindow = (0, import_react.useCallback)(() => {
|
|
2465
|
+
if (isVercelBackend) setListingWindow(advanceListingWindow(period, periodPreset.ms));
|
|
2466
|
+
}, [
|
|
2467
|
+
isVercelBackend,
|
|
2468
|
+
period,
|
|
2469
|
+
periodPreset.ms
|
|
2470
|
+
]);
|
|
2471
|
+
const { items: runs, error, isLoading, isLoadingMore, hasMore, loadMore, reload, refresh, pageInfo: analyticsPageInfo } = useWorkflowRunsInfinite(env, {
|
|
2472
|
+
sortOrder,
|
|
2473
|
+
workflowName: workflowNameFilter === "all" ? void 0 : workflowNameFilter,
|
|
2474
|
+
status: status === "all" ? void 0 : status,
|
|
2475
|
+
startTime: listingWindow?.startTime,
|
|
2476
|
+
endTime: listingWindow?.endTime
|
|
2477
|
+
});
|
|
2478
|
+
const [planInfo, setPlanInfo] = (0, import_react.useState)(void 0);
|
|
2479
|
+
(0, import_react.useEffect)(() => {
|
|
2480
|
+
if (analyticsPageInfo) setPlanInfo(analyticsPageInfo);
|
|
2481
|
+
}, [analyticsPageInfo]);
|
|
2482
|
+
const planWindowMs = planInfo !== void 0 ? planInfo.currentLookbackDays * DAY_MS : void 0;
|
|
2483
|
+
const [scrollRoot, setScrollRoot] = (0, import_react.useState)(null);
|
|
2484
|
+
const sentinelRef = useLoadMoreOnScroll(loadMore, {
|
|
2485
|
+
hasMore,
|
|
2486
|
+
isLoadingMore,
|
|
2487
|
+
root: scrollRoot
|
|
2488
|
+
});
|
|
2489
|
+
const selection = useTableSelection({ getItemId: (run) => run.runId });
|
|
2490
|
+
const [isBulkCancelling, setIsBulkCancelling] = (0, import_react.useState)(false);
|
|
2491
|
+
const [isBulkReenqueuing, setIsBulkReenqueuing] = (0, import_react.useState)(false);
|
|
2492
|
+
const isLocalAndHasMissingData = isLocal && (!localDataDirPath || !runs.length);
|
|
2493
|
+
(0, import_react.useEffect)(() => {
|
|
2494
|
+
if (runs.length > 0) {
|
|
2495
|
+
const newNames = new Set(runs.map((run) => run.workflowName));
|
|
2496
|
+
setSeenWorkflowNames((prev) => {
|
|
2497
|
+
const updated = new Set(prev);
|
|
2498
|
+
for (const name of newNames) updated.add(name);
|
|
2499
|
+
return updated;
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
}, [runs]);
|
|
2503
|
+
const loading = isLoading;
|
|
2504
|
+
(0, import_react.useEffect)(() => {
|
|
2505
|
+
if (!loading && !hasLoadedOnce) setHasLoadedOnce(true);
|
|
2506
|
+
}, [loading, hasLoadedOnce]);
|
|
2507
|
+
(0, import_react.useEffect)(() => {
|
|
2508
|
+
setHasLoadedOnce(false);
|
|
2509
|
+
}, [
|
|
2510
|
+
workflowNameFilter,
|
|
2511
|
+
status,
|
|
2512
|
+
sortOrder
|
|
2513
|
+
]);
|
|
2514
|
+
const onReload = (0, import_react.useCallback)(() => {
|
|
2515
|
+
setLastRefreshTime(() => /* @__PURE__ */ new Date());
|
|
2516
|
+
setHasLoadedOnce(false);
|
|
2517
|
+
refreshListingWindow();
|
|
2518
|
+
reload();
|
|
2519
|
+
}, [reload, refreshListingWindow]);
|
|
2520
|
+
const onRefresh = (0, import_react.useCallback)(() => {
|
|
2521
|
+
setLastRefreshTime(() => /* @__PURE__ */ new Date());
|
|
2522
|
+
refreshListingWindow();
|
|
2523
|
+
refresh();
|
|
2524
|
+
}, [refresh, refreshListingWindow]);
|
|
2525
|
+
const selectedRuns = (0, import_react.useMemo)(() => {
|
|
2526
|
+
return runs.filter((run) => selection.selectedIds.has(run.runId));
|
|
2527
|
+
}, [runs, selection.selectedIds]);
|
|
2528
|
+
const cancellableSelectedRuns = (0, import_react.useMemo)(() => {
|
|
2529
|
+
return selectedRuns.filter((run) => run.status === "pending" || run.status === "running");
|
|
2530
|
+
}, [selectedRuns]);
|
|
2531
|
+
const hasCancellableSelection = cancellableSelectedRuns.length > 0;
|
|
2532
|
+
const exceedsBulkCancelLimit = cancellableSelectedRuns.length > 500;
|
|
2533
|
+
const handleBulkCancel = (0, import_react.useCallback)(async () => {
|
|
2534
|
+
if (isBulkCancelling || cancellableSelectedRuns.length === 0 || cancellableSelectedRuns.length > 500) return;
|
|
2535
|
+
setIsBulkCancelling(true);
|
|
2536
|
+
try {
|
|
2537
|
+
const { summary, results } = await bulkCancelRuns(env, cancellableSelectedRuns.map((run) => run.runId));
|
|
2538
|
+
const parts = [];
|
|
2539
|
+
if (summary.cancelled > 0) parts.push(`${summary.cancelled} cancelled`);
|
|
2540
|
+
if (summary.alreadyCancelled > 0) parts.push(`${summary.alreadyCancelled} already cancelled`);
|
|
2541
|
+
if (summary.notCancellable > 0) parts.push(`${summary.notCancellable} not cancellable`);
|
|
2542
|
+
if (summary.notFound > 0) parts.push(`${summary.notFound} not found`);
|
|
2543
|
+
if (summary.failed > 0) parts.push(`${summary.failed} failed`);
|
|
2544
|
+
const message = parts.join(", ") || "No runs cancelled";
|
|
2545
|
+
const severity = bulkCancelToastSeverity(summary);
|
|
2546
|
+
if (severity === "error") toast.error(message);
|
|
2547
|
+
else if (severity === "warning") toast.warning(message);
|
|
2548
|
+
else toast.success(message);
|
|
2549
|
+
for (const result of results) if (!shouldRetainSelectionAfterBulkCancel(result)) selection.deselectById(result.runId);
|
|
2550
|
+
onReload();
|
|
2551
|
+
} catch (err) {
|
|
2552
|
+
toast.error("Failed to cancel runs", { description: err instanceof Error ? err.message : "Unknown error" });
|
|
2553
|
+
} finally {
|
|
2554
|
+
setIsBulkCancelling(false);
|
|
2555
|
+
}
|
|
2556
|
+
}, [
|
|
2557
|
+
env,
|
|
2558
|
+
cancellableSelectedRuns,
|
|
2559
|
+
isBulkCancelling,
|
|
2560
|
+
selection,
|
|
2561
|
+
onReload
|
|
2562
|
+
]);
|
|
2563
|
+
const handleBulkReenqueue = (0, import_react.useCallback)(async () => {
|
|
2564
|
+
if (isBulkReenqueuing || selectedRuns.length === 0) return;
|
|
2565
|
+
setIsBulkReenqueuing(true);
|
|
2566
|
+
try {
|
|
2567
|
+
const results = await Promise.allSettled(selectedRuns.map((run) => reenqueueRun(env, run.runId)));
|
|
2568
|
+
const succeeded = results.filter((r) => r.status === "fulfilled").length;
|
|
2569
|
+
const failed = results.filter((r) => r.status === "rejected").length;
|
|
2570
|
+
if (failed === 0) toast.success(`Re-enqueued ${succeeded} run${succeeded !== 1 ? "s" : ""}`);
|
|
2571
|
+
else if (succeeded === 0) toast.error(`Failed to re-enqueue ${failed} run${failed !== 1 ? "s" : ""}`);
|
|
2572
|
+
else toast.warning(`Re-enqueued ${succeeded} run${succeeded !== 1 ? "s" : ""}, ${failed} failed`);
|
|
2573
|
+
selection.clearSelection();
|
|
2574
|
+
onReload();
|
|
2575
|
+
} catch (err) {
|
|
2576
|
+
toast.error("Failed to re-enqueue runs", { description: err instanceof Error ? err.message : "Unknown error" });
|
|
2577
|
+
} finally {
|
|
2578
|
+
setIsBulkReenqueuing(false);
|
|
2579
|
+
}
|
|
2580
|
+
}, [
|
|
2581
|
+
env,
|
|
2582
|
+
selectedRuns,
|
|
2583
|
+
isBulkReenqueuing,
|
|
2584
|
+
selection,
|
|
2585
|
+
onReload
|
|
2586
|
+
]);
|
|
2587
|
+
const toggleSortOrder = () => {
|
|
2588
|
+
setSortOrder((prev) => prev === "desc" ? "asc" : "desc");
|
|
2589
|
+
};
|
|
2590
|
+
(0, import_react.useEffect)(() => {
|
|
2591
|
+
if (isLocalAndHasMissingData) {
|
|
2592
|
+
const interval = setInterval(() => {
|
|
2593
|
+
onRefresh();
|
|
2594
|
+
}, 5e3);
|
|
2595
|
+
return () => clearInterval(interval);
|
|
2596
|
+
}
|
|
2597
|
+
}, [isLocalAndHasMissingData, onRefresh]);
|
|
2598
|
+
(0, import_react.useEffect)(() => {
|
|
2599
|
+
const handleVisibilityChange = () => {
|
|
2600
|
+
if (document.visibilityState === "visible" && lastRefreshTime) {
|
|
2601
|
+
if (Date.now() - lastRefreshTime.getTime() >= 1e4) onReload();
|
|
2602
|
+
}
|
|
2603
|
+
};
|
|
2604
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
2605
|
+
return () => {
|
|
2606
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
2607
|
+
};
|
|
2608
|
+
}, [lastRefreshTime, onReload]);
|
|
2609
|
+
const localDirText = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
|
|
2610
|
+
className: "font-mono",
|
|
2611
|
+
children: localShortName || "current directory"
|
|
2612
|
+
});
|
|
2613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterControls, {
|
|
2615
|
+
workflowNameFilter,
|
|
2616
|
+
status,
|
|
2617
|
+
seenWorkflowNames,
|
|
2618
|
+
sortOrder,
|
|
2619
|
+
loading,
|
|
2620
|
+
period,
|
|
2621
|
+
showPeriodPicker: isVercelBackend,
|
|
2622
|
+
planWindowMs,
|
|
2623
|
+
planUpgradeAvailable: planInfo?.upgradeAvailable ?? false,
|
|
2624
|
+
onWorkflowChange: handleWorkflowFilter,
|
|
2625
|
+
onStatusChange: handleStatusFilter,
|
|
2626
|
+
onPeriodChange: handlePeriodFilter,
|
|
2627
|
+
onSortToggle: toggleSortOrder,
|
|
2628
|
+
onRefresh: onReload,
|
|
2629
|
+
lastRefreshTime
|
|
2630
|
+
}),
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
2632
|
+
className: "overflow-hidden mt-4 bg-background",
|
|
2633
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardContent, {
|
|
2634
|
+
ref: setScrollRoot,
|
|
2635
|
+
className: "p-0 max-h-[calc(100vh-280px)] overflow-auto",
|
|
2636
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, { children: [
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
2638
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10",
|
|
2639
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, {
|
|
2640
|
+
checked: selection.isAllSelected(runs),
|
|
2641
|
+
indeterminate: selection.isSomeSelected(runs),
|
|
2642
|
+
onCheckedChange: () => selection.toggleSelectAll(runs),
|
|
2643
|
+
"aria-label": "Select all runs",
|
|
2644
|
+
disabled: !runs.length
|
|
2645
|
+
})
|
|
2646
|
+
}),
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
2648
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
2649
|
+
children: "Workflow"
|
|
2650
|
+
}),
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
2652
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
2653
|
+
children: "Run ID"
|
|
2654
|
+
}),
|
|
2655
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
2656
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
2657
|
+
children: "Status"
|
|
2658
|
+
}),
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
2660
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
2661
|
+
children: "Started"
|
|
2662
|
+
}),
|
|
2663
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
|
|
2664
|
+
className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10",
|
|
2665
|
+
children: "Completed"
|
|
2666
|
+
}),
|
|
2667
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, { className: "sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10" })
|
|
2668
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableBody, { children: [error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2669
|
+
colSpan: 7,
|
|
2670
|
+
className: "h-[400px]",
|
|
2671
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
2672
|
+
className: "flex items-center justify-center h-full",
|
|
2673
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
|
|
2674
|
+
variant: "destructive",
|
|
2675
|
+
className: "max-w-md",
|
|
2676
|
+
children: [
|
|
2677
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "h-4 w-4" }),
|
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: getErrorTitle(error, "Error loading runs") }),
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDescription, { children: getErrorMessage(error) })
|
|
2680
|
+
]
|
|
2681
|
+
})
|
|
2682
|
+
})
|
|
2683
|
+
}) }) : loading && !hasLoadedOnce ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2684
|
+
colSpan: 7,
|
|
2685
|
+
className: "h-[400px]",
|
|
2686
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
2687
|
+
className: "flex items-center justify-center h-full",
|
|
2688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-8 w-8 animate-spin text-muted-foreground" })
|
|
2689
|
+
})
|
|
2690
|
+
}) }) : runs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2691
|
+
colSpan: 7,
|
|
2692
|
+
className: "h-[400px]",
|
|
2693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2694
|
+
className: "text-sm text-center text-muted-foreground flex flex-col items-center justify-center gap-3 h-full",
|
|
2695
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
2696
|
+
className: "text-sm",
|
|
2697
|
+
children: [
|
|
2698
|
+
"No workflow runs found",
|
|
2699
|
+
isLocalAndHasMissingData ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" in ", localDirText] }) : "",
|
|
2700
|
+
"."
|
|
2701
|
+
]
|
|
2702
|
+
}), isLocalAndHasMissingData && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
2703
|
+
className: "text-sm flex items-center gap-2",
|
|
2704
|
+
children: "This view will update once you run a workflow."
|
|
2705
|
+
})]
|
|
2706
|
+
})
|
|
2707
|
+
}) }) : runs.map((run) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, {
|
|
2708
|
+
className: "cursor-pointer group relative",
|
|
2709
|
+
onClick: () => onRunClick(run.runId),
|
|
2710
|
+
"data-selected": selection.isSelected(run),
|
|
2711
|
+
children: [
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2713
|
+
className: "py-2",
|
|
2714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, {
|
|
2715
|
+
checked: selection.isSelected(run),
|
|
2716
|
+
onCheckedChange: () => selection.toggleSelection(run),
|
|
2717
|
+
"aria-label": `Select run ${run.runId}`
|
|
2718
|
+
})
|
|
2719
|
+
}),
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2721
|
+
className: "py-2",
|
|
2722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyableText, {
|
|
2723
|
+
text: run.workflowName,
|
|
2724
|
+
overlay: true,
|
|
2725
|
+
children: parseWorkflowName(run.workflowName)?.shortName || "?"
|
|
2726
|
+
})
|
|
2727
|
+
}),
|
|
2728
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2729
|
+
className: "font-mono text-xs py-2",
|
|
2730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyableText, {
|
|
2731
|
+
text: run.runId,
|
|
2732
|
+
overlay: true,
|
|
2733
|
+
children: run.runId
|
|
2734
|
+
})
|
|
2735
|
+
}),
|
|
2736
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2737
|
+
className: "py-2",
|
|
2738
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBadge, {
|
|
2739
|
+
status: run.status,
|
|
2740
|
+
context: run,
|
|
2741
|
+
durationMs: run.startedAt ? (run.completedAt ? new Date(run.completedAt).getTime() : Date.now()) - new Date(run.startedAt).getTime() : void 0
|
|
2742
|
+
})
|
|
2743
|
+
}),
|
|
2744
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2745
|
+
className: "py-2 text-muted-foreground text-xs",
|
|
2746
|
+
children: run.startedAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.startedAt }) : "-"
|
|
2747
|
+
}),
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2749
|
+
className: "py-2 text-muted-foreground text-xs",
|
|
2750
|
+
children: run.completedAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.completedAt }) : "-"
|
|
2751
|
+
}),
|
|
2752
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2753
|
+
className: "py-2",
|
|
2754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LazyDropdownMenu, {
|
|
2755
|
+
env,
|
|
2756
|
+
runId: run.runId,
|
|
2757
|
+
runStatus: run.status,
|
|
2758
|
+
onSuccess: onReload
|
|
2759
|
+
})
|
|
2760
|
+
})
|
|
2761
|
+
]
|
|
2762
|
+
}, run.runId)), isLoadingMore && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
2763
|
+
colSpan: 7,
|
|
2764
|
+
className: "py-3",
|
|
2765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2766
|
+
className: "flex items-center justify-center gap-2 text-sm text-muted-foreground",
|
|
2767
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-4 w-4 animate-spin" }), "Loading more runs…"]
|
|
2768
|
+
})
|
|
2769
|
+
}) })] })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
2770
|
+
ref: sentinelRef,
|
|
2771
|
+
"aria-hidden": true,
|
|
2772
|
+
className: "h-px"
|
|
2773
|
+
})]
|
|
2774
|
+
})
|
|
2775
|
+
}),
|
|
2776
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2777
|
+
className: "flex items-center justify-between mt-4 text-sm text-muted-foreground",
|
|
2778
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: runs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2779
|
+
"Showing ",
|
|
2780
|
+
runs.length,
|
|
2781
|
+
" run",
|
|
2782
|
+
runs.length === 1 ? "" : "s",
|
|
2783
|
+
!hasMore && !loading ? " · end of list" : ""
|
|
2784
|
+
] }) }), isVercelBackend && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [periodPreset.label, planInfo?.upgradeAvailable ? ` · plan window ${planInfo.currentLookbackDays} day${planInfo.currentLookbackDays === 1 ? "" : "s"}` : ""] })]
|
|
2785
|
+
}),
|
|
2786
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectionBar, {
|
|
2787
|
+
selectionCount: selection.selectionCount,
|
|
2788
|
+
onClearSelection: selection.clearSelection,
|
|
2789
|
+
itemLabel: "runs",
|
|
2790
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
2791
|
+
asChild: true,
|
|
2792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
2793
|
+
variant: "tertiary",
|
|
2794
|
+
size: "small",
|
|
2795
|
+
className: "h-7 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",
|
|
2796
|
+
onClick: handleBulkReenqueue,
|
|
2797
|
+
disabled: isBulkReenqueuing || selectedRuns.length === 0,
|
|
2798
|
+
children: [isBulkReenqueuing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-4 w-4 mr-1 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zap, { className: "h-4 w-4 mr-1" }), isBulkReenqueuing ? "Re-enqueuing..." : "Re-enqueue"]
|
|
2799
|
+
})
|
|
2800
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Re-enqueue the workflow orchestration layer for selected runs. Useful if workflows appear stuck." })] }), hasCancellableSelection && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
2801
|
+
asChild: true,
|
|
2802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
2803
|
+
className: "inline-flex",
|
|
2804
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
2805
|
+
variant: "tertiary",
|
|
2806
|
+
size: "small",
|
|
2807
|
+
className: "h-7 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",
|
|
2808
|
+
onClick: handleBulkCancel,
|
|
2809
|
+
disabled: isBulkCancelling || exceedsBulkCancelLimit,
|
|
2810
|
+
children: [
|
|
2811
|
+
isBulkCancelling ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-4 w-4 mr-1 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleX, { className: "h-4 w-4 mr-1" }),
|
|
2812
|
+
"Cancel",
|
|
2813
|
+
" ",
|
|
2814
|
+
cancellableSelectedRuns.length !== selection.selectionCount ? `${cancellableSelectedRuns.length} ` : "",
|
|
2815
|
+
isBulkCancelling ? "cancelling..." : ""
|
|
2816
|
+
]
|
|
2817
|
+
})
|
|
2818
|
+
})
|
|
2819
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: exceedsBulkCancelLimit ? `Select up to 500 runs at a time.` : "Cancel the selected pending and running runs." })] })] })
|
|
2820
|
+
})
|
|
2821
|
+
] });
|
|
2822
|
+
}
|
|
2823
|
+
// app/routes/home.tsx
|
|
2824
|
+
var home_default = withComponentProps(function Home() {
|
|
2825
|
+
const navigate = useNavigate();
|
|
2826
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
2827
|
+
const sidebar = searchParams.get("sidebar");
|
|
2828
|
+
const hookId = searchParams.get("hookId");
|
|
2829
|
+
const tab = searchParams.get("tab") || "runs";
|
|
2830
|
+
const setTab = (value) => {
|
|
2831
|
+
setSearchParams((prev) => {
|
|
2832
|
+
prev.set("tab", value);
|
|
2833
|
+
return prev;
|
|
2834
|
+
}, { replace: true });
|
|
2835
|
+
};
|
|
2836
|
+
const selectedHookId = sidebar === "hook" && hookId ? hookId : void 0;
|
|
2837
|
+
const handleRunClick = (runId, streamId) => {
|
|
2838
|
+
if (!streamId) navigate(`/run/${runId}`);
|
|
2839
|
+
else navigate(`/run/${runId}/streams/${streamId}`);
|
|
2840
|
+
};
|
|
2841
|
+
const handleHookSelect = (hookId, runId) => {
|
|
2842
|
+
if (hookId) navigate(`/run/${runId}?sidebar=hook&hookId=${hookId}`);
|
|
2843
|
+
else navigate(`/run/${runId}`);
|
|
2844
|
+
};
|
|
2845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
2846
|
+
className: "max-w-7xl mx-auto px-4",
|
|
2847
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs, {
|
|
2848
|
+
value: tab,
|
|
2849
|
+
onValueChange: setTab,
|
|
2850
|
+
className: "w-full",
|
|
2851
|
+
children: [
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsList, {
|
|
2853
|
+
className: "mb-4",
|
|
2854
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTrigger, {
|
|
2855
|
+
value: "runs",
|
|
2856
|
+
children: "Runs"
|
|
2857
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTrigger, {
|
|
2858
|
+
value: "hooks",
|
|
2859
|
+
children: "Hooks"
|
|
2860
|
+
})]
|
|
2861
|
+
}),
|
|
2862
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
2863
|
+
value: "runs",
|
|
2864
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
2865
|
+
title: "Failed to load workflow runs",
|
|
2866
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunsTable, { onRunClick: handleRunClick })
|
|
2867
|
+
})
|
|
2868
|
+
}),
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
2870
|
+
value: "hooks",
|
|
2871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
2872
|
+
title: "Failed to load hooks",
|
|
2873
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HooksTable, {
|
|
2874
|
+
onHookClick: handleHookSelect,
|
|
2875
|
+
selectedHookId
|
|
2876
|
+
})
|
|
2877
|
+
})
|
|
2878
|
+
})
|
|
2879
|
+
]
|
|
2880
|
+
})
|
|
2881
|
+
});
|
|
2882
|
+
});
|
|
2883
|
+
export { home_default as default };
|