@acmekit/dashboard 2.13.34 → 2.13.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/{api-key-management-create-4AG76FJV.mjs → api-key-management-create-U37VC624.mjs} +3 -3
  2. package/dist/{api-key-management-detail-T2TB4KST.mjs → api-key-management-detail-ZYKL4ATI.mjs} +10 -10
  3. package/dist/{api-key-management-edit-R44OHS7B.mjs → api-key-management-edit-TSZGMIBL.mjs} +3 -3
  4. package/dist/{api-key-management-list-QK4Q7Y5I.mjs → api-key-management-list-HCJFJWWB.mjs} +3 -3
  5. package/dist/app.css +31 -0
  6. package/dist/app.js +3726 -1386
  7. package/dist/app.mjs +240 -38
  8. package/dist/{chunk-GBFVWROS.mjs → chunk-5IEHCYJO.mjs} +1 -1
  9. package/dist/{chunk-DQCEH3X2.mjs → chunk-7F3CWXUH.mjs} +1 -1
  10. package/dist/chunk-A7ULKHDE.mjs +126 -0
  11. package/dist/{chunk-DN3MIYQH.mjs → chunk-FKTMBR44.mjs} +1 -1
  12. package/dist/chunk-GBPAZAJK.mjs +34 -0
  13. package/dist/{chunk-YRWSG3YM.mjs → chunk-HHPPTD3B.mjs} +1 -1
  14. package/dist/chunk-LP6CPB7N.mjs +213 -0
  15. package/dist/{chunk-EFRMWHRX.mjs → chunk-PFZQYK7R.mjs} +1 -1
  16. package/dist/{chunk-XIM7X4FB.mjs → chunk-SYACY6AL.mjs} +1 -1
  17. package/dist/{chunk-2U3RK3JG.mjs → chunk-VEI6HW6L.mjs} +3 -5
  18. package/dist/{chunk-ST2YB7JN.mjs → chunk-WLRJXEKL.mjs} +1 -1
  19. package/dist/{chunk-ULSPL3DR.mjs → chunk-XIP35KXF.mjs} +1 -1
  20. package/dist/{chunk-DTY37DDZ.mjs → chunk-YKIWIMJX.mjs} +1 -0
  21. package/dist/en.json +132 -3
  22. package/dist/{invite-XGPZZBUP.mjs → invite-3JSNOA2B.mjs} +3 -3
  23. package/dist/{login-GNP3QIPI.mjs → login-BEJ5EFGE.mjs} +9 -9
  24. package/dist/{profile-detail-YX27F7N6.mjs → profile-detail-QVTJC4JC.mjs} +3 -3
  25. package/dist/{profile-edit-2VRDU75O.mjs → profile-edit-MIO62TWH.mjs} +3 -3
  26. package/dist/{reset-password-TWRNZO6Z.mjs → reset-password-BN4KAJQL.mjs} +2 -2
  27. package/dist/{settings-3XWLL5LG.mjs → settings-GH5IWXHE.mjs} +3 -3
  28. package/dist/{translation-list-CCEQJNED.mjs → translation-list-JA22BUKN.mjs} +10 -10
  29. package/dist/{translations-edit-E57GVUFV.mjs → translations-edit-STTMANVT.mjs} +11 -11
  30. package/dist/{user-detail-KUSRRVNX.mjs → user-detail-WCXBFRGS.mjs} +3 -3
  31. package/dist/{user-edit-HTN3ZGCL.mjs → user-edit-XDVMJOS4.mjs} +3 -3
  32. package/dist/{user-invite-E3FAAU3V.mjs → user-invite-73ZDSDFC.mjs} +3 -3
  33. package/dist/{user-list-KNJ5S3IM.mjs → user-list-MPJXE3CA.mjs} +5 -5
  34. package/dist/{user-metadata-5GQK75DT.mjs → user-metadata-ADNTL3LT.mjs} +10 -10
  35. package/dist/workflow-analytics-4WCI4ODQ.mjs +152 -0
  36. package/dist/workflow-definition-detail-GI6CFBMG.mjs +94 -0
  37. package/dist/workflow-definition-list-GF3XAEPS.mjs +142 -0
  38. package/dist/workflow-execution-complete-step-WSRLO572.mjs +245 -0
  39. package/dist/workflow-execution-detail-3RH6EQSS.mjs +1411 -0
  40. package/dist/workflow-execution-list-AQEGAME4.mjs +596 -0
  41. package/dist/workflow-execution-rerun-WCYLYL3Q.mjs +138 -0
  42. package/dist/workflow-execution-run-MWN5KWNY.mjs +135 -0
  43. package/dist/workflow-scheduled-list-ZPXR7CZM.mjs +174 -0
  44. package/package.json +9 -9
  45. package/src/components/layout/main-layout/main-layout.tsx +28 -1
  46. package/src/dashboard-app/routes/get-route.map.tsx +71 -0
  47. package/src/hooks/api/workflow-definitions.tsx +79 -0
  48. package/src/hooks/api/workflow-executions.tsx +145 -1
  49. package/src/hooks/api/workflow-metrics.tsx +48 -0
  50. package/src/hooks/use-workflow-sse.tsx +78 -0
  51. package/src/i18n/translations/$schema.json +534 -4
  52. package/src/i18n/translations/en.json +132 -3
  53. package/src/routes/workflow-analytics/workflow-analytics.tsx +167 -0
  54. package/src/routes/workflow-definitions/workflow-definition-detail/workflow-definition-detail.tsx +98 -0
  55. package/src/routes/workflow-definitions/workflow-definition-list/components/workflow-definition-list-table/use-workflow-definition-table-columns.tsx +78 -0
  56. package/src/routes/workflow-definitions/workflow-definition-list/components/workflow-definition-list-table/workflow-definition-list-table.tsx +65 -0
  57. package/src/routes/workflow-definitions/workflow-definition-list/workflow-definition-list.tsx +15 -0
  58. package/src/routes/workflow-executions/constants.ts +16 -0
  59. package/src/routes/workflow-executions/utils.ts +170 -14
  60. package/src/routes/workflow-executions/workflow-execution-complete-step/workflow-execution-complete-step.tsx +270 -0
  61. package/src/routes/workflow-executions/workflow-execution-detail/breadcrumb.tsx +7 -1
  62. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-action-bar/index.ts +1 -0
  63. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-action-bar/workflow-execution-action-bar.tsx +212 -0
  64. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-error-card/index.ts +1 -0
  65. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-error-card/workflow-execution-error-card.tsx +59 -0
  66. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-history-section/workflow-execution-history-section.tsx +157 -6
  67. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-payload-section/workflow-execution-payload-section.tsx +122 -6
  68. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-timeline-section/workflow-execution-timeline-section.tsx +7 -1
  69. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-waiting-banner/index.ts +1 -0
  70. package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-waiting-banner/workflow-execution-waiting-banner.tsx +63 -0
  71. package/src/routes/workflow-executions/workflow-execution-detail/workflow-detail.tsx +46 -1
  72. package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-columns.tsx +7 -0
  73. package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-filters.tsx +7 -1
  74. package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-query.tsx +4 -2
  75. package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-auto-refresh.tsx +73 -0
  76. package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx +17 -1
  77. package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-row-actions.tsx +116 -0
  78. package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-saved-views.tsx +84 -0
  79. package/src/routes/workflow-executions/workflow-execution-list/workflow-execution-list.tsx +1 -1
  80. package/src/routes/workflow-executions/workflow-execution-rerun/workflow-execution-rerun.tsx +159 -0
  81. package/src/routes/workflow-executions/workflow-execution-run/workflow-execution-run.tsx +139 -0
  82. package/src/routes/workflow-scheduled/workflow-scheduled-list.tsx +269 -0
  83. package/dist/chunk-LKWTBYYC.mjs +0 -35
  84. package/dist/chunk-RPAL6FHW.mjs +0 -73
  85. package/dist/workflow-execution-detail-5O5VCXL3.mjs +0 -870
  86. package/dist/workflow-execution-list-DETG4MRT.mjs +0 -347
  87. /package/dist/{chunk-22YYMH6M.mjs → chunk-RISX76YT.mjs} +0 -0
@@ -0,0 +1,596 @@
1
+ import {
2
+ DateCell
3
+ } from "./chunk-QZOY6YYT.mjs";
4
+ import {
5
+ TRANSACTION_ERROR_STATES,
6
+ TRANSACTION_IN_PROGRESS_STATES,
7
+ getTransactionState,
8
+ getTransactionStateColor
9
+ } from "./chunk-LP6CPB7N.mjs";
10
+ import {
11
+ _DataTable,
12
+ useDataTable
13
+ } from "./chunk-YLPAZ2DP.mjs";
14
+ import {
15
+ useQueryParams
16
+ } from "./chunk-C76H5USB.mjs";
17
+ import "./chunk-DFFLVEZ5.mjs";
18
+ import "./chunk-535OVBXR.mjs";
19
+ import {
20
+ SingleColumnPage
21
+ } from "./chunk-RISX76YT.mjs";
22
+ import {
23
+ useExtension
24
+ } from "./chunk-C5P5PL3E.mjs";
25
+ import {
26
+ ActionMenu
27
+ } from "./chunk-S3REQHPQ.mjs";
28
+ import {
29
+ useCancelWorkflowExecution,
30
+ useRunWorkflow,
31
+ useWorkflowExecutions,
32
+ workflowExecutionsQueryKeys
33
+ } from "./chunk-A7ULKHDE.mjs";
34
+ import "./chunk-ITNQKZQQ.mjs";
35
+ import "./chunk-OAHCJFG3.mjs";
36
+ import "./chunk-S4DMV3ZT.mjs";
37
+ import "./chunk-FXYH54JP.mjs";
38
+ import "./chunk-774WSTCC.mjs";
39
+ import "./chunk-YKIWIMJX.mjs";
40
+ import "./chunk-QZ7TP4HQ.mjs";
41
+
42
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx
43
+ import { PlayMiniSolid } from "@acmekit/icons";
44
+ import { Button as Button2, Container, Heading, Text as Text2 } from "@acmekit/ui";
45
+ import { keepPreviousData } from "@tanstack/react-query";
46
+ import { useTranslation as useTranslation5 } from "react-i18next";
47
+ import { Link } from "react-router-dom";
48
+
49
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-auto-refresh.tsx
50
+ import { ArrowPathMini } from "@acmekit/icons";
51
+ import { DropdownMenu, IconButton } from "@acmekit/ui";
52
+ import { useQueryClient } from "@tanstack/react-query";
53
+ import { useCallback, useEffect, useRef, useState } from "react";
54
+ import { jsx, jsxs } from "react/jsx-runtime";
55
+ var INTERVALS = [
56
+ { label: "Off", value: 0 },
57
+ { label: "5s", value: 5e3 },
58
+ { label: "10s", value: 1e4 },
59
+ { label: "30s", value: 3e4 }
60
+ ];
61
+ var WorkflowExecutionAutoRefresh = () => {
62
+ const queryClient = useQueryClient();
63
+ const [interval, setInterval_] = useState(0);
64
+ const intervalRef = useRef(null);
65
+ const refresh = useCallback(() => {
66
+ queryClient.invalidateQueries({
67
+ queryKey: workflowExecutionsQueryKeys.lists()
68
+ });
69
+ }, [queryClient]);
70
+ useEffect(() => {
71
+ if (intervalRef.current) {
72
+ clearInterval(intervalRef.current);
73
+ intervalRef.current = null;
74
+ }
75
+ if (interval > 0) {
76
+ intervalRef.current = setInterval(refresh, interval);
77
+ }
78
+ return () => {
79
+ if (intervalRef.current) {
80
+ clearInterval(intervalRef.current);
81
+ }
82
+ };
83
+ }, [interval, refresh]);
84
+ const activeLabel = INTERVALS.find((i) => i.value === interval)?.label;
85
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
86
+ /* @__PURE__ */ jsx(
87
+ IconButton,
88
+ {
89
+ size: "small",
90
+ variant: "transparent",
91
+ onClick: refresh,
92
+ children: /* @__PURE__ */ jsx(ArrowPathMini, {})
93
+ }
94
+ ),
95
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
96
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { className: "txt-compact-small text-ui-fg-muted hover:text-ui-fg-subtle rounded px-1.5 py-0.5 transition-colors", children: activeLabel }) }),
97
+ /* @__PURE__ */ jsx(DropdownMenu.Content, { align: "end", children: INTERVALS.map((opt) => /* @__PURE__ */ jsx(
98
+ DropdownMenu.Item,
99
+ {
100
+ onClick: () => setInterval_(opt.value),
101
+ className: interval === opt.value ? "font-medium" : "",
102
+ children: opt.label
103
+ },
104
+ opt.value
105
+ )) })
106
+ ] })
107
+ ] });
108
+ };
109
+
110
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-saved-views.tsx
111
+ import { Button, clx } from "@acmekit/ui";
112
+ import { useCallback as useCallback2, useMemo } from "react";
113
+ import { useTranslation } from "react-i18next";
114
+ import { useSearchParams } from "react-router-dom";
115
+ import { jsx as jsx2 } from "react/jsx-runtime";
116
+ var WorkflowExecutionSavedViews = () => {
117
+ const { t } = useTranslation();
118
+ const [searchParams, setSearchParams] = useSearchParams();
119
+ const views = useMemo(
120
+ () => [
121
+ {
122
+ label: t("workflowExecutions.filters.allExecutions"),
123
+ params: {}
124
+ },
125
+ {
126
+ label: t("workflowExecutions.filters.running"),
127
+ params: { state: "invoking" }
128
+ },
129
+ {
130
+ label: t("workflowExecutions.filters.failedToday"),
131
+ params: {
132
+ state: "failed",
133
+ created_at: JSON.stringify({
134
+ $gte: new Date(
135
+ (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)
136
+ ).toISOString()
137
+ })
138
+ }
139
+ }
140
+ ],
141
+ [t]
142
+ );
143
+ const isActive = useCallback2(
144
+ (view) => {
145
+ const viewKeys = Object.keys(view.params);
146
+ if (viewKeys.length === 0) {
147
+ return !searchParams.has("state") && !searchParams.has("created_at");
148
+ }
149
+ return viewKeys.every(
150
+ (key) => searchParams.get(key) === view.params[key]
151
+ );
152
+ },
153
+ [searchParams]
154
+ );
155
+ const handleClick = useCallback2(
156
+ (view) => {
157
+ const newParams = new URLSearchParams();
158
+ for (const [key, value] of Object.entries(view.params)) {
159
+ newParams.set(key, value);
160
+ }
161
+ setSearchParams(newParams);
162
+ },
163
+ [setSearchParams]
164
+ );
165
+ return /* @__PURE__ */ jsx2("div", { className: "flex items-center gap-x-1", children: views.map((view) => /* @__PURE__ */ jsx2(
166
+ Button,
167
+ {
168
+ variant: "transparent",
169
+ size: "small",
170
+ onClick: () => handleClick(view),
171
+ className: clx(
172
+ "txt-compact-small-plus",
173
+ isActive(view) ? "bg-ui-bg-base shadow-elevation-card-rest text-ui-fg-base" : "text-ui-fg-muted"
174
+ ),
175
+ children: view.label
176
+ },
177
+ view.label
178
+ )) });
179
+ };
180
+
181
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-columns.tsx
182
+ import { Badge, Copy, Text, clx as clx3 } from "@acmekit/ui";
183
+ import { createColumnHelper } from "@tanstack/react-table";
184
+ import { useMemo as useMemo2 } from "react";
185
+ import { useTranslation as useTranslation3 } from "react-i18next";
186
+
187
+ // src/components/data-table/components/data-table-status-cell/data-table-status-cell.tsx
188
+ import { clx as clx2 } from "@acmekit/ui";
189
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
190
+ var DataTableStatusCell = ({
191
+ color,
192
+ children
193
+ }) => {
194
+ return /* @__PURE__ */ jsxs2("div", { className: "txt-compact-small text-ui-fg-subtle flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
195
+ /* @__PURE__ */ jsx3(
196
+ "div",
197
+ {
198
+ role: "presentation",
199
+ className: "flex h-5 w-2 items-center justify-center",
200
+ children: /* @__PURE__ */ jsx3(
201
+ "div",
202
+ {
203
+ className: clx2(
204
+ "h-2 w-2 rounded-sm shadow-[0px_0px_0px_1px_rgba(0,0,0,0.12)_inset]",
205
+ {
206
+ "bg-ui-tag-neutral-icon": color === "grey",
207
+ "bg-ui-tag-green-icon": color === "green",
208
+ "bg-ui-tag-red-icon": color === "red",
209
+ "bg-ui-tag-blue-icon": color === "blue",
210
+ "bg-ui-tag-orange-icon": color === "orange",
211
+ "bg-ui-tag-purple-icon": color === "purple"
212
+ }
213
+ )
214
+ }
215
+ )
216
+ }
217
+ ),
218
+ /* @__PURE__ */ jsx3("span", { className: "truncate", children })
219
+ ] });
220
+ };
221
+
222
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-row-actions.tsx
223
+ import { ArrowPathMini as ArrowPathMini2, Eye, XMark } from "@acmekit/icons";
224
+ import { toast, usePrompt } from "@acmekit/ui";
225
+ import { useTranslation as useTranslation2 } from "react-i18next";
226
+ import { jsx as jsx4 } from "react/jsx-runtime";
227
+ var WorkflowExecutionRowActions = ({
228
+ execution
229
+ }) => {
230
+ const { t } = useTranslation2();
231
+ const prompt = usePrompt();
232
+ const state = execution.state;
233
+ const isFailed = TRANSACTION_ERROR_STATES.includes(state);
234
+ const isRunning = TRANSACTION_IN_PROGRESS_STATES.includes(state);
235
+ const workflowId = execution.workflow_id;
236
+ const transactionId = execution.transaction_id;
237
+ const { mutateAsync: runAsync } = useRunWorkflow(workflowId);
238
+ const { mutateAsync: cancelAsync } = useCancelWorkflowExecution(
239
+ workflowId,
240
+ transactionId
241
+ );
242
+ const handleRetry = async () => {
243
+ const payload = execution?.context?.data?.payload;
244
+ const input = payload && typeof payload === "object" ? payload : {};
245
+ await runAsync(
246
+ { input },
247
+ {
248
+ onSuccess: () => {
249
+ toast.success(t("workflowExecutions.actions.retrySuccess"));
250
+ },
251
+ onError: (err) => {
252
+ toast.error(err.message);
253
+ }
254
+ }
255
+ );
256
+ };
257
+ const handleCancel = async () => {
258
+ const res = await prompt({
259
+ title: t("workflowExecutions.actions.cancelConfirmTitle"),
260
+ description: t(
261
+ "workflowExecutions.actions.cancelConfirmDescription",
262
+ { workflow_id: workflowId }
263
+ ),
264
+ confirmText: t("workflowExecutions.actions.cancel"),
265
+ cancelText: t("actions.cancel")
266
+ });
267
+ if (!res) return;
268
+ await cancelAsync(void 0, {
269
+ onSuccess: () => {
270
+ toast.success(t("workflowExecutions.actions.cancelSuccess"));
271
+ },
272
+ onError: (err) => {
273
+ toast.error(err.message);
274
+ }
275
+ });
276
+ };
277
+ const secondaryActions = [];
278
+ if (isFailed) {
279
+ secondaryActions.push({
280
+ icon: /* @__PURE__ */ jsx4(ArrowPathMini2, {}),
281
+ label: t("workflowExecutions.actions.retry"),
282
+ onClick: handleRetry
283
+ });
284
+ }
285
+ if (isRunning) {
286
+ secondaryActions.push({
287
+ icon: /* @__PURE__ */ jsx4(XMark, {}),
288
+ label: t("workflowExecutions.actions.cancel"),
289
+ onClick: handleCancel
290
+ });
291
+ }
292
+ const groups = [
293
+ {
294
+ actions: [
295
+ {
296
+ icon: /* @__PURE__ */ jsx4(Eye, {}),
297
+ label: t("workflowExecutions.actions.viewDetails"),
298
+ to: `${execution.id}`
299
+ }
300
+ ]
301
+ },
302
+ ...secondaryActions.length > 0 ? [{ actions: secondaryActions }] : []
303
+ ];
304
+ return /* @__PURE__ */ jsx4(ActionMenu, { groups });
305
+ };
306
+
307
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-columns.tsx
308
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
309
+ var columnHelper = createColumnHelper();
310
+ var useWorkflowExecutionTableColumns = () => {
311
+ const { t } = useTranslation3();
312
+ return useMemo2(
313
+ () => [
314
+ columnHelper.accessor("workflow_id", {
315
+ header: t("workflowExecutions.workflowIdLabel"),
316
+ cell: ({ getValue }) => {
317
+ const workflowId = getValue();
318
+ return /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-1", children: [
319
+ /* @__PURE__ */ jsx5(Badge, { size: "2xsmall", className: "truncate", children: workflowId }),
320
+ /* @__PURE__ */ jsx5(Copy, { content: workflowId, className: "text-ui-fg-muted" })
321
+ ] });
322
+ }
323
+ }),
324
+ columnHelper.accessor("state", {
325
+ header: t("fields.state"),
326
+ cell: ({ getValue }) => {
327
+ const state = getValue();
328
+ const color = getTransactionStateColor(state);
329
+ const translatedState = getTransactionState(t, state);
330
+ return /* @__PURE__ */ jsx5(DataTableStatusCell, { color, children: /* @__PURE__ */ jsx5("span", { className: "capitalize", children: translatedState }) });
331
+ }
332
+ }),
333
+ columnHelper.accessor("execution", {
334
+ header: t("workflowExecutions.progressLabel"),
335
+ cell: ({ getValue }) => {
336
+ const steps = getValue()?.steps;
337
+ if (!steps) {
338
+ return /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-subtle whitespace-nowrap", children: t("workflowExecutions.stepsCompletedLabel", {
339
+ completed: 0,
340
+ count: 0
341
+ }) });
342
+ }
343
+ const actionableSteps = Object.values(steps).filter(
344
+ (step) => step.id !== ROOT_PREFIX
345
+ );
346
+ const completedSteps = actionableSteps.filter(
347
+ (step) => step.invoke.state === "done" /* DONE */
348
+ );
349
+ return /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-2", children: [
350
+ /* @__PURE__ */ jsx5("div", { className: "flex items-center gap-x-[3px]", children: actionableSteps.map((step) => /* @__PURE__ */ jsx5(
351
+ "div",
352
+ {
353
+ className: clx3(
354
+ "bg-ui-bg-switch-off shadow-details-switch-background h-3 w-1.5 rounded-full",
355
+ {
356
+ "bg-ui-fg-muted": step.invoke.state === "done" /* DONE */
357
+ }
358
+ ),
359
+ "data-completed": step.invoke.state === "done" /* DONE */
360
+ },
361
+ step.id
362
+ )) }),
363
+ /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-subtle whitespace-nowrap", children: t("workflowExecutions.stepsCompletedLabel", {
364
+ completed: completedSteps.length,
365
+ count: actionableSteps.length
366
+ }) })
367
+ ] });
368
+ }
369
+ }),
370
+ columnHelper.display({
371
+ id: "duration",
372
+ header: t("fields.duration"),
373
+ cell: ({ row }) => {
374
+ const createdAt = row.original.created_at;
375
+ const updatedAt = row.original.updated_at;
376
+ const state = row.original.state;
377
+ if (!createdAt) {
378
+ return /* @__PURE__ */ jsx5(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: "-" });
379
+ }
380
+ const start = new Date(createdAt);
381
+ const end = updatedAt && ["done", "failed", "reverted"].includes(state) ? new Date(updatedAt) : /* @__PURE__ */ new Date();
382
+ if (isNaN(start.getTime()) || isNaN(end.getTime())) {
383
+ return /* @__PURE__ */ jsx5(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: "-" });
384
+ }
385
+ const ms = end.getTime() - start.getTime();
386
+ if (ms < 0) {
387
+ return /* @__PURE__ */ jsx5(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: "-" });
388
+ }
389
+ const seconds = Math.floor(ms / 1e3);
390
+ const minutes = Math.floor(seconds / 60);
391
+ const hours = Math.floor(minutes / 60);
392
+ let label;
393
+ if (hours > 0) {
394
+ label = `${hours}h ${minutes % 60}m`;
395
+ } else if (minutes > 0) {
396
+ label = `${minutes}m ${seconds % 60}s`;
397
+ } else if (seconds > 0) {
398
+ label = `${seconds}s`;
399
+ } else if (ms > 0) {
400
+ label = "<1s";
401
+ } else {
402
+ label = "0s";
403
+ }
404
+ return /* @__PURE__ */ jsx5(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
405
+ }
406
+ }),
407
+ columnHelper.accessor("created_at", {
408
+ header: t("fields.createdAt"),
409
+ cell: ({ getValue }) => {
410
+ const date = getValue();
411
+ return /* @__PURE__ */ jsx5(DateCell, { date });
412
+ }
413
+ }),
414
+ columnHelper.accessor("updated_at", {
415
+ header: t("fields.updatedAt"),
416
+ cell: ({ getValue }) => {
417
+ const date = getValue();
418
+ return /* @__PURE__ */ jsx5(DateCell, { date });
419
+ }
420
+ }),
421
+ columnHelper.display({
422
+ id: "actions",
423
+ cell: ({ row }) => /* @__PURE__ */ jsx5(WorkflowExecutionRowActions, { execution: row.original })
424
+ })
425
+ ],
426
+ [t]
427
+ );
428
+ };
429
+ var ROOT_PREFIX = "_root";
430
+
431
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-filters.tsx
432
+ import { useTranslation as useTranslation4 } from "react-i18next";
433
+ var useWorkflowExecutionTableFilters = () => {
434
+ const { t } = useTranslation4();
435
+ const stateFilter = {
436
+ key: "state",
437
+ label: t("fields.status"),
438
+ type: "select",
439
+ multiple: true,
440
+ options: [
441
+ {
442
+ label: t("workflowExecutions.state.done"),
443
+ value: "done"
444
+ },
445
+ {
446
+ label: t("workflowExecutions.state.failed"),
447
+ value: "failed"
448
+ },
449
+ {
450
+ label: t("workflowExecutions.state.reverted"),
451
+ value: "reverted"
452
+ },
453
+ {
454
+ label: t("workflowExecutions.state.invoking"),
455
+ value: "invoking"
456
+ },
457
+ {
458
+ label: t("workflowExecutions.transaction.state.waitingToCompensate"),
459
+ value: "waiting_to_compensate"
460
+ },
461
+ {
462
+ label: t("workflowExecutions.state.compensating"),
463
+ value: "compensating"
464
+ },
465
+ {
466
+ label: t("workflowExecutions.state.notStarted"),
467
+ value: "not_started"
468
+ }
469
+ ]
470
+ };
471
+ const dateFilters = [
472
+ { key: "created_at", label: t("fields.createdAt"), type: "date" },
473
+ { key: "updated_at", label: t("fields.updatedAt"), type: "date" }
474
+ ];
475
+ const workflowIdFilter = {
476
+ key: "workflow_id",
477
+ label: t("workflowExecutions.workflowIdLabel"),
478
+ type: "string"
479
+ };
480
+ return [stateFilter, workflowIdFilter, ...dateFilters];
481
+ };
482
+
483
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-query.tsx
484
+ var useWorkflowExecutionTableQuery = ({
485
+ pageSize = 20,
486
+ prefix
487
+ }) => {
488
+ const raw = useQueryParams(
489
+ ["q", "offset", "order", "state", "workflow_id", "created_at", "updated_at"],
490
+ prefix
491
+ );
492
+ const { offset, order, state, workflow_id, created_at, updated_at, ...rest } = raw;
493
+ const searchParams = {
494
+ limit: pageSize,
495
+ offset: offset ? parseInt(offset) : 0,
496
+ order: order ?? "-created_at",
497
+ state: state ? state.split(",") : void 0,
498
+ workflow_id: workflow_id ? workflow_id.split(",") : void 0,
499
+ created_at: created_at ? JSON.parse(created_at) : void 0,
500
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0,
501
+ ...rest
502
+ };
503
+ return {
504
+ searchParams,
505
+ raw
506
+ };
507
+ };
508
+
509
+ // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx
510
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
511
+ var PAGE_SIZE = 20;
512
+ var WorkflowExecutionListTable = () => {
513
+ const { t } = useTranslation5();
514
+ const { searchParams, raw } = useWorkflowExecutionTableQuery({
515
+ pageSize: PAGE_SIZE
516
+ });
517
+ const { workflow_executions, count, isLoading, isError, error } = useWorkflowExecutions(
518
+ {
519
+ ...searchParams
520
+ },
521
+ {
522
+ placeholderData: keepPreviousData
523
+ }
524
+ );
525
+ const columns = useWorkflowExecutionTableColumns();
526
+ const filters = useWorkflowExecutionTableFilters();
527
+ const { table } = useDataTable({
528
+ data: workflow_executions || [],
529
+ columns,
530
+ count,
531
+ pageSize: PAGE_SIZE,
532
+ enablePagination: true,
533
+ getRowId: (row) => row.id
534
+ });
535
+ if (isError) {
536
+ throw error;
537
+ }
538
+ return /* @__PURE__ */ jsxs4(Container, { className: "divide-y p-0", children: [
539
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-6 py-4", children: [
540
+ /* @__PURE__ */ jsxs4("div", { children: [
541
+ /* @__PURE__ */ jsx6(Heading, { children: t("workflowExecutions.domain") }),
542
+ /* @__PURE__ */ jsx6(Text2, { className: "text-ui-fg-subtle", size: "small", children: t(`workflowExecutions.subtitle`) })
543
+ ] }),
544
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-2", children: [
545
+ /* @__PURE__ */ jsx6(WorkflowExecutionAutoRefresh, {}),
546
+ /* @__PURE__ */ jsx6(Button2, { variant: "secondary", size: "small", asChild: true, children: /* @__PURE__ */ jsxs4(Link, { to: "run", children: [
547
+ /* @__PURE__ */ jsx6(PlayMiniSolid, { className: "mr-1" }),
548
+ t("workflowExecutions.actions.runWorkflow")
549
+ ] }) })
550
+ ] })
551
+ ] }),
552
+ /* @__PURE__ */ jsx6("div", { className: "border-ui-border-base border-b px-6 py-2", children: /* @__PURE__ */ jsx6(WorkflowExecutionSavedViews, {}) }),
553
+ /* @__PURE__ */ jsx6(
554
+ _DataTable,
555
+ {
556
+ table,
557
+ columns,
558
+ filters,
559
+ count,
560
+ isLoading,
561
+ orderBy: [
562
+ { key: "created_at", label: t("fields.createdAt") },
563
+ { key: "updated_at", label: t("fields.updatedAt") }
564
+ ],
565
+ pageSize: PAGE_SIZE,
566
+ navigateTo: (row) => `${row.id}`,
567
+ search: true,
568
+ pagination: true,
569
+ queryObject: raw,
570
+ noRecords: {
571
+ message: t("workflowExecutions.list.noRecordsMessage")
572
+ }
573
+ }
574
+ )
575
+ ] });
576
+ };
577
+
578
+ // src/routes/workflow-executions/workflow-execution-list/workflow-execution-list.tsx
579
+ import { jsx as jsx7 } from "react/jsx-runtime";
580
+ var WorkflowExcecutionList = () => {
581
+ const { getWidgets } = useExtension();
582
+ return /* @__PURE__ */ jsx7(
583
+ SingleColumnPage,
584
+ {
585
+ widgets: {
586
+ after: getWidgets("workflow.list.after"),
587
+ before: getWidgets("workflow.list.before")
588
+ },
589
+ hasOutlet: true,
590
+ children: /* @__PURE__ */ jsx7(WorkflowExecutionListTable, {})
591
+ }
592
+ );
593
+ };
594
+ export {
595
+ WorkflowExcecutionList as Component
596
+ };