@antelopejs/dms-automation 0.0.1

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 (305) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +95 -0
  3. package/dist/cluster/bus.d.ts +17 -0
  4. package/dist/cluster/bus.js +82 -0
  5. package/dist/cluster/bus.js.map +1 -0
  6. package/dist/cluster/instance.d.ts +1 -0
  7. package/dist/cluster/instance.js +6 -0
  8. package/dist/cluster/instance.js.map +1 -0
  9. package/dist/cluster/leader.d.ts +7 -0
  10. package/dist/cluster/leader.js +123 -0
  11. package/dist/cluster/leader.js.map +1 -0
  12. package/dist/cluster/mode.d.ts +3 -0
  13. package/dist/cluster/mode.js +25 -0
  14. package/dist/cluster/mode.js.map +1 -0
  15. package/dist/data/procedures-table.d.ts +66 -0
  16. package/dist/data/procedures-table.js +271 -0
  17. package/dist/data/procedures-table.js.map +1 -0
  18. package/dist/data/runs-table.d.ts +23 -0
  19. package/dist/data/runs-table.js +125 -0
  20. package/dist/data/runs-table.js.map +1 -0
  21. package/dist/db/index.d.ts +7 -0
  22. package/dist/db/index.js +24 -0
  23. package/dist/db/index.js.map +1 -0
  24. package/dist/db/models/automation_template.model.d.ts +58 -0
  25. package/dist/db/models/automation_template.model.js +134 -0
  26. package/dist/db/models/automation_template.model.js.map +1 -0
  27. package/dist/db/models/index.d.ts +3 -0
  28. package/dist/db/models/index.js +20 -0
  29. package/dist/db/models/index.js.map +1 -0
  30. package/dist/db/models/procedure.model.d.ts +25 -0
  31. package/dist/db/models/procedure.model.js +28 -0
  32. package/dist/db/models/procedure.model.js.map +1 -0
  33. package/dist/db/models/procedure_run.model.d.ts +34 -0
  34. package/dist/db/models/procedure_run.model.js +39 -0
  35. package/dist/db/models/procedure_run.model.js.map +1 -0
  36. package/dist/db/models/stats.model.d.ts +73 -0
  37. package/dist/db/models/stats.model.js +267 -0
  38. package/dist/db/models/stats.model.js.map +1 -0
  39. package/dist/db/models/type_config.model.d.ts +47 -0
  40. package/dist/db/models/type_config.model.js +51 -0
  41. package/dist/db/models/type_config.model.js.map +1 -0
  42. package/dist/db/tables/action_type_config.table.d.ts +7 -0
  43. package/dist/db/tables/action_type_config.table.js +35 -0
  44. package/dist/db/tables/action_type_config.table.js.map +1 -0
  45. package/dist/db/tables/automation_template.table.d.ts +11 -0
  46. package/dist/db/tables/automation_template.table.js +52 -0
  47. package/dist/db/tables/automation_template.table.js.map +1 -0
  48. package/dist/db/tables/index.d.ts +5 -0
  49. package/dist/db/tables/index.js +22 -0
  50. package/dist/db/tables/index.js.map +1 -0
  51. package/dist/db/tables/procedure.table.d.ts +10 -0
  52. package/dist/db/tables/procedure.table.js +48 -0
  53. package/dist/db/tables/procedure.table.js.map +1 -0
  54. package/dist/db/tables/procedure_run.table.d.ts +13 -0
  55. package/dist/db/tables/procedure_run.table.js +57 -0
  56. package/dist/db/tables/procedure_run.table.js.map +1 -0
  57. package/dist/db/tables/trigger_type_config.table.d.ts +7 -0
  58. package/dist/db/tables/trigger_type_config.table.js +35 -0
  59. package/dist/db/tables/trigger_type_config.table.js.map +1 -0
  60. package/dist/implementations/dms-automation/index.d.ts +19 -0
  61. package/dist/implementations/dms-automation/index.js +50 -0
  62. package/dist/implementations/dms-automation/index.js.map +1 -0
  63. package/dist/index.d.ts +14 -0
  64. package/dist/index.js +121 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/pages/builder.d.ts +10 -0
  67. package/dist/pages/builder.js +28 -0
  68. package/dist/pages/builder.js.map +1 -0
  69. package/dist/pages/category.d.ts +1 -0
  70. package/dist/pages/category.js +10 -0
  71. package/dist/pages/category.js.map +1 -0
  72. package/dist/pages/index.d.ts +6 -0
  73. package/dist/pages/index.js +9 -0
  74. package/dist/pages/index.js.map +1 -0
  75. package/dist/pages/library.d.ts +10 -0
  76. package/dist/pages/library.js +28 -0
  77. package/dist/pages/library.js.map +1 -0
  78. package/dist/pages/overview.d.ts +10 -0
  79. package/dist/pages/overview.js +28 -0
  80. package/dist/pages/overview.js.map +1 -0
  81. package/dist/pages/procedures.d.ts +10 -0
  82. package/dist/pages/procedures.js +72 -0
  83. package/dist/pages/procedures.js.map +1 -0
  84. package/dist/pages/runs.d.ts +11 -0
  85. package/dist/pages/runs.js +61 -0
  86. package/dist/pages/runs.js.map +1 -0
  87. package/dist/routes/action-types.d.ts +23 -0
  88. package/dist/routes/action-types.js +80 -0
  89. package/dist/routes/action-types.js.map +1 -0
  90. package/dist/routes/data-node-types.d.ts +6 -0
  91. package/dist/routes/data-node-types.js +36 -0
  92. package/dist/routes/data-node-types.js.map +1 -0
  93. package/dist/routes/graphSchema.d.ts +92 -0
  94. package/dist/routes/graphSchema.js +60 -0
  95. package/dist/routes/graphSchema.js.map +1 -0
  96. package/dist/routes/index.d.ts +8 -0
  97. package/dist/routes/index.js +11 -0
  98. package/dist/routes/index.js.map +1 -0
  99. package/dist/routes/node-kinds.d.ts +9 -0
  100. package/dist/routes/node-kinds.js +35 -0
  101. package/dist/routes/node-kinds.js.map +1 -0
  102. package/dist/routes/procedures.d.ts +23 -0
  103. package/dist/routes/procedures.js +181 -0
  104. package/dist/routes/procedures.js.map +1 -0
  105. package/dist/routes/runs.d.ts +7 -0
  106. package/dist/routes/runs.js +81 -0
  107. package/dist/routes/runs.js.map +1 -0
  108. package/dist/routes/stats.d.ts +6 -0
  109. package/dist/routes/stats.js +35 -0
  110. package/dist/routes/stats.js.map +1 -0
  111. package/dist/routes/templates.d.ts +20 -0
  112. package/dist/routes/templates.js +243 -0
  113. package/dist/routes/templates.js.map +1 -0
  114. package/dist/routes/trigger-types.d.ts +24 -0
  115. package/dist/routes/trigger-types.js +80 -0
  116. package/dist/routes/trigger-types.js.map +1 -0
  117. package/dist/routes/typeConfigShared.d.ts +22 -0
  118. package/dist/routes/typeConfigShared.js +37 -0
  119. package/dist/routes/typeConfigShared.js.map +1 -0
  120. package/dist/runtime/builtins/actions/http.d.ts +13 -0
  121. package/dist/runtime/builtins/actions/http.js +47 -0
  122. package/dist/runtime/builtins/actions/http.js.map +1 -0
  123. package/dist/runtime/builtins/actions/index.d.ts +2 -0
  124. package/dist/runtime/builtins/actions/index.js +7 -0
  125. package/dist/runtime/builtins/actions/index.js.map +1 -0
  126. package/dist/runtime/builtins/actions/log.d.ts +13 -0
  127. package/dist/runtime/builtins/actions/log.js +49 -0
  128. package/dist/runtime/builtins/actions/log.js.map +1 -0
  129. package/dist/runtime/builtins/data/boolean.d.ts +2 -0
  130. package/dist/runtime/builtins/data/boolean.js +39 -0
  131. package/dist/runtime/builtins/data/boolean.js.map +1 -0
  132. package/dist/runtime/builtins/data/compare.d.ts +2 -0
  133. package/dist/runtime/builtins/data/compare.js +29 -0
  134. package/dist/runtime/builtins/data/compare.js.map +1 -0
  135. package/dist/runtime/builtins/data/constant.d.ts +2 -0
  136. package/dist/runtime/builtins/data/constant.js +29 -0
  137. package/dist/runtime/builtins/data/constant.js.map +1 -0
  138. package/dist/runtime/builtins/data/index.d.ts +2 -0
  139. package/dist/runtime/builtins/data/index.js +20 -0
  140. package/dist/runtime/builtins/data/index.js.map +1 -0
  141. package/dist/runtime/builtins/data/json.d.ts +2 -0
  142. package/dist/runtime/builtins/data/json.js +46 -0
  143. package/dist/runtime/builtins/data/json.js.map +1 -0
  144. package/dist/runtime/builtins/data/math.d.ts +2 -0
  145. package/dist/runtime/builtins/data/math.js +53 -0
  146. package/dist/runtime/builtins/data/math.js.map +1 -0
  147. package/dist/runtime/builtins/data/object.d.ts +2 -0
  148. package/dist/runtime/builtins/data/object.js +121 -0
  149. package/dist/runtime/builtins/data/object.js.map +1 -0
  150. package/dist/runtime/builtins/data/string.d.ts +2 -0
  151. package/dist/runtime/builtins/data/string.js +143 -0
  152. package/dist/runtime/builtins/data/string.js.map +1 -0
  153. package/dist/runtime/builtins/index.d.ts +17 -0
  154. package/dist/runtime/builtins/index.js +24 -0
  155. package/dist/runtime/builtins/index.js.map +1 -0
  156. package/dist/runtime/builtins/nodes/action.d.ts +1 -0
  157. package/dist/runtime/builtins/nodes/action.js +36 -0
  158. package/dist/runtime/builtins/nodes/action.js.map +1 -0
  159. package/dist/runtime/builtins/nodes/data.d.ts +1 -0
  160. package/dist/runtime/builtins/nodes/data.js +28 -0
  161. package/dist/runtime/builtins/nodes/data.js.map +1 -0
  162. package/dist/runtime/builtins/nodes/delay.d.ts +1 -0
  163. package/dist/runtime/builtins/nodes/delay.js +41 -0
  164. package/dist/runtime/builtins/nodes/delay.js.map +1 -0
  165. package/dist/runtime/builtins/nodes/forRange.d.ts +1 -0
  166. package/dist/runtime/builtins/nodes/forRange.js +52 -0
  167. package/dist/runtime/builtins/nodes/forRange.js.map +1 -0
  168. package/dist/runtime/builtins/nodes/foreach.d.ts +1 -0
  169. package/dist/runtime/builtins/nodes/foreach.js +31 -0
  170. package/dist/runtime/builtins/nodes/foreach.js.map +1 -0
  171. package/dist/runtime/builtins/nodes/groupInput.d.ts +1 -0
  172. package/dist/runtime/builtins/nodes/groupInput.js +11 -0
  173. package/dist/runtime/builtins/nodes/groupInput.js.map +1 -0
  174. package/dist/runtime/builtins/nodes/groupOutput.d.ts +1 -0
  175. package/dist/runtime/builtins/nodes/groupOutput.js +11 -0
  176. package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -0
  177. package/dist/runtime/builtins/nodes/if.d.ts +1 -0
  178. package/dist/runtime/builtins/nodes/if.js +23 -0
  179. package/dist/runtime/builtins/nodes/if.js.map +1 -0
  180. package/dist/runtime/builtins/nodes/parallel.d.ts +1 -0
  181. package/dist/runtime/builtins/nodes/parallel.js +34 -0
  182. package/dist/runtime/builtins/nodes/parallel.js.map +1 -0
  183. package/dist/runtime/builtins/nodes/retry.d.ts +1 -0
  184. package/dist/runtime/builtins/nodes/retry.js +46 -0
  185. package/dist/runtime/builtins/nodes/retry.js.map +1 -0
  186. package/dist/runtime/builtins/nodes/setVariable.d.ts +1 -0
  187. package/dist/runtime/builtins/nodes/setVariable.js +31 -0
  188. package/dist/runtime/builtins/nodes/setVariable.js.map +1 -0
  189. package/dist/runtime/builtins/nodes/switch.d.ts +1 -0
  190. package/dist/runtime/builtins/nodes/switch.js +33 -0
  191. package/dist/runtime/builtins/nodes/switch.js.map +1 -0
  192. package/dist/runtime/builtins/nodes/trigger.d.ts +1 -0
  193. package/dist/runtime/builtins/nodes/trigger.js +25 -0
  194. package/dist/runtime/builtins/nodes/trigger.js.map +1 -0
  195. package/dist/runtime/builtins/nodes/tryCatch.d.ts +1 -0
  196. package/dist/runtime/builtins/nodes/tryCatch.js +35 -0
  197. package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -0
  198. package/dist/runtime/builtins/triggers/cron.d.ts +9 -0
  199. package/dist/runtime/builtins/triggers/cron.js +52 -0
  200. package/dist/runtime/builtins/triggers/cron.js.map +1 -0
  201. package/dist/runtime/builtins/triggers/index.d.ts +2 -0
  202. package/dist/runtime/builtins/triggers/index.js +12 -0
  203. package/dist/runtime/builtins/triggers/index.js.map +1 -0
  204. package/dist/runtime/builtins/triggers/manual.d.ts +3 -0
  205. package/dist/runtime/builtins/triggers/manual.js +20 -0
  206. package/dist/runtime/builtins/triggers/manual.js.map +1 -0
  207. package/dist/runtime/builtins/triggers/webhook.d.ts +14 -0
  208. package/dist/runtime/builtins/triggers/webhook.js +90 -0
  209. package/dist/runtime/builtins/triggers/webhook.js.map +1 -0
  210. package/dist/runtime/executionResult.d.ts +6 -0
  211. package/dist/runtime/executionResult.js +3 -0
  212. package/dist/runtime/executionResult.js.map +1 -0
  213. package/dist/runtime/executor.d.ts +9 -0
  214. package/dist/runtime/executor.js +300 -0
  215. package/dist/runtime/executor.js.map +1 -0
  216. package/dist/runtime/flatten.d.ts +3 -0
  217. package/dist/runtime/flatten.js +188 -0
  218. package/dist/runtime/flatten.js.map +1 -0
  219. package/dist/runtime/nodeKinds.d.ts +64 -0
  220. package/dist/runtime/nodeKinds.js +43 -0
  221. package/dist/runtime/nodeKinds.js.map +1 -0
  222. package/dist/runtime/reconcileDiff.d.ts +9 -0
  223. package/dist/runtime/reconcileDiff.js +26 -0
  224. package/dist/runtime/reconcileDiff.js.map +1 -0
  225. package/dist/runtime/registry.d.ts +19 -0
  226. package/dist/runtime/registry.js +47 -0
  227. package/dist/runtime/registry.js.map +1 -0
  228. package/dist/runtime/resolveInputs.d.ts +14 -0
  229. package/dist/runtime/resolveInputs.js +64 -0
  230. package/dist/runtime/resolveInputs.js.map +1 -0
  231. package/dist/runtime/resolveSubgraph.d.ts +7 -0
  232. package/dist/runtime/resolveSubgraph.js +15 -0
  233. package/dist/runtime/resolveSubgraph.js.map +1 -0
  234. package/dist/runtime/subscriptions.d.ts +16 -0
  235. package/dist/runtime/subscriptions.js +419 -0
  236. package/dist/runtime/subscriptions.js.map +1 -0
  237. package/dist/runtime/subwalk.d.ts +17 -0
  238. package/dist/runtime/subwalk.js +74 -0
  239. package/dist/runtime/subwalk.js.map +1 -0
  240. package/dist/runtime/topo.d.ts +3 -0
  241. package/dist/runtime/topo.js +75 -0
  242. package/dist/runtime/topo.js.map +1 -0
  243. package/dist/runtime/typeOrigin.d.ts +7 -0
  244. package/dist/runtime/typeOrigin.js +24 -0
  245. package/dist/runtime/typeOrigin.js.map +1 -0
  246. package/dist/runtime/validate.d.ts +10 -0
  247. package/dist/runtime/validate.js +185 -0
  248. package/dist/runtime/validate.js.map +1 -0
  249. package/dist/runtime/validateTemplate.d.ts +3 -0
  250. package/dist/runtime/validateTemplate.js +54 -0
  251. package/dist/runtime/validateTemplate.js.map +1 -0
  252. package/dist/types/constants.d.ts +6 -0
  253. package/dist/types/constants.js +10 -0
  254. package/dist/types/constants.js.map +1 -0
  255. package/dist/types/graph.d.ts +51 -0
  256. package/dist/types/graph.js +23 -0
  257. package/dist/types/graph.js.map +1 -0
  258. package/dist/types/pagination.d.ts +8 -0
  259. package/dist/types/pagination.js +3 -0
  260. package/dist/types/pagination.js.map +1 -0
  261. package/dist/types/runLog.d.ts +26 -0
  262. package/dist/types/runLog.js +3 -0
  263. package/dist/types/runLog.js.map +1 -0
  264. package/frontend-vue/.prettierignore +4 -0
  265. package/frontend-vue/app/components/Actions.vue +141 -0
  266. package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +166 -0
  267. package/frontend-vue/app/components/Catalog/TypeList.vue +198 -0
  268. package/frontend-vue/app/components/DataNodes.vue +259 -0
  269. package/frontend-vue/app/components/Editor/BuilderPalette.vue +234 -0
  270. package/frontend-vue/app/components/Editor/GraphCanvas.vue +994 -0
  271. package/frontend-vue/app/components/Editor/GroupPortEditor.vue +289 -0
  272. package/frontend-vue/app/components/Editor/JsonField.vue +63 -0
  273. package/frontend-vue/app/components/Editor/NodeInspector.vue +356 -0
  274. package/frontend-vue/app/components/Editor/ProcedureList.vue +156 -0
  275. package/frontend-vue/app/components/Editor/RunsDrawer.vue +312 -0
  276. package/frontend-vue/app/components/Editor/WiredField.vue +42 -0
  277. package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +161 -0
  278. package/frontend-vue/app/components/Editor/nodes/GroupInputNode.vue +19 -0
  279. package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +200 -0
  280. package/frontend-vue/app/components/Editor/nodes/GroupOutputNode.vue +19 -0
  281. package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +161 -0
  282. package/frontend-vue/app/components/Editor/nodes/styles.ts +53 -0
  283. package/frontend-vue/app/components/Editor.vue +2504 -0
  284. package/frontend-vue/app/components/Library.vue +67 -0
  285. package/frontend-vue/app/components/Overview.vue +503 -0
  286. package/frontend-vue/app/components/RunDetailDrawer.vue +165 -0
  287. package/frontend-vue/app/components/RunFireTree.vue +170 -0
  288. package/frontend-vue/app/components/RunTraceDrawer.vue +59 -0
  289. package/frontend-vue/app/components/RunsStats.vue +126 -0
  290. package/frontend-vue/app/components/RunsTimelineDisplay.vue +287 -0
  291. package/frontend-vue/app/components/Templates.vue +663 -0
  292. package/frontend-vue/app/components/Triggers.vue +137 -0
  293. package/frontend-vue/app/composables/useAutomationNodeKinds.ts +48 -0
  294. package/frontend-vue/app/composables/useAutomationRuns.ts +75 -0
  295. package/frontend-vue/app/composables/useGraphConnect.ts +542 -0
  296. package/frontend-vue/app/plugins/runs-timeline-display.client.ts +16 -0
  297. package/frontend-vue/app/utils/automation.ts +51 -0
  298. package/frontend-vue/dms.frontend.ts +26 -0
  299. package/frontend-vue/eslint.config.mjs +24 -0
  300. package/frontend-vue/i18n/locales/dms-automation-en-GB.json +369 -0
  301. package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +369 -0
  302. package/frontend-vue/package.json +33 -0
  303. package/frontend-vue/pnpm-lock.yaml +6483 -0
  304. package/frontend-vue/pnpm-workspace.yaml +2 -0
  305. package/package.json +81 -0
@@ -0,0 +1,287 @@
1
+ <script setup lang="ts">
2
+ import { computed, onMounted, ref } from 'vue'
3
+ import type { ProcedureRef, RunSummary } from '../composables/useAutomationRuns'
4
+ import { formatDuration } from '../utils/automation'
5
+ import RunTraceDrawer from './RunTraceDrawer.vue'
6
+
7
+ // Custom TableView display (registered in plugins/runs-timeline-display.client.ts):
8
+ // renders the run history as a timeline instead of a grid. It is ONLY the list —
9
+ // status tabs, the (native RelationType filter-only) procedure filter, search,
10
+ // export and the KPI header are owned by the TableView chrome / the page-level
11
+ // RunsStats component. Everything shown here comes from the shared TableView state
12
+ // via `context` (already filtered/sorted); the only extra fetch is the
13
+ // procedure-name lookup for display (the filter-only relation keeps the raw
14
+ // procedureId on the row, so we resolve the name client-side).
15
+
16
+ // Minimal slice of the dms `TableViewDisplayContext` we consume.
17
+ interface DisplayPagination {
18
+ pageIndex: number
19
+ pageSize: number
20
+ total: number
21
+ setPage: (index: number) => void
22
+ }
23
+ interface DisplayContext {
24
+ items: RunSummary[]
25
+ loading: boolean
26
+ refresh: () => void | Promise<void>
27
+ pagination: DisplayPagination
28
+ }
29
+
30
+ const props = defineProps<{ context: DisplayContext }>()
31
+
32
+ const { listProcedures } = useAutomationRuns()
33
+ const { $authFetch } = useAuthFetch()
34
+ const { open: openRunDrawer } = useDrawer()
35
+ const { t } = useI18n()
36
+ const toast = useToast()
37
+
38
+ const rows = computed<RunSummary[]>(() => props.context.items ?? [])
39
+ const loading = computed(() => props.context.loading)
40
+ const pagination = computed(() => props.context.pagination)
41
+ const replayingId = ref<string | null>(null)
42
+
43
+ // Procedure-name lookup (the list rows only carry the raw procedureId).
44
+ const procedures = ref<ProcedureRef[]>([])
45
+ function procedureName(id: string): string {
46
+ return procedures.value.find((x) => x._id === id)?.name ?? id
47
+ }
48
+
49
+ onMounted(async () => {
50
+ await listProcedures()
51
+ .then((p) => {
52
+ procedures.value = p
53
+ })
54
+ .catch(() => {
55
+ /* name lookup is best-effort; falls back to procedureId */
56
+ })
57
+ })
58
+
59
+ // ---- Pagination ----
60
+ const pageNumber = computed(() => pagination.value.pageIndex + 1)
61
+ const hasPrev = computed(() => pagination.value.pageIndex > 0)
62
+ const hasNext = computed(
63
+ () =>
64
+ (pagination.value.pageIndex + 1) * pagination.value.pageSize <
65
+ pagination.value.total,
66
+ )
67
+
68
+ // ---- Formatting ----
69
+ function isFailed(status: string): boolean {
70
+ return status === 'failed'
71
+ }
72
+
73
+ function fmtClock(ts: string): string {
74
+ try {
75
+ return new Date(ts).toLocaleTimeString([], {
76
+ hour: '2-digit',
77
+ minute: '2-digit',
78
+ })
79
+ } catch {
80
+ return ts
81
+ }
82
+ }
83
+
84
+ function fmtDuration(
85
+ startedAt: string | Date | null | undefined,
86
+ endedAt: string | Date | null | undefined,
87
+ ): string {
88
+ if (!startedAt || !endedAt) return '—'
89
+ const s = new Date(startedAt).getTime()
90
+ const e = new Date(endedAt).getTime()
91
+ if (Number.isNaN(s) || Number.isNaN(e)) return '—'
92
+ return formatDuration(e - s)
93
+ }
94
+
95
+ function runSummaryLine(r: RunSummary): string {
96
+ if (isFailed(r.status)) {
97
+ return r.errorMessage || t('dms_automation.runs.timeline.failed')
98
+ }
99
+ return t('dms_automation.runs.timeline.completed')
100
+ }
101
+
102
+ // ---- Actions ----
103
+ // Track open trace drawers by container id so a rapid double-click doesn't stack
104
+ // two identical drawers sharing one container.
105
+ const openTraceIds = new Set<string>()
106
+ function openTrace(r: RunSummary) {
107
+ const containerId = `dms-automation-run-${r._id}`
108
+ if (openTraceIds.has(containerId)) return
109
+ openTraceIds.add(containerId)
110
+ const drawer = openRunDrawer({
111
+ containerId,
112
+ title: `${r.status.toUpperCase()} · ${procedureName(r.procedureId)}`,
113
+ description: new Date(r.startedAt).toLocaleString(),
114
+ direction: 'right',
115
+ component: RunTraceDrawer,
116
+ componentOptions: {
117
+ rowData: r,
118
+ procedureName: procedureName(r.procedureId),
119
+ },
120
+ })
121
+ void drawer.result.finally(() => openTraceIds.delete(containerId))
122
+ }
123
+
124
+ async function replay(r: RunSummary) {
125
+ if (replayingId.value) return
126
+ replayingId.value = r._id
127
+ try {
128
+ await $authFetch(`/api/automation/procedures/${r.procedureId}/run`, {
129
+ method: 'POST',
130
+ body: {},
131
+ })
132
+ toast.add({
133
+ title: t('dms_automation.runs.timeline.replayQueued'),
134
+ color: 'success',
135
+ icon: 'i-ph-check-circle',
136
+ })
137
+ await props.context.refresh()
138
+ } catch (e) {
139
+ toast.add({
140
+ title: t('dms_automation.runs.timeline.replayFailed'),
141
+ description: (e as Error).message,
142
+ color: 'error',
143
+ icon: 'i-ph-warning',
144
+ })
145
+ } finally {
146
+ replayingId.value = null
147
+ }
148
+ }
149
+ </script>
150
+
151
+ <template>
152
+ <div class="flex flex-col pt-4">
153
+ <div v-if="loading && rows.length === 0" class="flex flex-col gap-3">
154
+ <USkeleton v-for="i in 6" :key="i" class="h-16 w-full" />
155
+ </div>
156
+
157
+ <div
158
+ v-else-if="rows.length === 0"
159
+ class="flex flex-col items-center gap-2 py-12 text-center"
160
+ >
161
+ <UIcon name="i-ph-list-bullets" class="size-7 text-dimmed" />
162
+ <p class="text-sm font-medium text-muted">{{ $t('dms_automation.runs.empty') }}</p>
163
+ <p class="text-xs text-dimmed">{{ $t('dms_automation.runs.emptyHint') }}</p>
164
+ </div>
165
+
166
+ <ol v-else class="flex flex-col">
167
+ <li v-for="(r, idx) in rows" :key="r._id" class="flex gap-3">
168
+ <!-- rail -->
169
+ <div class="flex flex-col items-center">
170
+ <span
171
+ class="grid size-7 shrink-0 place-items-center rounded-full ring-4 ring-default/40"
172
+ :class="
173
+ isFailed(r.status)
174
+ ? 'bg-error/15 text-error'
175
+ : 'bg-success/15 text-success'
176
+ "
177
+ >
178
+ <UIcon
179
+ :name="isFailed(r.status) ? 'i-ph-x' : 'i-ph-check'"
180
+ class="size-3.5"
181
+ />
182
+ </span>
183
+ <span v-if="idx < rows.length - 1" class="w-px flex-1 bg-default" />
184
+ </div>
185
+
186
+ <!-- card -->
187
+ <div
188
+ class="mb-3 min-w-0 flex-1 rounded-xl border border-default bg-elevated/40 p-3.5"
189
+ >
190
+ <div class="flex flex-wrap items-center gap-2">
191
+ <span class="truncate text-sm font-semibold text-highlighted">
192
+ {{ procedureName(r.procedureId) }}
193
+ </span>
194
+ <UBadge
195
+ v-if="r.triggerNodeId"
196
+ color="neutral"
197
+ variant="subtle"
198
+ size="xs"
199
+ class="gap-1"
200
+ >
201
+ <UIcon name="i-ph-lightning" class="size-3" />
202
+ {{ r.triggerNodeId }}
203
+ </UBadge>
204
+ <UBadge
205
+ :color="isFailed(r.status) ? 'error' : 'success'"
206
+ variant="subtle"
207
+ size="xs"
208
+ >
209
+ {{
210
+ isFailed(r.status)
211
+ ? $t('dms_automation.runs.badge.failed')
212
+ : $t('dms_automation.runs.badge.success')
213
+ }}
214
+ </UBadge>
215
+ <time class="ml-auto text-xs tabular-nums text-dimmed">
216
+ {{ fmtClock(r.startedAt) }}
217
+ </time>
218
+ </div>
219
+
220
+ <p
221
+ class="mt-1.5 line-clamp-2 text-xs"
222
+ :class="isFailed(r.status) ? 'text-error' : 'text-muted'"
223
+ >
224
+ {{ runSummaryLine(r) }}
225
+ </p>
226
+
227
+ <div class="mt-2.5 flex flex-wrap items-center gap-3">
228
+ <span
229
+ class="inline-flex items-center gap-1 rounded-md bg-default/60 px-1.5 py-0.5 text-[11px] tabular-nums text-muted"
230
+ >
231
+ <UIcon name="i-ph-clock" class="size-3" />
232
+ {{ fmtDuration(r.startedAt, r.endedAt) }}
233
+ </span>
234
+ <button
235
+ type="button"
236
+ class="inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline"
237
+ @click="openTrace(r)"
238
+ >
239
+ <UIcon name="i-ph-eye" class="size-3.5" />
240
+ {{ $t('dms_automation.runs.timeline.trace') }}
241
+ </button>
242
+ <button
243
+ type="button"
244
+ class="inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline disabled:opacity-50"
245
+ :disabled="!!replayingId"
246
+ @click="replay(r)"
247
+ >
248
+ <UIcon
249
+ :name="replayingId === r._id ? 'i-ph-spinner' : 'i-ph-arrows-clockwise'"
250
+ class="size-3.5"
251
+ :class="{ 'animate-spin': replayingId === r._id }"
252
+ />
253
+ {{ $t('dms_automation.runs.timeline.replay') }}
254
+ </button>
255
+ </div>
256
+ </div>
257
+ </li>
258
+ </ol>
259
+
260
+ <div
261
+ v-if="pagination.total > 0"
262
+ class="flex items-center justify-between gap-3 pt-3"
263
+ >
264
+ <UButton
265
+ size="sm"
266
+ color="neutral"
267
+ variant="ghost"
268
+ icon="i-ph-caret-left"
269
+ :label="$t('dms_automation.common.previous')"
270
+ :disabled="!hasPrev || loading"
271
+ @click="pagination.setPage(pagination.pageIndex - 1)"
272
+ />
273
+ <span class="text-xs tabular-nums text-dimmed">
274
+ {{ $t('dms_automation.runs.pageLabel', { n: pageNumber }) }}
275
+ </span>
276
+ <UButton
277
+ size="sm"
278
+ color="neutral"
279
+ variant="ghost"
280
+ trailing-icon="i-ph-caret-right"
281
+ :label="$t('dms_automation.common.next')"
282
+ :disabled="!hasNext || loading"
283
+ @click="pagination.setPage(pagination.pageIndex + 1)"
284
+ />
285
+ </div>
286
+ </div>
287
+ </template>