@antelopejs/dms-automation 0.2.7 → 0.3.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 (312) hide show
  1. package/README.md +46 -2
  2. package/dist/data/procedures-table.d.ts +38 -4
  3. package/dist/data/procedures-table.js +264 -82
  4. package/dist/data/procedures-table.js.map +1 -1
  5. package/dist/data/runs-table.d.ts +19 -3
  6. package/dist/data/runs-table.js +254 -19
  7. package/dist/data/runs-table.js.map +1 -1
  8. package/dist/db/index.d.ts +1 -2
  9. package/dist/db/index.js +1 -2
  10. package/dist/db/index.js.map +1 -1
  11. package/dist/db/models/automation_template.model.d.ts +16 -1
  12. package/dist/db/models/automation_template.model.js +31 -11
  13. package/dist/db/models/automation_template.model.js.map +1 -1
  14. package/dist/db/models/index.d.ts +1 -1
  15. package/dist/db/models/index.js +1 -1
  16. package/dist/db/models/procedure.model.d.ts +1 -0
  17. package/dist/db/models/procedure.model.js +7 -0
  18. package/dist/db/models/procedure.model.js.map +1 -1
  19. package/dist/db/models/procedure_run.model.d.ts +16 -9
  20. package/dist/db/models/procedure_run.model.js +96 -17
  21. package/dist/db/models/procedure_run.model.js.map +1 -1
  22. package/dist/db/models/stats.model.d.ts +60 -61
  23. package/dist/db/models/stats.model.js +189 -236
  24. package/dist/db/models/stats.model.js.map +1 -1
  25. package/dist/db/models/type_switch.model.d.ts +25 -0
  26. package/dist/db/models/type_switch.model.js +25 -0
  27. package/dist/db/models/type_switch.model.js.map +1 -0
  28. package/dist/db/tables/index.d.ts +1 -2
  29. package/dist/db/tables/index.js +1 -2
  30. package/dist/db/tables/index.js.map +1 -1
  31. package/dist/db/tables/procedure.table.d.ts +6 -0
  32. package/dist/db/tables/procedure.table.js +24 -0
  33. package/dist/db/tables/procedure.table.js.map +1 -1
  34. package/dist/db/tables/procedure_run.table.d.ts +15 -1
  35. package/dist/db/tables/procedure_run.table.js +54 -0
  36. package/dist/db/tables/procedure_run.table.js.map +1 -1
  37. package/dist/db/tables/type_switch.table.d.ts +8 -0
  38. package/dist/db/tables/{trigger_type_config.table.js → type_switch.table.js} +16 -15
  39. package/dist/db/tables/type_switch.table.js.map +1 -0
  40. package/dist/displays/index.d.ts +14 -0
  41. package/dist/displays/index.js +23 -0
  42. package/dist/displays/index.js.map +1 -0
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.js +8 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/pages/builder.d.ts +1 -1
  47. package/dist/pages/builder.js +10 -3
  48. package/dist/pages/builder.js.map +1 -1
  49. package/dist/pages/index.d.ts +2 -1
  50. package/dist/pages/index.js +2 -1
  51. package/dist/pages/index.js.map +1 -1
  52. package/dist/pages/library.d.ts +2 -1
  53. package/dist/pages/library.js +54 -4
  54. package/dist/pages/library.js.map +1 -1
  55. package/dist/pages/overview.d.ts +6 -1
  56. package/dist/pages/overview.js +121 -2
  57. package/dist/pages/overview.js.map +1 -1
  58. package/dist/pages/procedures.js +111 -16
  59. package/dist/pages/procedures.js.map +1 -1
  60. package/dist/pages/runs.d.ts +4 -1
  61. package/dist/pages/runs.js +109 -13
  62. package/dist/pages/runs.js.map +1 -1
  63. package/dist/pages/shared.d.ts +18 -0
  64. package/dist/pages/shared.js +238 -0
  65. package/dist/pages/shared.js.map +1 -0
  66. package/dist/pages/trace.d.ts +10 -0
  67. package/dist/pages/trace.js +41 -0
  68. package/dist/pages/trace.js.map +1 -0
  69. package/dist/realtime.d.ts +3 -0
  70. package/dist/realtime.js +14 -0
  71. package/dist/realtime.js.map +1 -0
  72. package/dist/routes/action-types.d.ts +2 -14
  73. package/dist/routes/action-types.js +2 -32
  74. package/dist/routes/action-types.js.map +1 -1
  75. package/dist/routes/deleteConfirm.d.ts +3 -0
  76. package/dist/routes/deleteConfirm.js +64 -0
  77. package/dist/routes/deleteConfirm.js.map +1 -0
  78. package/dist/routes/graphSchema.d.ts +3 -90
  79. package/dist/routes/graphSchema.js +36 -9
  80. package/dist/routes/graphSchema.js.map +1 -1
  81. package/dist/routes/index.d.ts +1 -0
  82. package/dist/routes/index.js +1 -0
  83. package/dist/routes/index.js.map +1 -1
  84. package/dist/routes/library.d.ts +40 -0
  85. package/dist/routes/library.js +147 -0
  86. package/dist/routes/library.js.map +1 -0
  87. package/dist/routes/procedureChecks.d.ts +16 -0
  88. package/dist/routes/procedureChecks.js +72 -0
  89. package/dist/routes/procedureChecks.js.map +1 -0
  90. package/dist/routes/procedureRuns.d.ts +21 -0
  91. package/dist/routes/procedureRuns.js +45 -0
  92. package/dist/routes/procedureRuns.js.map +1 -0
  93. package/dist/routes/procedureSchemas.d.ts +107 -0
  94. package/dist/routes/procedureSchemas.js +61 -0
  95. package/dist/routes/procedureSchemas.js.map +1 -0
  96. package/dist/routes/procedures.d.ts +125 -7
  97. package/dist/routes/procedures.js +363 -67
  98. package/dist/routes/procedures.js.map +1 -1
  99. package/dist/routes/requests.d.ts +15 -0
  100. package/dist/routes/requests.js +35 -0
  101. package/dist/routes/requests.js.map +1 -0
  102. package/dist/routes/runs.d.ts +107 -2
  103. package/dist/routes/runs.js +340 -37
  104. package/dist/routes/runs.js.map +1 -1
  105. package/dist/routes/stats.d.ts +19 -1
  106. package/dist/routes/stats.js +160 -4
  107. package/dist/routes/stats.js.map +1 -1
  108. package/dist/routes/templates.d.ts +6 -2
  109. package/dist/routes/templates.js +106 -36
  110. package/dist/routes/templates.js.map +1 -1
  111. package/dist/routes/trigger-types.d.ts +2 -15
  112. package/dist/routes/trigger-types.js +2 -32
  113. package/dist/routes/trigger-types.js.map +1 -1
  114. package/dist/routes/typeConfigShared.d.ts +7 -11
  115. package/dist/routes/typeConfigShared.js +25 -15
  116. package/dist/routes/typeConfigShared.js.map +1 -1
  117. package/dist/runtime/armErrors.d.ts +16 -0
  118. package/dist/runtime/armErrors.js +69 -0
  119. package/dist/runtime/armErrors.js.map +1 -0
  120. package/dist/runtime/boundRunLog.d.ts +24 -0
  121. package/dist/runtime/boundRunLog.js +202 -10
  122. package/dist/runtime/boundRunLog.js.map +1 -1
  123. package/dist/runtime/builtins/actions/http.d.ts +10 -1
  124. package/dist/runtime/builtins/actions/http.js +306 -19
  125. package/dist/runtime/builtins/actions/http.js.map +1 -1
  126. package/dist/runtime/builtins/actions/log.js +2 -2
  127. package/dist/runtime/builtins/actions/log.js.map +1 -1
  128. package/dist/runtime/builtins/data/boolean.d.ts +1 -0
  129. package/dist/runtime/builtins/data/boolean.js +18 -10
  130. package/dist/runtime/builtins/data/boolean.js.map +1 -1
  131. package/dist/runtime/builtins/data/compare.js +60 -11
  132. package/dist/runtime/builtins/data/compare.js.map +1 -1
  133. package/dist/runtime/builtins/data/constant.js +9 -12
  134. package/dist/runtime/builtins/data/constant.js.map +1 -1
  135. package/dist/runtime/builtins/data/json.js +4 -4
  136. package/dist/runtime/builtins/data/json.js.map +1 -1
  137. package/dist/runtime/builtins/data/math.js +44 -24
  138. package/dist/runtime/builtins/data/math.js.map +1 -1
  139. package/dist/runtime/builtins/data/object.js +10 -10
  140. package/dist/runtime/builtins/data/object.js.map +1 -1
  141. package/dist/runtime/builtins/data/string.js +31 -20
  142. package/dist/runtime/builtins/data/string.js.map +1 -1
  143. package/dist/runtime/builtins/nodes/action.js +4 -0
  144. package/dist/runtime/builtins/nodes/action.js.map +1 -1
  145. package/dist/runtime/builtins/nodes/delay.js +1 -1
  146. package/dist/runtime/builtins/nodes/delay.js.map +1 -1
  147. package/dist/runtime/builtins/nodes/forRange.d.ts +1 -1
  148. package/dist/runtime/builtins/nodes/forRange.js +10 -4
  149. package/dist/runtime/builtins/nodes/forRange.js.map +1 -1
  150. package/dist/runtime/builtins/nodes/if.js +2 -1
  151. package/dist/runtime/builtins/nodes/if.js.map +1 -1
  152. package/dist/runtime/builtins/nodes/parallel.js +9 -2
  153. package/dist/runtime/builtins/nodes/parallel.js.map +1 -1
  154. package/dist/runtime/builtins/nodes/retry.js +1 -1
  155. package/dist/runtime/builtins/nodes/retry.js.map +1 -1
  156. package/dist/runtime/builtins/nodes/setVariable.js +1 -3
  157. package/dist/runtime/builtins/nodes/setVariable.js.map +1 -1
  158. package/dist/runtime/builtins/triggers/cron.d.ts +3 -0
  159. package/dist/runtime/builtins/triggers/cron.js +21 -7
  160. package/dist/runtime/builtins/triggers/cron.js.map +1 -1
  161. package/dist/runtime/builtins/triggers/manual.js +2 -2
  162. package/dist/runtime/builtins/triggers/manual.js.map +1 -1
  163. package/dist/runtime/builtins/triggers/webhook.d.ts +14 -1
  164. package/dist/runtime/builtins/triggers/webhook.js +116 -30
  165. package/dist/runtime/builtins/triggers/webhook.js.map +1 -1
  166. package/dist/runtime/describe.d.ts +23 -0
  167. package/dist/runtime/describe.js +114 -0
  168. package/dist/runtime/describe.js.map +1 -0
  169. package/dist/runtime/executionResult.d.ts +1 -0
  170. package/dist/runtime/executor.js +82 -5
  171. package/dist/runtime/executor.js.map +1 -1
  172. package/dist/runtime/graphIssues.d.ts +20 -0
  173. package/dist/runtime/graphIssues.js +290 -0
  174. package/dist/runtime/graphIssues.js.map +1 -0
  175. package/dist/runtime/graphVersion.d.ts +2 -0
  176. package/dist/runtime/graphVersion.js +43 -0
  177. package/dist/runtime/graphVersion.js.map +1 -0
  178. package/dist/runtime/nodeKinds.d.ts +4 -4
  179. package/dist/runtime/nodeKinds.js +1 -2
  180. package/dist/runtime/nodeKinds.js.map +1 -1
  181. package/dist/runtime/registry.d.ts +2 -1
  182. package/dist/runtime/registry.js +1 -2
  183. package/dist/runtime/registry.js.map +1 -1
  184. package/dist/runtime/resolveInputs.d.ts +3 -1
  185. package/dist/runtime/resolveInputs.js +12 -2
  186. package/dist/runtime/resolveInputs.js.map +1 -1
  187. package/dist/runtime/resolveSubgraph.d.ts +12 -1
  188. package/dist/runtime/resolveSubgraph.js +36 -0
  189. package/dist/runtime/resolveSubgraph.js.map +1 -1
  190. package/dist/runtime/retention.d.ts +6 -0
  191. package/dist/runtime/retention.js +54 -0
  192. package/dist/runtime/retention.js.map +1 -0
  193. package/dist/runtime/runProcedure.d.ts +12 -0
  194. package/dist/runtime/runProcedure.js +130 -0
  195. package/dist/runtime/runProcedure.js.map +1 -0
  196. package/dist/runtime/schedule.d.ts +2 -0
  197. package/dist/runtime/schedule.js +139 -0
  198. package/dist/runtime/schedule.js.map +1 -0
  199. package/dist/runtime/subscriptions.d.ts +11 -1
  200. package/dist/runtime/subscriptions.js +91 -125
  201. package/dist/runtime/subscriptions.js.map +1 -1
  202. package/dist/runtime/subwalk.js +2 -3
  203. package/dist/runtime/subwalk.js.map +1 -1
  204. package/dist/runtime/templateUsages.d.ts +4 -0
  205. package/dist/runtime/templateUsages.js +102 -0
  206. package/dist/runtime/templateUsages.js.map +1 -0
  207. package/dist/runtime/topo.d.ts +1 -0
  208. package/dist/runtime/topo.js +23 -0
  209. package/dist/runtime/topo.js.map +1 -1
  210. package/dist/runtime/trace.d.ts +44 -0
  211. package/dist/runtime/trace.js +240 -0
  212. package/dist/runtime/trace.js.map +1 -0
  213. package/dist/runtime/typeSwitches.d.ts +3 -0
  214. package/dist/runtime/typeSwitches.js +27 -0
  215. package/dist/runtime/typeSwitches.js.map +1 -0
  216. package/dist/runtime/validate.d.ts +11 -0
  217. package/dist/runtime/validate.js +118 -61
  218. package/dist/runtime/validate.js.map +1 -1
  219. package/dist/runtime/webhookRoutes.d.ts +4 -0
  220. package/dist/runtime/webhookRoutes.js +68 -0
  221. package/dist/runtime/webhookRoutes.js.map +1 -0
  222. package/dist/runtime/withTimeout.d.ts +1 -0
  223. package/dist/runtime/withTimeout.js +17 -0
  224. package/dist/runtime/withTimeout.js.map +1 -0
  225. package/dist/runtime/wording.d.ts +10 -0
  226. package/dist/runtime/wording.js +118 -0
  227. package/dist/runtime/wording.js.map +1 -0
  228. package/dist/stats/health-banner.d.ts +13 -0
  229. package/dist/stats/health-banner.js +149 -0
  230. package/dist/stats/health-banner.js.map +1 -0
  231. package/dist/stats/health.d.ts +49 -0
  232. package/dist/stats/health.js +130 -0
  233. package/dist/stats/health.js.map +1 -0
  234. package/dist/stats/kpi.d.ts +21 -0
  235. package/dist/stats/kpi.js +101 -0
  236. package/dist/stats/kpi.js.map +1 -0
  237. package/dist/stats/overview.d.ts +94 -0
  238. package/dist/stats/overview.js +244 -0
  239. package/dist/stats/overview.js.map +1 -0
  240. package/dist/types/constants.d.ts +0 -1
  241. package/dist/types/constants.js +1 -2
  242. package/dist/types/constants.js.map +1 -1
  243. package/dist/types/runLog.d.ts +2 -0
  244. package/dist/types/runLog.js +4 -0
  245. package/dist/types/runLog.js.map +1 -1
  246. package/frontend-vue/app/components/AttentionList.vue +276 -0
  247. package/frontend-vue/app/components/Catalog/SchemaTable.vue +127 -0
  248. package/frontend-vue/app/components/Catalog.vue +457 -0
  249. package/frontend-vue/app/components/Editor/BottomDock.vue +188 -0
  250. package/frontend-vue/app/components/Editor/BuilderPalette.vue +101 -45
  251. package/frontend-vue/app/components/Editor/GraphCanvas.vue +818 -206
  252. package/frontend-vue/app/components/Editor/GroupPortEditor.vue +29 -18
  253. package/frontend-vue/app/components/Editor/JsonField.vue +3 -3
  254. package/frontend-vue/app/components/Editor/NewProcedureDialog.vue +108 -0
  255. package/frontend-vue/app/components/Editor/NodeInspector.vue +373 -101
  256. package/frontend-vue/app/components/Editor/ProcedureSwitcher.vue +147 -0
  257. package/frontend-vue/app/components/Editor/RunNowDialog.vue +145 -0
  258. package/frontend-vue/app/components/Editor/WiredField.vue +3 -3
  259. package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +97 -91
  260. package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +5 -6
  261. package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +3 -2
  262. package/frontend-vue/app/components/Editor/nodes/styles.ts +14 -18
  263. package/frontend-vue/app/components/Editor.vue +1894 -705
  264. package/frontend-vue/app/components/IconPicker.vue +122 -0
  265. package/frontend-vue/app/components/LiveTopics.vue +20 -0
  266. package/frontend-vue/app/components/Run/RunCompare.vue +115 -0
  267. package/frontend-vue/app/components/Run/RunFailure.vue +54 -0
  268. package/frontend-vue/app/components/Run/RunLogList.vue +167 -0
  269. package/frontend-vue/app/components/Run/RunPathTaken.vue +139 -0
  270. package/frontend-vue/app/components/Run/RunPayload.vue +85 -0
  271. package/frontend-vue/app/components/Run/RunWaterfall.vue +374 -0
  272. package/frontend-vue/app/components/RunPeek.vue +132 -0
  273. package/frontend-vue/app/components/RunTrace.vue +462 -0
  274. package/frontend-vue/app/components/Templates.vue +382 -537
  275. package/frontend-vue/app/components/WebhookEndpoint.vue +81 -0
  276. package/frontend-vue/app/composables/useAutomationNodeKinds.ts +23 -6
  277. package/frontend-vue/app/composables/useAutomationRuns.ts +160 -25
  278. package/frontend-vue/app/composables/useGraphConnect.ts +103 -51
  279. package/frontend-vue/app/composables/useRunActions.ts +60 -0
  280. package/frontend-vue/app/plugins/cell-displays.ts +169 -0
  281. package/frontend-vue/app/utils/automation.ts +4 -36
  282. package/frontend-vue/app/utils/describe.ts +252 -0
  283. package/frontend-vue/app/utils/redactedHeaders.ts +31 -0
  284. package/frontend-vue/dms.frontend.build.ts +7 -0
  285. package/frontend-vue/dms.frontend.ts +7 -4
  286. package/frontend-vue/i18n/locales/dms-automation-en-GB.json +1149 -309
  287. package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +1154 -314
  288. package/frontend-vue/package.json +1 -1
  289. package/package.json +8 -6
  290. package/dist/db/models/type_config.model.d.ts +0 -47
  291. package/dist/db/models/type_config.model.js +0 -51
  292. package/dist/db/models/type_config.model.js.map +0 -1
  293. package/dist/db/tables/action_type_config.table.d.ts +0 -7
  294. package/dist/db/tables/action_type_config.table.js +0 -35
  295. package/dist/db/tables/action_type_config.table.js.map +0 -1
  296. package/dist/db/tables/trigger_type_config.table.d.ts +0 -7
  297. package/dist/db/tables/trigger_type_config.table.js.map +0 -1
  298. package/frontend-vue/app/components/Actions.vue +0 -151
  299. package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +0 -170
  300. package/frontend-vue/app/components/Catalog/TypeList.vue +0 -203
  301. package/frontend-vue/app/components/DataNodes.vue +0 -275
  302. package/frontend-vue/app/components/Editor/ProcedureList.vue +0 -156
  303. package/frontend-vue/app/components/Editor/RunsDrawer.vue +0 -312
  304. package/frontend-vue/app/components/Library.vue +0 -69
  305. package/frontend-vue/app/components/Overview.vue +0 -503
  306. package/frontend-vue/app/components/RunDetailDrawer.vue +0 -165
  307. package/frontend-vue/app/components/RunFireTree.vue +0 -170
  308. package/frontend-vue/app/components/RunTraceDrawer.vue +0 -59
  309. package/frontend-vue/app/components/RunsStats.vue +0 -126
  310. package/frontend-vue/app/components/RunsTimelineDisplay.vue +0 -287
  311. package/frontend-vue/app/components/Triggers.vue +0 -147
  312. package/frontend-vue/app/plugins/runs-timeline-display.client.ts +0 -16
@@ -1,170 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, ref } from 'vue'
3
- import type {
4
- FireNode,
5
- LogEntry,
6
- } from '../composables/useAutomationRuns'
7
-
8
- const props = defineProps<{
9
- fire: FireNode
10
- childrenOf: Map<string, FireNode[]>
11
- entriesOf: Map<string, LogEntry[]>
12
- }>()
13
-
14
- defineOptions({ name: 'RunFireTree' })
15
-
16
- const open = ref(true)
17
- function toggle() {
18
- open.value = !open.value
19
- }
20
-
21
- const ownEntries = computed<LogEntry[]>(
22
- () => props.entriesOf.get(props.fire.id) ?? [],
23
- )
24
- const childFires = computed<FireNode[]>(
25
- () => props.childrenOf.get(props.fire.id) ?? [],
26
- )
27
-
28
- type Item =
29
- | { kind: 'entry'; ts: number; seq: number; entry: LogEntry }
30
- | { kind: 'fire'; ts: number; seq: number; fire: FireNode }
31
-
32
- // Chronological interleave of own log entries and child fires within this
33
- // fire's scope. Sort by ts first; break ties with `seq` (the executor's
34
- // monotonic event counter) so sub-millisecond iterations preserve their
35
- // logical order — without this, "run ok" sometimes appears between
36
- // iterations because the entry was pushed into the merge first.
37
- const items = computed<Item[]>(() => {
38
- const merged: Item[] = []
39
- for (const entry of ownEntries.value) {
40
- merged.push({ kind: 'entry', ts: entry.ts, seq: entry.seq, entry })
41
- }
42
- for (const child of childFires.value) {
43
- merged.push({ kind: 'fire', ts: child.ts, seq: child.seq, fire: child })
44
- }
45
- merged.sort((a, b) => a.ts - b.ts || a.seq - b.seq)
46
- return merged
47
- })
48
-
49
- const headerLabel = computed(() => {
50
- const f = props.fire
51
- const port = f.port ? ` · ${f.port}` : ''
52
- const iter =
53
- typeof f.iteration === 'number' ? ` · iter ${f.iteration}` : ''
54
- return `${f.sourceNodeId}${port}${iter}`
55
- })
56
-
57
- const durationLabel = computed(() => {
58
- const f = props.fire
59
- if (typeof f.closedAt !== 'number') return '…'
60
- return `${f.closedAt - f.ts} ms`
61
- })
62
-
63
- // Track expanded entries by `seq` (executor-emitted, stable across
64
- // reflows). Index-based keying flips state every time logs arrive in
65
- // a different order.
66
- const expandedEntrySeq = ref<Set<number>>(new Set())
67
- function toggleExpanded(seq: number) {
68
- if (expandedEntrySeq.value.has(seq)) expandedEntrySeq.value.delete(seq)
69
- else expandedEntrySeq.value.add(seq)
70
- expandedEntrySeq.value = new Set(expandedEntrySeq.value)
71
- }
72
-
73
- function iconFor(level: LogEntry['level']): { name: string; class: string } {
74
- if (level === 'error') return { name: 'i-ph-x-circle', class: 'text-error' }
75
- if (level === 'warn') return { name: 'i-ph-warning', class: 'text-warning' }
76
- return { name: 'i-ph-info', class: 'text-muted' }
77
- }
78
-
79
- function formatTs(ms: number): string {
80
- return `+${ms} ms`
81
- }
82
-
83
- function nodeLabel(entry: LogEntry): string {
84
- if (!entry.nodeId) return 'run'
85
- return entry.nodeKind ? `${entry.nodeKind} · ${entry.nodeId}` : entry.nodeId
86
- }
87
-
88
- function prettyValue(v: unknown): string {
89
- try {
90
- return JSON.stringify(v, null, 2)
91
- } catch {
92
- return String(v)
93
- }
94
- }
95
-
96
- // Short inline summary shown next to the message for `log`-source entries
97
- // (e.g. `Body alpha`, `Body 42`). Falls back to a compact JSON snippet
98
- // for arrays/objects; truncates anything longer than 40 chars.
99
- function inlineSummary(v: unknown): string {
100
- if (v === undefined || v === null) return ''
101
- if (typeof v === 'string') return v.length > 40 ? `${v.slice(0, 40)}…` : v
102
- if (typeof v === 'number' || typeof v === 'boolean') return String(v)
103
- try {
104
- const j = JSON.stringify(v)
105
- return j.length > 40 ? `${j.slice(0, 40)}…` : j
106
- } catch {
107
- return ''
108
- }
109
- }
110
- </script>
111
-
112
- <template>
113
- <div class="flex flex-col">
114
- <button
115
- type="button"
116
- class="grid grid-cols-[auto_auto_1fr_auto] items-center gap-2 px-2 py-1 text-left text-xs hover:bg-elevated border-b border-default"
117
- @click="toggle"
118
- >
119
- <UIcon
120
- :name="open ? 'i-ph-caret-down' : 'i-ph-caret-right'"
121
- class="text-dimmed"
122
- />
123
- <span class="font-mono tabular-nums text-dimmed">{{ formatTs(fire.ts) }}</span>
124
- <span class="font-mono text-default truncate">{{ headerLabel }}</span>
125
- <span class="font-mono tabular-nums text-dimmed">{{ durationLabel }}</span>
126
- </button>
127
- <div v-if="open" class="border-l-2 border-default pl-2 ml-2">
128
- <template v-for="item in items" :key="`${item.kind}-${item.seq}`">
129
- <RunFireTree
130
- v-if="item.kind === 'fire'"
131
- :fire="item.fire"
132
- :children-of="childrenOf"
133
- :entries-of="entriesOf"
134
- />
135
- <div
136
- v-else
137
- class="border-b border-default last:border-b-0"
138
- >
139
- <button
140
- type="button"
141
- class="grid w-full grid-cols-[auto_auto_auto_1fr_auto] items-center gap-2 px-2 py-1 text-left text-xs hover:bg-elevated"
142
- :disabled="item.entry.value === undefined"
143
- @click="toggleExpanded(item.seq)"
144
- >
145
- <span class="font-mono tabular-nums text-dimmed">{{ formatTs(item.entry.ts) }}</span>
146
- <UIcon :name="iconFor(item.entry.level).name" :class="iconFor(item.entry.level).class" />
147
- <span class="font-mono text-muted truncate">{{ nodeLabel(item.entry) }}</span>
148
- <span class="truncate text-default">
149
- <span v-if="item.entry.source === 'exec'" class="mr-1 inline-block rounded bg-elevated px-1 py-px text-[10px] uppercase text-dimmed">exec</span>
150
- {{ item.entry.message }}
151
- <span
152
- v-if="item.entry.source === 'log' && inlineSummary(item.entry.value)"
153
- class="ml-2 font-mono text-dimmed"
154
- >{{ inlineSummary(item.entry.value) }}</span>
155
- </span>
156
- <UIcon
157
- v-if="item.entry.value !== undefined"
158
- :name="expandedEntrySeq.has(item.seq) ? 'i-ph-caret-down' : 'i-ph-caret-right'"
159
- class="text-dimmed"
160
- />
161
- </button>
162
- <pre
163
- v-if="item.entry.value !== undefined && expandedEntrySeq.has(item.seq)"
164
- class="max-h-48 overflow-auto bg-elevated px-3 py-2 text-[11px]"
165
- >{{ prettyValue(item.entry.value) }}</pre>
166
- </div>
167
- </template>
168
- </div>
169
- </div>
170
- </template>
@@ -1,59 +0,0 @@
1
- <script setup lang="ts">
2
- import { onMounted, ref } from 'vue'
3
- import type { RunDetail, RunSummary } from '../composables/useAutomationRuns'
4
- import RunDetailDrawer from './RunDetailDrawer.vue'
5
-
6
- // Drawer body for a single run, opened by the timeline display's Trace
7
- // button via `useDrawer` (which passes `rowData` and `procedureName`). The
8
- // summary row carries no logs, so we re-fetch the full run by id here.
9
- // Attribute fallthrough is disabled so extra injected props don't leak
10
- // onto the DOM.
11
- defineOptions({ inheritAttrs: false })
12
-
13
- const props = defineProps<{
14
- rowData: RunSummary
15
- procedureName?: string
16
- }>()
17
-
18
- const { getRun, listProcedures } = useAutomationRuns()
19
-
20
- const run = ref<RunDetail | null>(null)
21
- const resolvedName = ref<string | undefined>(props.procedureName)
22
- const loading = ref(true)
23
-
24
- onMounted(async () => {
25
- const [full] = await Promise.all([
26
- // Fall back to the summary row (no logs) if the detail fetch fails, so the
27
- // drawer still shows status/timing/error.
28
- getRun(props.rowData._id).catch(() => props.rowData as RunDetail),
29
- props.procedureName
30
- ? Promise.resolve()
31
- : listProcedures()
32
- .then((ps) => {
33
- resolvedName.value = ps.find(
34
- (p) => p._id === props.rowData.procedureId,
35
- )?.name
36
- })
37
- .catch(() => {
38
- /* name lookup is best-effort; falls back to procedureId */
39
- }),
40
- ])
41
- run.value = full
42
- loading.value = false
43
- })
44
- </script>
45
-
46
- <template>
47
- <div class="p-1">
48
- <div v-if="loading" class="flex flex-col gap-3 p-1">
49
- <USkeleton class="h-6 w-2/3" />
50
- <USkeleton class="h-4 w-1/2" />
51
- <USkeleton class="h-32 w-full" />
52
- </div>
53
- <RunDetailDrawer
54
- v-else-if="run"
55
- :run="run"
56
- :procedure-name="resolvedName"
57
- />
58
- </div>
59
- </template>
@@ -1,126 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, onMounted, ref } from 'vue'
3
- import { formatDuration } from '../utils/automation'
4
-
5
- // Page-level header + KPI cards for the Runs page, rendered ABOVE the TableView
6
- // (registered as `dms-automation-runs-stats`, wired via `static stats` in
7
- // src/pages/runs.ts). Self-contained: fetches its own stats snapshot. The run
8
- // list, tabs, filters, export and pagination are owned by the TableView below.
9
-
10
- const { $authFetch } = useAuthFetch()
11
-
12
- interface StatsSnapshot {
13
- health: { '24h': { avgDurationMs: number } }
14
- runsPerDay7d: Array<{ day: string; ok: number; failed: number }>
15
- }
16
-
17
- const stats = ref<StatsSnapshot | null>(null)
18
- const loading = ref(false)
19
-
20
- const kpis = computed(() => {
21
- const days = stats.value?.runsPerDay7d ?? []
22
- const today = days[days.length - 1] ?? { ok: 0, failed: 0 }
23
- return [
24
- {
25
- key: 'today',
26
- title: '$dms_automation.runs.kpis.today',
27
- value: today.ok + today.failed,
28
- icon: 'i-ph-activity',
29
- },
30
- {
31
- key: 'success',
32
- title: '$dms_automation.runs.kpis.success',
33
- value: today.ok,
34
- icon: 'i-ph-check-circle',
35
- },
36
- {
37
- key: 'failed',
38
- title: '$dms_automation.runs.kpis.failed',
39
- value: today.failed,
40
- icon: 'i-ph-x-circle',
41
- },
42
- ]
43
- })
44
-
45
- const avgDurationLabel = computed(() =>
46
- formatDuration(stats.value?.health?.['24h']?.avgDurationMs ?? 0),
47
- )
48
-
49
- async function loadStats() {
50
- loading.value = true
51
- try {
52
- stats.value = await $authFetch<StatsSnapshot>('/api/automation/stats')
53
- } catch {
54
- /* KPIs are best-effort. */
55
- } finally {
56
- loading.value = false
57
- }
58
- }
59
-
60
- onMounted(loadStats)
61
- </script>
62
-
63
- <template>
64
- <!--
65
- Title / icon / description come from the page's native dms header
66
- (src/pages/runs.ts) — only the refresh action lives here.
67
- -->
68
- <div class="runs-stats flex flex-col gap-5">
69
- <section class="flex flex-wrap items-center justify-end gap-4">
70
- <UButton
71
- color="neutral"
72
- variant="ghost"
73
- icon="i-ph-arrows-clockwise"
74
- :loading="loading"
75
- :aria-label="$t('dms_automation.common.refresh')"
76
- @click="loadStats"
77
- />
78
- </section>
79
-
80
- <!-- KPI stat cards -->
81
- <div class="grid grid-cols-2 gap-4 lg:grid-cols-4">
82
- <template v-if="stats">
83
- <DmsKpiCard
84
- v-for="k in kpis"
85
- :key="k.key"
86
- variant="stat"
87
- page-id="automation.runs"
88
- :component-id="`runs-kpi-${k.key}`"
89
- :title="k.title"
90
- :icon="k.icon"
91
- :static-value="k.value"
92
- value-format="compact"
93
- :show-delta="false"
94
- />
95
- <DmsCard :padded="false" class="flex flex-col justify-between gap-2 p-4">
96
- <div class="flex items-center justify-between">
97
- <span class="font-mono text-[11px] uppercase tracking-wider text-dimmed">
98
- {{ $t('dms_automation.runs.kpis.avgDuration') }}
99
- </span>
100
- <UIcon name="i-ph-clock" class="size-4 text-dimmed" />
101
- </div>
102
- <span class="text-2xl font-semibold tabular-nums text-highlighted">
103
- {{ avgDurationLabel }}
104
- </span>
105
- </DmsCard>
106
- </template>
107
- <template v-else>
108
- <DmsCard v-for="i in 4" :key="`skel-${i}`" :padded="false" class="p-5">
109
- <USkeleton class="h-10 w-full" />
110
- </DmsCard>
111
- </template>
112
- </div>
113
- </div>
114
- </template>
115
-
116
- <style>
117
- /* The Runs TableView sits directly under these KPI cards. Drop its native card
118
- frame (background/border/shadow) so the whole page reads as one flat section;
119
- the card's inner padding is kept so the table content stays aligned with the
120
- KPI grid above. Scoped to the runs page via the .runs-stats marker. */
121
- .dms-page-stack:has(.runs-stats) .dms-card.flow-root {
122
- background-color: transparent;
123
- border-color: transparent;
124
- box-shadow: none;
125
- }
126
- </style>
@@ -1,287 +0,0 @@
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>