@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.8

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 (323) hide show
  1. package/README.md +564 -2
  2. package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
  3. package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
  4. package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
  5. package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
  6. package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
  7. package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
  8. package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
  9. package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
  10. package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
  11. package/dist/DateTimeField-B1qR4ruo.js +51 -0
  12. package/dist/Disclosure-BNKij7-v.js +45 -0
  13. package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
  14. package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
  15. package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
  16. package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
  17. package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
  18. package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
  19. package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
  20. package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
  21. package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
  22. package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
  23. package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
  24. package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
  25. package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
  26. package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
  27. package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
  28. package/dist/FluidGridsMark-CE2blT7K.js +74 -0
  29. package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
  30. package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
  31. package/dist/HistoryPage-BSBISXoj.js +2835 -0
  32. package/dist/Icon-BtQ0HXLh.js +160 -0
  33. package/dist/InsightsPage-D7ybj8N9.js +11245 -0
  34. package/dist/IsolationSetting-vy911E8b.js +1153 -0
  35. package/dist/LibraryParts-DOeNgR8A.js +413 -0
  36. package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
  37. package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
  38. package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
  39. package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
  40. package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
  41. package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
  42. package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
  43. package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
  44. package/dist/NodesPage-O7KeeKtd.js +653 -0
  45. package/dist/OfflineIcon-TwMKYWjA.js +207 -0
  46. package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
  47. package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
  48. package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
  49. package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
  50. package/dist/RunActionsMenu-DodOgIQm.js +59 -0
  51. package/dist/RunnerStatusPill-C1v967iq.js +24 -0
  52. package/dist/RunnersPage-dB0RSdY_.js +1929 -0
  53. package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
  54. package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
  55. package/dist/SearchBox-BGtYjvfs.js +49 -0
  56. package/dist/SequenceEditor-CFiHeHkR.js +497 -0
  57. package/dist/SettingsPage-0CQBNPZV.js +8695 -0
  58. package/dist/StewardPages-DAJhepen.js +47 -0
  59. package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
  60. package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
  61. package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
  62. package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
  63. package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
  64. package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
  65. package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
  66. package/dist/TemplatePreview-cx7-NOeG.js +868 -0
  67. package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
  68. package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
  69. package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
  70. package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
  71. package/dist/TranslationBridge-Da-TPgQm.js +68 -0
  72. package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
  73. package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
  74. package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
  75. package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
  76. package/dist/VariablesPage-ChfGuW22.js +2243 -0
  77. package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
  78. package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
  79. package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
  80. package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
  81. package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
  82. package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
  83. package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
  84. package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
  85. package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
  86. package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
  87. package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
  88. package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
  89. package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
  90. package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
  91. package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
  92. package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
  93. package/dist/WorkflowsList--hR2_8gf.js +4593 -0
  94. package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
  95. package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
  96. package/dist/addonCatalog-CbZS4deh.js +58 -0
  97. package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
  98. package/dist/addons.d.ts +3 -0
  99. package/dist/addons.js +4 -0
  100. package/dist/agent-form-Bfvm32j1.js +83 -0
  101. package/dist/agent-tools.d.ts +3 -0
  102. package/dist/agent-tools.js +5 -0
  103. package/dist/agentTools-CyL7DLOF.js +320 -0
  104. package/dist/ai-usage-BrxDgvdR.js +240 -0
  105. package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
  106. package/dist/api-BKq-nIOZ.js +2286 -0
  107. package/dist/api-Ol7I8NxE.js +8289 -0
  108. package/dist/apollo-type-policies.d.ts +11 -0
  109. package/dist/apollo-type-policies.js +64 -0
  110. package/dist/askAboutBridge-ByYsQams.js +106 -0
  111. package/dist/askQuestions-Cmx7VnMm.js +742 -0
  112. package/dist/assert-rules-lfYEMc99.js +318 -0
  113. package/dist/assistant.d.ts +94 -0
  114. package/dist/assistant.js +99 -0
  115. package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
  116. package/dist/badge-CXfPhoMH.js +26 -0
  117. package/dist/basil.generated-BK-EHbwN.js +10 -0
  118. package/dist/browser-steps-DMpS5TyB.js +533 -0
  119. package/dist/builderTimings-pvGnK1m-.js +510 -0
  120. package/dist/button-DG7y_FVJ.js +48 -0
  121. package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
  122. package/dist/card-Bomy_1UG.js +44 -0
  123. package/dist/catalogGrid-BOrfMgi-.js +41 -0
  124. package/dist/channel-CPyQ1NR1.js +212 -0
  125. package/dist/chips-CvNrYJZa.js +27 -0
  126. package/dist/client-holder-C0M5Cfwl.js +68 -0
  127. package/dist/cn-QqidFIgr.js +10 -0
  128. package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
  129. package/dist/code-editor-field-x_JrY8KR.js +113 -0
  130. package/dist/codec-client-DPuD6mw7.js +515 -0
  131. package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
  132. package/dist/config-DO68jw5k.js +322 -0
  133. package/dist/constants-DgbVc24O.d.ts +296 -0
  134. package/dist/constants-DlRnHBfQ.js +217 -0
  135. package/dist/convert-browser-action-pfecelF7.js +347 -0
  136. package/dist/convert-dialog-B_o22NiJ.js +382 -0
  137. package/dist/create-workflow-first-Azg3JUdX.js +120 -0
  138. package/dist/definition-canvas-Bsda-rDT.js +31 -0
  139. package/dist/dialog-BVd152GS.js +94 -0
  140. package/dist/durable-nodes-BXyYCLxT.js +91 -0
  141. package/dist/duration-CDb7-mT_.js +33 -0
  142. package/dist/edge-mapper-wEAdGVU2.js +4477 -0
  143. package/dist/element-library-DkSlg_VE.js +727 -0
  144. package/dist/entities-I_0kio3q.js +38 -0
  145. package/dist/error-advice-QLr5NCm7.js +65 -0
  146. package/dist/errors-ClKb5sEt.js +188 -0
  147. package/dist/executions.d.ts +3 -0
  148. package/dist/executions.js +5 -0
  149. package/dist/feature-flags-B2qetXKd.js +385 -0
  150. package/dist/field-label-DPZRmE_B.js +153 -0
  151. package/dist/firstWorkflow-C_h0KMB2.js +133 -0
  152. package/dist/flags.d.ts +3 -0
  153. package/dist/flags.js +4 -0
  154. package/dist/flow-builder-DIvLOhz0.js +28038 -0
  155. package/dist/flow-store-holder-CUN7Terz.js +52 -0
  156. package/dist/fluent.generated-CA_e6-4l.js +14 -0
  157. package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
  158. package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
  159. package/dist/global-client-BQPuFrFa.js +433 -0
  160. package/dist/global-operations-BG6YgxrM.js +136 -0
  161. package/dist/graphql-types-UTYtujY9.js +21358 -0
  162. package/dist/history.d.ts +3 -0
  163. package/dist/history.js +4 -0
  164. package/dist/index-AoJAa5vU.d.ts +164958 -0
  165. package/dist/index-DEMT3iAM.d.ts +120 -0
  166. package/dist/index-ROZzNGyY.d.ts +76 -0
  167. package/dist/index.d.ts +20 -0
  168. package/dist/index.js +8123 -0
  169. package/dist/ion.generated-mbajjcAg.js +10 -0
  170. package/dist/label-Lzb8ZXf_.js +29 -0
  171. package/dist/labels-rXd9gYQz.js +1236 -0
  172. package/dist/liveCanvas-D5ytXDp8.js +103 -0
  173. package/dist/logos.generated-X6_0kjVR.js +21 -0
  174. package/dist/logs-panel-Cw0DkG0l.js +468 -0
  175. package/dist/lucide.generated-B6NVd3GT.js +29 -0
  176. package/dist/marksStore-a9oIMMot.js +175 -0
  177. package/dist/mcp-trigger-D0nRdvq5.js +307 -0
  178. package/dist/mdi.generated-D1BV74d6.js +292 -0
  179. package/dist/menus-CU3hDGYl.js +160 -0
  180. package/dist/mynaui.generated-DMWr5cXz.js +66 -0
  181. package/dist/navigation-v2.d.ts +3 -0
  182. package/dist/navigation-v2.js +5 -0
  183. package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
  184. package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
  185. package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
  186. package/dist/node-registry-refresh-s3okf83X.js +27 -0
  187. package/dist/node-role-TMbnkmeP.js +132 -0
  188. package/dist/node-type-icon-BZa8n4iG.js +33 -0
  189. package/dist/nodes.d.ts +3 -0
  190. package/dist/nodes.js +4 -0
  191. package/dist/notesKey-5EaREBGA.js +12 -0
  192. package/dist/observability.d.ts +3 -0
  193. package/dist/observability.js +5 -0
  194. package/dist/offset-pages-zghoClB3.js +55 -0
  195. package/dist/operations-BBmT9ToP.js +663 -0
  196. package/dist/operations-WxRJWeqO.js +3133 -0
  197. package/dist/output-files-Ba8bu5lv.js +196 -0
  198. package/dist/page-operation-DrWuhd6Y.js +129 -0
  199. package/dist/page-twins.d.ts +13 -0
  200. package/dist/page-twins.js +186 -0
  201. package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
  202. package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
  203. package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
  204. package/dist/panels-PfBBAToE.js +346 -0
  205. package/dist/parts-B7fBcw-B.js +346 -0
  206. package/dist/popover-Dms9Vz3j.js +3389 -0
  207. package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
  208. package/dist/proactive.d.ts +66 -0
  209. package/dist/proactive.js +237 -0
  210. package/dist/quick-config-panel-DFd77xho.js +451 -0
  211. package/dist/quota-DeA_CJ2e.js +175 -0
  212. package/dist/quota.d.ts +3 -0
  213. package/dist/quota.js +4 -0
  214. package/dist/read-only-context-Dt9N9SIG.js +18 -0
  215. package/dist/relative-time-Dxt8ZIIu.js +55 -0
  216. package/dist/results-CwK_yDxK.js +325 -0
  217. package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
  218. package/dist/route-data.d.ts +12 -0
  219. package/dist/route-data.js +69 -0
  220. package/dist/route-match-C-0_EnAt.d.ts +5 -0
  221. package/dist/route-match-DMkUICYV.js +41 -0
  222. package/dist/route-preload-C4DlGoCd.js +120 -0
  223. package/dist/run-display-UjLAoYqQ.js +81 -0
  224. package/dist/run-history-arGiHzGU.js +285 -0
  225. package/dist/run-list-links-DJn4Mf1T.js +98 -0
  226. package/dist/run-mode-USmM0-Uo.js +82 -0
  227. package/dist/run-parity-CWXqEJqM.js +144 -0
  228. package/dist/runsQuota-B6SyTbne.js +100 -0
  229. package/dist/runsQuota-DsniKiSg.d.ts +20 -0
  230. package/dist/safe-expression-Cw7-SCsm.js +1251 -0
  231. package/dist/save-status-store-C7nEYpfb.js +631 -0
  232. package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
  233. package/dist/schedule-rules-ggVKRkBH.js +358 -0
  234. package/dist/secrets-Re_wSiE3.js +153 -0
  235. package/dist/settings.d.ts +4 -0
  236. package/dist/settings.js +6 -0
  237. package/dist/shared-DAWGGMSM.js +177 -0
  238. package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
  239. package/dist/solar.generated-CGYuUQAC.js +10 -0
  240. package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
  241. package/dist/start-url-CT6Yz96K.js +24 -0
  242. package/dist/status-CessxGpm.js +55 -0
  243. package/dist/store-icon-OctYp5zP.js +155 -0
  244. package/dist/styles-WGmTnZ2n.js +26 -0
  245. package/dist/styles.css +139 -0
  246. package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
  247. package/dist/template-code-CzN6JWNV.js +191 -0
  248. package/dist/template-graph-DLF9dygU.js +20 -0
  249. package/dist/template-preview-DcIIKOOL.js +32 -0
  250. package/dist/template-price-CdUHZRMF.js +40 -0
  251. package/dist/templates.d.ts +3 -0
  252. package/dist/templates.js +5 -0
  253. package/dist/theme-provider-CntfC4_i.js +23 -0
  254. package/dist/transient-DgZfhDfN.js +57 -0
  255. package/dist/typed-calls-C5tO03wq.js +26 -0
  256. package/dist/ui-script-By74Guk3.js +1094 -0
  257. package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
  258. package/dist/ui-step-fix-8uM2_Hft.js +67 -0
  259. package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
  260. package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
  261. package/dist/ui-target-editor-D2JhB_lD.js +673 -0
  262. package/dist/uiMarkTools-CSznnO1i.js +1054 -0
  263. package/dist/upgradePrompt-BAFBKKW5.js +72 -0
  264. package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
  265. package/dist/use-browser-available-hj8wc3Kb.js +241 -0
  266. package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
  267. package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
  268. package/dist/use-mobile-BTqCUjzS.js +27 -0
  269. package/dist/use-sdk-query-C697xZVv.js +116 -0
  270. package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
  271. package/dist/useActionParam-B2tU2BlY.js +85 -0
  272. package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
  273. package/dist/useBrowserClients-3v95-gSh.js +103 -0
  274. package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
  275. package/dist/useConnections-DsgEJs05.js +439 -0
  276. package/dist/useDebouncedValue-BFekcv6n.js +18 -0
  277. package/dist/useDurableParity-8fnMZmBc.js +1787 -0
  278. package/dist/useEntityTags-D0spL6Ut.js +460 -0
  279. package/dist/useExecutions-2u5nGJJk.js +681 -0
  280. package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
  281. package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
  282. package/dist/useHumanRequests-zlYDp3l1.js +221 -0
  283. package/dist/useNavigationV2-C2WeqN7d.js +29 -0
  284. package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
  285. package/dist/useObservability-BRlQ0tOA.js +285 -0
  286. package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
  287. package/dist/useRunHistory-CXCMUPyf.js +2759 -0
  288. package/dist/useRunLive-D0JvVZT2.js +1060 -0
  289. package/dist/useRunnerList-Dbi59i1K.js +446 -0
  290. package/dist/useRunners-URUc5quU.js +173 -0
  291. package/dist/useRunsPage-DG656UCK.js +2709 -0
  292. package/dist/useVariables-BIelxcWr.js +463 -0
  293. package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
  294. package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
  295. package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
  296. package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
  297. package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
  298. package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
  299. package/dist/utils-fvBb5qOD.js +89 -0
  300. package/dist/webhook-deliveries-AvQujaZy.js +99 -0
  301. package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
  302. package/dist/workflow-builder.d.ts +3 -0
  303. package/dist/workflow-builder.js +8 -0
  304. package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
  305. package/dist/workflow-embed.d.ts +3 -0
  306. package/dist/workflow-embed.js +4 -0
  307. package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
  308. package/dist/workflow-host.d.ts +6 -0
  309. package/dist/workflow-host.js +11 -0
  310. package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
  311. package/dist/workflow-pages.d.ts +3 -0
  312. package/dist/workflow-pages.js +115 -0
  313. package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
  314. package/dist/workflow-preview.d.ts +65 -0
  315. package/dist/workflow-preview.js +4 -0
  316. package/dist/workflow-route.d.ts +33 -0
  317. package/dist/workflow-route.js +4 -0
  318. package/dist/workflow-save-state-D0l-DkLf.js +767 -0
  319. package/dist/workflow-transfer-CQnQC-ke.js +104 -0
  320. package/dist/workflowRouteData-BkfVOc-O.js +169 -0
  321. package/dist/workflows-list.d.ts +10 -0
  322. package/dist/workflows-list.js +5 -0
  323. package/package.json +320 -4
@@ -0,0 +1,4307 @@
1
+ "use client";
2
+ import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
3
+ import { t as Icon } from "./Icon-BtQ0HXLh.js";
4
+ import { d as DEFAULT_EXECUTIONS_FILTER, f as useExecutionsStore } from "./config-DO68jw5k.js";
5
+ import { a as useExecutionsStoreInput, c as OPERATORS_BY_TYPE, d as fromLocalInputValue, f as toLocalInputValue, l as buildSearchAttributeFilter, p as validateDateRange, r as useExecutionActions, s as EMPTY_SEARCH_FILTER, t as useAutoRefresh, u as searchFilterConflicts } from "./useExecutions-2u5nGJJk.js";
6
+ import { f as useDurableParityEnabled, g as usePhaseCFlags, m as useFluidGridsFlagsSettled } from "./feature-flags-B2qetXKd.js";
7
+ import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
8
+ import { n as useFluidGridsPageControls } from "./pageControlsBridge-0pX9s-3k.js";
9
+ import { t as executionsControls } from "./pageControlSpecs-DZJ9K37m.js";
10
+ import { t as TagFilterSelect } from "./TagFilterSelect-CyA8QrS7.js";
11
+ import { t as DateTimeField } from "./DateTimeField-B1qR4ruo.js";
12
+ import { n as useNavigationV2 } from "./useNavigationV2-C2WeqN7d.js";
13
+ import { n as errorAdvice, t as ADVICE_ERROR_TYPES } from "./error-advice-QLr5NCm7.js";
14
+ import { t as Disclosure } from "./Disclosure-BNKij7-v.js";
15
+ import { i as RUN_STATUS_CONFIG, r as runStatusLabels, t as ExecutionStatusBadge } from "./ExecutionStatusBadge-BsDVor9t.js";
16
+ import { i as PageIntro, o as RunsStatsSkeleton, s as RunsTableSkeleton } from "./parts-B7fBcw-B.js";
17
+ import { t as HeldLoadRegion } from "./HeldLoadRegion-BtTxbvOW.js";
18
+ import { n as formatRunVersion } from "./run-display-UjLAoYqQ.js";
19
+ import { d as isSandboxRuntimeExhausted } from "./quota-DeA_CJ2e.js";
20
+ import { r as runSuggestAnchorProps } from "./entities-I_0kio3q.js";
21
+ import { r as runDurationMs, t as formatElapsedMs } from "./duration-CDb7-mT_.js";
22
+ import { r as useRunHumanRequests } from "./useHumanRequests-zlYDp3l1.js";
23
+ import { n as runListLinkKey, t as runListFilterFromSearch } from "./run-list-links-DJn4Mf1T.js";
24
+ import { n as useRunsPage } from "./useRunsPage-DG656UCK.js";
25
+ import { i as relativeFormat, r as pageLocale } from "./relative-time-Dxt8ZIIu.js";
26
+ import { t as RunActionsMenu } from "./RunActionsMenu-DodOgIQm.js";
27
+ import { i as isPermissionDenied, t as describeOperationError } from "./errors-ClKb5sEt.js";
28
+ import { t as TechnicalDetails } from "./TechnicalDetails-B0Oi4aZw.js";
29
+ import { a as ConfirmStopRunDialog, i as ConfirmDeleteRunsDialog, n as EMPTY_ACTIVITY_OPTIONS_FORM, r as activityOptionsFrom, t as ActivityOptionsFields } from "./ActivityOptionsFields-C2u-hY2U.js";
30
+ import { n as writeTyped } from "./typed-calls-C5tO03wq.js";
31
+ import { t as FluidGridsDocsLink } from "./FluidGridsDocsLink-bX0Hnhxr.js";
32
+ import { s as useFluidGridsPermission, t as FLUIDGRIDS_PERMISSIONS } from "./constants-DlRnHBfQ.js";
33
+ import { F as startBatchExport, I as startBatchOperation, L as startBatchTerminate, S as fetchSearchAttributes, m as fetchBatchOperations, n as cancelBatchOperation, p as fetchBatchOperation, w as jsonArg } from "./api-Ol7I8NxE.js";
34
+ import { a as NativeSelect, d as useResource, l as parseJsonInput, o as RUN_CONTROL_DIALOG_STYLE, r as JsonField, s as StatusPill, t as FieldError } from "./shared-DAWGGMSM.js";
35
+ import { n as getFluidGridsClient } from "./client-holder-C0M5Cfwl.js";
36
+ import { y as useWorkflowVersions } from "./useWorkflows-Cvg-Z_IE.js";
37
+ import { r as overrideRequestOf } from "./run-parity-CWXqEJqM.js";
38
+ import { VH as WorkflowBatchOperationType, bU as WorkflowResetType } from "./graphql-types-UTYtujY9.js";
39
+ import { r as useRunsListLive, u as shouldPoll } from "./useRunLive-D0JvVZT2.js";
40
+ import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
41
+ import { useNavigate, useSearchParams } from "react-router";
42
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
43
+ import { toast } from "sonner";
44
+ import { cn } from "@burdenoff/fe-libs/utils";
45
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, EmptyState, Input, Label, LoadError, LoadRegion, ResponsiveTable, Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, ThemedSelect, useLoadingSystem } from "@burdenoff/fe-libs/ui";
46
+ import { Button as Button$1 } from "@burdenoff/fe-libs/button";
47
+
48
+ // src/generated/documents/wspace/DeleteWorkflowRunsDocument.ts
49
+ const DeleteWorkflowRunsDocument = {
50
+ "kind": "Document",
51
+ "definitions": [{
52
+ "kind": "OperationDefinition",
53
+ "operation": "mutation",
54
+ "name": {
55
+ "kind": "Name",
56
+ "value": "DeleteWorkflowRuns"
57
+ },
58
+ "variableDefinitions": [{
59
+ "kind": "VariableDefinition",
60
+ "variable": {
61
+ "kind": "Variable",
62
+ "name": {
63
+ "kind": "Name",
64
+ "value": "input"
65
+ }
66
+ },
67
+ "type": {
68
+ "kind": "NonNullType",
69
+ "type": {
70
+ "kind": "NamedType",
71
+ "name": {
72
+ "kind": "Name",
73
+ "value": "DeleteWorkflowRunsInput"
74
+ }
75
+ }
76
+ },
77
+ "directives": []
78
+ }],
79
+ "directives": [],
80
+ "selectionSet": {
81
+ "kind": "SelectionSet",
82
+ "selections": [{
83
+ "kind": "Field",
84
+ "name": {
85
+ "kind": "Name",
86
+ "value": "deleteWorkflowRuns"
87
+ },
88
+ "arguments": [{
89
+ "kind": "Argument",
90
+ "name": {
91
+ "kind": "Name",
92
+ "value": "input"
93
+ },
94
+ "value": {
95
+ "kind": "Variable",
96
+ "name": {
97
+ "kind": "Name",
98
+ "value": "input"
99
+ }
100
+ }
101
+ }],
102
+ "directives": [],
103
+ "selectionSet": {
104
+ "kind": "SelectionSet",
105
+ "selections": [
106
+ {
107
+ "kind": "Field",
108
+ "name": {
109
+ "kind": "Name",
110
+ "value": "deleted"
111
+ },
112
+ "arguments": [],
113
+ "directives": []
114
+ },
115
+ {
116
+ "kind": "Field",
117
+ "name": {
118
+ "kind": "Name",
119
+ "value": "skippedInFlight"
120
+ },
121
+ "arguments": [],
122
+ "directives": []
123
+ },
124
+ {
125
+ "kind": "Field",
126
+ "name": {
127
+ "kind": "Name",
128
+ "value": "hasMore"
129
+ },
130
+ "arguments": [],
131
+ "directives": []
132
+ }
133
+ ]
134
+ }
135
+ }]
136
+ }
137
+ }]
138
+ };
139
+
140
+ // src/generated/documents/wspace/WorkflowBatchOperationUpdatedDocument.ts
141
+ const WorkflowBatchOperationUpdatedDocument = {
142
+ "kind": "Document",
143
+ "definitions": [{
144
+ "kind": "OperationDefinition",
145
+ "operation": "subscription",
146
+ "name": {
147
+ "kind": "Name",
148
+ "value": "WorkflowBatchOperationUpdated"
149
+ },
150
+ "variableDefinitions": [{
151
+ "kind": "VariableDefinition",
152
+ "variable": {
153
+ "kind": "Variable",
154
+ "name": {
155
+ "kind": "Name",
156
+ "value": "id"
157
+ }
158
+ },
159
+ "type": {
160
+ "kind": "NonNullType",
161
+ "type": {
162
+ "kind": "NamedType",
163
+ "name": {
164
+ "kind": "Name",
165
+ "value": "ID"
166
+ }
167
+ }
168
+ },
169
+ "directives": []
170
+ }],
171
+ "directives": [],
172
+ "selectionSet": {
173
+ "kind": "SelectionSet",
174
+ "selections": [{
175
+ "kind": "Field",
176
+ "name": {
177
+ "kind": "Name",
178
+ "value": "workflowBatchOperationUpdated"
179
+ },
180
+ "arguments": [{
181
+ "kind": "Argument",
182
+ "name": {
183
+ "kind": "Name",
184
+ "value": "id"
185
+ },
186
+ "value": {
187
+ "kind": "Variable",
188
+ "name": {
189
+ "kind": "Name",
190
+ "value": "id"
191
+ }
192
+ }
193
+ }],
194
+ "directives": [],
195
+ "selectionSet": {
196
+ "kind": "SelectionSet",
197
+ "selections": [{
198
+ "kind": "FragmentSpread",
199
+ "name": {
200
+ "kind": "Name",
201
+ "value": "WorkflowBatchJobFields"
202
+ },
203
+ "directives": []
204
+ }]
205
+ }
206
+ }]
207
+ }
208
+ }, {
209
+ "kind": "FragmentDefinition",
210
+ "name": {
211
+ "kind": "Name",
212
+ "value": "WorkflowBatchJobFields"
213
+ },
214
+ "variableDefinitions": [],
215
+ "typeCondition": {
216
+ "kind": "NamedType",
217
+ "name": {
218
+ "kind": "Name",
219
+ "value": "WorkflowBatchJob"
220
+ }
221
+ },
222
+ "directives": [],
223
+ "selectionSet": {
224
+ "kind": "SelectionSet",
225
+ "selections": [
226
+ {
227
+ "kind": "Field",
228
+ "name": {
229
+ "kind": "Name",
230
+ "value": "id"
231
+ },
232
+ "arguments": [],
233
+ "directives": []
234
+ },
235
+ {
236
+ "kind": "Field",
237
+ "name": {
238
+ "kind": "Name",
239
+ "value": "type"
240
+ },
241
+ "arguments": [],
242
+ "directives": []
243
+ },
244
+ {
245
+ "kind": "Field",
246
+ "name": {
247
+ "kind": "Name",
248
+ "value": "status"
249
+ },
250
+ "arguments": [],
251
+ "directives": []
252
+ },
253
+ {
254
+ "kind": "Field",
255
+ "name": {
256
+ "kind": "Name",
257
+ "value": "reason"
258
+ },
259
+ "arguments": [],
260
+ "directives": []
261
+ },
262
+ {
263
+ "kind": "Field",
264
+ "name": {
265
+ "kind": "Name",
266
+ "value": "dryRun"
267
+ },
268
+ "arguments": [],
269
+ "directives": []
270
+ },
271
+ {
272
+ "kind": "Field",
273
+ "name": {
274
+ "kind": "Name",
275
+ "value": "total"
276
+ },
277
+ "arguments": [],
278
+ "directives": []
279
+ },
280
+ {
281
+ "kind": "Field",
282
+ "name": {
283
+ "kind": "Name",
284
+ "value": "succeeded"
285
+ },
286
+ "arguments": [],
287
+ "directives": []
288
+ },
289
+ {
290
+ "kind": "Field",
291
+ "name": {
292
+ "kind": "Name",
293
+ "value": "failed"
294
+ },
295
+ "arguments": [],
296
+ "directives": []
297
+ },
298
+ {
299
+ "kind": "Field",
300
+ "name": {
301
+ "kind": "Name",
302
+ "value": "skipped"
303
+ },
304
+ "arguments": [],
305
+ "directives": []
306
+ },
307
+ {
308
+ "kind": "Field",
309
+ "name": {
310
+ "kind": "Name",
311
+ "value": "maxOperationsPerSecond"
312
+ },
313
+ "arguments": [],
314
+ "directives": []
315
+ },
316
+ {
317
+ "kind": "Field",
318
+ "name": {
319
+ "kind": "Name",
320
+ "value": "filter"
321
+ },
322
+ "arguments": [],
323
+ "directives": []
324
+ },
325
+ {
326
+ "kind": "Field",
327
+ "name": {
328
+ "kind": "Name",
329
+ "value": "errors"
330
+ },
331
+ "arguments": [],
332
+ "directives": [],
333
+ "selectionSet": {
334
+ "kind": "SelectionSet",
335
+ "selections": [{
336
+ "kind": "Field",
337
+ "name": {
338
+ "kind": "Name",
339
+ "value": "runId"
340
+ },
341
+ "arguments": [],
342
+ "directives": []
343
+ }, {
344
+ "kind": "Field",
345
+ "name": {
346
+ "kind": "Name",
347
+ "value": "message"
348
+ },
349
+ "arguments": [],
350
+ "directives": []
351
+ }]
352
+ }
353
+ },
354
+ {
355
+ "kind": "Field",
356
+ "name": {
357
+ "kind": "Name",
358
+ "value": "failureMessage"
359
+ },
360
+ "arguments": [],
361
+ "directives": []
362
+ },
363
+ {
364
+ "kind": "Field",
365
+ "name": {
366
+ "kind": "Name",
367
+ "value": "requestedBy"
368
+ },
369
+ "arguments": [],
370
+ "directives": []
371
+ },
372
+ {
373
+ "kind": "Field",
374
+ "name": {
375
+ "kind": "Name",
376
+ "value": "createdAt"
377
+ },
378
+ "arguments": [],
379
+ "directives": []
380
+ },
381
+ {
382
+ "kind": "Field",
383
+ "name": {
384
+ "kind": "Name",
385
+ "value": "startedAt"
386
+ },
387
+ "arguments": [],
388
+ "directives": []
389
+ },
390
+ {
391
+ "kind": "Field",
392
+ "name": {
393
+ "kind": "Name",
394
+ "value": "completedAt"
395
+ },
396
+ "arguments": [],
397
+ "directives": []
398
+ },
399
+ {
400
+ "kind": "Field",
401
+ "name": {
402
+ "kind": "Name",
403
+ "value": "cancelRequestedAt"
404
+ },
405
+ "arguments": [],
406
+ "directives": []
407
+ }
408
+ ]
409
+ }
410
+ }]
411
+ };
412
+
413
+ // src/modules/executions/utils/active-filters.ts
414
+ function countActiveFilters(filter, parityEnabled) {
415
+ return [
416
+ filter.status !== "all",
417
+ filter.workflowKey !== "",
418
+ filter.dateRange.preset !== "all",
419
+ filter.search !== "",
420
+ filter.triggerType !== "all",
421
+ filter.durationMinSeconds !== null,
422
+ filter.durationMaxSeconds !== null,
423
+ filter.errorType !== "all",
424
+ filter.nodeId !== "",
425
+ filter.failedNodeType !== "",
426
+ filter.tagId !== "",
427
+ parityEnabled && filter.workflowId.trim() !== ""
428
+ ].filter(Boolean).length;
429
+ }
430
+
431
+ // src/modules/executions/components/ExecutionFilters.tsx
432
+ /**
433
+ * An error type set by a link (Insights, BOFF-9974) that the dropdown offers
434
+ * no option for, so the dropdown adds one for it and it still shows as
435
+ * selected; null when it is offered (or no error type is set). A plain
436
+ * `<option>` in the dropdown, not a component: the themed select reads only
437
+ * `<option>` and `<optgroup>` children.
438
+ */
439
+ function linkedErrorTypeOf(errorType, offered) {
440
+ if (errorType === "all" || offered.some(({ value }) => value === errorType)) return null;
441
+ return errorType;
442
+ }
443
+ /** The failed-node-type filter (BOFF-9974), set only by links, with its clear button. */
444
+ function FailedNodeTypeChip({ nodeType, onClear }) {
445
+ const tr = useTr();
446
+ if (!nodeType) return null;
447
+ return /* @__PURE__ */ jsxs("span", {
448
+ className: "inline-flex items-center gap-1.5 rounded-lg border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary",
449
+ "data-testid": "runs-failed-node-type-filter",
450
+ children: [tr("fluidgrids.executions.executionFilters.failedNodeType", "Failed node: {{nodeType}}", { nodeType }), /* @__PURE__ */ jsx("button", {
451
+ type: "button",
452
+ onClick: onClear,
453
+ "aria-label": tr("fluidgrids.executions.executionFilters.clearFailedNodeType", "Remove the failed node filter"),
454
+ className: "text-text-secondary hover:text-text-primary",
455
+ children: /* @__PURE__ */ jsx(Icon, {
456
+ icon: "mdi:close",
457
+ width: 14
458
+ })
459
+ })]
460
+ });
461
+ }
462
+ function ExecutionFilters({ workflows = [], onRefresh, moreFilters, moreFiltersActive = 0, onClearMoreFilters }) {
463
+ const tr = useTr();
464
+ const v2 = useNavigationV2();
465
+ const statusOptions = useMemo(() => [
466
+ {
467
+ value: "all",
468
+ label: tr("fluidgrids.executions.executionFilters.statusAll", "All Statuses")
469
+ },
470
+ {
471
+ value: "RUNNING",
472
+ label: tr("fluidgrids.executions.executionFilters.statusRunning", "Running")
473
+ },
474
+ {
475
+ value: "COMPLETED",
476
+ label: tr("fluidgrids.executions.executionFilters.statusCompleted", "Completed")
477
+ },
478
+ {
479
+ value: "FAILED",
480
+ label: tr("fluidgrids.executions.executionFilters.statusFailed", "Failed")
481
+ },
482
+ {
483
+ value: "PENDING",
484
+ label: tr("fluidgrids.executions.executionFilters.statusPending", "Pending")
485
+ },
486
+ {
487
+ value: "CANCELLED",
488
+ label: tr("fluidgrids.executions.executionFilters.statusCancelled", "Cancelled")
489
+ },
490
+ {
491
+ value: "WAITING",
492
+ label: tr("fluidgrids.executions.executionFilters.statusWaiting", "Waiting")
493
+ },
494
+ {
495
+ value: "TERMINATED",
496
+ label: tr("fluidgrids.executions.executionFilters.statusTerminated", "Terminated")
497
+ }
498
+ ], [tr]);
499
+ const rawErrorOptions = [
500
+ {
501
+ value: "TIMEOUT",
502
+ label: tr("fluidgrids.executions.executionFilters.errorTimeout", "TIMEOUT")
503
+ },
504
+ {
505
+ value: "TRANSIENT",
506
+ label: tr("fluidgrids.executions.executionFilters.errorTransient", "TRANSIENT")
507
+ },
508
+ {
509
+ value: "DEPENDENCY",
510
+ label: tr("fluidgrids.executions.executionFilters.errorDependency", "DEPENDENCY")
511
+ },
512
+ {
513
+ value: "AUTHORIZATION",
514
+ label: tr("fluidgrids.executions.executionFilters.errorAuthorization", "AUTHORIZATION")
515
+ },
516
+ {
517
+ value: "VALIDATION",
518
+ label: tr("fluidgrids.executions.executionFilters.errorValidation", "VALIDATION")
519
+ },
520
+ {
521
+ value: "PERMANENT",
522
+ label: tr("fluidgrids.executions.executionFilters.errorPermanent", "PERMANENT")
523
+ },
524
+ {
525
+ value: "UNKNOWN",
526
+ label: tr("fluidgrids.executions.executionFilters.errorUnknown", "UNKNOWN")
527
+ }
528
+ ];
529
+ const errorOptions = v2 ? ADVICE_ERROR_TYPES.map((value) => ({
530
+ value,
531
+ label: errorAdvice(tr, value)
532
+ })) : rawErrorOptions;
533
+ const datePresets = [
534
+ {
535
+ value: "all",
536
+ label: tr("fluidgrids.executions.executionFilters.dateAllTime", "All Time")
537
+ },
538
+ {
539
+ value: "today",
540
+ label: tr("fluidgrids.executions.executionFilters.dateToday", "Today")
541
+ },
542
+ {
543
+ value: "yesterday",
544
+ label: tr("fluidgrids.executions.executionFilters.dateYesterday", "Yesterday")
545
+ },
546
+ {
547
+ value: "7days",
548
+ label: tr("fluidgrids.executions.executionFilters.dateLast7Days", "Last 7 Days")
549
+ },
550
+ {
551
+ value: "30days",
552
+ label: tr("fluidgrids.executions.executionFilters.dateLast30Days", "Last 30 Days")
553
+ },
554
+ {
555
+ value: "90days",
556
+ label: tr("fluidgrids.executions.executionFilters.dateLast90Days", "Last 90 Days")
557
+ },
558
+ {
559
+ value: "custom",
560
+ label: tr("fluidgrids.executions.executionFilters.dateCustomRange", "Custom Range")
561
+ }
562
+ ];
563
+ const { filter, setStatusFilter, setWorkflowFilter, setDateRange, setSearchQuery, setTriggerTypeFilter, setDurationFilter, setErrorTypeFilter, setNodeFilter, setFailedNodeTypeFilter, setTagFilter, resetFilters, autoRefresh, setAutoRefresh } = useExecutionsStore();
564
+ const linkedErrorType = linkedErrorTypeOf(filter.errorType, errorOptions);
565
+ const levelOneDatePresets = v2 ? datePresets.filter(({ value }) => value !== "custom" || filter.dateRange.preset === "custom") : datePresets;
566
+ const MORE_STATUSES = ["PENDING", "TERMINATED"];
567
+ const primaryStatusOptions = v2 ? statusOptions.filter(({ value }) => value === "all" || !MORE_STATUSES.includes(value)) : statusOptions;
568
+ const moreStatusOptions = v2 ? statusOptions.filter(({ value }) => MORE_STATUSES.includes(value)) : [];
569
+ const [showCustomDate, setShowCustomDate] = useState(() => filter.dateRange.preset === "custom");
570
+ const handleDatePresetChange = useCallback((preset) => {
571
+ const now = /* @__PURE__ */ new Date();
572
+ let start = null;
573
+ let end = null;
574
+ switch (preset) {
575
+ case "today":
576
+ start = new Date(now.getFullYear(), now.getMonth(), now.getDate());
577
+ end = now;
578
+ break;
579
+ case "yesterday":
580
+ start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1);
581
+ end = new Date(now.getFullYear(), now.getMonth(), now.getDate());
582
+ break;
583
+ case "7days":
584
+ start = /* @__PURE__ */ new Date(now.getTime() - 6048e5);
585
+ end = now;
586
+ break;
587
+ case "30days":
588
+ start = /* @__PURE__ */ new Date(now.getTime() - 2592e6);
589
+ end = now;
590
+ break;
591
+ case "90days":
592
+ start = /* @__PURE__ */ new Date(now.getTime() - 7776e6);
593
+ end = now;
594
+ break;
595
+ case "custom":
596
+ setShowCustomDate(true);
597
+ return;
598
+ default:
599
+ start = null;
600
+ end = null;
601
+ }
602
+ setShowCustomDate(false);
603
+ setDateRange({
604
+ start,
605
+ end,
606
+ preset
607
+ });
608
+ }, [setDateRange]);
609
+ const parityEnabled = useDurableParityEnabled();
610
+ const pageFiltersActive = v2 ? moreFiltersActive : 0;
611
+ const activeFiltersCount = countActiveFilters(filter, parityEnabled) + pageFiltersActive;
612
+ const hasMoreFiltersSet = filter.tagId !== "" || filter.triggerType !== "all" || filter.errorType !== "all" || filter.nodeId !== "" || filter.failedNodeType !== "" || filter.durationMinSeconds !== null || filter.durationMaxSeconds !== null || filter.dateRange.preset === "custom" || parityEnabled && filter.workflowId.trim() !== "" || pageFiltersActive > 0;
613
+ const clearFilters = () => {
614
+ resetFilters();
615
+ if (v2) onClearMoreFilters?.();
616
+ };
617
+ const assistantControls = useMemo(() => executionsControls({
618
+ page: tr("fluidgrids.executions.executionsList.title", "Executions"),
619
+ search: setSearchQuery,
620
+ status: {
621
+ label: tr("fluidgrids.executions.executionTable.colStatus", "Status"),
622
+ options: statusOptions,
623
+ neutral: "all",
624
+ value: filter.status,
625
+ set: setStatusFilter
626
+ },
627
+ workflow: {
628
+ label: tr("fluidgrids.executions.executionTable.colWorkflow", "Workflow"),
629
+ allLabel: tr("fluidgrids.executions.executionFilters.allWorkflows", "All Workflows"),
630
+ options: workflows.map((wf) => ({
631
+ value: wf.workflowKey,
632
+ label: wf.name
633
+ })),
634
+ value: filter.workflowKey,
635
+ set: setWorkflowFilter
636
+ }
637
+ }), [
638
+ tr,
639
+ statusOptions,
640
+ workflows,
641
+ filter.status,
642
+ filter.workflowKey,
643
+ setSearchQuery,
644
+ setStatusFilter,
645
+ setWorkflowFilter
646
+ ]);
647
+ useFluidGridsPageControls(assistantControls);
648
+ return /* @__PURE__ */ jsxs("div", {
649
+ className: "space-y-4",
650
+ children: [
651
+ /* @__PURE__ */ jsxs("div", {
652
+ className: "flex flex-col sm:flex-row gap-3",
653
+ children: [
654
+ /* @__PURE__ */ jsxs("div", {
655
+ className: "relative flex-1",
656
+ children: [
657
+ /* @__PURE__ */ jsx(Icon, {
658
+ icon: "mdi:magnify",
659
+ className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",
660
+ width: 18
661
+ }),
662
+ /* @__PURE__ */ jsx("input", {
663
+ type: "text",
664
+ placeholder: tr("fluidgrids.executions.executionFilters.searchPlaceholder", "Search by workflow name or run ID..."),
665
+ value: filter.search,
666
+ onChange: (e) => setSearchQuery(e.target.value),
667
+ className: "w-full pl-[3.25rem] pr-4 py-2 bg-surface border border-border-default rounded-lg text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg focus:border-transparent"
668
+ }),
669
+ filter.search && /* @__PURE__ */ jsx("button", {
670
+ onClick: () => setSearchQuery(""),
671
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary",
672
+ children: /* @__PURE__ */ jsx(Icon, {
673
+ icon: "mdi:close",
674
+ width: 18
675
+ })
676
+ })
677
+ ]
678
+ }),
679
+ /* @__PURE__ */ jsxs(ThemedSelect, {
680
+ "aria-label": tr("fluidgrids.executions.executionTable.colStatus", "Status"),
681
+ value: filter.status,
682
+ onChange: (e) => setStatusFilter(e.target.value),
683
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg scheme-normal dark:scheme-dark",
684
+ children: [primaryStatusOptions.map((option) => /* @__PURE__ */ jsx("option", {
685
+ value: option.value,
686
+ className: "bg-bg-surface text-text-primary",
687
+ children: option.label
688
+ }, option.value)), moreStatusOptions.length > 0 && /* @__PURE__ */ jsx("optgroup", {
689
+ label: tr("fluidgrids.executions.executionFilters.moreStatuses", "More statuses"),
690
+ children: moreStatusOptions.map((option) => /* @__PURE__ */ jsx("option", {
691
+ value: option.value,
692
+ children: option.label
693
+ }, option.value))
694
+ })]
695
+ }),
696
+ workflows.length > 0 && /* @__PURE__ */ jsxs(ThemedSelect, {
697
+ "aria-label": tr("fluidgrids.executions.executionTable.colWorkflow", "Workflow"),
698
+ value: filter.workflowKey,
699
+ onChange: (e) => setWorkflowFilter(e.target.value),
700
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg max-w-[200px] scheme-normal dark:scheme-dark",
701
+ children: [/* @__PURE__ */ jsx("option", {
702
+ value: "",
703
+ className: "bg-bg-surface text-text-primary",
704
+ children: tr("fluidgrids.executions.executionFilters.allWorkflows", "All Workflows")
705
+ }), workflows.map((wf) => /* @__PURE__ */ jsx("option", {
706
+ value: wf.workflowKey,
707
+ className: "bg-bg-surface text-text-primary",
708
+ children: wf.name
709
+ }, wf.workflowKey))]
710
+ }),
711
+ !v2 && /* @__PURE__ */ jsx(TagFilterSelect, {
712
+ value: filter.tagId,
713
+ onChange: setTagFilter,
714
+ className: "max-w-[200px]"
715
+ }),
716
+ /* @__PURE__ */ jsx(ThemedSelect, {
717
+ "aria-label": tr("fluidgrids.executions.executionFilters.timeRange", "Time range"),
718
+ value: filter.dateRange.preset,
719
+ onChange: (e) => handleDatePresetChange(e.target.value),
720
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg scheme-normal dark:scheme-dark",
721
+ children: levelOneDatePresets.map((option) => /* @__PURE__ */ jsx("option", {
722
+ value: option.value,
723
+ className: "bg-bg-surface text-text-primary",
724
+ children: option.label
725
+ }, option.value))
726
+ })
727
+ ]
728
+ }),
729
+ v2 ? /* @__PURE__ */ jsx(Disclosure, {
730
+ closedLabel: tr("fluidgrids.executions.executionFilters.moreFilters", "More filters"),
731
+ openLabel: tr("fluidgrids.executions.executionFilters.fewerFilters", "Fewer filters"),
732
+ defaultOpen: hasMoreFiltersSet,
733
+ keptContent: moreFilters === void 0 ? void 0 : /* @__PURE__ */ jsx("div", {
734
+ className: "mt-3 flex flex-col gap-3",
735
+ "data-testid": "runs-more-filters-page-rows",
736
+ children: moreFilters
737
+ }),
738
+ "data-testid": "runs-more-filters",
739
+ children: /* @__PURE__ */ jsxs("div", {
740
+ className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5",
741
+ children: [
742
+ /* @__PURE__ */ jsx(TagFilterSelect, {
743
+ value: filter.tagId,
744
+ onChange: setTagFilter,
745
+ className: "max-w-[200px]"
746
+ }),
747
+ /* @__PURE__ */ jsxs(ThemedSelect, {
748
+ "aria-label": tr("fluidgrids.executions.executionFilters.triggerType", "Trigger type"),
749
+ value: filter.triggerType,
750
+ onChange: (e) => setTriggerTypeFilter(e.target.value),
751
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg scheme-normal dark:scheme-dark",
752
+ children: [
753
+ /* @__PURE__ */ jsx("option", {
754
+ value: "all",
755
+ children: tr("fluidgrids.executions.executionFilters.allTriggers", "All trigger types")
756
+ }),
757
+ /* @__PURE__ */ jsx("option", {
758
+ value: "MANUAL",
759
+ children: tr("fluidgrids.executions.executionFilters.manual", "Manual")
760
+ }),
761
+ /* @__PURE__ */ jsx("option", {
762
+ value: "WEBHOOK",
763
+ children: tr("fluidgrids.executions.executionFilters.webhook", "Webhook")
764
+ }),
765
+ /* @__PURE__ */ jsx("option", {
766
+ value: "SCHEDULE",
767
+ children: tr("fluidgrids.executions.executionFilters.schedule", "Schedule")
768
+ }),
769
+ /* @__PURE__ */ jsx("option", {
770
+ value: "EVENT",
771
+ children: tr("fluidgrids.executions.executionFilters.event", "Event")
772
+ }),
773
+ /* @__PURE__ */ jsx("option", {
774
+ value: "MCP",
775
+ children: tr("fluidgrids.executions.executionFilters.mcp", "MCP tool call")
776
+ })
777
+ ]
778
+ }),
779
+ /* @__PURE__ */ jsxs(ThemedSelect, {
780
+ "aria-label": tr("fluidgrids.executions.executionFilters.errorType", "Error type"),
781
+ value: filter.errorType,
782
+ onChange: (e) => setErrorTypeFilter(e.target.value),
783
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg scheme-normal dark:scheme-dark",
784
+ children: [
785
+ /* @__PURE__ */ jsx("option", {
786
+ value: "all",
787
+ children: tr("fluidgrids.executions.executionFilters.allErrors", "All error types")
788
+ }),
789
+ errorOptions.map(({ value, label }) => /* @__PURE__ */ jsx("option", {
790
+ value,
791
+ children: label
792
+ }, value)),
793
+ linkedErrorType && /* @__PURE__ */ jsx("option", {
794
+ value: linkedErrorType,
795
+ children: linkedErrorType
796
+ })
797
+ ]
798
+ }),
799
+ /* @__PURE__ */ jsx(FailedNodeTypeChip, {
800
+ nodeType: filter.failedNodeType,
801
+ onClear: () => setFailedNodeTypeFilter("")
802
+ }),
803
+ /* @__PURE__ */ jsx("input", {
804
+ type: "text",
805
+ value: filter.nodeId,
806
+ onChange: (e) => setNodeFilter(e.target.value),
807
+ placeholder: tr("fluidgrids.executions.executionFilters.nodePlaceholder", "Node ID"),
808
+ "aria-label": tr("fluidgrids.executions.executionFilters.nodeId", "Node ID"),
809
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
810
+ }),
811
+ /* @__PURE__ */ jsx("input", {
812
+ type: "number",
813
+ min: 0,
814
+ value: filter.durationMinSeconds ?? "",
815
+ onChange: (e) => setDurationFilter(e.target.value ? Number(e.target.value) : null, filter.durationMaxSeconds),
816
+ placeholder: tr("fluidgrids.executions.executionFilters.durationMin", "Min seconds"),
817
+ "aria-label": tr("fluidgrids.executions.executionFilters.durationMin", "Minimum duration in seconds"),
818
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
819
+ }),
820
+ /* @__PURE__ */ jsx("input", {
821
+ type: "number",
822
+ min: 0,
823
+ value: filter.durationMaxSeconds ?? "",
824
+ onChange: (e) => setDurationFilter(filter.durationMinSeconds, e.target.value ? Number(e.target.value) : null),
825
+ placeholder: tr("fluidgrids.executions.executionFilters.durationMax", "Max seconds"),
826
+ "aria-label": tr("fluidgrids.executions.executionFilters.durationMax", "Maximum duration in seconds"),
827
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
828
+ }),
829
+ /* @__PURE__ */ jsx("button", {
830
+ type: "button",
831
+ onClick: () => handleDatePresetChange("custom"),
832
+ className: "px-3 py-2 border border-border-default rounded-lg text-text-primary text-left hover:bg-surface-sunken",
833
+ "data-testid": "runs-custom-range",
834
+ children: tr("fluidgrids.executions.executionFilters.dateCustomRange", "Custom Range")
835
+ }),
836
+ /* @__PURE__ */ jsxs("label", {
837
+ className: "inline-flex items-center gap-2 cursor-pointer",
838
+ children: [/* @__PURE__ */ jsx("input", {
839
+ type: "checkbox",
840
+ checked: autoRefresh,
841
+ onChange: (e) => setAutoRefresh(e.target.checked),
842
+ className: "w-4 h-4 rounded border-border-default text-action-primary-bg focus:ring-action-primary-bg"
843
+ }), /* @__PURE__ */ jsx("span", {
844
+ className: "text-sm text-text-secondary",
845
+ children: tr("fluidgrids.executions.executionFilters.liveUpdates", "Live updates")
846
+ })]
847
+ })
848
+ ]
849
+ })
850
+ }) : /* @__PURE__ */ jsxs("div", {
851
+ className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5",
852
+ children: [
853
+ /* @__PURE__ */ jsxs(ThemedSelect, {
854
+ "aria-label": tr("fluidgrids.executions.executionFilters.triggerType", "Trigger type"),
855
+ value: filter.triggerType,
856
+ onChange: (e) => setTriggerTypeFilter(e.target.value),
857
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg scheme-normal dark:scheme-dark",
858
+ children: [
859
+ /* @__PURE__ */ jsx("option", {
860
+ value: "all",
861
+ children: tr("fluidgrids.executions.executionFilters.allTriggers", "All trigger types")
862
+ }),
863
+ /* @__PURE__ */ jsx("option", {
864
+ value: "MANUAL",
865
+ children: tr("fluidgrids.executions.executionFilters.manual", "Manual")
866
+ }),
867
+ /* @__PURE__ */ jsx("option", {
868
+ value: "WEBHOOK",
869
+ children: tr("fluidgrids.executions.executionFilters.webhook", "Webhook")
870
+ }),
871
+ /* @__PURE__ */ jsx("option", {
872
+ value: "SCHEDULE",
873
+ children: tr("fluidgrids.executions.executionFilters.schedule", "Schedule")
874
+ }),
875
+ /* @__PURE__ */ jsx("option", {
876
+ value: "EVENT",
877
+ children: tr("fluidgrids.executions.executionFilters.event", "Event")
878
+ }),
879
+ /* @__PURE__ */ jsx("option", {
880
+ value: "MCP",
881
+ children: tr("fluidgrids.executions.executionFilters.mcp", "MCP tool call")
882
+ })
883
+ ]
884
+ }),
885
+ /* @__PURE__ */ jsxs(ThemedSelect, {
886
+ "aria-label": tr("fluidgrids.executions.executionFilters.errorType", "Error type"),
887
+ value: filter.errorType,
888
+ onChange: (e) => setErrorTypeFilter(e.target.value),
889
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg scheme-normal dark:scheme-dark",
890
+ children: [
891
+ /* @__PURE__ */ jsx("option", {
892
+ value: "all",
893
+ children: tr("fluidgrids.executions.executionFilters.allErrors", "All error types")
894
+ }),
895
+ errorOptions.map(({ value, label }) => /* @__PURE__ */ jsx("option", {
896
+ value,
897
+ children: label
898
+ }, value)),
899
+ linkedErrorType && /* @__PURE__ */ jsx("option", {
900
+ value: linkedErrorType,
901
+ children: linkedErrorType
902
+ })
903
+ ]
904
+ }),
905
+ /* @__PURE__ */ jsx(FailedNodeTypeChip, {
906
+ nodeType: filter.failedNodeType,
907
+ onClear: () => setFailedNodeTypeFilter("")
908
+ }),
909
+ /* @__PURE__ */ jsx("input", {
910
+ type: "text",
911
+ value: filter.nodeId,
912
+ onChange: (e) => setNodeFilter(e.target.value),
913
+ placeholder: tr("fluidgrids.executions.executionFilters.nodePlaceholder", "Node ID"),
914
+ "aria-label": tr("fluidgrids.executions.executionFilters.nodeId", "Node ID"),
915
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
916
+ }),
917
+ /* @__PURE__ */ jsx("input", {
918
+ type: "number",
919
+ min: 0,
920
+ value: filter.durationMinSeconds ?? "",
921
+ onChange: (e) => setDurationFilter(e.target.value ? Number(e.target.value) : null, filter.durationMaxSeconds),
922
+ placeholder: tr("fluidgrids.executions.executionFilters.durationMin", "Min seconds"),
923
+ "aria-label": tr("fluidgrids.executions.executionFilters.durationMin", "Minimum duration in seconds"),
924
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
925
+ }),
926
+ /* @__PURE__ */ jsx("input", {
927
+ type: "number",
928
+ min: 0,
929
+ value: filter.durationMaxSeconds ?? "",
930
+ onChange: (e) => setDurationFilter(filter.durationMinSeconds, e.target.value ? Number(e.target.value) : null),
931
+ placeholder: tr("fluidgrids.executions.executionFilters.durationMax", "Max seconds"),
932
+ "aria-label": tr("fluidgrids.executions.executionFilters.durationMax", "Maximum duration in seconds"),
933
+ className: "px-3 py-2 bg-bg-surface border border-border-default rounded-lg text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
934
+ })
935
+ ]
936
+ }),
937
+ showCustomDate && /* @__PURE__ */ jsxs("div", {
938
+ className: "space-y-2",
939
+ children: [/* @__PURE__ */ jsxs("div", {
940
+ className: "flex flex-wrap gap-3 items-center p-3 bg-surface rounded-lg border border-border-default",
941
+ children: [
942
+ /* @__PURE__ */ jsx("label", {
943
+ className: "text-sm text-text-secondary",
944
+ children: tr("fluidgrids.executions.executionFilters.fromLabel", "From:")
945
+ }),
946
+ /* @__PURE__ */ jsx(DateTimeField, {
947
+ value: toLocalInputValue(filter.dateRange.start),
948
+ onChange: (text) => setDateRange({
949
+ ...filter.dateRange,
950
+ start: fromLocalInputValue(text),
951
+ preset: "custom"
952
+ }),
953
+ dateLabel: tr("fluidgrids.executions.executionFilters.startDate", "Start date"),
954
+ timeLabel: tr("fluidgrids.executions.executionFilters.startTime", "Start time"),
955
+ inputClassName: "px-3 py-1.5 bg-surface-canvas border border-border-default rounded text-text-primary text-sm",
956
+ "data-testid": "runs-custom-range-start"
957
+ }),
958
+ /* @__PURE__ */ jsx("label", {
959
+ className: "text-sm text-text-secondary",
960
+ children: tr("fluidgrids.executions.executionFilters.toLabel", "To:")
961
+ }),
962
+ /* @__PURE__ */ jsx(DateTimeField, {
963
+ value: toLocalInputValue(filter.dateRange.end),
964
+ onChange: (text) => setDateRange({
965
+ ...filter.dateRange,
966
+ end: fromLocalInputValue(text),
967
+ preset: "custom"
968
+ }),
969
+ dateLabel: tr("fluidgrids.executions.executionFilters.endDate", "End date"),
970
+ timeLabel: tr("fluidgrids.executions.executionFilters.endTime", "End time"),
971
+ defaultTime: "23:59",
972
+ inputClassName: "px-3 py-1.5 bg-surface-canvas border border-border-default rounded text-text-primary text-sm",
973
+ "data-testid": "runs-custom-range-end"
974
+ }),
975
+ /* @__PURE__ */ jsx("button", {
976
+ onClick: () => setShowCustomDate(false),
977
+ className: "text-text-secondary hover:text-text-primary",
978
+ children: /* @__PURE__ */ jsx(Icon, {
979
+ icon: "mdi:close",
980
+ width: 18
981
+ })
982
+ })
983
+ ]
984
+ }), !validateDateRange(filter.dateRange.start, filter.dateRange.end).valid && /* @__PURE__ */ jsx("p", {
985
+ role: "alert",
986
+ className: "text-sm text-[var(--color-status-error-text)]",
987
+ children: tr("fluidgrids.executions.executionFilters.dateRangeInvalid", "Invalid date range: \"From\" must be before or equal to \"To\".")
988
+ })]
989
+ }),
990
+ /* @__PURE__ */ jsxs("div", {
991
+ className: "flex flex-wrap items-center justify-between gap-3",
992
+ children: [/* @__PURE__ */ jsxs("div", {
993
+ className: "flex items-center gap-3",
994
+ children: [!v2 && /* @__PURE__ */ jsxs("label", {
995
+ className: "inline-flex items-center gap-2 cursor-pointer",
996
+ children: [/* @__PURE__ */ jsx("input", {
997
+ type: "checkbox",
998
+ checked: autoRefresh,
999
+ onChange: (e) => setAutoRefresh(e.target.checked),
1000
+ className: "w-4 h-4 rounded border-border-default text-action-primary-bg focus:ring-action-primary-bg"
1001
+ }), /* @__PURE__ */ jsx("span", {
1002
+ className: "text-sm text-text-secondary",
1003
+ children: tr("fluidgrids.executions.executionFilters.autoRefresh", "Auto-refresh")
1004
+ })]
1005
+ }), onRefresh && /* @__PURE__ */ jsxs(Button$1, {
1006
+ variant: "outline",
1007
+ size: "sm",
1008
+ onClick: onRefresh,
1009
+ className: "gap-1.5",
1010
+ children: [/* @__PURE__ */ jsx(Icon, {
1011
+ icon: "mdi:refresh",
1012
+ width: 16
1013
+ }), tr("fluidgrids.executions.executionFilters.refresh", "Refresh")]
1014
+ })]
1015
+ }), /* @__PURE__ */ jsxs("div", {
1016
+ className: "flex items-center gap-3",
1017
+ children: [activeFiltersCount > 0 && /* @__PURE__ */ jsxs("span", {
1018
+ className: "text-sm text-text-secondary",
1019
+ children: [
1020
+ activeFiltersCount,
1021
+ " filter",
1022
+ activeFiltersCount > 1 ? "s" : "",
1023
+ " ",
1024
+ "active"
1025
+ ]
1026
+ }), activeFiltersCount > 0 && /* @__PURE__ */ jsxs(Button$1, {
1027
+ variant: "ghost",
1028
+ size: "sm",
1029
+ onClick: clearFilters,
1030
+ className: "gap-1.5",
1031
+ children: [/* @__PURE__ */ jsx(Icon, {
1032
+ icon: "mdi:filter-remove",
1033
+ width: 16
1034
+ }), tr("fluidgrids.executions.executionFilters.clearFilters", "Clear Filters")]
1035
+ })]
1036
+ })]
1037
+ })
1038
+ ]
1039
+ });
1040
+ }
1041
+
1042
+ // src/modules/executions/components/ExecutionStats.tsx
1043
+ function StatCard({ label, value, icon, color, trend, onClick }) {
1044
+ return /* @__PURE__ */ jsxs("button", {
1045
+ onClick,
1046
+ disabled: !onClick,
1047
+ className: `
1048
+ flex flex-col p-4 bg-surface rounded-lg border border-border-default
1049
+ hover:border-border-strong transition-colors
1050
+ ${onClick ? "cursor-pointer" : "cursor-default"}
1051
+ text-left w-full
1052
+ `,
1053
+ children: [
1054
+ /* @__PURE__ */ jsxs("div", {
1055
+ className: "flex items-center justify-between mb-2",
1056
+ children: [/* @__PURE__ */ jsx(Icon, {
1057
+ icon,
1058
+ className: color,
1059
+ width: 24
1060
+ }), trend && /* @__PURE__ */ jsxs("span", {
1061
+ className: `text-xs font-medium ${trend.isPositive ? "text-[var(--color-status-success-text)]" : "text-[var(--color-status-error-text)]"}`,
1062
+ children: [
1063
+ trend.isPositive ? "+" : "-",
1064
+ Math.abs(trend.value),
1065
+ "%"
1066
+ ]
1067
+ })]
1068
+ }),
1069
+ /* @__PURE__ */ jsx("div", {
1070
+ className: "text-2xl font-bold text-text-primary",
1071
+ children: value
1072
+ }),
1073
+ /* @__PURE__ */ jsx("div", {
1074
+ className: "text-sm text-text-secondary mt-1",
1075
+ children: label
1076
+ })
1077
+ ]
1078
+ });
1079
+ }
1080
+ /** The plain (not timed) skeleton: one grey card per number. */
1081
+ function PlainStatsSkeleton({ cards, pulse }) {
1082
+ return /* @__PURE__ */ jsx("div", {
1083
+ className: "grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-6 gap-4",
1084
+ children: [...Array(cards)].map((_, i) => /* @__PURE__ */ jsx("div", { className: `h-24 bg-surface rounded-lg border border-border-default${pulse ? " animate-pulse" : ""}` }, i))
1085
+ });
1086
+ }
1087
+ /**
1088
+ * Numbers the person may not read (BOFF-16690): the skeleton's own markup,
1089
+ * hidden, holds the exact size the loading state had, so nothing under it
1090
+ * moves when it goes.
1091
+ */
1092
+ function ExecutionStatsUnavailable() {
1093
+ const tr = useTr();
1094
+ const v2 = useNavigationV2();
1095
+ const loadingSystem = useLoadingSystem();
1096
+ return /* @__PURE__ */ jsxs("div", {
1097
+ className: "relative",
1098
+ "data-testid": "runs-stats-unavailable",
1099
+ children: [/* @__PURE__ */ jsx("div", {
1100
+ "aria-hidden": "true",
1101
+ className: "invisible",
1102
+ children: v2 && loadingSystem ? /* @__PURE__ */ jsx(RunsStatsSkeleton, {}) : /* @__PURE__ */ jsx(PlainStatsSkeleton, {
1103
+ cards: v2 ? 4 : 6,
1104
+ pulse: false
1105
+ })
1106
+ }), /* @__PURE__ */ jsx("p", {
1107
+ className: "absolute inset-0 flex items-center justify-center rounded-lg border border-border-default bg-surface px-4 text-center text-sm text-text-secondary",
1108
+ children: tr("fluidgrids.executions.executionStats.unavailable", "The run numbers are not available to you.")
1109
+ })]
1110
+ });
1111
+ }
1112
+ function ExecutionStats({ stats, loading, scoped = false, onFilterByStatus }) {
1113
+ const tr = useTr();
1114
+ const v2 = useNavigationV2();
1115
+ const loadingSystem = useLoadingSystem();
1116
+ const timed = v2 && loadingSystem;
1117
+ const region = (body) => timed ? /* @__PURE__ */ jsx(HeldLoadRegion, {
1118
+ hold: Boolean(loading) && !stats,
1119
+ loading: Boolean(loading),
1120
+ skeleton: /* @__PURE__ */ jsx(RunsStatsSkeleton, {}),
1121
+ label: tr("fluidgrids.executions.executionStats.loadingRegion", "Loading the numbers"),
1122
+ children: body
1123
+ }) : body;
1124
+ if (loading && !timed) return /* @__PURE__ */ jsx(PlainStatsSkeleton, {
1125
+ cards: v2 ? 4 : 6,
1126
+ pulse: true
1127
+ });
1128
+ if (!stats) return timed ? region(null) : null;
1129
+ const formatDuration = (seconds) => {
1130
+ if (seconds < 60) return `${Math.round(seconds)}s`;
1131
+ if (seconds < 3600) return `${Math.round(seconds / 60)}m`;
1132
+ return `${Math.round(seconds / 3600)}h`;
1133
+ };
1134
+ if (v2) {
1135
+ const words = runStatusLabels(tr);
1136
+ return region(/* @__PURE__ */ jsxs("div", {
1137
+ className: "space-y-3",
1138
+ "data-testid": "runs-stats",
1139
+ children: [/* @__PURE__ */ jsxs("div", {
1140
+ className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
1141
+ children: [
1142
+ /* @__PURE__ */ jsx(StatCard, {
1143
+ label: tr("fluidgrids.executions.executionStats.totalRuns", "Total Runs"),
1144
+ value: stats.total.toLocaleString(),
1145
+ icon: "mdi:play-box-multiple",
1146
+ color: "text-text-primary",
1147
+ onClick: () => onFilterByStatus?.("all")
1148
+ }),
1149
+ /* @__PURE__ */ jsx(StatCard, {
1150
+ label: words.RUNNING,
1151
+ value: stats.running,
1152
+ icon: "mdi:play-circle",
1153
+ color: "text-[var(--color-status-info-text)]",
1154
+ onClick: () => onFilterByStatus?.("RUNNING")
1155
+ }),
1156
+ /* @__PURE__ */ jsx(StatCard, {
1157
+ label: words.COMPLETED,
1158
+ value: stats.completed.toLocaleString(),
1159
+ icon: "mdi:check-circle",
1160
+ color: "text-[var(--color-status-success-text)]",
1161
+ onClick: () => onFilterByStatus?.("COMPLETED")
1162
+ }),
1163
+ /* @__PURE__ */ jsx(StatCard, {
1164
+ label: words.FAILED,
1165
+ value: stats.failed,
1166
+ icon: "mdi:alert-circle",
1167
+ color: "text-[var(--color-status-error-text)]",
1168
+ onClick: () => onFilterByStatus?.("FAILED")
1169
+ })
1170
+ ]
1171
+ }), /* @__PURE__ */ jsx(Disclosure, {
1172
+ closedLabel: tr("fluidgrids.executions.executionStats.moreNumbers", "More numbers"),
1173
+ openLabel: tr("fluidgrids.executions.executionStats.fewerNumbers", "Fewer numbers"),
1174
+ "data-testid": "runs-more-numbers",
1175
+ children: /* @__PURE__ */ jsxs("div", {
1176
+ className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
1177
+ children: [
1178
+ /* @__PURE__ */ jsx(StatCard, {
1179
+ label: tr("fluidgrids.executions.executionStats.successRate", "Success Rate"),
1180
+ value: `${(stats.successRate ?? 0).toFixed(1)}%`,
1181
+ icon: "mdi:percent",
1182
+ color: "text-accent"
1183
+ }),
1184
+ !scoped && /* @__PURE__ */ jsx(StatCard, {
1185
+ label: tr("fluidgrids.executions.executionStats.avgDuration", "Avg Duration"),
1186
+ value: formatDuration(stats.avgDuration ?? 0),
1187
+ icon: "mdi:timer",
1188
+ color: "text-[var(--color-status-warning-text)]"
1189
+ }),
1190
+ /* @__PURE__ */ jsx(StatCard, {
1191
+ label: words.CANCELLED,
1192
+ value: stats.cancelled,
1193
+ icon: "mdi:cancel",
1194
+ color: "text-[var(--color-status-warning-text)]",
1195
+ onClick: () => onFilterByStatus?.("CANCELLED")
1196
+ }),
1197
+ /* @__PURE__ */ jsx(StatCard, {
1198
+ label: words.WAITING,
1199
+ value: stats.waiting,
1200
+ icon: "mdi:timer-sand",
1201
+ color: "text-text-primary",
1202
+ onClick: () => onFilterByStatus?.("WAITING")
1203
+ })
1204
+ ]
1205
+ })
1206
+ })]
1207
+ }));
1208
+ }
1209
+ return /* @__PURE__ */ jsxs("div", {
1210
+ className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-4",
1211
+ children: [
1212
+ /* @__PURE__ */ jsx(StatCard, {
1213
+ label: tr("fluidgrids.executions.executionStats.totalRuns", "Total Runs"),
1214
+ value: stats.total.toLocaleString(),
1215
+ icon: "mdi:play-box-multiple",
1216
+ color: "text-text-primary",
1217
+ onClick: () => onFilterByStatus?.("all")
1218
+ }),
1219
+ /* @__PURE__ */ jsx(StatCard, {
1220
+ label: tr("fluidgrids.executions.executionStats.running", "Running"),
1221
+ value: stats.running,
1222
+ icon: "mdi:play-circle",
1223
+ color: "text-[var(--color-status-info-text)]",
1224
+ onClick: () => onFilterByStatus?.("RUNNING")
1225
+ }),
1226
+ /* @__PURE__ */ jsx(StatCard, {
1227
+ label: tr("fluidgrids.executions.executionStats.completed", "Completed"),
1228
+ value: stats.completed.toLocaleString(),
1229
+ icon: "mdi:check-circle",
1230
+ color: "text-[var(--color-status-success-text)]",
1231
+ onClick: () => onFilterByStatus?.("COMPLETED")
1232
+ }),
1233
+ /* @__PURE__ */ jsx(StatCard, {
1234
+ label: tr("fluidgrids.executions.executionStats.failed", "Failed"),
1235
+ value: stats.failed,
1236
+ icon: "mdi:alert-circle",
1237
+ color: "text-[var(--color-status-error-text)]",
1238
+ onClick: () => onFilterByStatus?.("FAILED")
1239
+ }),
1240
+ /* @__PURE__ */ jsx(StatCard, {
1241
+ label: tr("fluidgrids.executions.executionStats.successRate", "Success Rate"),
1242
+ value: `${(stats.successRate ?? 0).toFixed(1)}%`,
1243
+ icon: "mdi:percent",
1244
+ color: "text-accent"
1245
+ }),
1246
+ /* @__PURE__ */ jsx(StatCard, {
1247
+ label: tr("fluidgrids.executions.executionStats.avgDuration", "Avg Duration"),
1248
+ value: formatDuration(stats.avgDuration ?? 0),
1249
+ icon: "mdi:timer",
1250
+ color: "text-[var(--color-status-warning-text)]"
1251
+ })
1252
+ ]
1253
+ });
1254
+ }
1255
+
1256
+ // src/modules/executions/utils/run-actions.ts
1257
+ /** Run statuses a bulk or row "Retry" (a new run of the same version) applies to. */
1258
+ const RETRYABLE_STATUSES = ["FAILED"];
1259
+ /** How many selected runs one bulk retry starts. */
1260
+ const BULK_RETRY_LIMIT = 10;
1261
+ /**
1262
+ * The quick actions for a run, in display order.
1263
+ *
1264
+ * `resumeOffered` is the answer to "would the run page offer Resume?": a run
1265
+ * that is still waiting on a person's answer cannot be resumed (the service
1266
+ * refuses), so the list must not offer it either.
1267
+ */
1268
+ function runQuickActions(status, { resumeOffered }) {
1269
+ switch (status) {
1270
+ case "RUNNING": return ["pause", "cancel"];
1271
+ case "WAITING": return resumeOffered ? ["resume", "cancel"] : ["cancel"];
1272
+ case "FAILED": return ["retry"];
1273
+ case "PENDING": return ["cancel"];
1274
+ default: return [];
1275
+ }
1276
+ }
1277
+ /**
1278
+ * Which of the selected runs a bulk retry starts: only runs that failed (a
1279
+ * retry of a succeeded run would silently run it again), and at most the first
1280
+ * {@link BULK_RETRY_LIMIT}. What was left out is counted so the page can say so.
1281
+ */
1282
+ function planBulkRetry(selectedIds, runs) {
1283
+ const statusById = new Map(runs.map((run) => [run.id, run.status]));
1284
+ const failed = selectedIds.filter((id) => {
1285
+ const status = statusById.get(id);
1286
+ return status !== void 0 && RETRYABLE_STATUSES.includes(status);
1287
+ });
1288
+ return {
1289
+ runIds: failed.slice(0, 10),
1290
+ skippedNotFailed: selectedIds.length - failed.length,
1291
+ skippedOverLimit: Math.max(0, failed.length - 10)
1292
+ };
1293
+ }
1294
+
1295
+ // src/modules/executions/hooks/useResumeOffered.ts
1296
+ /**
1297
+ * Whether the Runs list may offer "Resume" on a row. The run page offers it
1298
+ * only once the run's asks are known to be answered (a run waiting on a person
1299
+ * continues only with their answer, and the service refuses a generic resume),
1300
+ * so the list asks the same question for WAITING rows and nothing otherwise
1301
+ * (BOFF-11846). Until the asks have been read, Resume is not offered.
1302
+ */
1303
+ function useResumeOffered(run) {
1304
+ const waiting = run.status === "WAITING";
1305
+ const { items, loaded } = useRunHumanRequests(waiting ? run.id : void 0);
1306
+ return waiting && loaded && !items.some((item) => item.status === "PENDING");
1307
+ }
1308
+
1309
+ // src/modules/executions/components/WithResumeOffered.tsx
1310
+ /**
1311
+ * Lets a list row (which is rendered inside a `.map`, where hooks cannot be
1312
+ * called) ask whether Resume may be offered for its run (BOFF-11846).
1313
+ */
1314
+ function WithResumeOffered({ run, children }) {
1315
+ return /* @__PURE__ */ jsx(Fragment$1, { children: children(useResumeOffered(run)) });
1316
+ }
1317
+
1318
+ // src/modules/executions/components/ExecutionTable.tsx
1319
+ function ExecutionTable({ executions, workflowNames, loading, canExecute = true, filtered = false, onRowClick, onAction }) {
1320
+ const tr = useTr();
1321
+ const navigate = useNavigate();
1322
+ const { selection, toggleSelectRun, selectAll, expandedRows, toggleRowExpanded } = useExecutionsStore();
1323
+ const allRunIds = useMemo(() => executions.map((e) => e.id), [executions]);
1324
+ const selectedRunIds = useMemo(() => new Set(selection.runIds), [selection.runIds]);
1325
+ const formatDate = (dateStr) => {
1326
+ if (!dateStr) return "-";
1327
+ const date = new Date(dateStr);
1328
+ const diff = (/* @__PURE__ */ new Date()).getTime() - date.getTime();
1329
+ if (diff < 6e4) return tr("fluidgrids.executions.executionTable.justNow", "Just now");
1330
+ if (diff < 36e5) return `${Math.round(diff / 6e4)}m ago`;
1331
+ if (diff < 864e5) return `${Math.round(diff / 36e5)}h ago`;
1332
+ if (diff < 6048e5) return `${Math.round(diff / 864e5)}d ago`;
1333
+ return date.toLocaleDateString("en-US", {
1334
+ month: "short",
1335
+ day: "numeric",
1336
+ hour: "2-digit",
1337
+ minute: "2-digit"
1338
+ });
1339
+ };
1340
+ const getRowActions = (execution, resumeOffered) => {
1341
+ const labels = {
1342
+ pause: {
1343
+ icon: "mdi:pause",
1344
+ label: tr("fluidgrids.executions.executionTable.actionPause", "Pause")
1345
+ },
1346
+ cancel: {
1347
+ icon: "mdi:stop",
1348
+ label: tr("fluidgrids.executions.executionTable.actionCancel", "Cancel")
1349
+ },
1350
+ resume: {
1351
+ icon: "mdi:play",
1352
+ label: tr("fluidgrids.executions.executionTable.actionResume", "Resume")
1353
+ },
1354
+ retry: {
1355
+ icon: "mdi:refresh",
1356
+ label: tr("fluidgrids.executions.executionTable.actionRetry", "Retry")
1357
+ }
1358
+ };
1359
+ return runQuickActions(execution.status, { resumeOffered }).map((action) => ({
1360
+ action,
1361
+ ...labels[action]
1362
+ }));
1363
+ };
1364
+ if (loading && executions.length === 0) return /* @__PURE__ */ jsx("div", {
1365
+ className: "bg-surface rounded-lg border border-border-default overflow-hidden",
1366
+ children: /* @__PURE__ */ jsx("div", {
1367
+ className: "overflow-x-auto",
1368
+ children: /* @__PURE__ */ jsxs("table", {
1369
+ className: "w-full min-w-[800px]",
1370
+ children: [/* @__PURE__ */ jsx("thead", {
1371
+ className: "bg-surface-sunken border-b border-border-default",
1372
+ children: /* @__PURE__ */ jsxs("tr", { children: [
1373
+ /* @__PURE__ */ jsx("th", { className: "w-10 px-4 py-3" }),
1374
+ /* @__PURE__ */ jsx("th", {
1375
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase",
1376
+ children: tr("fluidgrids.executions.executionTable.colStatus", "Status")
1377
+ }),
1378
+ /* @__PURE__ */ jsx("th", {
1379
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase",
1380
+ children: tr("fluidgrids.executions.executionTable.colWorkflow", "Workflow")
1381
+ }),
1382
+ /* @__PURE__ */ jsx("th", {
1383
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase",
1384
+ children: tr("fluidgrids.executions.executionTable.colRunId", "Run ID")
1385
+ }),
1386
+ /* @__PURE__ */ jsx("th", {
1387
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase",
1388
+ children: tr("fluidgrids.executions.executionTable.colStarted", "Started")
1389
+ }),
1390
+ /* @__PURE__ */ jsx("th", {
1391
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase",
1392
+ children: tr("fluidgrids.executions.executionTable.colDuration", "Duration")
1393
+ }),
1394
+ /* @__PURE__ */ jsx("th", {
1395
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase",
1396
+ children: tr("fluidgrids.executions.executionTable.colProgress", "Progress")
1397
+ }),
1398
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3" })
1399
+ ] })
1400
+ }), /* @__PURE__ */ jsx("tbody", { children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsx("tr", {
1401
+ className: "border-b border-border-default",
1402
+ children: /* @__PURE__ */ jsx("td", {
1403
+ colSpan: 8,
1404
+ className: "px-4 py-4",
1405
+ children: /* @__PURE__ */ jsx("div", { className: "h-8 bg-surface-sunken rounded animate-pulse" })
1406
+ })
1407
+ }, i)) })]
1408
+ })
1409
+ })
1410
+ });
1411
+ if (executions.length === 0) return /* @__PURE__ */ jsx(EmptyState, {
1412
+ kind: filtered ? "filtered" : "first-use",
1413
+ illustration: "history",
1414
+ size: "page",
1415
+ icon: /* @__PURE__ */ jsx(Icon, {
1416
+ icon: "mdi:play-box-outline",
1417
+ className: "text-text-secondary",
1418
+ width: 48
1419
+ }),
1420
+ title: tr("fluidgrids.executions.executionTable.emptyTitle", "No executions found"),
1421
+ description: tr("fluidgrids.executions.executionTable.emptyDescription", "There are no workflow executions matching your filters."),
1422
+ action: /* @__PURE__ */ jsx(Button$1, {
1423
+ variant: "outline",
1424
+ onClick: () => navigate("../list"),
1425
+ children: tr("fluidgrids.executions.executionTable.viewWorkflows", "View Workflows")
1426
+ })
1427
+ });
1428
+ return /* @__PURE__ */ jsxs("div", {
1429
+ className: "bg-surface rounded-lg border border-border-default overflow-hidden",
1430
+ children: [/* @__PURE__ */ jsx("div", {
1431
+ className: "overflow-x-auto",
1432
+ children: /* @__PURE__ */ jsxs("table", {
1433
+ className: "w-full min-w-[800px]",
1434
+ children: [/* @__PURE__ */ jsx("thead", {
1435
+ className: "bg-surface-sunken border-b border-border-default",
1436
+ children: /* @__PURE__ */ jsxs("tr", { children: [
1437
+ /* @__PURE__ */ jsx("th", {
1438
+ className: "w-10 px-4 py-3",
1439
+ children: /* @__PURE__ */ jsx("input", {
1440
+ type: "checkbox",
1441
+ checked: selection.allSelected,
1442
+ onChange: () => selectAll(allRunIds),
1443
+ "aria-label": tr("fluidgrids.executions.executionTable.selectAllOnPage", "Select all runs on this page"),
1444
+ "data-testid": "runs-select-all",
1445
+ className: "w-4 h-4 rounded border-border-default"
1446
+ })
1447
+ }),
1448
+ /* @__PURE__ */ jsx("th", {
1449
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",
1450
+ children: tr("fluidgrids.executions.executionTable.colStatus", "Status")
1451
+ }),
1452
+ /* @__PURE__ */ jsx("th", {
1453
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",
1454
+ children: tr("fluidgrids.executions.executionTable.colWorkflow", "Workflow")
1455
+ }),
1456
+ /* @__PURE__ */ jsx("th", {
1457
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",
1458
+ children: tr("fluidgrids.executions.executionTable.colRunId", "Run ID")
1459
+ }),
1460
+ /* @__PURE__ */ jsx("th", {
1461
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",
1462
+ children: tr("fluidgrids.executions.executionTable.colStarted", "Started")
1463
+ }),
1464
+ /* @__PURE__ */ jsx("th", {
1465
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",
1466
+ children: tr("fluidgrids.executions.executionTable.colDuration", "Duration")
1467
+ }),
1468
+ /* @__PURE__ */ jsx("th", {
1469
+ className: "px-4 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",
1470
+ children: tr("fluidgrids.executions.executionTable.colProgress", "Progress")
1471
+ }),
1472
+ /* @__PURE__ */ jsx("th", { className: "px-4 py-3 w-32" })
1473
+ ] })
1474
+ }), /* @__PURE__ */ jsx("tbody", {
1475
+ className: "divide-y divide-border-default",
1476
+ children: executions.map((execution) => {
1477
+ const isSelected = selectedRunIds.has(execution.id);
1478
+ const isExpanded = expandedRows.has(execution.id);
1479
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
1480
+ ...runSuggestAnchorProps(execution.id),
1481
+ className: `
1482
+ hover:bg-surface-sunken/50 cursor-pointer transition-colors
1483
+ ${isSelected ? "bg-action-primary-bg/10" : ""}
1484
+ `,
1485
+ onClick: () => onRowClick?.(execution),
1486
+ children: [
1487
+ /* @__PURE__ */ jsx("td", {
1488
+ className: "px-4 py-3",
1489
+ onClick: (e) => e.stopPropagation(),
1490
+ children: /* @__PURE__ */ jsx("input", {
1491
+ type: "checkbox",
1492
+ checked: isSelected,
1493
+ onChange: () => toggleSelectRun(execution.id),
1494
+ "aria-label": tr("fluidgrids.executions.executionTable.selectRun", "Select this run"),
1495
+ "data-testid": "runs-select-row",
1496
+ className: "w-4 h-4 rounded border-border-default"
1497
+ })
1498
+ }),
1499
+ /* @__PURE__ */ jsx("td", {
1500
+ className: "px-4 py-3",
1501
+ children: /* @__PURE__ */ jsx(ExecutionStatusBadge, {
1502
+ status: execution.status,
1503
+ caughtErrorCount: execution.caughtErrors?.length,
1504
+ size: "sm"
1505
+ })
1506
+ }),
1507
+ /* @__PURE__ */ jsx("td", {
1508
+ className: "px-4 py-3",
1509
+ children: /* @__PURE__ */ jsxs("div", {
1510
+ className: "flex flex-col",
1511
+ children: [/* @__PURE__ */ jsx("span", {
1512
+ className: "text-sm font-medium text-text-primary",
1513
+ children: execution.workflow?.name || workflowNames?.[execution.workflowKey] || execution.workflowKey
1514
+ }), /* @__PURE__ */ jsx("span", {
1515
+ className: "text-xs text-text-secondary",
1516
+ children: formatRunVersion(execution.version)
1517
+ })]
1518
+ })
1519
+ }),
1520
+ /* @__PURE__ */ jsx("td", {
1521
+ className: "px-4 py-3",
1522
+ children: /* @__PURE__ */ jsxs("span", {
1523
+ className: "text-sm font-mono text-text-secondary",
1524
+ children: [execution.id.slice(0, 8), "..."]
1525
+ })
1526
+ }),
1527
+ /* @__PURE__ */ jsx("td", {
1528
+ className: "px-4 py-3",
1529
+ children: /* @__PURE__ */ jsx("span", {
1530
+ className: "text-sm text-text-secondary",
1531
+ children: formatDate(execution.startedAt || execution.createdAt)
1532
+ })
1533
+ }),
1534
+ /* @__PURE__ */ jsx("td", {
1535
+ className: "px-4 py-3",
1536
+ children: /* @__PURE__ */ jsx("span", {
1537
+ className: "text-sm text-text-secondary",
1538
+ children: formatElapsedMs(runDurationMs(execution))
1539
+ })
1540
+ }),
1541
+ /* @__PURE__ */ jsx("td", {
1542
+ className: "px-4 py-3",
1543
+ children: /* @__PURE__ */ jsxs("div", {
1544
+ className: "flex items-center gap-2",
1545
+ children: [/* @__PURE__ */ jsx("div", {
1546
+ className: "flex-1 h-2 bg-surface-sunken rounded-full overflow-hidden max-w-[100px]",
1547
+ children: /* @__PURE__ */ jsx("div", {
1548
+ className: `h-full transition-all ${execution.status === "FAILED" ? "bg-[var(--color-status-error-bg)]" : execution.status === "COMPLETED" ? "bg-[var(--color-status-success-bg)]" : "bg-[var(--color-status-info-bg)]"}`,
1549
+ style: { width: `${execution.progress}%` }
1550
+ })
1551
+ }), /* @__PURE__ */ jsxs("span", {
1552
+ className: "text-xs text-text-secondary min-w-[45px]",
1553
+ children: [
1554
+ execution.completedNodes ?? 0,
1555
+ "/",
1556
+ execution.totalNodes ?? 0
1557
+ ]
1558
+ })]
1559
+ })
1560
+ }),
1561
+ /* @__PURE__ */ jsx("td", {
1562
+ className: "px-4 py-3",
1563
+ onClick: (e) => e.stopPropagation(),
1564
+ children: /* @__PURE__ */ jsxs("div", {
1565
+ className: "flex items-center gap-1",
1566
+ children: [
1567
+ /* @__PURE__ */ jsx("button", {
1568
+ type: "button",
1569
+ onClick: () => toggleRowExpanded(execution.id),
1570
+ "aria-expanded": isExpanded,
1571
+ "aria-label": isExpanded ? tr("fluidgrids.executions.executionTable.collapseRow", "Hide run details") : tr("fluidgrids.executions.executionTable.expandRow", "Show run details"),
1572
+ className: "p-1.5 rounded hover:bg-surface-sunken text-text-secondary",
1573
+ children: /* @__PURE__ */ jsx(Icon, {
1574
+ icon: isExpanded ? "mdi:chevron-up" : "mdi:chevron-down",
1575
+ width: 18
1576
+ })
1577
+ }),
1578
+ /* @__PURE__ */ jsx(WithResumeOffered, {
1579
+ run: execution,
1580
+ children: (resumeOffered) => (canExecute ? getRowActions(execution, resumeOffered) : []).slice(0, 2).map((action) => /* @__PURE__ */ jsx("button", {
1581
+ "data-agent": "confirm",
1582
+ type: "button",
1583
+ onClick: () => onAction?.(action.action, execution),
1584
+ className: "p-1.5 rounded hover:bg-surface-sunken text-text-secondary",
1585
+ title: action.label,
1586
+ "aria-label": action.label,
1587
+ children: /* @__PURE__ */ jsx(Icon, {
1588
+ icon: action.icon,
1589
+ width: 18
1590
+ })
1591
+ }, action.action))
1592
+ }),
1593
+ /* @__PURE__ */ jsx("button", {
1594
+ onClick: () => navigate(`../runs/${execution.id}`),
1595
+ className: "p-1.5 rounded hover:bg-surface-sunken text-text-secondary",
1596
+ title: tr("fluidgrids.executions.executionTable.viewDetails", "View Details"),
1597
+ "aria-label": tr("fluidgrids.executions.executionTable.viewDetails", "View Details"),
1598
+ children: /* @__PURE__ */ jsx(Icon, {
1599
+ icon: "mdi:arrow-right",
1600
+ width: 18
1601
+ })
1602
+ })
1603
+ ]
1604
+ })
1605
+ })
1606
+ ]
1607
+ }, execution.id), isExpanded && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
1608
+ colSpan: 8,
1609
+ className: "px-4 py-4 bg-surface-sunken/30",
1610
+ children: /* @__PURE__ */ jsxs("div", {
1611
+ className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
1612
+ children: [
1613
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1614
+ className: "text-xs text-text-secondary mb-1",
1615
+ children: tr("fluidgrids.executions.executionTable.triggerNode", "Trigger Node")
1616
+ }), /* @__PURE__ */ jsx("div", {
1617
+ className: "text-sm text-text-primary font-medium",
1618
+ children: execution.triggerNodeId
1619
+ })] }),
1620
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1621
+ className: "text-xs text-text-secondary mb-1",
1622
+ children: tr("fluidgrids.executions.executionTable.nodeStats", "Node Stats")
1623
+ }), /* @__PURE__ */ jsxs("div", {
1624
+ className: "flex gap-2 text-sm",
1625
+ children: [
1626
+ /* @__PURE__ */ jsxs("span", {
1627
+ className: "text-[var(--color-status-success-text)]",
1628
+ children: [
1629
+ execution.completedNodes ?? 0,
1630
+ " ",
1631
+ tr("fluidgrids.executions.executionTable.completed", "completed")
1632
+ ]
1633
+ }),
1634
+ (execution.failedNodes ?? 0) > 0 && /* @__PURE__ */ jsxs("span", {
1635
+ className: "text-[var(--color-status-error-text)]",
1636
+ children: [
1637
+ execution.failedNodes,
1638
+ " ",
1639
+ tr("fluidgrids.executions.executionTable.failed", "failed")
1640
+ ]
1641
+ }),
1642
+ (execution.skippedNodes ?? 0) > 0 && /* @__PURE__ */ jsxs("span", {
1643
+ className: "text-text-muted",
1644
+ children: [
1645
+ execution.skippedNodes,
1646
+ " ",
1647
+ tr("fluidgrids.executions.executionTable.skipped", "skipped")
1648
+ ]
1649
+ })
1650
+ ]
1651
+ })] }),
1652
+ execution.errorMessage && /* @__PURE__ */ jsxs("div", {
1653
+ className: "col-span-2",
1654
+ children: [
1655
+ /* @__PURE__ */ jsx("div", {
1656
+ className: "text-xs text-text-secondary mb-1",
1657
+ children: tr("fluidgrids.executions.executionTable.error", "Error")
1658
+ }),
1659
+ /* @__PURE__ */ jsx("div", {
1660
+ className: "text-sm text-[var(--color-status-error-text)] bg-[var(--color-status-error-bg-subtle)] p-2 rounded",
1661
+ children: execution.errorMessage
1662
+ }),
1663
+ isSandboxRuntimeExhausted(execution.errorType) && /* @__PURE__ */ jsx("div", {
1664
+ className: "mt-1 text-xs text-text-secondary",
1665
+ children: errorAdvice(tr, execution.errorType)
1666
+ })
1667
+ ]
1668
+ }),
1669
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1670
+ className: "text-xs text-text-secondary mb-1",
1671
+ children: tr("fluidgrids.executions.executionTable.fullRunId", "Full Run ID")
1672
+ }), /* @__PURE__ */ jsx("div", {
1673
+ className: "text-sm font-mono text-text-secondary break-all",
1674
+ children: execution.id
1675
+ })] })
1676
+ ]
1677
+ })
1678
+ }) }, `${execution.id}-expanded`)] }, execution.id);
1679
+ })
1680
+ })]
1681
+ })
1682
+ }), /* @__PURE__ */ jsx("div", {
1683
+ className: "sm:hidden px-4 py-2 bg-surface-sunken border-t border-border-default text-xs text-text-secondary text-center",
1684
+ children: tr("fluidgrids.executions.executionTable.swipeHint", "Swipe to see more columns")
1685
+ })]
1686
+ });
1687
+ }
1688
+
1689
+ // src/modules/executions/components/ExecutionCards.tsx
1690
+ /**
1691
+ * ExecutionCards — Card-grid view for workflow executions.
1692
+ * Displays each execution as a card with status badge, timing info, and progress bar.
1693
+ * Used when viewMode is 'cards' in ExecutionsListPage.
1694
+ */
1695
+ function formatRelativeTime(dateStr) {
1696
+ if (!dateStr) return "--";
1697
+ const date = new Date(dateStr);
1698
+ const diffMs = (/* @__PURE__ */ new Date()).getTime() - date.getTime();
1699
+ const diffMins = Math.floor(diffMs / 6e4);
1700
+ if (diffMins < 1) return "just now";
1701
+ if (diffMins < 60) return `${diffMins}m ago`;
1702
+ const diffHours = Math.floor(diffMins / 60);
1703
+ if (diffHours < 24) return `${diffHours}h ago`;
1704
+ return `${Math.floor(diffHours / 24)}d ago`;
1705
+ }
1706
+ /** Icon, label and hover colour of each card action. */
1707
+ const CARD_ACTIONS = (tr) => ({
1708
+ pause: {
1709
+ icon: "mdi:pause",
1710
+ label: tr("fluidgrids.executions.executionCards.pauseButton", "Pause"),
1711
+ hover: "hover:bg-status-warning-bg-subtle hover:text-status-warning-text"
1712
+ },
1713
+ cancel: {
1714
+ icon: "mdi:stop",
1715
+ label: tr("fluidgrids.executions.executionCards.cancelButton", "Cancel"),
1716
+ hover: "hover:bg-status-error-bg-subtle hover:text-status-error-text"
1717
+ },
1718
+ resume: {
1719
+ icon: "mdi:play",
1720
+ label: tr("fluidgrids.executions.executionTable.actionResume", "Resume"),
1721
+ hover: "hover:bg-status-info-bg-subtle hover:text-status-info-text"
1722
+ },
1723
+ retry: {
1724
+ icon: "mdi:refresh",
1725
+ label: tr("fluidgrids.executions.executionTable.actionRetry", "Retry"),
1726
+ hover: "hover:bg-status-info-bg-subtle hover:text-status-info-text"
1727
+ }
1728
+ });
1729
+ function getProgressColor(status) {
1730
+ switch (status) {
1731
+ case "COMPLETED": return "bg-status-success-bg";
1732
+ case "FAILED":
1733
+ case "TERMINATED": return "bg-status-error-bg";
1734
+ case "RUNNING": return "bg-status-info-bg";
1735
+ case "CANCELLED": return "bg-status-warning-bg";
1736
+ default: return "bg-text-muted";
1737
+ }
1738
+ }
1739
+ function ExecutionCards({ executions, workflowNames, loading, filtered = false, onCardClick, onAction }) {
1740
+ const tr = useTr();
1741
+ if (loading) return /* @__PURE__ */ jsx("div", {
1742
+ className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
1743
+ children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsxs("div", {
1744
+ className: "rounded-lg border border-border-default bg-surface p-4 animate-pulse",
1745
+ children: [
1746
+ /* @__PURE__ */ jsxs("div", {
1747
+ className: "flex justify-between mb-3",
1748
+ children: [/* @__PURE__ */ jsx("div", { className: "h-4 bg-surface-sunken rounded w-32" }), /* @__PURE__ */ jsx("div", { className: "h-5 bg-surface-sunken rounded-full w-20" })]
1749
+ }),
1750
+ /* @__PURE__ */ jsx("div", { className: "h-3 bg-surface-sunken rounded w-48 mb-2" }),
1751
+ /* @__PURE__ */ jsx("div", { className: "h-2 bg-surface-sunken rounded w-full mb-3" }),
1752
+ /* @__PURE__ */ jsxs("div", {
1753
+ className: "flex justify-between",
1754
+ children: [/* @__PURE__ */ jsx("div", { className: "h-3 bg-surface-sunken rounded w-16" }), /* @__PURE__ */ jsx("div", { className: "h-3 bg-surface-sunken rounded w-24" })]
1755
+ })
1756
+ ]
1757
+ }, i))
1758
+ });
1759
+ if (executions.length === 0) return /* @__PURE__ */ jsx(EmptyState, {
1760
+ kind: filtered ? "filtered" : "first-use",
1761
+ illustration: "history",
1762
+ size: "page",
1763
+ icon: /* @__PURE__ */ jsx(Icon, {
1764
+ icon: "mdi:play-circle-outline",
1765
+ width: 48
1766
+ }),
1767
+ title: tr("fluidgrids.executions.executionCards.emptyTitle", "No executions found"),
1768
+ description: tr("fluidgrids.executions.executionCards.emptyDescription", "Run a workflow to see results here")
1769
+ });
1770
+ return /* @__PURE__ */ jsx("div", {
1771
+ className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
1772
+ children: executions.map((execution) => {
1773
+ const config = RUN_STATUS_CONFIG[execution.status];
1774
+ return /* @__PURE__ */ jsxs("div", {
1775
+ onClick: () => onCardClick(execution),
1776
+ className: `
1777
+ rounded-lg border bg-surface p-4 cursor-pointer
1778
+ transition-all duration-200 hover:shadow-md hover:border-border-strong
1779
+ ${config.borderColor}
1780
+ `,
1781
+ children: [
1782
+ /* @__PURE__ */ jsxs("div", {
1783
+ className: "flex items-start justify-between mb-3",
1784
+ children: [/* @__PURE__ */ jsxs("div", {
1785
+ className: "min-w-0 flex-1 mr-2",
1786
+ children: [/* @__PURE__ */ jsx("p", {
1787
+ className: "text-sm font-semibold text-text-primary truncate",
1788
+ children: execution.workflow?.name || workflowNames?.[execution.workflowKey] || execution.workflowKey
1789
+ }), /* @__PURE__ */ jsx("p", {
1790
+ className: "text-xs text-text-muted mt-0.5",
1791
+ children: formatRunVersion(execution.version)
1792
+ })]
1793
+ }), /* @__PURE__ */ jsx(ExecutionStatusBadge, {
1794
+ status: execution.status,
1795
+ size: "sm"
1796
+ })]
1797
+ }),
1798
+ /* @__PURE__ */ jsxs("div", {
1799
+ className: "mb-3",
1800
+ children: [/* @__PURE__ */ jsxs("div", {
1801
+ className: "flex justify-between text-xs text-text-muted mb-1",
1802
+ children: [/* @__PURE__ */ jsx("span", { children: tr("fluidgrids.executions.executionCards.progressLabel", "Progress") }), /* @__PURE__ */ jsxs("span", { children: [Math.round(execution.progress), "%"] })]
1803
+ }), /* @__PURE__ */ jsx("div", {
1804
+ className: "h-1.5 bg-surface-sunken rounded-full overflow-hidden",
1805
+ children: /* @__PURE__ */ jsx("div", {
1806
+ className: `h-full rounded-full transition-all duration-500 ${getProgressColor(execution.status)}`,
1807
+ style: { width: `${Math.min(execution.progress, 100)}%` }
1808
+ })
1809
+ })]
1810
+ }),
1811
+ (execution.totalNodes ?? 0) > 0 && /* @__PURE__ */ jsxs("div", {
1812
+ className: "flex gap-3 text-xs text-text-secondary mb-3",
1813
+ children: [
1814
+ /* @__PURE__ */ jsxs("span", {
1815
+ className: "flex items-center gap-1",
1816
+ children: [/* @__PURE__ */ jsx(Icon, {
1817
+ icon: "mdi:check-circle",
1818
+ width: 12,
1819
+ className: "text-status-success-text"
1820
+ }), execution.completedNodes ?? 0]
1821
+ }),
1822
+ /* @__PURE__ */ jsxs("span", {
1823
+ className: "flex items-center gap-1",
1824
+ children: [/* @__PURE__ */ jsx(Icon, {
1825
+ icon: "mdi:alert-circle",
1826
+ width: 12,
1827
+ className: "text-status-error-text"
1828
+ }), execution.failedNodes ?? 0]
1829
+ }),
1830
+ /* @__PURE__ */ jsxs("span", {
1831
+ className: "flex items-center gap-1",
1832
+ children: [/* @__PURE__ */ jsx(Icon, {
1833
+ icon: "mdi:skip-next",
1834
+ width: 12,
1835
+ className: "text-text-muted"
1836
+ }), execution.skippedNodes ?? 0]
1837
+ }),
1838
+ /* @__PURE__ */ jsxs("span", {
1839
+ className: "flex items-center gap-1 ml-auto",
1840
+ children: [/* @__PURE__ */ jsx(Icon, {
1841
+ icon: "mdi:sigma",
1842
+ width: 12
1843
+ }), execution.totalNodes]
1844
+ })
1845
+ ]
1846
+ }),
1847
+ /* @__PURE__ */ jsxs("div", {
1848
+ className: "flex items-center justify-between text-xs text-text-muted pt-2 border-t border-border-default",
1849
+ children: [/* @__PURE__ */ jsxs("span", {
1850
+ className: "flex items-center gap-1",
1851
+ children: [/* @__PURE__ */ jsx(Icon, {
1852
+ icon: "mdi:timer-outline",
1853
+ width: 12
1854
+ }), formatElapsedMs(runDurationMs(execution), "--")]
1855
+ }), /* @__PURE__ */ jsx("span", { children: formatRelativeTime(execution.startedAt ?? execution.createdAt) })]
1856
+ }),
1857
+ /* @__PURE__ */ jsx(WithResumeOffered, {
1858
+ run: execution,
1859
+ children: (resumeOffered) => {
1860
+ const actions = runQuickActions(execution.status, { resumeOffered });
1861
+ if (actions.length === 0) return null;
1862
+ return /* @__PURE__ */ jsx("div", {
1863
+ className: "flex gap-1 mt-2 pt-2 border-t border-border-default",
1864
+ children: actions.map((action) => {
1865
+ const { icon, label, hover } = CARD_ACTIONS(tr)[action];
1866
+ return /* @__PURE__ */ jsxs("button", {
1867
+ type: "button",
1868
+ "data-agent": "confirm",
1869
+ onClick: (e) => {
1870
+ e.stopPropagation();
1871
+ onAction(action, execution);
1872
+ },
1873
+ className: `flex items-center gap-1 text-xs px-2 py-1 rounded bg-surface-sunken text-text-secondary transition-colors ${hover}`,
1874
+ children: [
1875
+ /* @__PURE__ */ jsx(Icon, {
1876
+ icon,
1877
+ width: 12
1878
+ }),
1879
+ " ",
1880
+ label
1881
+ ]
1882
+ }, action);
1883
+ })
1884
+ });
1885
+ }
1886
+ })
1887
+ ]
1888
+ }, execution.id);
1889
+ })
1890
+ });
1891
+ }
1892
+
1893
+ // src/modules/executions/components/ExecutionTimeline.tsx
1894
+ /**
1895
+ * ExecutionTimeline — Chronological timeline view for workflow executions.
1896
+ * Displays executions as a vertical timeline with status indicators and duration bars.
1897
+ * Used when viewMode is 'timeline' in ExecutionsListPage.
1898
+ */
1899
+ function formatTime(dateStr) {
1900
+ if (!dateStr) return "--";
1901
+ return new Date(dateStr).toLocaleTimeString(void 0, {
1902
+ hour: "2-digit",
1903
+ minute: "2-digit",
1904
+ second: "2-digit"
1905
+ });
1906
+ }
1907
+ function formatDate(dateStr) {
1908
+ if (!dateStr) return "";
1909
+ return new Date(dateStr).toLocaleDateString(void 0, {
1910
+ weekday: "short",
1911
+ month: "short",
1912
+ day: "numeric"
1913
+ });
1914
+ }
1915
+ function getStatusDotColor(status) {
1916
+ switch (status) {
1917
+ case "COMPLETED": return "bg-status-success-bg";
1918
+ case "FAILED":
1919
+ case "TERMINATED": return "bg-status-error-bg";
1920
+ case "RUNNING": return "bg-status-info-bg animate-pulse";
1921
+ case "CANCELLED": return "bg-status-warning-bg";
1922
+ case "WAITING": return "bg-chart-3";
1923
+ default: return "bg-text-muted";
1924
+ }
1925
+ }
1926
+ /** Group executions by date for timeline sections */
1927
+ function groupByDate(executions) {
1928
+ const groups = /* @__PURE__ */ new Map();
1929
+ for (const exec of executions) {
1930
+ const dateKey = formatDate(exec.startedAt ?? exec.createdAt);
1931
+ if (!groups.has(dateKey)) groups.set(dateKey, []);
1932
+ groups.get(dateKey).push(exec);
1933
+ }
1934
+ return groups;
1935
+ }
1936
+ function ExecutionTimeline({ executions, workflowNames, loading, filtered = false, onItemClick, onAction }) {
1937
+ const tr = useTr();
1938
+ if (loading) return /* @__PURE__ */ jsx("div", {
1939
+ className: "space-y-6 pl-8",
1940
+ children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsxs("div", {
1941
+ className: "flex gap-4 animate-pulse",
1942
+ children: [/* @__PURE__ */ jsx("div", { className: "w-3 h-3 rounded-full bg-surface-sunken mt-1.5 shrink-0" }), /* @__PURE__ */ jsxs("div", {
1943
+ className: "flex-1",
1944
+ children: [
1945
+ /* @__PURE__ */ jsx("div", { className: "h-4 bg-surface-sunken rounded w-48 mb-2" }),
1946
+ /* @__PURE__ */ jsx("div", { className: "h-3 bg-surface-sunken rounded w-32 mb-1" }),
1947
+ /* @__PURE__ */ jsx("div", { className: "h-3 bg-surface-sunken rounded w-24" })
1948
+ ]
1949
+ })]
1950
+ }, i))
1951
+ });
1952
+ if (executions.length === 0) return /* @__PURE__ */ jsx(EmptyState, {
1953
+ kind: filtered ? "filtered" : "first-use",
1954
+ illustration: "history",
1955
+ size: "page",
1956
+ icon: /* @__PURE__ */ jsx(Icon, {
1957
+ icon: "mdi:timeline",
1958
+ width: 48
1959
+ }),
1960
+ title: tr("fluidgrids.executions.executionTimeline.emptyTitle", "No executions found"),
1961
+ description: tr("fluidgrids.executions.executionTimeline.emptyDescription", "Run a workflow to see the timeline")
1962
+ });
1963
+ const grouped = groupByDate(executions);
1964
+ return /* @__PURE__ */ jsx("div", {
1965
+ className: "space-y-8",
1966
+ children: Array.from(grouped.entries()).map(([dateLabel, dateExecutions]) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
1967
+ className: "flex items-center gap-2 mb-4",
1968
+ children: [
1969
+ /* @__PURE__ */ jsx(Icon, {
1970
+ icon: "mdi:calendar",
1971
+ width: 14,
1972
+ className: "text-text-muted"
1973
+ }),
1974
+ /* @__PURE__ */ jsx("span", {
1975
+ className: "text-xs font-semibold text-text-muted uppercase tracking-wider",
1976
+ children: dateLabel
1977
+ }),
1978
+ /* @__PURE__ */ jsx("div", { className: "flex-1 h-px bg-border-default" }),
1979
+ /* @__PURE__ */ jsxs("span", {
1980
+ className: "text-xs text-text-muted",
1981
+ children: [
1982
+ dateExecutions.length,
1983
+ " ",
1984
+ tr("fluidgrids.executions.executionTimeline.runsCountSuffix", "runs")
1985
+ ]
1986
+ })
1987
+ ]
1988
+ }), /* @__PURE__ */ jsxs("div", {
1989
+ className: "relative ml-4",
1990
+ children: [/* @__PURE__ */ jsx("div", { className: "absolute left-[5px] top-0 bottom-0 w-px bg-border-default" }), /* @__PURE__ */ jsx("div", {
1991
+ className: "space-y-4",
1992
+ children: dateExecutions.map((execution, idx) => {
1993
+ const isLast = idx === dateExecutions.length - 1;
1994
+ const canCancel = execution.status === "RUNNING" || execution.status === "PENDING";
1995
+ return /* @__PURE__ */ jsxs("div", {
1996
+ onClick: () => onItemClick(execution),
1997
+ className: "relative flex gap-4 cursor-pointer group",
1998
+ children: [/* @__PURE__ */ jsx("div", {
1999
+ className: "relative z-10 shrink-0 mt-1.5",
2000
+ children: /* @__PURE__ */ jsx("div", { className: `w-[11px] h-[11px] rounded-full border-2 border-surface-canvas ${getStatusDotColor(execution.status)}` })
2001
+ }), /* @__PURE__ */ jsxs("div", {
2002
+ className: `
2003
+ flex-1 rounded-lg border border-border-default bg-surface p-3
2004
+ transition-all duration-200 group-hover:shadow-sm group-hover:border-border-strong
2005
+ ${isLast ? "" : "mb-0"}
2006
+ `,
2007
+ children: [/* @__PURE__ */ jsxs("div", {
2008
+ className: "flex items-start justify-between gap-2",
2009
+ children: [/* @__PURE__ */ jsxs("div", {
2010
+ className: "min-w-0 flex-1",
2011
+ children: [
2012
+ /* @__PURE__ */ jsxs("div", {
2013
+ className: "flex items-center gap-2",
2014
+ children: [/* @__PURE__ */ jsx("span", {
2015
+ className: "text-sm font-semibold text-text-primary truncate",
2016
+ children: execution.workflow?.name || workflowNames?.[execution.workflowKey] || execution.workflowKey
2017
+ }), /* @__PURE__ */ jsx("span", {
2018
+ className: "text-xs text-text-muted",
2019
+ children: formatRunVersion(execution.version)
2020
+ })]
2021
+ }),
2022
+ /* @__PURE__ */ jsxs("div", {
2023
+ className: "flex items-center gap-3 mt-1 text-xs text-text-secondary",
2024
+ children: [
2025
+ /* @__PURE__ */ jsxs("span", {
2026
+ className: "flex items-center gap-1",
2027
+ children: [/* @__PURE__ */ jsx(Icon, {
2028
+ icon: "mdi:clock-outline",
2029
+ width: 12
2030
+ }), formatTime(execution.startedAt ?? execution.createdAt)]
2031
+ }),
2032
+ /* @__PURE__ */ jsxs("span", {
2033
+ className: "flex items-center gap-1",
2034
+ children: [/* @__PURE__ */ jsx(Icon, {
2035
+ icon: "mdi:timer-outline",
2036
+ width: 12
2037
+ }), formatElapsedMs(runDurationMs(execution), "--")]
2038
+ }),
2039
+ (execution.totalNodes ?? 0) > 0 && /* @__PURE__ */ jsxs("span", {
2040
+ className: "flex items-center gap-1",
2041
+ children: [
2042
+ /* @__PURE__ */ jsx(Icon, {
2043
+ icon: "mdi:puzzle-outline",
2044
+ width: 12
2045
+ }),
2046
+ execution.completedNodes ?? 0,
2047
+ "/",
2048
+ execution.totalNodes,
2049
+ " ",
2050
+ tr("fluidgrids.executions.executionTimeline.nodesCountSuffix", "nodes")
2051
+ ]
2052
+ })
2053
+ ]
2054
+ }),
2055
+ execution.errorMessage && /* @__PURE__ */ jsx("p", {
2056
+ className: "mt-1.5 text-xs text-status-error-text truncate max-w-sm",
2057
+ children: isSandboxRuntimeExhausted(execution.errorType) ? errorAdvice(tr, execution.errorType) : execution.errorMessage
2058
+ })
2059
+ ]
2060
+ }), /* @__PURE__ */ jsxs("div", {
2061
+ className: "flex items-center gap-2 shrink-0",
2062
+ children: [/* @__PURE__ */ jsx(ExecutionStatusBadge, {
2063
+ status: execution.status,
2064
+ caughtErrorCount: execution.caughtErrors?.length,
2065
+ size: "sm"
2066
+ }), canCancel && /* @__PURE__ */ jsx("button", {
2067
+ type: "button",
2068
+ onClick: (e) => {
2069
+ e.stopPropagation();
2070
+ onAction("cancel", execution);
2071
+ },
2072
+ className: "p-1 rounded opacity-60 group-hover:opacity-100 focus-visible:opacity-100 hover:bg-status-error-bg-subtle text-text-muted hover:text-status-error-text transition-all",
2073
+ title: tr("fluidgrids.executions.executionTimeline.cancelTooltip", "Cancel execution"),
2074
+ "aria-label": tr("fluidgrids.executions.executionTimeline.cancelTooltip", "Cancel execution"),
2075
+ children: /* @__PURE__ */ jsx(Icon, {
2076
+ icon: "mdi:stop",
2077
+ width: 14
2078
+ })
2079
+ })]
2080
+ })]
2081
+ }), execution.status === "RUNNING" && /* @__PURE__ */ jsx("div", {
2082
+ className: "mt-2",
2083
+ children: /* @__PURE__ */ jsx("div", {
2084
+ className: "h-1 bg-surface-sunken rounded-full overflow-hidden",
2085
+ children: /* @__PURE__ */ jsx("div", {
2086
+ className: "h-full bg-status-info-bg rounded-full transition-all duration-500 animate-pulse",
2087
+ style: { width: `${Math.min(execution.progress, 100)}%` }
2088
+ })
2089
+ })
2090
+ })]
2091
+ })]
2092
+ }, execution.id);
2093
+ })
2094
+ })]
2095
+ })] }, dateLabel))
2096
+ });
2097
+ }
2098
+
2099
+ // src/modules/executions/components/Pagination.tsx
2100
+ function Pagination({ totalItems, totalCapped = false, showPageSize = true }) {
2101
+ const tr = useTr();
2102
+ const { pagination, setPage, setPageSize } = useExecutionsStore();
2103
+ const { page, pageSize, total } = pagination;
2104
+ const totalPages = Math.ceil((totalItems ?? total) / pageSize) + (totalCapped ? 1 : 0);
2105
+ const startItem = (totalItems ?? total) === 0 ? 0 : (page - 1) * pageSize + 1;
2106
+ const endItem = Math.min(page * pageSize, totalItems ?? total);
2107
+ const pageSizeOptions = [
2108
+ 10,
2109
+ 25,
2110
+ 50,
2111
+ 100
2112
+ ];
2113
+ const goToPage = (newPage) => {
2114
+ if (newPage >= 1 && newPage <= totalPages) setPage(newPage);
2115
+ };
2116
+ const getPageNumbers = () => {
2117
+ const pages = [];
2118
+ if (totalPages <= 7) for (let i = 1; i <= totalPages; i++) pages.push(i);
2119
+ else {
2120
+ pages.push(1);
2121
+ if (page > 3) pages.push("ellipsis");
2122
+ const start = Math.max(2, page - 1);
2123
+ const end = Math.min(totalPages - 1, page + 1);
2124
+ for (let i = start; i <= end; i++) pages.push(i);
2125
+ if (page < totalPages - 2) pages.push("ellipsis");
2126
+ pages.push(totalPages);
2127
+ }
2128
+ return pages;
2129
+ };
2130
+ if (totalPages <= 1 && !showPageSize) return null;
2131
+ return /* @__PURE__ */ jsxs("div", {
2132
+ className: "flex flex-col sm:flex-row items-center justify-between gap-4 py-4",
2133
+ children: [/* @__PURE__ */ jsxs("div", {
2134
+ className: "text-sm text-text-secondary",
2135
+ children: [
2136
+ tr("fluidgrids.executions.pagination.showingLabel", "Showing"),
2137
+ " ",
2138
+ /* @__PURE__ */ jsx("span", {
2139
+ className: "font-medium text-text-primary",
2140
+ children: startItem
2141
+ }),
2142
+ " ",
2143
+ tr("fluidgrids.executions.pagination.toLabel", "to"),
2144
+ " ",
2145
+ /* @__PURE__ */ jsx("span", {
2146
+ className: "font-medium text-text-primary",
2147
+ children: endItem
2148
+ }),
2149
+ " ",
2150
+ tr("fluidgrids.executions.pagination.ofLabel", "of"),
2151
+ " ",
2152
+ /* @__PURE__ */ jsxs("span", {
2153
+ className: "font-medium text-text-primary",
2154
+ "data-testid": "pagination-total",
2155
+ children: [totalItems ?? total, totalCapped ? "+" : ""]
2156
+ }),
2157
+ " ",
2158
+ tr("fluidgrids.executions.pagination.resultsLabel", "results")
2159
+ ]
2160
+ }), /* @__PURE__ */ jsxs("div", {
2161
+ className: "flex items-center gap-4",
2162
+ children: [showPageSize && /* @__PURE__ */ jsxs("div", {
2163
+ className: "flex items-center gap-2",
2164
+ children: [/* @__PURE__ */ jsx("label", {
2165
+ className: "text-sm text-text-secondary",
2166
+ children: tr("fluidgrids.executions.pagination.pageSizeLabel", "Show")
2167
+ }), /* @__PURE__ */ jsx(ThemedSelect, {
2168
+ value: pageSize,
2169
+ onChange: (e) => setPageSize(Number(e.target.value)),
2170
+ className: "px-2 py-1 bg-bg-surface border border-border-default rounded text-sm text-text-primary scheme-normal dark:scheme-dark",
2171
+ children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx("option", {
2172
+ value: size,
2173
+ className: "bg-bg-surface text-text-primary",
2174
+ children: size
2175
+ }, size))
2176
+ })]
2177
+ }), totalPages > 1 && /* @__PURE__ */ jsxs("nav", {
2178
+ className: "flex items-center gap-1",
2179
+ children: [
2180
+ /* @__PURE__ */ jsx("button", {
2181
+ onClick: () => goToPage(page - 1),
2182
+ disabled: page === 1,
2183
+ className: "p-2 rounded hover:bg-surface-sunken disabled:opacity-50 disabled:cursor-not-allowed",
2184
+ children: /* @__PURE__ */ jsx(Icon, {
2185
+ icon: "mdi:chevron-left",
2186
+ width: 20,
2187
+ className: "text-text-secondary"
2188
+ })
2189
+ }),
2190
+ /* @__PURE__ */ jsx("div", {
2191
+ className: "hidden sm:flex items-center gap-1",
2192
+ children: getPageNumbers().map((pageNum, index) => pageNum === "ellipsis" ? /* @__PURE__ */ jsx("span", {
2193
+ className: "px-2 text-text-secondary",
2194
+ children: "..."
2195
+ }, `ellipsis-${index}`) : /* @__PURE__ */ jsx("button", {
2196
+ onClick: () => goToPage(pageNum),
2197
+ className: `
2198
+ min-w-[32px] h-8 px-2 rounded text-sm font-medium
2199
+ ${pageNum === page ? "bg-action-primary-bg text-action-primary-text" : "hover:bg-surface-sunken text-text-secondary"}
2200
+ `,
2201
+ children: pageNum
2202
+ }, pageNum))
2203
+ }),
2204
+ /* @__PURE__ */ jsxs("span", {
2205
+ className: "sm:hidden px-3 text-sm text-text-secondary",
2206
+ children: [
2207
+ page,
2208
+ " / ",
2209
+ totalPages
2210
+ ]
2211
+ }),
2212
+ /* @__PURE__ */ jsx("button", {
2213
+ onClick: () => goToPage(page + 1),
2214
+ disabled: page === totalPages,
2215
+ className: "p-2 rounded hover:bg-surface-sunken disabled:opacity-50 disabled:cursor-not-allowed",
2216
+ children: /* @__PURE__ */ jsx(Icon, {
2217
+ icon: "mdi:chevron-right",
2218
+ width: 20,
2219
+ className: "text-text-secondary"
2220
+ })
2221
+ })
2222
+ ]
2223
+ })]
2224
+ })]
2225
+ });
2226
+ }
2227
+
2228
+ // src/modules/executions/components/RunsPlainTable.tsx
2229
+ /** Run statuses a row offers "Run again" on. */
2230
+ const RERUNNABLE = /* @__PURE__ */ new Set([
2231
+ "FAILED",
2232
+ "CANCELLED",
2233
+ "TERMINATED"
2234
+ ]);
2235
+ /** Run statuses a row offers "Stop" on. */
2236
+ const STOPPABLE = /* @__PURE__ */ new Set([
2237
+ "RUNNING",
2238
+ "WAITING",
2239
+ "PENDING"
2240
+ ]);
2241
+ /**
2242
+ * "Just now", then "5m ago" / "3h ago" / "2d ago" in the page's language
2243
+ * (Intl's narrow relative time: the same English as before, translated in the
2244
+ * other locales), then a short date.
2245
+ */
2246
+ function formatStarted(tr, dateStr) {
2247
+ if (!dateStr) return "-";
2248
+ const date = new Date(dateStr);
2249
+ const diff = Date.now() - date.getTime();
2250
+ if (diff < 6e4) return tr("fluidgrids.executions.executionTable.justNow", "Just now");
2251
+ const locale = pageLocale();
2252
+ const relative = relativeFormat(locale);
2253
+ if (diff < 36e5) return relative.format(-Math.round(diff / 6e4), "minute");
2254
+ if (diff < 864e5) return relative.format(-Math.round(diff / 36e5), "hour");
2255
+ if (diff < 6048e5) return relative.format(-Math.round(diff / 864e5), "day");
2256
+ return date.toLocaleDateString(locale, {
2257
+ month: "short",
2258
+ day: "numeric",
2259
+ hour: "2-digit",
2260
+ minute: "2-digit"
2261
+ });
2262
+ }
2263
+ function RowActions({ run, canExecute, onAction }) {
2264
+ const tr = useTr();
2265
+ const resumeOffered = useResumeOffered(run);
2266
+ const menuItems = [];
2267
+ if (canExecute && run.status === "RUNNING") menuItems.push({
2268
+ id: "pause",
2269
+ icon: "mdi:pause",
2270
+ label: tr("fluidgrids.executions.executionTable.actionPause", "Pause"),
2271
+ onSelect: () => onAction("pause", run)
2272
+ });
2273
+ if (canExecute && run.status === "WAITING" && resumeOffered) menuItems.push({
2274
+ id: "resume",
2275
+ icon: "mdi:play",
2276
+ label: tr("fluidgrids.executions.executionTable.actionResume", "Resume"),
2277
+ onSelect: () => onAction("resume", run)
2278
+ });
2279
+ const viewLabel = tr("fluidgrids.executions.executionTable.viewDetails", "View Details");
2280
+ return /* @__PURE__ */ jsxs("span", {
2281
+ className: "flex items-center gap-1",
2282
+ onClick: (event) => event.stopPropagation(),
2283
+ children: [
2284
+ canExecute && RERUNNABLE.has(run.status) && /* @__PURE__ */ jsxs(Button$1, {
2285
+ "data-agent": "confirm",
2286
+ variant: "outline",
2287
+ size: "sm",
2288
+ onClick: () => onAction("retry", run),
2289
+ "data-testid": "run-row-run-again",
2290
+ children: [/* @__PURE__ */ jsx(Icon, {
2291
+ icon: "mdi:refresh",
2292
+ className: "mr-1",
2293
+ width: 14
2294
+ }), tr("fluidgrids.executions.executionTable.actionRetry", "Retry")]
2295
+ }),
2296
+ canExecute && STOPPABLE.has(run.status) && /* @__PURE__ */ jsxs(Button$1, {
2297
+ "data-agent": "confirm",
2298
+ variant: "outline",
2299
+ size: "sm",
2300
+ onClick: () => onAction("cancel", run),
2301
+ "data-testid": "run-row-stop",
2302
+ children: [/* @__PURE__ */ jsx(Icon, {
2303
+ icon: "mdi:stop",
2304
+ className: "mr-1",
2305
+ width: 14
2306
+ }), tr("fluidgrids.executions.executionTable.actionCancel", "Cancel")]
2307
+ }),
2308
+ /* @__PURE__ */ jsx(RunActionsMenu, {
2309
+ items: menuItems,
2310
+ label: tr("fluidgrids.executions.executionTable.moreActions", "More actions"),
2311
+ "data-testid": `run-row-menu-${run.id}`
2312
+ }),
2313
+ /* @__PURE__ */ jsx(Button$1, {
2314
+ variant: "ghost",
2315
+ size: "sm",
2316
+ onClick: () => onAction("view", run),
2317
+ "aria-label": viewLabel,
2318
+ title: viewLabel,
2319
+ children: /* @__PURE__ */ jsx(Icon, {
2320
+ icon: "mdi:arrow-right",
2321
+ width: 18
2322
+ })
2323
+ })
2324
+ ]
2325
+ });
2326
+ }
2327
+ function RunsPlainTable({ executions, workflowNames, loading, canExecute = true, onRowClick, onAction, footer }) {
2328
+ const tr = useTr();
2329
+ const loadingSystem = useLoadingSystem();
2330
+ const waiting = Boolean(loading) && executions.length === 0;
2331
+ if (!loadingSystem && waiting) return /* @__PURE__ */ jsx(RunsTableSkeleton, {});
2332
+ const table = /* @__PURE__ */ jsx("div", {
2333
+ "data-testid": "runs-plain-table",
2334
+ children: /* @__PURE__ */ jsx(ResponsiveTable, {
2335
+ data: executions,
2336
+ rowKey: (run) => run.id,
2337
+ onRowClick,
2338
+ rowActionsLabel: tr("fluidgrids.executions.executionTable.colActions", "Actions"),
2339
+ rowActions: (run) => /* @__PURE__ */ jsx(RowActions, {
2340
+ run,
2341
+ canExecute,
2342
+ onAction
2343
+ }),
2344
+ columns: [
2345
+ {
2346
+ key: "status",
2347
+ header: tr("fluidgrids.executions.executionTable.colStatus", "Status"),
2348
+ priority: "primary",
2349
+ cell: (run) => /* @__PURE__ */ jsxs("span", {
2350
+ className: "inline-flex items-center gap-2",
2351
+ children: [/* @__PURE__ */ jsx("span", {
2352
+ title: run.status,
2353
+ children: /* @__PURE__ */ jsx(ExecutionStatusBadge, {
2354
+ status: run.status,
2355
+ caughtErrorCount: run.caughtErrors?.length,
2356
+ size: "sm"
2357
+ })
2358
+ }), run.mode === "TEST" && /* @__PURE__ */ jsx("span", {
2359
+ className: "px-1.5 py-0.5 text-xs border border-border-default text-text-secondary rounded",
2360
+ "data-testid": "run-row-test-badge",
2361
+ children: tr("fluidgrids.executions.executionTable.testBadge", "Test")
2362
+ })]
2363
+ })
2364
+ },
2365
+ {
2366
+ key: "workflow",
2367
+ header: tr("fluidgrids.executions.executionTable.colWorkflow", "Workflow"),
2368
+ priority: "primary",
2369
+ cell: (run) => /* @__PURE__ */ jsxs("div", {
2370
+ className: "flex flex-col",
2371
+ ...runSuggestAnchorProps(run.id),
2372
+ children: [/* @__PURE__ */ jsx("span", {
2373
+ className: "text-sm font-medium text-text-primary",
2374
+ children: run.workflow?.name || workflowNames?.[run.workflowKey] || run.workflowKey
2375
+ }), run.status === "FAILED" && /* @__PURE__ */ jsx("span", {
2376
+ className: "text-xs text-[var(--color-status-error-text)]",
2377
+ "data-testid": "run-row-error",
2378
+ children: errorAdvice(tr, run.errorType)
2379
+ })]
2380
+ })
2381
+ },
2382
+ {
2383
+ key: "started",
2384
+ header: tr("fluidgrids.executions.executionTable.colStarted", "Started"),
2385
+ priority: "primary",
2386
+ cell: (run) => /* @__PURE__ */ jsx("span", {
2387
+ className: "text-sm text-text-secondary",
2388
+ children: formatStarted(tr, run.startedAt || run.createdAt)
2389
+ })
2390
+ },
2391
+ {
2392
+ key: "progress",
2393
+ header: tr("fluidgrids.executions.executionTable.colProgress", "Progress"),
2394
+ priority: "secondary",
2395
+ cell: (run) => /* @__PURE__ */ jsxs("span", {
2396
+ className: "text-xs text-text-secondary",
2397
+ children: [
2398
+ run.completedNodes ?? 0,
2399
+ "/",
2400
+ run.totalNodes ?? 0
2401
+ ]
2402
+ })
2403
+ }
2404
+ ]
2405
+ })
2406
+ });
2407
+ return loadingSystem ? /* @__PURE__ */ jsxs(LoadRegion, {
2408
+ loading: waiting,
2409
+ skeleton: /* @__PURE__ */ jsx(RunsTableSkeleton, {}),
2410
+ label: tr("fluidgrids.executions.runsTable.loadingRegion", "Loading runs"),
2411
+ doneLabel: tr("fluidgrids.executions.runsTable.loadedRegion", "Runs loaded"),
2412
+ children: [table, footer]
2413
+ }) : table;
2414
+ }
2415
+
2416
+ // src/modules/executions/components/RunsEmptyState.tsx
2417
+ /**
2418
+ * The Runs list's two empty states (BOFF-11846, Navigation v2 only): "no runs
2419
+ * yet" (the workspace has never run anything: point to My Workflows and
2420
+ * templates) versus "no matches" (filters hide everything: offer Clear
2421
+ * filters). Today's list says the filters are wrong to a person with none.
2422
+ */
2423
+ function RunsEmptyState({ filtered, onClearFilters, onOpenWorkflows, onBrowseTemplates }) {
2424
+ const tr = useTr();
2425
+ if (filtered) return /* @__PURE__ */ jsx("div", {
2426
+ "data-testid": "runs-empty-no-matches",
2427
+ children: /* @__PURE__ */ jsx(EmptyState, {
2428
+ kind: "filtered",
2429
+ size: "page",
2430
+ icon: /* @__PURE__ */ jsx(Icon, {
2431
+ icon: "mdi:filter-off-outline",
2432
+ width: 48
2433
+ }),
2434
+ title: tr("fluidgrids.executions.executionTable.noMatchesTitle", "No matches"),
2435
+ description: tr("fluidgrids.executions.executionTable.noMatchesDescription", "No runs match these filters."),
2436
+ action: /* @__PURE__ */ jsx(Button$1, {
2437
+ variant: "outline",
2438
+ onClick: onClearFilters,
2439
+ children: tr("fluidgrids.executions.executionFilters.clearFilters", "Clear Filters")
2440
+ })
2441
+ })
2442
+ });
2443
+ return /* @__PURE__ */ jsx("div", {
2444
+ "data-testid": "runs-empty-no-runs",
2445
+ children: /* @__PURE__ */ jsx(EmptyState, {
2446
+ kind: "first-use",
2447
+ illustration: "history",
2448
+ size: "page",
2449
+ icon: /* @__PURE__ */ jsx(Icon, {
2450
+ icon: "mdi:play-box-outline",
2451
+ width: 48
2452
+ }),
2453
+ title: tr("fluidgrids.executions.executionTable.noRunsTitle", "No runs yet"),
2454
+ description: tr("fluidgrids.executions.executionTable.noRunsDescription", "Your workflows haven't run yet. Open one and press Run, or start from a template."),
2455
+ action: /* @__PURE__ */ jsx(Button$1, {
2456
+ onClick: onOpenWorkflows,
2457
+ children: tr("fluidgrids.executions.executionTable.myWorkflows", "My Workflows")
2458
+ }),
2459
+ secondaryAction: /* @__PURE__ */ jsx(Button$1, {
2460
+ variant: "outline",
2461
+ onClick: onBrowseTemplates,
2462
+ children: tr("fluidgrids.executions.executionTable.browseTemplates", "Browse templates")
2463
+ })
2464
+ })
2465
+ });
2466
+ }
2467
+
2468
+ // src/modules/executions/components/RunsLoadFailure.tsx
2469
+ /**
2470
+ * Why the Runs list is not showing (BOFF-16744).
2471
+ *
2472
+ * A read the gateway refused because the caller is known and lacks the
2473
+ * permission (FORBIDDEN / PERMISSION_DENIED with no `authFailure`) is an
2474
+ * access answer, not a malfunction: it shows the kit's access state, with a
2475
+ * lock and no Retry, because retrying a refusal cannot succeed. Anything else
2476
+ * (a gateway blip, a session that could not be established) keeps the
2477
+ * retryable load error.
2478
+ */
2479
+ function RunsLoadFailure({ error, onRetry }) {
2480
+ const tr = useTr();
2481
+ if (isPermissionDenied(error)) return /* @__PURE__ */ jsx("div", {
2482
+ className: "mb-6",
2483
+ "data-testid": "runs-load-denied",
2484
+ children: /* @__PURE__ */ jsx(LoadError, {
2485
+ kind: "denied",
2486
+ what: tr("fluidgrids.executions.executionsList.deniedWhat", "runs"),
2487
+ error
2488
+ })
2489
+ });
2490
+ return /* @__PURE__ */ jsxs("div", {
2491
+ className: "mb-6 p-4 bg-[var(--color-status-error-bg-subtle)] border border-[var(--color-status-error-border)] rounded-lg",
2492
+ "data-testid": "runs-load-error",
2493
+ children: [
2494
+ /* @__PURE__ */ jsxs("div", {
2495
+ className: "flex items-center gap-2 text-[var(--color-status-error-text)]",
2496
+ children: [/* @__PURE__ */ jsx(Icon, {
2497
+ icon: "mdi:alert-circle",
2498
+ width: 20
2499
+ }), /* @__PURE__ */ jsx("span", {
2500
+ className: "font-medium",
2501
+ children: tr("fluidgrids.executions.executionsList.loadErrorTitle", "Error loading executions")
2502
+ })]
2503
+ }),
2504
+ /* @__PURE__ */ jsx("p", {
2505
+ className: "mt-1 text-sm text-[var(--color-status-error-text)]",
2506
+ children: tr("fluidgrids.executions.executionsList.loadErrorDescription", "We couldn't load your runs. Try again in a moment.")
2507
+ }),
2508
+ /* @__PURE__ */ jsx(TechnicalDetails, {
2509
+ className: "mt-2 text-[var(--color-status-error-text)]",
2510
+ children: /* @__PURE__ */ jsx("p", {
2511
+ className: "text-sm font-mono break-words",
2512
+ children: error.message
2513
+ })
2514
+ }),
2515
+ /* @__PURE__ */ jsx(Button$1, {
2516
+ variant: "outline",
2517
+ size: "sm",
2518
+ onClick: onRetry,
2519
+ className: "mt-3 border-[var(--color-status-error-border)] text-[var(--color-status-error-text)] hover:bg-[var(--color-status-error-bg-subtle)]",
2520
+ children: tr("fluidgrids.executions.executionsList.retryButton", "Retry")
2521
+ })
2522
+ ]
2523
+ });
2524
+ }
2525
+
2526
+ // src/modules/executions/utils/bulk-delete.ts
2527
+ /** The most run ids one deleteWorkflowRuns call takes (the service's limit). */
2528
+ const MAX_DELETE_RUN_IDS = 500;
2529
+ /**
2530
+ * The most filter calls one bulk delete sends (100,000 runs at 500 a call).
2531
+ * A safety stop: the service never selects in-flight runs, so `hasMore`
2532
+ * turns false long before this in practice.
2533
+ */
2534
+ const MAX_FILTER_DELETE_CALLS = 200;
2535
+ /**
2536
+ * The runs a delete selects: the chosen ids, or (for "select all matching")
2537
+ * the list's filter without paging, which the service ignores anyway.
2538
+ *
2539
+ * The filter is frozen at `confirmedAt`: its `endDate` (runs created at or
2540
+ * before) becomes the earlier of the list's own end and that moment. Every
2541
+ * call of a multi-call delete sends the same filter, so runs started while
2542
+ * the delete is running never join it.
2543
+ */
2544
+ function runDeleteSelection(input, selection, confirmedAt = /* @__PURE__ */ new Date()) {
2545
+ if (selection.allMatching) {
2546
+ const filter = { ...input };
2547
+ delete filter.limit;
2548
+ delete filter.offset;
2549
+ if (!((filter.endDate ? Date.parse(filter.endDate) : NaN) <= confirmedAt.getTime())) filter.endDate = confirmedAt.toISOString();
2550
+ return { filter };
2551
+ }
2552
+ return { ids: [...new Set(selection.runIds)] };
2553
+ }
2554
+ /** Splits ids into chunks the service accepts. */
2555
+ function chunkRunIds(ids, size = 500) {
2556
+ const chunks = [];
2557
+ for (let start = 0; start < ids.length; start += size) chunks.push(ids.slice(start, start + size));
2558
+ return chunks;
2559
+ }
2560
+ function errorMessage(error) {
2561
+ return error instanceof Error ? error.message : String(error);
2562
+ }
2563
+ /**
2564
+ * Deletes the selection. With ids, one call per chunk, adding up what each
2565
+ * deleted and skipped. With a filter, calls again while `hasMore` is true;
2566
+ * every call reports all in-flight runs matching the filter, so the skipped
2567
+ * count is the last answer's, not a sum. The loop also stops when a call
2568
+ * deletes nothing yet says more remain, or after MAX_FILTER_DELETE_CALLS.
2569
+ * A failed call stops the loop and is reported with what was already done.
2570
+ */
2571
+ async function deleteRunsInBulk(selection, call) {
2572
+ let deleted = 0;
2573
+ let skippedInFlight = 0;
2574
+ try {
2575
+ if ("ids" in selection) {
2576
+ for (const ids of chunkRunIds(selection.ids)) {
2577
+ const result = await call({ ids });
2578
+ deleted += result.deleted;
2579
+ skippedInFlight += result.skippedInFlight;
2580
+ }
2581
+ return {
2582
+ deleted,
2583
+ skippedInFlight,
2584
+ complete: true,
2585
+ error: null
2586
+ };
2587
+ }
2588
+ for (let calls = 0; calls < 200; calls += 1) {
2589
+ const result = await call({ filter: selection.filter });
2590
+ deleted += result.deleted;
2591
+ skippedInFlight = result.skippedInFlight;
2592
+ if (!result.hasMore) return {
2593
+ deleted,
2594
+ skippedInFlight,
2595
+ complete: true,
2596
+ error: null
2597
+ };
2598
+ if (result.deleted === 0) break;
2599
+ }
2600
+ return {
2601
+ deleted,
2602
+ skippedInFlight,
2603
+ complete: false,
2604
+ error: null
2605
+ };
2606
+ } catch (error) {
2607
+ return {
2608
+ deleted,
2609
+ skippedInFlight,
2610
+ complete: false,
2611
+ error: errorMessage(error)
2612
+ };
2613
+ }
2614
+ }
2615
+
2616
+ // src/modules/executions/hooks/useBulkDeleteRuns.ts
2617
+ /**
2618
+ * Bulk delete on the Runs list (BOFF-9731): sends deleteWorkflowRuns through
2619
+ * the shared FluidGrids client until the selection is gone (see
2620
+ * ../utils/bulk-delete for the loop) and says whether it is still busy.
2621
+ */
2622
+ /** One deleteWorkflowRuns call. */
2623
+ async function sendDeleteWorkflowRuns(selection) {
2624
+ const input = "ids" in selection ? { ids: selection.ids } : { filter: selection.filter };
2625
+ return (await writeTyped(DeleteWorkflowRunsDocument, { input })).deleteWorkflowRuns;
2626
+ }
2627
+ function useBulkDeleteRuns() {
2628
+ const [deleting, setDeleting] = useState(false);
2629
+ return {
2630
+ deleteRuns: useCallback(async (selection) => {
2631
+ setDeleting(true);
2632
+ try {
2633
+ return await deleteRunsInBulk(selection, sendDeleteWorkflowRuns);
2634
+ } finally {
2635
+ setDeleting(false);
2636
+ }
2637
+ }, []),
2638
+ deleting
2639
+ };
2640
+ }
2641
+
2642
+ // src/modules/run-control/components/SearchAttributeFilterBar.tsx
2643
+ /**
2644
+ * The Runs list's search-attribute filter builder (BOFF-9906, spec code-first
2645
+ * 11 §2.8): rows of attribute, operator and value over the workspace's
2646
+ * definitions, combined with "all" or "any", plus free text over TEXT
2647
+ * attributes. *Apply* hands the filter to the list; the list sends it only
2648
+ * when no filter the service refuses alongside it is set (search, node,
2649
+ * trigger type), and says so here.
2650
+ */
2651
+ const OPERATOR_LABELS = {
2652
+ EQ: "=",
2653
+ NEQ: "≠",
2654
+ IN: "in",
2655
+ GT: ">",
2656
+ GTE: "≥",
2657
+ LT: "<",
2658
+ LTE: "≤",
2659
+ STARTS_WITH: "starts with",
2660
+ CONTAINS: "contains"
2661
+ };
2662
+ function SearchAttributeFilterBar({ applied, onApply, conflicts, className, pageAttributes }) {
2663
+ const tr = useTr();
2664
+ const readHere = pageAttributes === void 0 || pageAttributes.settled && pageAttributes.data === null;
2665
+ const ownDefinitions = useResource("search-attributes", readHere, fetchSearchAttributes);
2666
+ const definitions = {
2667
+ data: readHere ? ownDefinitions.data : pageAttributes?.data ?? null,
2668
+ error: readHere ? ownDefinitions.error : null
2669
+ };
2670
+ const [state, setState] = useState(EMPTY_SEARCH_FILTER);
2671
+ const types = useMemo(() => new Map((definitions.data ?? []).map((definition) => [definition.name, definition.type])), [definitions.data]);
2672
+ const built = buildSearchAttributeFilter(state, types);
2673
+ const names = [...types.keys()].sort();
2674
+ const setRow = (index, patch) => setState((current) => ({
2675
+ ...current,
2676
+ rows: current.rows.map((row, i) => {
2677
+ if (i !== index) return row;
2678
+ const next = {
2679
+ ...row,
2680
+ ...patch
2681
+ };
2682
+ const type = types.get(next.name);
2683
+ if (type && !OPERATORS_BY_TYPE[type].includes(next.op)) next.op = OPERATORS_BY_TYPE[type][0];
2684
+ return next;
2685
+ })
2686
+ }));
2687
+ const addRow = () => {
2688
+ const name = names[0];
2689
+ if (!name) return;
2690
+ const type = types.get(name);
2691
+ setState((current) => ({
2692
+ ...current,
2693
+ rows: [...current.rows, {
2694
+ name,
2695
+ op: type ? OPERATORS_BY_TYPE[type][0] : "EQ",
2696
+ value: ""
2697
+ }]
2698
+ }));
2699
+ };
2700
+ return /* @__PURE__ */ jsxs("section", {
2701
+ className: cn("mb-4 space-y-3 rounded-lg border border-border-default bg-surface p-3", className),
2702
+ "data-testid": "search-attribute-filter",
2703
+ children: [
2704
+ /* @__PURE__ */ jsxs("div", {
2705
+ className: "flex flex-wrap items-center gap-2",
2706
+ children: [
2707
+ /* @__PURE__ */ jsx(Icon, {
2708
+ icon: "mdi:tag-search-outline",
2709
+ width: 18,
2710
+ className: "text-text-secondary"
2711
+ }),
2712
+ /* @__PURE__ */ jsx("span", {
2713
+ className: "text-sm font-medium text-text-primary",
2714
+ children: tr("fluidgrids.runControl.searchFilter.title", "Search attributes")
2715
+ }),
2716
+ state.rows.length > 1 && /* @__PURE__ */ jsxs(NativeSelect, {
2717
+ value: state.combine,
2718
+ onChange: (value) => setState((current) => ({
2719
+ ...current,
2720
+ combine: value === "or" ? "or" : "and"
2721
+ })),
2722
+ ariaLabel: tr("fluidgrids.runControl.searchFilter.combine", "Match"),
2723
+ testId: "search-filter-combine",
2724
+ children: [/* @__PURE__ */ jsx("option", {
2725
+ value: "and",
2726
+ children: tr("fluidgrids.runControl.searchFilter.all", "all conditions")
2727
+ }), /* @__PURE__ */ jsx("option", {
2728
+ value: "or",
2729
+ children: tr("fluidgrids.runControl.searchFilter.any", "any condition")
2730
+ })]
2731
+ }),
2732
+ /* @__PURE__ */ jsx(Input, {
2733
+ value: state.text,
2734
+ onChange: (event) => setState((current) => ({
2735
+ ...current,
2736
+ text: event.target.value
2737
+ })),
2738
+ placeholder: tr("fluidgrids.runControl.searchFilter.text", "Words in text attributes"),
2739
+ className: "h-9 max-w-xs",
2740
+ maxLength: 256,
2741
+ "data-testid": "search-filter-text"
2742
+ }),
2743
+ /* @__PURE__ */ jsxs(Button$1, {
2744
+ size: "sm",
2745
+ variant: "outline",
2746
+ onClick: addRow,
2747
+ disabled: names.length === 0 || state.rows.length >= 20,
2748
+ "data-testid": "search-filter-add",
2749
+ children: [/* @__PURE__ */ jsx(Icon, {
2750
+ icon: "mdi:plus",
2751
+ className: "mr-1",
2752
+ width: 14
2753
+ }), tr("fluidgrids.runControl.searchFilter.add", "Condition")]
2754
+ }),
2755
+ /* @__PURE__ */ jsxs("div", {
2756
+ className: "ml-auto flex gap-2",
2757
+ children: [applied && /* @__PURE__ */ jsx(Button$1, {
2758
+ size: "sm",
2759
+ variant: "ghost",
2760
+ onClick: () => {
2761
+ setState(EMPTY_SEARCH_FILTER);
2762
+ onApply(null);
2763
+ },
2764
+ "data-testid": "search-filter-clear",
2765
+ children: tr("fluidgrids.runControl.searchFilter.clear", "Clear")
2766
+ }), /* @__PURE__ */ jsx(Button$1, {
2767
+ size: "sm",
2768
+ onClick: () => onApply(built.filter),
2769
+ disabled: built.incomplete > 0,
2770
+ "data-testid": "search-filter-apply",
2771
+ children: tr("fluidgrids.runControl.searchFilter.apply", "Apply")
2772
+ })]
2773
+ })
2774
+ ]
2775
+ }),
2776
+ definitions.data && names.length === 0 && /* @__PURE__ */ jsx("p", {
2777
+ className: "text-xs text-text-secondary",
2778
+ "data-testid": "search-filter-no-definitions",
2779
+ children: tr("fluidgrids.runControl.searchFilter.noDefinitions", "No search attributes are defined. Define them in Settings → Run control.")
2780
+ }),
2781
+ /* @__PURE__ */ jsx(FieldError, { message: definitions.error }),
2782
+ state.rows.map((row, index) => {
2783
+ const type = types.get(row.name);
2784
+ return /* @__PURE__ */ jsxs("div", {
2785
+ className: "flex flex-wrap items-center gap-2",
2786
+ "data-testid": `search-filter-row-${index}`,
2787
+ children: [
2788
+ /* @__PURE__ */ jsx("div", {
2789
+ className: "w-44",
2790
+ children: /* @__PURE__ */ jsx(NativeSelect, {
2791
+ value: row.name,
2792
+ onChange: (name) => setRow(index, { name }),
2793
+ ariaLabel: tr("fluidgrids.runControl.searchFilter.attribute", "Attribute"),
2794
+ testId: `search-filter-name-${index}`,
2795
+ children: names.map((name) => /* @__PURE__ */ jsx("option", {
2796
+ value: name,
2797
+ children: name
2798
+ }, name))
2799
+ })
2800
+ }),
2801
+ /* @__PURE__ */ jsx("div", {
2802
+ className: "w-32",
2803
+ children: /* @__PURE__ */ jsx(NativeSelect, {
2804
+ value: row.op,
2805
+ onChange: (op) => setRow(index, { op: (type ? OPERATORS_BY_TYPE[type] : []).find((item) => item === op) ?? row.op }),
2806
+ ariaLabel: tr("fluidgrids.runControl.searchFilter.operator", "Operator"),
2807
+ testId: `search-filter-op-${index}`,
2808
+ children: (type ? OPERATORS_BY_TYPE[type] : []).map((op) => /* @__PURE__ */ jsx("option", {
2809
+ value: op,
2810
+ children: OPERATOR_LABELS[op]
2811
+ }, op))
2812
+ })
2813
+ }),
2814
+ /* @__PURE__ */ jsx(Input, {
2815
+ value: row.value,
2816
+ onChange: (event) => setRow(index, { value: event.target.value }),
2817
+ placeholder: row.op === "IN" ? tr("fluidgrids.runControl.searchFilter.listValue", "a, b, c") : type ?? "",
2818
+ className: "h-9 max-w-xs",
2819
+ "aria-label": tr("fluidgrids.runControl.searchFilter.value", "Value"),
2820
+ "data-testid": `search-filter-value-${index}`
2821
+ }),
2822
+ /* @__PURE__ */ jsx(Button$1, {
2823
+ size: "sm",
2824
+ variant: "ghost",
2825
+ "aria-label": tr("fluidgrids.runControl.searchFilter.remove", "Remove condition"),
2826
+ onClick: () => setState((current) => ({
2827
+ ...current,
2828
+ rows: current.rows.filter((_, i) => i !== index)
2829
+ })),
2830
+ children: /* @__PURE__ */ jsx(Icon, {
2831
+ icon: "mdi:close",
2832
+ width: 14
2833
+ })
2834
+ })
2835
+ ]
2836
+ }, index);
2837
+ }),
2838
+ built.incomplete > 0 && /* @__PURE__ */ jsx("p", {
2839
+ className: "text-xs text-[var(--color-status-warning-text)]",
2840
+ "data-testid": "search-filter-incomplete",
2841
+ children: tr("fluidgrids.runControl.searchFilter.incomplete", "Give every condition a value of its attribute's type.")
2842
+ }),
2843
+ applied && conflicts.length > 0 && /* @__PURE__ */ jsx("p", {
2844
+ className: "text-xs text-[var(--color-status-warning-text)]",
2845
+ "data-testid": "search-filter-conflicts",
2846
+ children: tr("fluidgrids.runControl.searchFilter.conflicts", "The attribute filter is not applied while these filters are set: {{filters}}. Clear them to use it.", { filters: conflicts.join(", ") })
2847
+ })
2848
+ ]
2849
+ });
2850
+ }
2851
+
2852
+ // src/modules/run-control/utils/batch.ts
2853
+ /**
2854
+ * The operations the batch menu offers, in menu order: every batch type the
2855
+ * service runs (spec code-first 11 §2.19).
2856
+ */
2857
+ const BATCH_MENU_OPERATIONS = [
2858
+ "SIGNAL",
2859
+ "CANCEL",
2860
+ "TERMINATE",
2861
+ "RESET",
2862
+ "PAUSE_ACTIVITY",
2863
+ "UNPAUSE_ACTIVITY",
2864
+ "RESET_ACTIVITY",
2865
+ "UPDATE_ACTIVITY_OPTIONS",
2866
+ "UPDATE_RUN_OPTIONS",
2867
+ "EXPORT"
2868
+ ];
2869
+ /**
2870
+ * Operations on durable work only. A copy of the service's
2871
+ * `DURABLE_BATCH_TYPES`: the service refuses them with FEATURE_DISABLED unless
2872
+ * durable functions are on besides run control.
2873
+ */
2874
+ const DURABLE_BATCH_OPERATIONS = /* @__PURE__ */ new Set([
2875
+ "RESET",
2876
+ "PAUSE_ACTIVITY",
2877
+ "UNPAUSE_ACTIVITY",
2878
+ "RESET_ACTIVITY",
2879
+ "UPDATE_ACTIVITY_OPTIONS",
2880
+ "UPDATE_RUN_OPTIONS"
2881
+ ]);
2882
+ /**
2883
+ * Operations that also need durable parity (`fluidgrids.durable-parity`): the
2884
+ * service's startBatchOperation calls requireDurableParity for them, as the
2885
+ * single-run setWorkflowRunVersioningOverride does.
2886
+ */
2887
+ const PARITY_BATCH_OPERATIONS = /* @__PURE__ */ new Set(["UPDATE_RUN_OPTIONS"]);
2888
+ /**
2889
+ * The operations the batch menu offers: nothing without run control; the
2890
+ * durable-only ones need run control with durable functions, and run options
2891
+ * durable parity as well; TERMINATE the workflow-run delete permission, EXPORT
2892
+ * run archival, the rest execute.
2893
+ */
2894
+ function allowedBatchOperations(gates, permissions) {
2895
+ const allowed = /* @__PURE__ */ new Set();
2896
+ if (!gates.runControl) return allowed;
2897
+ if (permissions.canExecute) for (const type of BATCH_MENU_OPERATIONS) {
2898
+ if (type === "TERMINATE" || type === "EXPORT") continue;
2899
+ if (DURABLE_BATCH_OPERATIONS.has(type) && !gates.runControlDurable) continue;
2900
+ if (PARITY_BATCH_OPERATIONS.has(type) && gates.durableParity !== true) continue;
2901
+ allowed.add(type);
2902
+ }
2903
+ if (permissions.canDelete) allowed.add("TERMINATE");
2904
+ if (gates.runArchival) allowed.add("EXPORT");
2905
+ return allowed;
2906
+ }
2907
+ /**
2908
+ * The mutation (and so the RBAC pair) each operation goes through: TERMINATE
2909
+ * is the workflow-run delete pair, EXPORT the read pair, the rest execute.
2910
+ */
2911
+ function batchMutationOf(type) {
2912
+ if (type === "TERMINATE") return "terminate";
2913
+ if (type === "EXPORT") return "export";
2914
+ return "operation";
2915
+ }
2916
+ /** The most run ids one job takes; beyond that, a filter selects. */
2917
+ const MAX_BATCH_RUN_IDS = 1e3;
2918
+ /**
2919
+ * The runs a job selects: the chosen ids, or (for "select all matching") the
2920
+ * list's filter without paging, which the service ignores anyway.
2921
+ */
2922
+ function batchSelection(input, selection) {
2923
+ if (selection.allMatching) {
2924
+ const filter = { ...input };
2925
+ delete filter.limit;
2926
+ delete filter.offset;
2927
+ return { filter };
2928
+ }
2929
+ return { runIds: selection.runIds.slice(0, MAX_BATCH_RUN_IDS) };
2930
+ }
2931
+ /** Whether the operation needs the activity selector. */
2932
+ function needsActivitySelector(type) {
2933
+ return type === "PAUSE_ACTIVITY" || type === "UNPAUSE_ACTIVITY" || type === "RESET_ACTIVITY" || type === "UPDATE_ACTIVITY_OPTIONS";
2934
+ }
2935
+ /**
2936
+ * The `selector` of an activity operation; null when a type is chosen but not
2937
+ * named. The service takes exactly one of activityId, activityType or all;
2938
+ * an activity id names one run's activity, so a batch never sends it.
2939
+ */
2940
+ function batchActivitySelector(scope) {
2941
+ if (scope.kind === "all") return { all: true };
2942
+ const activityType = scope.activityType.trim();
2943
+ return activityType ? { activityType } : null;
2944
+ }
2945
+ /**
2946
+ * The payload of an UPDATE_ACTIVITY_OPTIONS job; null until the selector is
2947
+ * complete and at least one option is set (the service refuses a job without
2948
+ * `activityOptions`, and an empty one would change nothing).
2949
+ */
2950
+ function updateActivityOptionsPayload(scope, options) {
2951
+ const selector = batchActivitySelector(scope);
2952
+ if (!selector || !options) return null;
2953
+ return {
2954
+ selector,
2955
+ activityOptions: options
2956
+ };
2957
+ }
2958
+ /**
2959
+ * The payload of an UPDATE_RUN_OPTIONS job: the versioning override to set on
2960
+ * each run, or `clearVersioningOverride` to remove it. Null for a pin with no
2961
+ * version chosen.
2962
+ */
2963
+ function updateRunOptionsPayload(choice, version) {
2964
+ const request = overrideRequestOf(choice, version);
2965
+ if (!request.ok) return null;
2966
+ return request.override ? { versioningOverride: request.override } : { clearVersioningOverride: true };
2967
+ }
2968
+ /**
2969
+ * The one workflow a job covers, or null when it may cover several. A pinned
2970
+ * version belongs to one workflow, so the batch dialog offers "Pin to a
2971
+ * version" only when this is known: "select all matching" takes the list's
2972
+ * workflow filter; selected ids count only when every one of them is on the
2973
+ * current page and they share one workflow.
2974
+ */
2975
+ function batchWorkflowKey(input, selection, rows) {
2976
+ if (selection.allMatching) return input.workflowKey?.trim() || null;
2977
+ if (selection.runIds.length === 0) return null;
2978
+ const keyOf = new Map(rows.map((row) => [row.id, row.workflowKey]));
2979
+ const keys = /* @__PURE__ */ new Set();
2980
+ for (const id of selection.runIds) {
2981
+ const key = keyOf.get(id);
2982
+ if (!key) return null;
2983
+ keys.add(key);
2984
+ }
2985
+ return keys.size === 1 ? [...keys][0] : null;
2986
+ }
2987
+ /** Progress of a job: succeeded, failed and skipped runs out of its total. */
2988
+ function batchProgress(job) {
2989
+ const done = job.succeeded + job.failed + job.skipped;
2990
+ const total = Math.max(job.total, 0);
2991
+ const finished = job.status === "COMPLETED" || job.status === "FAILED" || job.status === "CANCELLED";
2992
+ return {
2993
+ done,
2994
+ total,
2995
+ percent: total === 0 ? finished ? 100 : 0 : Math.min(100, Math.round(done / total * 100)),
2996
+ finished
2997
+ };
2998
+ }
2999
+
3000
+ // src/modules/run-control/components/BatchOperations.tsx
3001
+ /**
3002
+ * Batch operations of the Runs list (BOFF-9906, spec code-first 11 §2.19):
3003
+ * the batch menu over the selected runs (or every run matching the list's
3004
+ * filter), the dialog that dry-runs and starts a job, and the progress drawer
3005
+ * that follows it. TERMINATE goes through startBatchTerminate (the workflow-run
3006
+ * delete pair) and EXPORT through startBatchExport (the read pair); the rest
3007
+ * through startBatchOperation. UPDATE_ACTIVITY_OPTIONS changes the retry
3008
+ * policy and timeouts of every open activity (or every activity of one type)
3009
+ * of each run; UPDATE_RUN_OPTIONS sets or removes each run's versioning
3010
+ * override, pinning only when the job covers one workflow.
3011
+ */
3012
+ /** The drawer re-reads a running job this often (besides the subscription). */
3013
+ const BATCH_POLL_INTERVAL_MS = 3e3;
3014
+ const OPERATION_TYPES = {
3015
+ SIGNAL: "SIGNAL",
3016
+ CANCEL: "CANCEL",
3017
+ TERMINATE: "TERMINATE",
3018
+ RESET: "RESET",
3019
+ PAUSE_ACTIVITY: "PAUSE_ACTIVITY",
3020
+ UNPAUSE_ACTIVITY: "UNPAUSE_ACTIVITY",
3021
+ RESET_ACTIVITY: "RESET_ACTIVITY",
3022
+ UPDATE_ACTIVITY_OPTIONS: "UPDATE_ACTIVITY_OPTIONS",
3023
+ UPDATE_RUN_OPTIONS: "UPDATE_RUN_OPTIONS",
3024
+ EXPORT: "EXPORT"
3025
+ };
3026
+ function useBatchOperationLabels() {
3027
+ const tr = useTr();
3028
+ return {
3029
+ SIGNAL: tr("fluidgrids.runControl.batch.op.signal", "Signal"),
3030
+ CANCEL: tr("fluidgrids.runControl.batch.op.cancel", "Cancel"),
3031
+ TERMINATE: tr("fluidgrids.runControl.batch.op.terminate", "Terminate"),
3032
+ RESET: tr("fluidgrids.runControl.batch.op.reset", "Reset to last clean task"),
3033
+ PAUSE_ACTIVITY: tr("fluidgrids.runControl.batch.op.pauseActivity", "Pause activities"),
3034
+ UNPAUSE_ACTIVITY: tr("fluidgrids.runControl.batch.op.unpauseActivity", "Unpause activities"),
3035
+ RESET_ACTIVITY: tr("fluidgrids.runControl.batch.op.resetActivity", "Reset activity attempts"),
3036
+ UPDATE_ACTIVITY_OPTIONS: tr("fluidgrids.runControl.batch.op.updateActivityOptions", "Change activity options"),
3037
+ UPDATE_RUN_OPTIONS: tr("fluidgrids.runControl.batch.op.updateRunOptions", "Change run versioning"),
3038
+ EXPORT: tr("fluidgrids.runControl.batch.op.export", "Export to archive")
3039
+ };
3040
+ }
3041
+ function BatchMenu({ allowed, onPick, onShowJobs }) {
3042
+ const tr = useTr();
3043
+ const labels = useBatchOperationLabels();
3044
+ const offered = BATCH_MENU_OPERATIONS.filter((type) => allowed.has(type));
3045
+ return /* @__PURE__ */ jsxs("div", {
3046
+ className: "flex items-center gap-2",
3047
+ children: [/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
3048
+ asChild: true,
3049
+ children: /* @__PURE__ */ jsxs(Button$1, {
3050
+ variant: "outline",
3051
+ size: "sm",
3052
+ disabled: offered.length === 0,
3053
+ "data-testid": "batch-menu",
3054
+ children: [
3055
+ /* @__PURE__ */ jsx(Icon, {
3056
+ icon: "mdi:layers-triple-outline",
3057
+ className: "mr-1",
3058
+ width: 14
3059
+ }),
3060
+ tr("fluidgrids.runControl.batch.menu", "Batch"),
3061
+ /* @__PURE__ */ jsx(Icon, {
3062
+ icon: "mdi:chevron-down",
3063
+ className: "ml-1",
3064
+ width: 14
3065
+ })
3066
+ ]
3067
+ })
3068
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, {
3069
+ style: RUN_CONTROL_DIALOG_STYLE,
3070
+ children: offered.map((type) => /* @__PURE__ */ jsx(DropdownMenuItem, {
3071
+ onSelect: () => onPick(type),
3072
+ "data-testid": `batch-op-${type}`,
3073
+ children: labels[type]
3074
+ }, type))
3075
+ })] }), /* @__PURE__ */ jsx(Button$1, {
3076
+ variant: "ghost",
3077
+ size: "sm",
3078
+ onClick: onShowJobs,
3079
+ "data-testid": "batch-jobs-button",
3080
+ children: tr("fluidgrids.runControl.batch.jobs", "Batch jobs")
3081
+ })]
3082
+ });
3083
+ }
3084
+ /** The pin version picker, mounted only while a pin is chosen. */
3085
+ function BatchPinVersionSelect({ workflowKey, value, onChange }) {
3086
+ const tr = useTr();
3087
+ const { versions } = useWorkflowVersions(workflowKey);
3088
+ return /* @__PURE__ */ jsxs("label", {
3089
+ className: "block text-sm text-text-secondary",
3090
+ children: [tr("fluidgrids.executions.override.version", "Version"), /* @__PURE__ */ jsxs(ThemedSelect, {
3091
+ value,
3092
+ onChange: (event) => onChange(event.target.value),
3093
+ className: "mt-1 h-9 w-full rounded-md border border-border-default bg-surface-canvas px-2 text-sm text-text-primary",
3094
+ "data-testid": "batch-run-options-version",
3095
+ children: [/* @__PURE__ */ jsx("option", {
3096
+ value: "",
3097
+ children: tr("fluidgrids.executions.override.chooseVersion", "Choose a version")
3098
+ }), versions.map((definition) => /* @__PURE__ */ jsx("option", {
3099
+ value: definition.version,
3100
+ children: definition.version
3101
+ }, definition.version))]
3102
+ })]
3103
+ });
3104
+ }
3105
+ /** Which activities of each run an activity operation acts on. */
3106
+ function BatchActivityScopeFields({ value, onChange }) {
3107
+ const tr = useTr();
3108
+ return /* @__PURE__ */ jsxs("fieldset", {
3109
+ className: "space-y-2",
3110
+ "data-testid": "batch-activity-scope",
3111
+ children: [
3112
+ /* @__PURE__ */ jsxs("label", {
3113
+ className: "flex items-center gap-2 text-sm text-text-primary",
3114
+ children: [/* @__PURE__ */ jsx("input", {
3115
+ type: "radio",
3116
+ name: "batch-activity-scope",
3117
+ checked: value.kind === "all",
3118
+ onChange: () => onChange({ kind: "all" }),
3119
+ "data-testid": "batch-activity-scope-all"
3120
+ }), tr("fluidgrids.runControl.batch.allActivities", "Applies to every open activity of each run.")]
3121
+ }),
3122
+ /* @__PURE__ */ jsxs("label", {
3123
+ className: "flex items-center gap-2 text-sm text-text-primary",
3124
+ children: [/* @__PURE__ */ jsx("input", {
3125
+ type: "radio",
3126
+ name: "batch-activity-scope",
3127
+ checked: value.kind === "type",
3128
+ onChange: () => onChange({
3129
+ kind: "type",
3130
+ activityType: ""
3131
+ }),
3132
+ "data-testid": "batch-activity-scope-type"
3133
+ }), tr("fluidgrids.runControl.batch.activityTypeScope", "Only activities of one type")]
3134
+ }),
3135
+ value.kind === "type" && /* @__PURE__ */ jsxs("div", {
3136
+ className: "space-y-1.5",
3137
+ children: [/* @__PURE__ */ jsx(Label, {
3138
+ htmlFor: "batch-activity-type",
3139
+ children: tr("fluidgrids.runControl.batch.activityType", "Activity type")
3140
+ }), /* @__PURE__ */ jsx(Input, {
3141
+ id: "batch-activity-type",
3142
+ value: value.activityType,
3143
+ placeholder: "chargeCard",
3144
+ onChange: (event) => onChange({
3145
+ kind: "type",
3146
+ activityType: event.target.value
3147
+ }),
3148
+ "data-testid": "batch-activity-type"
3149
+ })]
3150
+ })
3151
+ ]
3152
+ });
3153
+ }
3154
+ /**
3155
+ * The versioning override an UPDATE_RUN_OPTIONS job sets. Pinning is offered
3156
+ * only when the job covers one workflow, whose versions the picker lists.
3157
+ */
3158
+ function BatchRunOptionsFields({ choice, onChoiceChange, pinVersion, onPinVersionChange, workflowKey }) {
3159
+ const tr = useTr();
3160
+ return /* @__PURE__ */ jsxs("fieldset", {
3161
+ className: "space-y-2",
3162
+ "data-testid": "batch-run-options",
3163
+ children: [[
3164
+ [
3165
+ "autoUpgrade",
3166
+ tr("fluidgrids.executions.override.autoUpgrade", "Auto-upgrade"),
3167
+ tr("fluidgrids.executions.override.autoUpgradeHint", "Each new workflow task uses the active version's bundle, after a replay check.")
3168
+ ],
3169
+ [
3170
+ "remove",
3171
+ tr("fluidgrids.executions.override.remove", "Remove override"),
3172
+ tr("fluidgrids.executions.override.removeHint", "The run follows the behaviour it started with. A pinned run keeps its bundle.")
3173
+ ],
3174
+ [
3175
+ "pin",
3176
+ tr("fluidgrids.executions.override.pin", "Pin to a version"),
3177
+ workflowKey ? tr("fluidgrids.executions.override.pinHint", "The run keeps that version's bundle. A different bundle is replay-checked first.") : tr("fluidgrids.runControl.batch.pinNeedsOneWorkflow", "Filter the list to one workflow, or select runs of one workflow, to pin them to a version.")
3178
+ ]
3179
+ ].map(([id, label, hint]) => /* @__PURE__ */ jsxs("label", {
3180
+ className: "flex cursor-pointer gap-2 rounded-md border border-border-default p-2",
3181
+ children: [/* @__PURE__ */ jsx("input", {
3182
+ type: "radio",
3183
+ name: "batch-run-options",
3184
+ value: id,
3185
+ checked: choice === id,
3186
+ disabled: id === "pin" && !workflowKey,
3187
+ onChange: () => onChoiceChange(id),
3188
+ "data-testid": `batch-run-options-${id}`,
3189
+ className: "mt-1"
3190
+ }), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
3191
+ className: "block text-sm font-medium text-text-primary",
3192
+ children: label
3193
+ }), /* @__PURE__ */ jsx("span", {
3194
+ className: "block text-xs text-text-secondary",
3195
+ children: hint
3196
+ })] })]
3197
+ }, id)), choice === "pin" && workflowKey && /* @__PURE__ */ jsx(BatchPinVersionSelect, {
3198
+ workflowKey,
3199
+ value: pinVersion,
3200
+ onChange: onPinVersionChange
3201
+ })]
3202
+ });
3203
+ }
3204
+ async function startJob(type, selection, common, payload) {
3205
+ const mutation = batchMutationOf(type);
3206
+ if (mutation === "terminate") return startBatchTerminate({
3207
+ ...selection,
3208
+ ...common
3209
+ });
3210
+ if (mutation === "export") return startBatchExport({
3211
+ ...selection,
3212
+ ...common
3213
+ });
3214
+ return startBatchOperation({
3215
+ ...selection,
3216
+ ...common,
3217
+ type: OPERATION_TYPES[type],
3218
+ payload
3219
+ });
3220
+ }
3221
+ function BatchOperationDialog({ type, input, selection, workflowKey = null, onClose, onStarted }) {
3222
+ const tr = useTr();
3223
+ const labels = useBatchOperationLabels();
3224
+ const [reason, setReason] = useState("");
3225
+ const [rate, setRate] = useState("50");
3226
+ const [signalName, setSignalName] = useState("");
3227
+ const [signalPayload, setSignalPayload] = useState("");
3228
+ const [pauseReason, setPauseReason] = useState("");
3229
+ const [activityScope, setActivityScope] = useState({ kind: "all" });
3230
+ const [activityOptions, setActivityOptions] = useState({ ...EMPTY_ACTIVITY_OPTIONS_FORM });
3231
+ const [overrideChoice, setOverrideChoice] = useState("autoUpgrade");
3232
+ const [pinVersion, setPinVersion] = useState("");
3233
+ const [dryRun, setDryRun] = useState(null);
3234
+ const [busy, setBusy] = useState(null);
3235
+ const [error, setError] = useState(null);
3236
+ const parsedPayload = parseJsonInput(signalPayload);
3237
+ const maxOperationsPerSecond = Math.min(50, Math.max(1, Math.round(Number(rate) || 0)));
3238
+ const payload = () => {
3239
+ if (type === "SIGNAL") return {
3240
+ signalName: signalName.trim(),
3241
+ signalPayload: parsedPayload.ok ? jsonArg(parsedPayload.value) : null
3242
+ };
3243
+ if (type === "RESET") return { resetTo: { type: "LAST_TASK" } };
3244
+ if (type === "UPDATE_ACTIVITY_OPTIONS") return updateActivityOptionsPayload(activityScope, activityOptionsFrom(activityOptions));
3245
+ if (type === "UPDATE_RUN_OPTIONS") return updateRunOptionsPayload(overrideChoice, pinVersion);
3246
+ if (needsActivitySelector(type)) {
3247
+ const selector = batchActivitySelector(activityScope);
3248
+ return selector ? { selector } : null;
3249
+ }
3250
+ return null;
3251
+ };
3252
+ const payloadComplete = !(needsActivitySelector(type) || type === "UPDATE_RUN_OPTIONS") || payload() !== null;
3253
+ const valid = reason.trim().length > 0 && Number.isFinite(Number(rate)) && payloadComplete && (type !== "SIGNAL" || signalName.trim().length > 0 && parsedPayload.ok) && (type !== "PAUSE_ACTIVITY" || pauseReason.trim().length > 0);
3254
+ const jobReason = type === "PAUSE_ACTIVITY" && pauseReason.trim() ? pauseReason.trim() : reason.trim();
3255
+ const run = async (asDryRun) => {
3256
+ if (!valid) return;
3257
+ setBusy(asDryRun ? "dry" : "start");
3258
+ setError(null);
3259
+ try {
3260
+ const chosen = batchSelection(input, selection);
3261
+ const job = await startJob(type, "filter" in chosen ? { filter: chosen.filter } : { runIds: chosen.runIds }, {
3262
+ reason: jobReason,
3263
+ maxOperationsPerSecond,
3264
+ dryRun: asDryRun
3265
+ }, payload());
3266
+ if (asDryRun) setDryRun(job);
3267
+ else onStarted(job);
3268
+ } catch (err) {
3269
+ setError(describeOperationError(err));
3270
+ } finally {
3271
+ setBusy(null);
3272
+ }
3273
+ };
3274
+ return /* @__PURE__ */ jsx(Dialog, {
3275
+ open: true,
3276
+ onOpenChange: (open) => !open && onClose(),
3277
+ children: /* @__PURE__ */ jsxs(DialogContent, {
3278
+ style: RUN_CONTROL_DIALOG_STYLE,
3279
+ "data-testid": "batch-dialog",
3280
+ children: [
3281
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: labels[type] }), /* @__PURE__ */ jsx(DialogDescription, { children: selection.allMatching ? tr("fluidgrids.runControl.batch.allMatching", "Every run that matches the list's filters.") : tr("fluidgrids.runControl.batch.selected", "{{count}} selected runs.", { count: Math.min(selection.runIds.length, 1e3) }) })] }),
3282
+ /* @__PURE__ */ jsxs("div", {
3283
+ className: "space-y-3",
3284
+ children: [
3285
+ type === "SIGNAL" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
3286
+ className: "space-y-1.5",
3287
+ children: [/* @__PURE__ */ jsx(Label, {
3288
+ htmlFor: "batch-signal-name",
3289
+ children: tr("fluidgrids.runControl.batch.signalName", "Signal name")
3290
+ }), /* @__PURE__ */ jsx(Input, {
3291
+ id: "batch-signal-name",
3292
+ value: signalName,
3293
+ onChange: (event) => setSignalName(event.target.value),
3294
+ "data-testid": "batch-signal-name"
3295
+ })]
3296
+ }), /* @__PURE__ */ jsx(JsonField, {
3297
+ id: "batch-signal-payload",
3298
+ label: tr("fluidgrids.runControl.batch.signalPayload", "Payload (JSON, optional)"),
3299
+ value: signalPayload,
3300
+ onChange: setSignalPayload,
3301
+ rows: 3,
3302
+ error: parsedPayload.ok ? null : parsedPayload.error
3303
+ })] }),
3304
+ type === "PAUSE_ACTIVITY" && /* @__PURE__ */ jsxs("div", {
3305
+ className: "space-y-1.5",
3306
+ children: [/* @__PURE__ */ jsx(Label, {
3307
+ htmlFor: "batch-pause-reason",
3308
+ children: tr("fluidgrids.runControl.batch.pauseReason", "Pause reason")
3309
+ }), /* @__PURE__ */ jsx(Input, {
3310
+ id: "batch-pause-reason",
3311
+ value: pauseReason,
3312
+ onChange: (event) => setPauseReason(event.target.value),
3313
+ "data-testid": "batch-pause-reason"
3314
+ })]
3315
+ }),
3316
+ needsActivitySelector(type) && /* @__PURE__ */ jsx(BatchActivityScopeFields, {
3317
+ value: activityScope,
3318
+ onChange: setActivityScope
3319
+ }),
3320
+ type === "UPDATE_ACTIVITY_OPTIONS" && /* @__PURE__ */ jsx(ActivityOptionsFields, {
3321
+ idPrefix: "batch-activity-option",
3322
+ value: activityOptions,
3323
+ onChange: setActivityOptions
3324
+ }),
3325
+ type === "UPDATE_RUN_OPTIONS" && /* @__PURE__ */ jsx(BatchRunOptionsFields, {
3326
+ choice: overrideChoice,
3327
+ onChoiceChange: setOverrideChoice,
3328
+ pinVersion,
3329
+ onPinVersionChange: setPinVersion,
3330
+ workflowKey
3331
+ }),
3332
+ /* @__PURE__ */ jsxs("div", {
3333
+ className: "space-y-1.5",
3334
+ children: [/* @__PURE__ */ jsx(Label, {
3335
+ htmlFor: "batch-reason",
3336
+ children: tr("fluidgrids.runControl.batch.reason", "Reason")
3337
+ }), /* @__PURE__ */ jsx(Input, {
3338
+ id: "batch-reason",
3339
+ value: reason,
3340
+ maxLength: 1e3,
3341
+ onChange: (event) => setReason(event.target.value),
3342
+ "data-testid": "batch-reason"
3343
+ })]
3344
+ }),
3345
+ /* @__PURE__ */ jsxs("div", {
3346
+ className: "space-y-1.5",
3347
+ children: [/* @__PURE__ */ jsx(Label, {
3348
+ htmlFor: "batch-rate",
3349
+ children: tr("fluidgrids.runControl.batch.rate", "Runs per second (1 to 50)")
3350
+ }), /* @__PURE__ */ jsx(Input, {
3351
+ id: "batch-rate",
3352
+ inputMode: "numeric",
3353
+ value: rate,
3354
+ onChange: (event) => setRate(event.target.value),
3355
+ "data-testid": "batch-rate"
3356
+ })]
3357
+ }),
3358
+ dryRun && /* @__PURE__ */ jsx("p", {
3359
+ className: "rounded-md bg-surface-canvas p-2 text-sm text-text-primary",
3360
+ "data-testid": "batch-dry-run-result",
3361
+ children: tr("fluidgrids.runControl.batch.dryRunResult", "The job would select {{count}} runs.", { count: dryRun.total })
3362
+ }),
3363
+ /* @__PURE__ */ jsx(FieldError, {
3364
+ message: error,
3365
+ testId: "batch-error"
3366
+ })
3367
+ ]
3368
+ }),
3369
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
3370
+ /* @__PURE__ */ jsx(Button$1, {
3371
+ variant: "outline",
3372
+ onClick: onClose,
3373
+ disabled: busy !== null,
3374
+ children: tr("fluidgrids.runControl.common.cancel", "Cancel")
3375
+ }),
3376
+ /* @__PURE__ */ jsx(Button$1, {
3377
+ variant: "outline",
3378
+ onClick: () => void run(true),
3379
+ disabled: !valid || busy !== null,
3380
+ "data-testid": "batch-dry-run",
3381
+ children: busy === "dry" ? tr("fluidgrids.runControl.batch.counting", "Counting…") : tr("fluidgrids.runControl.batch.dryRun", "Dry run")
3382
+ }),
3383
+ /* @__PURE__ */ jsx(Button$1, {
3384
+ onClick: () => void run(false),
3385
+ disabled: !valid || busy !== null,
3386
+ "data-testid": "batch-start",
3387
+ children: busy === "start" ? tr("fluidgrids.runControl.common.working", "Working…") : tr("fluidgrids.runControl.batch.start", "Start job")
3388
+ })
3389
+ ] })
3390
+ ]
3391
+ })
3392
+ });
3393
+ }
3394
+ function statusTone(status) {
3395
+ if (status === "COMPLETED") return "success";
3396
+ if (status === "FAILED") return "error";
3397
+ if (status === "CANCELLED") return "neutral";
3398
+ return "info";
3399
+ }
3400
+ function isBatchMenuOperation(type) {
3401
+ return BATCH_MENU_OPERATIONS.some((item) => item === type);
3402
+ }
3403
+ /** Follows one job: its subscription, plus a re-read on a timer while it runs. */
3404
+ function useBatchJob(initial) {
3405
+ const [job, setJob] = useState(initial);
3406
+ const id = job?.id ?? null;
3407
+ const finished = job ? batchProgress(job).finished : true;
3408
+ useEffect(() => {
3409
+ if (!id || finished) return;
3410
+ let cancelled = false;
3411
+ const subscription = getFluidGridsClient().subscribe({
3412
+ query: WorkflowBatchOperationUpdatedDocument,
3413
+ variables: { id }
3414
+ }).subscribe({
3415
+ next: ({ data }) => {
3416
+ if (!cancelled && data?.workflowBatchOperationUpdated) setJob(data.workflowBatchOperationUpdated);
3417
+ },
3418
+ error: () => void 0
3419
+ });
3420
+ const timer = setInterval(() => {
3421
+ fetchBatchOperation(id).then((next) => {
3422
+ if (!cancelled) setJob(next);
3423
+ }).catch(() => void 0);
3424
+ }, BATCH_POLL_INTERVAL_MS);
3425
+ return () => {
3426
+ cancelled = true;
3427
+ subscription.unsubscribe();
3428
+ clearInterval(timer);
3429
+ };
3430
+ }, [id, finished]);
3431
+ return {
3432
+ job,
3433
+ setJob
3434
+ };
3435
+ }
3436
+ function BatchProgressDrawer({ job: initial, open, onOpenChange, canCancel }) {
3437
+ const tr = useTr();
3438
+ const labels = useBatchOperationLabels();
3439
+ const { job, setJob } = useBatchJob(initial);
3440
+ const [error, setError] = useState(null);
3441
+ const jobs = useResource("batch-jobs", open && !job, () => fetchBatchOperations({ first: 20 }));
3442
+ useEffect(() => setJob(initial), [initial, setJob]);
3443
+ const cancel = async () => {
3444
+ if (!job) return;
3445
+ try {
3446
+ setJob(await cancelBatchOperation(job.id));
3447
+ } catch (err) {
3448
+ setError(describeOperationError(err));
3449
+ }
3450
+ };
3451
+ const labelOf = (type) => isBatchMenuOperation(type) ? labels[type] : type;
3452
+ return /* @__PURE__ */ jsx(Sheet, {
3453
+ open,
3454
+ onOpenChange,
3455
+ children: /* @__PURE__ */ jsxs(SheetContent, {
3456
+ style: RUN_CONTROL_DIALOG_STYLE,
3457
+ className: "w-full sm:max-w-md",
3458
+ "data-testid": "batch-drawer",
3459
+ children: [
3460
+ /* @__PURE__ */ jsxs(SheetHeader, { children: [/* @__PURE__ */ jsx(SheetTitle, { children: job ? labelOf(job.type) : tr("fluidgrids.runControl.batch.jobs", "Batch jobs") }), /* @__PURE__ */ jsx(SheetDescription, { children: job ? job.reason : tr("fluidgrids.runControl.batch.jobsDescription", "The workspace's recent batch jobs.") })] }),
3461
+ job ? /* @__PURE__ */ jsx(BatchJobProgress, {
3462
+ job,
3463
+ onCancel: canCancel ? () => void cancel() : void 0
3464
+ }) : /* @__PURE__ */ jsxs("div", {
3465
+ className: "mt-4 space-y-2",
3466
+ children: [
3467
+ /* @__PURE__ */ jsx(FieldError, { message: jobs.error }),
3468
+ (jobs.data?.items ?? []).map((item) => /* @__PURE__ */ jsxs("button", {
3469
+ type: "button",
3470
+ className: "w-full rounded-md border border-border-default p-2 text-left hover:bg-surface-sunken",
3471
+ onClick: () => setJob(item),
3472
+ "data-testid": `batch-job-${item.id}`,
3473
+ children: [/* @__PURE__ */ jsxs("div", {
3474
+ className: "flex items-center gap-2 text-sm",
3475
+ children: [
3476
+ /* @__PURE__ */ jsx("span", {
3477
+ className: "font-medium text-text-primary",
3478
+ children: labelOf(item.type)
3479
+ }),
3480
+ /* @__PURE__ */ jsx(StatusPill, {
3481
+ tone: statusTone(item.status),
3482
+ children: item.status
3483
+ }),
3484
+ /* @__PURE__ */ jsxs("span", {
3485
+ className: "ml-auto text-xs text-text-secondary",
3486
+ children: [batchProgress(item).percent, "%"]
3487
+ })
3488
+ ]
3489
+ }), /* @__PURE__ */ jsx("p", {
3490
+ className: "truncate text-xs text-text-secondary",
3491
+ children: item.reason
3492
+ })]
3493
+ }, item.id)),
3494
+ jobs.data && jobs.data.items.length === 0 && /* @__PURE__ */ jsx(EmptyState, {
3495
+ kind: "first-use",
3496
+ illustration: "tasks",
3497
+ size: "inline",
3498
+ compact: true,
3499
+ icon: null,
3500
+ title: tr("fluidgrids.runControl.batch.noJobs", "No batch jobs yet.")
3501
+ })
3502
+ ]
3503
+ }),
3504
+ /* @__PURE__ */ jsx(FieldError, { message: error })
3505
+ ]
3506
+ })
3507
+ });
3508
+ }
3509
+ function BatchJobProgress({ job, onCancel }) {
3510
+ const tr = useTr();
3511
+ const progress = batchProgress(job);
3512
+ return /* @__PURE__ */ jsxs("div", {
3513
+ className: "mt-4 space-y-3",
3514
+ "data-testid": "batch-progress",
3515
+ children: [
3516
+ /* @__PURE__ */ jsxs("div", {
3517
+ className: "flex items-center gap-2",
3518
+ children: [/* @__PURE__ */ jsx(StatusPill, {
3519
+ tone: statusTone(job.status),
3520
+ testId: "batch-progress-status",
3521
+ children: job.status
3522
+ }), /* @__PURE__ */ jsxs("span", {
3523
+ className: "text-sm text-text-secondary",
3524
+ "data-testid": "batch-progress-count",
3525
+ children: [
3526
+ progress.done,
3527
+ " / ",
3528
+ progress.total
3529
+ ]
3530
+ })]
3531
+ }),
3532
+ /* @__PURE__ */ jsx("div", {
3533
+ className: "h-2 overflow-hidden rounded-full bg-surface-sunken",
3534
+ children: /* @__PURE__ */ jsx("div", {
3535
+ className: "h-full bg-[var(--color-status-info-bg)]",
3536
+ style: { width: `${progress.percent}%` }
3537
+ })
3538
+ }),
3539
+ /* @__PURE__ */ jsxs("dl", {
3540
+ className: "grid grid-cols-3 gap-2 text-center text-xs",
3541
+ children: [
3542
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
3543
+ className: "text-text-secondary",
3544
+ children: tr("fluidgrids.runControl.batch.succeeded", "Succeeded")
3545
+ }), /* @__PURE__ */ jsx("dd", {
3546
+ className: "text-base font-semibold text-text-primary",
3547
+ children: job.succeeded
3548
+ })] }),
3549
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
3550
+ className: "text-text-secondary",
3551
+ children: tr("fluidgrids.runControl.batch.failed", "Failed")
3552
+ }), /* @__PURE__ */ jsx("dd", {
3553
+ className: "text-base font-semibold text-text-primary",
3554
+ children: job.failed
3555
+ })] }),
3556
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
3557
+ className: "text-text-secondary",
3558
+ children: tr("fluidgrids.runControl.batch.skipped", "Skipped")
3559
+ }), /* @__PURE__ */ jsx("dd", {
3560
+ className: "text-base font-semibold text-text-primary",
3561
+ children: job.skipped
3562
+ })] })
3563
+ ]
3564
+ }),
3565
+ job.failureMessage && /* @__PURE__ */ jsx(FieldError, { message: job.failureMessage }),
3566
+ job.errors.length > 0 && /* @__PURE__ */ jsx("ul", {
3567
+ className: "max-h-48 space-y-1 overflow-auto text-xs",
3568
+ "data-testid": "batch-progress-errors",
3569
+ children: job.errors.map((item) => /* @__PURE__ */ jsxs("li", { children: [
3570
+ /* @__PURE__ */ jsx("code", {
3571
+ className: "font-mono",
3572
+ children: item.runId.slice(0, 12)
3573
+ }),
3574
+ " ",
3575
+ item.message
3576
+ ] }, item.runId))
3577
+ }),
3578
+ onCancel && !progress.finished && !job.cancelRequestedAt && /* @__PURE__ */ jsx(Button$1, {
3579
+ variant: "outline",
3580
+ size: "sm",
3581
+ onClick: onCancel,
3582
+ "data-testid": "batch-cancel",
3583
+ children: tr("fluidgrids.runControl.batch.cancel", "Cancel job")
3584
+ })
3585
+ ]
3586
+ });
3587
+ }
3588
+
3589
+ // src/modules/executions/components/RunsParityBar.tsx
3590
+ /**
3591
+ * Runs list additions from durable-function parity (BOFF-9905, spec
3592
+ * code-first 11 §2.1, §2.34): a workflow-id filter and the number of runs per
3593
+ * status for the current filter (`workflowRunsCount`, the same filter and
3594
+ * visibility as the list). Rendered only while fluidgrids.durable-parity is
3595
+ * on.
3596
+ */
3597
+ /** How long typing in the workflow-id box settles before it filters. */
3598
+ const WORKFLOW_ID_FILTER_DEBOUNCE_MS = 350;
3599
+ const RUN_STATUSES = [
3600
+ "PENDING",
3601
+ "RUNNING",
3602
+ "WAITING",
3603
+ "COMPLETED",
3604
+ "FAILED",
3605
+ "CANCELLED",
3606
+ "TERMINATED"
3607
+ ];
3608
+ function isRunStatus(value) {
3609
+ return RUN_STATUSES.includes(value);
3610
+ }
3611
+ function RunsParityBar({ workflowId, onWorkflowIdChange, total, counts, countsError, selectedStatus, onSelectStatus, className }) {
3612
+ const tr = useTr();
3613
+ const statusLabels = runStatusLabels(tr);
3614
+ const [draft, setDraft] = useState(workflowId);
3615
+ useEffect(() => {
3616
+ setDraft(workflowId);
3617
+ }, [workflowId]);
3618
+ useEffect(() => {
3619
+ if (draft === workflowId) return;
3620
+ const timer = setTimeout(() => onWorkflowIdChange(draft), 350);
3621
+ return () => clearTimeout(timer);
3622
+ }, [
3623
+ draft,
3624
+ workflowId,
3625
+ onWorkflowIdChange
3626
+ ]);
3627
+ return /* @__PURE__ */ jsxs("div", {
3628
+ "data-testid": "runs-parity-bar",
3629
+ className: cn("mb-6 flex flex-col gap-3 lg:flex-row lg:items-center", className),
3630
+ children: [/* @__PURE__ */ jsxs("label", {
3631
+ className: "flex min-w-0 items-center gap-2 text-sm text-text-secondary lg:w-80",
3632
+ children: [
3633
+ /* @__PURE__ */ jsx(Icon, {
3634
+ icon: "mdi:key-outline",
3635
+ width: 16,
3636
+ className: "shrink-0"
3637
+ }),
3638
+ /* @__PURE__ */ jsx("span", {
3639
+ className: "sr-only",
3640
+ children: tr("fluidgrids.executions.parity.workflowIdFilter", "Workflow ID")
3641
+ }),
3642
+ /* @__PURE__ */ jsx(Input, {
3643
+ value: draft,
3644
+ maxLength: 256,
3645
+ placeholder: tr("fluidgrids.executions.parity.workflowIdPlaceholder", "Filter by workflow ID"),
3646
+ onChange: (event) => setDraft(event.target.value),
3647
+ "data-testid": "runs-workflow-id-filter"
3648
+ })
3649
+ ]
3650
+ }), /* @__PURE__ */ jsx("div", {
3651
+ className: "flex flex-wrap items-center gap-2",
3652
+ "data-testid": "runs-status-counts",
3653
+ children: countsError ? /* @__PURE__ */ jsxs("span", {
3654
+ className: "text-xs text-[var(--color-status-error-text)]",
3655
+ children: [
3656
+ tr("fluidgrids.executions.parity.countsError", "Could not count the runs:"),
3657
+ " ",
3658
+ countsError
3659
+ ]
3660
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [total !== null && /* @__PURE__ */ jsx("button", {
3661
+ type: "button",
3662
+ onClick: () => onSelectStatus("all"),
3663
+ className: cn("rounded-full border px-2.5 py-1 text-xs", selectedStatus === "all" ? "border-action-primary-bg bg-action-primary-bg text-action-primary-text" : "border-border-default text-text-secondary hover:text-text-primary"),
3664
+ "aria-pressed": selectedStatus === "all",
3665
+ "data-testid": "runs-count-all",
3666
+ children: tr("fluidgrids.executions.parity.countAll", "All {{count}}", { count: total })
3667
+ }), counts.map(({ status, count }) => isRunStatus(status) ? /* @__PURE__ */ jsx("button", {
3668
+ type: "button",
3669
+ onClick: () => onSelectStatus(status),
3670
+ className: cn("rounded-full border px-2.5 py-1 text-xs", selectedStatus === status ? "border-action-primary-bg bg-action-primary-bg text-action-primary-text" : "border-border-default text-text-secondary hover:text-text-primary"),
3671
+ "aria-pressed": selectedStatus === status,
3672
+ "data-testid": `runs-count-${status}`,
3673
+ children: tr("fluidgrids.executions.parity.countStatus", "{{status}} {{count}}", {
3674
+ status: statusLabels[status],
3675
+ count
3676
+ })
3677
+ }, status) : null)] })
3678
+ })]
3679
+ });
3680
+ }
3681
+
3682
+ // src/modules/executions/pages/ExecutionsListPage.tsx
3683
+ var ExecutionsListPage_exports = /* @__PURE__ */ __exportAll({ ExecutionsListPage: () => ExecutionsListPage });
3684
+ function ExecutionsListPage() {
3685
+ const tr = useTr();
3686
+ const navigate = useNavigate();
3687
+ const v2 = useNavigationV2();
3688
+ const loadingSystem = useLoadingSystem();
3689
+ const [showDetails, setShowDetails] = useState(false);
3690
+ const [confirmStop, setConfirmStop] = useState(null);
3691
+ const [confirmDelete, setConfirmDelete] = useState(false);
3692
+ const { viewMode, setViewMode, setSelectedExecution, selection, clearSelection, setStatusFilter, setWorkflowFilter, setWorkflowIdFilter, updateFilter, resetFilters, filter, autoRefresh, autoRefreshInterval } = useExecutionsStore();
3693
+ const [searchParams, setSearchParams] = useSearchParams();
3694
+ const workflowKeyParam = searchParams.get("workflowKey") ?? "";
3695
+ const lastWorkflowKeyParam = useRef(null);
3696
+ const linkKey = runListLinkKey(searchParams);
3697
+ const [appliedLinkKey, setAppliedLinkKey] = useState(null);
3698
+ if (appliedLinkKey !== linkKey) {
3699
+ setAppliedLinkKey(linkKey);
3700
+ const linked = runListFilterFromSearch(searchParams);
3701
+ if (linked) updateFilter({
3702
+ ...DEFAULT_EXECUTIONS_FILTER,
3703
+ ...linked,
3704
+ workflowKey: workflowKeyParam
3705
+ });
3706
+ }
3707
+ if (lastWorkflowKeyParam.current !== workflowKeyParam) {
3708
+ lastWorkflowKeyParam.current = workflowKeyParam;
3709
+ if (useExecutionsStore.getState().filter.workflowKey !== workflowKeyParam) setWorkflowFilter(workflowKeyParam);
3710
+ }
3711
+ const parityEnabled = useDurableParityEnabled();
3712
+ const phaseC = usePhaseCFlags();
3713
+ const [searchFilter, setSearchFilter] = useState(null);
3714
+ const [searchFilterBuilderKey, setSearchFilterBuilderKey] = useState(0);
3715
+ const clearSearchFilter = () => {
3716
+ setSearchFilter(null);
3717
+ setSearchFilterBuilderKey((key) => key + 1);
3718
+ };
3719
+ const [allMatching, setAllMatching] = useState(false);
3720
+ const [batchType, setBatchType] = useState(null);
3721
+ const [batchDrawer, setBatchDrawer] = useState(null);
3722
+ const { allowed: canExecuteRuns } = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.WORKFLOW_RUN_EXECUTE);
3723
+ const { allowed: canDeleteRuns } = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.WORKFLOW_RUN_DELETE);
3724
+ const { input, searchPending } = useExecutionsStoreInput({
3725
+ durableParity: parityEnabled,
3726
+ searchAttributes: phaseC.searchAttributes ? searchFilter : null
3727
+ });
3728
+ const scopedKey = v2 ? filter.workflowKey : "";
3729
+ const flagsSettled = useFluidGridsFlagsSettled();
3730
+ const runsPage = useRunsPage({
3731
+ input,
3732
+ withCounts: parityEnabled,
3733
+ scopedWorkflowKey: scopedKey,
3734
+ withSearchAttributes: phaseC.searchAttributes
3735
+ }, { ready: flagsSettled });
3736
+ const { executions, total, totalCapped, loading, error, stats, statsLoading, statusCounts, scopedCounts, workflows, refresh, refreshStats, listRefused } = runsPage;
3737
+ const refetch = useCallback(() => void refresh({ all: true }), [refresh]);
3738
+ const inputKey = JSON.stringify({
3739
+ ...input,
3740
+ limit: 0,
3741
+ offset: 0
3742
+ });
3743
+ useEffect(() => setAllMatching(false), [inputKey]);
3744
+ const matchingSelected = allMatching && selection.allSelected && !searchPending;
3745
+ const batchOperations = useMemo(() => allowedBatchOperations({
3746
+ runControl: phaseC.runControl,
3747
+ runControlDurable: phaseC.runControlDurable,
3748
+ runArchival: phaseC.runArchival,
3749
+ durableParity: parityEnabled
3750
+ }, {
3751
+ canExecute: canExecuteRuns,
3752
+ canDelete: canDeleteRuns
3753
+ }), [
3754
+ phaseC.runControl,
3755
+ phaseC.runControlDurable,
3756
+ phaseC.runArchival,
3757
+ parityEnabled,
3758
+ canExecuteRuns,
3759
+ canDeleteRuns
3760
+ ]);
3761
+ const { controlExecution, retryExecution, retryExecutions } = useExecutionActions();
3762
+ const { deleteRuns, deleting } = useBulkDeleteRuns();
3763
+ const refreshAll = useCallback(() => refresh(), [refresh]);
3764
+ const shownRunIds = useMemo(() => new Set(executions.map((run) => run.id)), [executions]);
3765
+ const liveStatus = useRunsListLive({
3766
+ enabled: autoRefresh,
3767
+ workflowKey: filter.workflowKey || null,
3768
+ refetch: refreshAll,
3769
+ refetchWorkspaceStats: refreshStats,
3770
+ shownRunIds
3771
+ });
3772
+ useAutoRefresh(useCallback(() => void refreshAll(), [refreshAll]), autoRefresh && shouldPoll(liveStatus) && !listRefused, autoRefreshInterval);
3773
+ const executionStats = useMemo(() => {
3774
+ if (!stats) return null;
3775
+ if (scopedKey !== "" && scopedCounts.total !== null && !scopedCounts.error) {
3776
+ const count = (status) => scopedCounts.counts.find((entry) => entry.status === status)?.count ?? 0;
3777
+ const completed = count("COMPLETED");
3778
+ const failed = count("FAILED");
3779
+ return {
3780
+ total: scopedCounts.total,
3781
+ running: count("RUNNING"),
3782
+ completed,
3783
+ failed,
3784
+ cancelled: count("CANCELLED"),
3785
+ pending: count("PENDING"),
3786
+ waiting: count("WAITING"),
3787
+ successRate: completed + failed > 0 ? completed / (completed + failed) * 100 : 0,
3788
+ avgDuration: stats.avgWorkflowExecutionTimeSeconds ?? 0
3789
+ };
3790
+ }
3791
+ return {
3792
+ total: stats.runsCountTotal,
3793
+ running: stats.runsRunningCount,
3794
+ completed: stats.runsCompletedCount,
3795
+ failed: stats.runsFailedCount,
3796
+ cancelled: stats.runsCancelledCount ?? 0,
3797
+ pending: stats.runsPendingCount,
3798
+ waiting: stats.runsWaitingCount ?? 0,
3799
+ successRate: stats.workflowSuccessRate ?? 0,
3800
+ avgDuration: stats.avgWorkflowExecutionTimeSeconds ?? 0
3801
+ };
3802
+ }, [
3803
+ stats,
3804
+ scopedKey,
3805
+ scopedCounts.total,
3806
+ scopedCounts.counts,
3807
+ scopedCounts.error
3808
+ ]);
3809
+ const statsScoped = scopedKey !== "" && scopedCounts.total !== null && !scopedCounts.error;
3810
+ const workflowOptions = useMemo(() => workflows.map((w) => ({
3811
+ workflowKey: w.workflowKey,
3812
+ name: w.name
3813
+ })), [workflows]);
3814
+ const workflowNames = useMemo(() => {
3815
+ const map = {};
3816
+ for (const w of workflows) map[w.workflowKey] = w.name;
3817
+ return map;
3818
+ }, [workflows]);
3819
+ const handleRowClick = (execution) => {
3820
+ setSelectedExecution(execution);
3821
+ navigate(`../runs/${execution.id}`);
3822
+ };
3823
+ const handleRetry = async (execution) => {
3824
+ const result = await retryExecution(execution);
3825
+ if (!result.ok) {
3826
+ toast.error(tr("fluidgrids.executions.executionsList.retryFailed", "Could not start a new run"), { description: result.message });
3827
+ return;
3828
+ }
3829
+ toast.success(tr("fluidgrids.executions.executionsList.retryStarted", "New run started"));
3830
+ navigate(`../runs/${result.run.runId}`);
3831
+ };
3832
+ const controlFailedTitle = (action) => {
3833
+ switch (action) {
3834
+ case "pause": return tr("fluidgrids.executions.executionsList.pauseFailed", "Could not pause this run");
3835
+ case "resume": return tr("fluidgrids.executions.executionsList.resumeFailed", "Could not resume this run");
3836
+ case "cancel": return tr("fluidgrids.executions.executionsList.cancelFailed", "Could not cancel this run");
3837
+ }
3838
+ };
3839
+ const handleControl = async (action, execution) => {
3840
+ const result = await controlExecution(action, execution.id);
3841
+ if (!result.ok) toast.error(controlFailedTitle(action), { description: result.message });
3842
+ };
3843
+ const handleAction = async (action, execution) => {
3844
+ switch (action) {
3845
+ case "cancel":
3846
+ if (v2) {
3847
+ setConfirmStop({
3848
+ kind: "row",
3849
+ run: execution
3850
+ });
3851
+ return;
3852
+ }
3853
+ await handleControl(action, execution);
3854
+ break;
3855
+ case "pause":
3856
+ case "resume":
3857
+ await handleControl(action, execution);
3858
+ break;
3859
+ case "retry":
3860
+ await handleRetry(execution);
3861
+ break;
3862
+ case "view": navigate(`../runs/${execution.id}`);
3863
+ }
3864
+ refetch();
3865
+ };
3866
+ const handleFilterByStatus = (status) => {
3867
+ setStatusFilter(status);
3868
+ };
3869
+ const handleBulkRetry = async () => {
3870
+ if (selection.runIds.length === 0) return;
3871
+ const plan = planBulkRetry(selection.runIds, executions);
3872
+ if (plan.runIds.length === 0) {
3873
+ toast.info(tr("fluidgrids.executions.executionsList.bulkRetryNoneFailed", "None of the selected runs failed, so there is nothing to run again."));
3874
+ return;
3875
+ }
3876
+ const retried = await retryExecutions(plan.runIds);
3877
+ if (retried.length === 0) {
3878
+ toast.error(tr("fluidgrids.executions.executionsList.bulkRetryFailed", "Could not retry the selected runs"));
3879
+ return;
3880
+ }
3881
+ toast.success(tr("fluidgrids.executions.executionsList.bulkRetryStarted", `${retried.length} new run${retried.length === 1 ? "" : "s"} started`));
3882
+ if (plan.skippedNotFailed > 0 || plan.skippedOverLimit > 0) toast.info(tr("fluidgrids.executions.executionsList.bulkRetrySkipped", "Only failed runs are run again, and at most {{limit}} at a time. Left out: {{notFailed}} that did not fail, {{overLimit}} over the limit.", {
3883
+ limit: 10,
3884
+ notFailed: plan.skippedNotFailed,
3885
+ overLimit: plan.skippedOverLimit
3886
+ }));
3887
+ clearSelection();
3888
+ refetch();
3889
+ };
3890
+ const handleConfirmedStop = async () => {
3891
+ const pending = confirmStop;
3892
+ setConfirmStop(null);
3893
+ if (!pending) return;
3894
+ if (pending.kind === "row") {
3895
+ await handleControl("cancel", pending.run);
3896
+ refetch();
3897
+ } else await handleBulkAction("cancel");
3898
+ };
3899
+ const reportBulkDelete = (outcome) => {
3900
+ if (outcome.deleted === 0 && outcome.error) {
3901
+ toast.error(tr("fluidgrids.executions.executionsList.bulkDeleteFailed", "Could not delete the selected runs"), { description: outcome.error });
3902
+ return;
3903
+ }
3904
+ const skipped = outcome.skippedInFlight > 0 ? tr("fluidgrids.executions.executionsList.bulkDeleteSkippedInFlight", "{{count}} still pending, running or waiting were left in place. Cancel them first to delete them.", { count: outcome.skippedInFlight }) : void 0;
3905
+ toast.success(outcome.deleted === 1 ? tr("fluidgrids.executions.executionsList.bulkDeleteDoneOne", "1 run deleted") : tr("fluidgrids.executions.executionsList.bulkDeleteDone", "{{count}} runs deleted", { count: outcome.deleted }), { description: skipped });
3906
+ if (!outcome.complete) toast.error(tr("fluidgrids.executions.executionsList.bulkDeleteStopped", "Deleting stopped before every selected run was deleted. Try again to delete the rest."), outcome.error ? { description: outcome.error } : void 0);
3907
+ };
3908
+ const handleConfirmedDelete = async () => {
3909
+ setConfirmDelete(false);
3910
+ const chosen = runDeleteSelection(input, {
3911
+ runIds: selection.runIds,
3912
+ allMatching: matchingSelected
3913
+ });
3914
+ if ("ids" in chosen && chosen.ids.length === 0) return;
3915
+ const outcome = await deleteRuns(chosen);
3916
+ reportBulkDelete(outcome);
3917
+ setAllMatching(false);
3918
+ clearSelection();
3919
+ refetch();
3920
+ };
3921
+ const handleBulkAction = async (action) => {
3922
+ if (selection.runIds.length === 0) return;
3923
+ const results = await Promise.all(selection.runIds.map((id) => controlExecution(action, id)));
3924
+ const failed = results.filter((result) => !result.ok);
3925
+ if (failed.length > 0) toast.error(tr("fluidgrids.executions.executionsList.bulkActionFailed", "{{failed}} of {{total}} runs could not be changed", {
3926
+ failed: failed.length,
3927
+ total: results.length
3928
+ }));
3929
+ clearSelection();
3930
+ refetch();
3931
+ };
3932
+ const viewLabel = (mode) => mode === "table" ? tr("fluidgrids.executions.executionsList.tableViewTooltip", "Table View") : mode === "cards" ? tr("fluidgrids.executions.executionsList.cardViewTooltip", "Card View") : tr("fluidgrids.executions.executionsList.timelineViewTooltip", "Timeline View");
3933
+ const viewMenuItems = [
3934
+ "table",
3935
+ "cards",
3936
+ "timeline"
3937
+ ].map((mode) => ({
3938
+ id: `view-${mode}`,
3939
+ icon: viewMode === mode ? "mdi:check" : void 0,
3940
+ label: viewLabel(mode),
3941
+ onSelect: () => setViewMode(mode)
3942
+ }));
3943
+ const showBatchJobs = phaseC.runControl && selection.runIds.length === 0;
3944
+ const batchJobsLabel = tr("fluidgrids.runControl.batch.jobs", "Batch jobs");
3945
+ const openBatchJobs = () => setBatchDrawer({ job: null });
3946
+ const headerMenuItems = showBatchJobs ? [...viewMenuItems, {
3947
+ id: "batch-jobs",
3948
+ icon: "mdi:layers-triple-outline",
3949
+ label: batchJobsLabel,
3950
+ onSelect: openBatchJobs,
3951
+ separatorBefore: true,
3952
+ testId: "batch-jobs-button"
3953
+ }] : viewMenuItems;
3954
+ const viewMenuToggles = [{
3955
+ id: "details",
3956
+ label: tr("fluidgrids.executions.executionsList.showRunDetails", "Show run details and bulk actions"),
3957
+ checked: showDetails,
3958
+ onCheckedChange: setShowDetails
3959
+ }];
3960
+ const filtersActive = countActiveFilters(filter, parityEnabled) > 0 || searchFilter !== null;
3961
+ const parityBar = parityEnabled ? /* @__PURE__ */ jsx(RunsParityBar, {
3962
+ workflowId: filter.workflowId,
3963
+ onWorkflowIdChange: setWorkflowIdFilter,
3964
+ total: statusCounts.total,
3965
+ counts: statusCounts.counts,
3966
+ countsError: statusCounts.error,
3967
+ selectedStatus: filter.status,
3968
+ onSelectStatus: handleFilterByStatus,
3969
+ className: v2 ? "mb-0" : void 0
3970
+ }) : null;
3971
+ const searchAttributeBar = phaseC.searchAttributes ? /* @__PURE__ */ jsx(SearchAttributeFilterBar, {
3972
+ applied: searchFilter,
3973
+ onApply: setSearchFilter,
3974
+ conflicts: searchFilter ? searchFilterConflicts(input) : [],
3975
+ pageAttributes: runsPage.searchAttributes,
3976
+ className: v2 ? "mb-0" : void 0
3977
+ }, searchFilterBuilderKey) : null;
3978
+ const moreFilterRows = v2 && (parityBar || searchAttributeBar) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [parityBar, searchAttributeBar] }) : void 0;
3979
+ const showEmptyState = v2 && !loading && !error && executions.length === 0;
3980
+ const pagination = /* @__PURE__ */ jsx(Pagination, {
3981
+ totalItems: total,
3982
+ totalCapped,
3983
+ showPageSize: !v2 || showDetails
3984
+ });
3985
+ const pagerWithRows = loadingSystem && !showEmptyState && viewMode === "table" && v2 && !showDetails;
3986
+ const scopedWorkflowName = workflowKeyParam ? workflowNames[workflowKeyParam] ?? workflowKeyParam : null;
3987
+ const showAllWorkflows = () => {
3988
+ setWorkflowFilter("");
3989
+ setSearchParams((params) => {
3990
+ const next = new URLSearchParams(params);
3991
+ next.delete("workflowKey");
3992
+ return next;
3993
+ }, { replace: true });
3994
+ };
3995
+ return /* @__PURE__ */ jsxs("div", {
3996
+ className: "p-4 sm:p-6 bg-surface-canvas min-h-screen",
3997
+ "data-live-updates": liveStatus,
3998
+ children: [
3999
+ /* @__PURE__ */ jsx(PageIntro, {
4000
+ "data-tour": "fluidgrids-runs-header",
4001
+ title: tr("fluidgrids.executions.executionsList.title", "Executions"),
4002
+ subtitle: tr("fluidgrids.executions.executionsList.subtitle", "Monitor and manage your workflow runs"),
4003
+ docsLink: /* @__PURE__ */ jsx(FluidGridsDocsLink, {
4004
+ topic: "runs",
4005
+ className: "mt-1"
4006
+ }),
4007
+ actions: /* @__PURE__ */ jsxs("div", {
4008
+ className: "flex flex-wrap items-center gap-3",
4009
+ children: [v2 ? /* @__PURE__ */ jsx(RunActionsMenu, {
4010
+ items: headerMenuItems,
4011
+ toggles: viewMenuToggles,
4012
+ label: tr("fluidgrids.executions.executionsList.moreOptions", "More options"),
4013
+ "data-testid": "runs-view-menu"
4014
+ }) : /* @__PURE__ */ jsxs("div", {
4015
+ className: "flex items-center bg-surface rounded-lg border border-border-default p-1",
4016
+ children: [
4017
+ /* @__PURE__ */ jsx("button", {
4018
+ onClick: () => setViewMode("table"),
4019
+ "aria-pressed": viewMode === "table",
4020
+ "aria-label": tr("fluidgrids.executions.executionsList.tableViewTooltip", "Table View"),
4021
+ className: `p-2 rounded ${viewMode === "table" ? "bg-surface-sunken text-text-primary" : "text-text-secondary hover:text-text-primary"}`,
4022
+ title: tr("fluidgrids.executions.executionsList.tableViewTooltip", "Table View"),
4023
+ children: /* @__PURE__ */ jsx(Icon, {
4024
+ icon: "mdi:table",
4025
+ width: 18
4026
+ })
4027
+ }),
4028
+ /* @__PURE__ */ jsx("button", {
4029
+ onClick: () => setViewMode("cards"),
4030
+ "aria-pressed": viewMode === "cards",
4031
+ "aria-label": tr("fluidgrids.executions.executionsList.cardViewTooltip", "Card View"),
4032
+ className: `p-2 rounded ${viewMode === "cards" ? "bg-surface-sunken text-text-primary" : "text-text-secondary hover:text-text-primary"}`,
4033
+ title: tr("fluidgrids.executions.executionsList.cardViewTooltip", "Card View"),
4034
+ children: /* @__PURE__ */ jsx(Icon, {
4035
+ icon: "mdi:view-grid",
4036
+ width: 18
4037
+ })
4038
+ }),
4039
+ /* @__PURE__ */ jsx("button", {
4040
+ onClick: () => setViewMode("timeline"),
4041
+ "aria-pressed": viewMode === "timeline",
4042
+ "aria-label": tr("fluidgrids.executions.executionsList.timelineViewTooltip", "Timeline View"),
4043
+ className: `p-2 rounded ${viewMode === "timeline" ? "bg-surface-sunken text-text-primary" : "text-text-secondary hover:text-text-primary"}`,
4044
+ title: tr("fluidgrids.executions.executionsList.timelineViewTooltip", "Timeline View"),
4045
+ children: /* @__PURE__ */ jsx(Icon, {
4046
+ icon: "mdi:timeline",
4047
+ width: 18
4048
+ })
4049
+ })
4050
+ ]
4051
+ }), /* @__PURE__ */ jsxs(Button$1, {
4052
+ variant: "outline",
4053
+ onClick: () => navigate("../list"),
4054
+ children: [/* @__PURE__ */ jsx(Icon, {
4055
+ icon: "mdi:arrow-left",
4056
+ className: "mr-2",
4057
+ width: 16
4058
+ }), tr("fluidgrids.executions.executionsList.backToWorkflows", "Back to Workflows")]
4059
+ })]
4060
+ })
4061
+ }),
4062
+ v2 && scopedWorkflowName && /* @__PURE__ */ jsxs("p", {
4063
+ className: "mb-3 text-sm text-text-secondary",
4064
+ "data-testid": "runs-of-workflow",
4065
+ children: [
4066
+ tr("fluidgrids.executions.executionsList.runsOfWorkflow", "Runs of {{workflow}}", { workflow: scopedWorkflowName }),
4067
+ " · ",
4068
+ /* @__PURE__ */ jsx("button", {
4069
+ type: "button",
4070
+ onClick: showAllWorkflows,
4071
+ className: "text-text-link hover:text-text-linkHover hover:underline",
4072
+ children: tr("fluidgrids.executions.executionsList.showAll", "Show all")
4073
+ })
4074
+ ]
4075
+ }),
4076
+ /* @__PURE__ */ jsx("div", {
4077
+ className: "mb-6",
4078
+ "data-tour": "fluidgrids-runs-stats",
4079
+ children: !statsLoading && executionStats === null ? /* @__PURE__ */ jsx(ExecutionStatsUnavailable, {}) : /* @__PURE__ */ jsx(ExecutionStats, {
4080
+ stats: executionStats,
4081
+ loading: v2 ? statsLoading && !executionStats : statsLoading,
4082
+ scoped: statsScoped,
4083
+ onFilterByStatus: handleFilterByStatus
4084
+ })
4085
+ }),
4086
+ /* @__PURE__ */ jsx("div", {
4087
+ className: "mb-6",
4088
+ "data-tour": "fluidgrids-runs-filters",
4089
+ children: /* @__PURE__ */ jsx(ExecutionFilters, {
4090
+ workflows: workflowOptions,
4091
+ onRefresh: refetch,
4092
+ moreFilters: moreFilterRows,
4093
+ moreFiltersActive: phaseC.searchAttributes && searchFilter !== null ? 1 : 0,
4094
+ onClearMoreFilters: clearSearchFilter
4095
+ })
4096
+ }),
4097
+ !v2 && parityBar,
4098
+ !v2 && searchAttributeBar,
4099
+ !v2 && showBatchJobs && /* @__PURE__ */ jsx("div", {
4100
+ className: "mb-4 flex justify-end",
4101
+ children: /* @__PURE__ */ jsxs(Button$1, {
4102
+ variant: "ghost",
4103
+ size: "sm",
4104
+ onClick: openBatchJobs,
4105
+ "data-testid": "batch-jobs-button",
4106
+ children: [/* @__PURE__ */ jsx(Icon, {
4107
+ icon: "mdi:layers-triple-outline",
4108
+ className: "mr-1",
4109
+ width: 14
4110
+ }), batchJobsLabel]
4111
+ })
4112
+ }),
4113
+ selection.runIds.length > 0 && (!v2 || canExecuteRuns || canDeleteRuns) && /* @__PURE__ */ jsxs("div", {
4114
+ className: "mb-4 p-3 bg-action-primary-bg/10 rounded-lg flex flex-wrap items-center gap-3",
4115
+ children: [
4116
+ /* @__PURE__ */ jsxs("span", {
4117
+ className: "text-sm text-text-primary",
4118
+ children: [
4119
+ selection.runIds.length,
4120
+ " ",
4121
+ selection.runIds.length > 1 ? tr("fluidgrids.executions.executionsList.selectionCountPlural", "executions selected") : tr("fluidgrids.executions.executionsList.selectionCountSingular", "execution selected")
4122
+ ]
4123
+ }),
4124
+ /* @__PURE__ */ jsxs("div", {
4125
+ className: "flex flex-wrap gap-2",
4126
+ children: [(!v2 || canExecuteRuns) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4127
+ /* @__PURE__ */ jsxs(Button$1, {
4128
+ "data-agent": "confirm",
4129
+ variant: "outline",
4130
+ size: "sm",
4131
+ onClick: () => void handleBulkRetry(),
4132
+ children: [/* @__PURE__ */ jsx(Icon, {
4133
+ icon: "mdi:refresh",
4134
+ className: "mr-1",
4135
+ width: 14
4136
+ }), tr("fluidgrids.executions.executionsList.bulkRetryButton", "Retry selected")]
4137
+ }),
4138
+ /* @__PURE__ */ jsxs(Button$1, {
4139
+ "data-agent": "confirm",
4140
+ variant: "outline",
4141
+ size: "sm",
4142
+ onClick: () => v2 ? setConfirmStop({ kind: "bulk" }) : handleBulkAction("cancel"),
4143
+ children: [/* @__PURE__ */ jsx(Icon, {
4144
+ icon: "mdi:stop",
4145
+ className: "mr-1",
4146
+ width: 14
4147
+ }), tr("fluidgrids.executions.executionsList.bulkCancelButton", "Cancel")]
4148
+ }),
4149
+ /* @__PURE__ */ jsxs(Button$1, {
4150
+ "data-agent": "confirm",
4151
+ variant: "outline",
4152
+ size: "sm",
4153
+ onClick: () => handleBulkAction("pause"),
4154
+ children: [/* @__PURE__ */ jsx(Icon, {
4155
+ icon: "mdi:pause",
4156
+ className: "mr-1",
4157
+ width: 14
4158
+ }), tr("fluidgrids.executions.executionsList.bulkPauseButton", "Pause")]
4159
+ }),
4160
+ /* @__PURE__ */ jsxs(Button$1, {
4161
+ "data-agent": "confirm",
4162
+ variant: "outline",
4163
+ size: "sm",
4164
+ onClick: () => handleBulkAction("resume"),
4165
+ children: [/* @__PURE__ */ jsx(Icon, {
4166
+ icon: "mdi:play",
4167
+ className: "mr-1",
4168
+ width: 14
4169
+ }), tr("fluidgrids.executions.executionsList.bulkResumeButton", "Resume")]
4170
+ })
4171
+ ] }), canDeleteRuns && /* @__PURE__ */ jsxs(Button$1, {
4172
+ "data-agent": "confirm",
4173
+ variant: "outline",
4174
+ size: "sm",
4175
+ disabled: deleting,
4176
+ onClick: () => setConfirmDelete(true),
4177
+ "data-testid": "runs-bulk-delete",
4178
+ children: [/* @__PURE__ */ jsx(Icon, {
4179
+ icon: "mdi:delete-outline",
4180
+ className: "mr-1",
4181
+ width: 14
4182
+ }), deleting ? tr("fluidgrids.executions.executionsList.bulkDeleting", "Deleting…") : tr("fluidgrids.executions.executionsList.bulkDeleteButton", "Delete")]
4183
+ })]
4184
+ }),
4185
+ (phaseC.runControl || canDeleteRuns) && selection.allSelected && total > selection.runIds.length && /* @__PURE__ */ jsx("button", {
4186
+ type: "button",
4187
+ onClick: () => setAllMatching(!matchingSelected),
4188
+ className: "text-sm text-action-primary-text hover:underline",
4189
+ "data-testid": "select-all-matching",
4190
+ "aria-pressed": matchingSelected,
4191
+ children: matchingSelected ? tr("fluidgrids.runControl.batch.allMatchingSelected", "All {{count}} matching runs are selected", { count: totalCapped ? `${total}+` : total }) : tr("fluidgrids.runControl.batch.selectAllMatching", "Select all {{count}} matching runs", { count: totalCapped ? `${total}+` : total })
4192
+ }),
4193
+ phaseC.runControl && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(BatchMenu, {
4194
+ allowed: batchOperations,
4195
+ onPick: setBatchType,
4196
+ onShowJobs: () => setBatchDrawer({ job: null })
4197
+ }) }),
4198
+ /* @__PURE__ */ jsx("button", {
4199
+ onClick: () => {
4200
+ setAllMatching(false);
4201
+ clearSelection();
4202
+ },
4203
+ className: "ml-auto text-sm text-text-secondary hover:text-text-primary",
4204
+ children: tr("fluidgrids.executions.executionsList.clearSelection", "Clear selection")
4205
+ })
4206
+ ]
4207
+ }),
4208
+ error && /* @__PURE__ */ jsx(RunsLoadFailure, {
4209
+ error,
4210
+ onRetry: refetch
4211
+ }),
4212
+ showEmptyState && /* @__PURE__ */ jsx(RunsEmptyState, {
4213
+ filtered: filtersActive,
4214
+ onClearFilters: () => {
4215
+ clearSearchFilter();
4216
+ resetFilters();
4217
+ },
4218
+ onOpenWorkflows: () => navigate("../list"),
4219
+ onBrowseTemplates: () => navigate("../templates")
4220
+ }),
4221
+ !showEmptyState && viewMode === "table" && v2 && !showDetails && /* @__PURE__ */ jsx(RunsPlainTable, {
4222
+ workflowNames,
4223
+ executions,
4224
+ loading,
4225
+ canExecute: canExecuteRuns,
4226
+ onRowClick: handleRowClick,
4227
+ onAction: handleAction,
4228
+ footer: pagerWithRows ? pagination : void 0
4229
+ }),
4230
+ !showEmptyState && viewMode === "table" && (!v2 || showDetails) && /* @__PURE__ */ jsx(ExecutionTable, {
4231
+ workflowNames,
4232
+ executions,
4233
+ loading,
4234
+ canExecute: !v2 || canExecuteRuns,
4235
+ filtered: filtersActive,
4236
+ onRowClick: handleRowClick,
4237
+ onAction: handleAction
4238
+ }),
4239
+ !showEmptyState && viewMode === "cards" && /* @__PURE__ */ jsx(ExecutionCards, {
4240
+ workflowNames,
4241
+ executions,
4242
+ loading,
4243
+ filtered: filtersActive,
4244
+ onCardClick: handleRowClick,
4245
+ onAction: handleAction
4246
+ }),
4247
+ !showEmptyState && viewMode === "timeline" && /* @__PURE__ */ jsx(ExecutionTimeline, {
4248
+ workflowNames,
4249
+ executions,
4250
+ loading,
4251
+ filtered: filtersActive,
4252
+ onItemClick: handleRowClick,
4253
+ onAction: handleAction
4254
+ }),
4255
+ pagerWithRows ? null : pagination,
4256
+ v2 && /* @__PURE__ */ jsx(ConfirmStopRunDialog, {
4257
+ open: confirmStop !== null,
4258
+ workflowName: confirmStop?.kind === "row" ? confirmStop.run.workflow?.name || workflowNames[confirmStop.run.workflowKey] || confirmStop.run.workflowKey : null,
4259
+ count: selection.runIds.length,
4260
+ onConfirm: () => void handleConfirmedStop(),
4261
+ onOpenChange: (open) => {
4262
+ if (!open) setConfirmStop(null);
4263
+ }
4264
+ }),
4265
+ /* @__PURE__ */ jsx(ConfirmDeleteRunsDialog, {
4266
+ open: confirmDelete,
4267
+ count: matchingSelected ? total : selection.runIds.length,
4268
+ allMatching: matchingSelected,
4269
+ countCapped: matchingSelected && totalCapped,
4270
+ busy: deleting,
4271
+ onConfirm: () => void handleConfirmedDelete(),
4272
+ onOpenChange: setConfirmDelete
4273
+ }),
4274
+ batchType && /* @__PURE__ */ jsx(BatchOperationDialog, {
4275
+ type: batchType,
4276
+ input,
4277
+ selection: {
4278
+ runIds: selection.runIds,
4279
+ allMatching: matchingSelected
4280
+ },
4281
+ workflowKey: batchWorkflowKey(input, {
4282
+ runIds: selection.runIds,
4283
+ allMatching: matchingSelected
4284
+ }, executions),
4285
+ onClose: () => setBatchType(null),
4286
+ onStarted: (job) => {
4287
+ setBatchType(null);
4288
+ setAllMatching(false);
4289
+ clearSelection();
4290
+ setBatchDrawer({ job });
4291
+ }
4292
+ }),
4293
+ batchDrawer && /* @__PURE__ */ jsx(BatchProgressDrawer, {
4294
+ job: batchDrawer.job,
4295
+ open: true,
4296
+ onOpenChange: (open) => {
4297
+ if (open) return;
4298
+ setBatchDrawer(null);
4299
+ refetch();
4300
+ },
4301
+ canCancel: canExecuteRuns
4302
+ })
4303
+ ]
4304
+ });
4305
+ }
4306
+
4307
+ export { DeleteWorkflowRunsDocument as i, ExecutionsListPage_exports as n, WorkflowBatchOperationUpdatedDocument as r, ExecutionsListPage as t };