@antelopejs/dms-automation 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +106 -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 +105 -44
  251. package/frontend-vue/app/components/Editor/GraphCanvas.vue +822 -207
  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 +382 -104
  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 -5
  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 -166
  300. package/frontend-vue/app/components/Catalog/TypeList.vue +0 -198
  301. package/frontend-vue/app/components/DataNodes.vue +0 -272
  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
@@ -0,0 +1,122 @@
1
+ <script lang="ts">
2
+ /** An Iconify name, `i-<set>-<icon>`, as the server accepts it. */
3
+ const ICON_PATTERN = /^i-[a-z0-9]+-[a-z0-9-]+$/
4
+
5
+ export function isIconName(name: string): boolean {
6
+ return ICON_PATTERN.test(name)
7
+ }
8
+
9
+ // Where the DMS frontend answers Iconify queries, `not_found` listing the
10
+ // names a collection lacks.
11
+ const ICON_API_PATH = '/api/_dms/icons/'
12
+ </script>
13
+
14
+ <script setup lang="ts">
15
+ import { computed, ref, useId, watch } from 'vue'
16
+
17
+ // A grid of icons to pick from, with a search, in place of typing an Iconify
18
+ // name. "More…" keeps the free text for an icon outside the grid, with a
19
+ // preview; it is open from the start when the current icon is not in the grid.
20
+
21
+ const ICONS = [
22
+ 'i-ph-package', 'i-ph-stack', 'i-ph-flow-arrow', 'i-ph-lightning', 'i-ph-webhooks-logo',
23
+ 'i-ph-clock', 'i-ph-calendar', 'i-ph-envelope', 'i-ph-paper-plane-tilt', 'i-ph-bell',
24
+ 'i-ph-chat-circle', 'i-ph-database', 'i-ph-cloud-arrow-up', 'i-ph-globe', 'i-ph-plugs',
25
+ 'i-ph-arrows-clockwise', 'i-ph-shield-check', 'i-ph-warning', 'i-ph-bug', 'i-ph-receipt',
26
+ 'i-ph-invoice', 'i-ph-credit-card', 'i-ph-shopping-cart', 'i-ph-user', 'i-ph-users',
27
+ 'i-ph-file-text', 'i-ph-table', 'i-ph-chart-bar', 'i-ph-funnel', 'i-ph-magic-wand',
28
+ 'i-ph-robot', 'i-ph-gear', 'i-ph-key', 'i-ph-lock', 'i-ph-map-pin', 'i-ph-truck',
29
+ ]
30
+
31
+ const model = defineModel<string>({ default: 'i-ph-package' })
32
+
33
+ const query = ref('')
34
+ const custom = ref(!ICONS.includes(model.value))
35
+ const customId = useId()
36
+ const unknown = ref(false)
37
+
38
+ // Another template picked in the same form: show its icon if the grid lacks
39
+ // it, and say so when no icon has that name (it would show empty).
40
+ let check: ReturnType<typeof setTimeout> | undefined
41
+ watch(
42
+ model,
43
+ (icon) => {
44
+ unknown.value = false
45
+ clearTimeout(check)
46
+ if (!icon || ICONS.includes(icon)) return
47
+ custom.value = true
48
+ if (!isIconName(icon) || import.meta.env.SSR) return
49
+ check = setTimeout(() => void lookUp(icon), 300)
50
+ },
51
+ { immediate: true },
52
+ )
53
+
54
+ async function lookUp(icon: string) {
55
+ // `i-ph-heart-beat`: collection `ph`, icon `heart-beat`. A collection with a
56
+ // dash in its name is not found this way, and is then not flagged.
57
+ const [, prefix, name] = icon.match(/^i-([a-z0-9]+)-(.+)$/) ?? []
58
+ try {
59
+ const response = await fetch(`${ICON_API_PATH}${prefix}.json?icons=${name}`)
60
+ if (!response.ok) return
61
+ const data = (await response.json()) as { not_found?: string[] }
62
+ if (model.value === icon) unknown.value = !!data.not_found?.includes(name!)
63
+ } catch {
64
+ // Unknown stays false: a lookup that failed says nothing of the icon.
65
+ }
66
+ }
67
+
68
+ const visible = computed(() => {
69
+ const q = query.value.trim().toLowerCase()
70
+ return q ? ICONS.filter((icon) => icon.includes(q)) : ICONS
71
+ })
72
+ const invalid = computed(() => !!model.value && !isIconName(model.value))
73
+
74
+ function label(icon: string): string {
75
+ return icon.replace(/^i-ph-/, '').replace(/-/g, ' ')
76
+ }
77
+ </script>
78
+
79
+ <template>
80
+ <div class="flex max-w-md flex-col gap-2">
81
+ <div class="flex items-center gap-2">
82
+ <UInput v-model="query" size="sm" icon="i-ph-magnifying-glass" :placeholder="$t('dms_automation.iconPicker.search')" class="flex-1" />
83
+ <UButton size="sm" variant="ghost" color="neutral" :aria-expanded="custom" @click="custom = !custom">
84
+ {{ $t('dms_automation.iconPicker.more') }}
85
+ </UButton>
86
+ </div>
87
+ <div class="grid grid-cols-[repeat(auto-fill,minmax(2.5rem,1fr))] gap-1 sm:grid-cols-[repeat(auto-fill,minmax(2rem,1fr))]" role="listbox" :aria-label="$t('dms_automation.iconPicker.label')">
88
+ <UTooltip v-for="icon in visible" :key="icon" :text="label(icon)">
89
+ <button
90
+ type="button"
91
+ role="option"
92
+ :aria-selected="model === icon"
93
+ :aria-label="label(icon)"
94
+ class="grid size-10 place-items-center rounded-md border transition-colors sm:size-8"
95
+ :class="model === icon ? 'border-primary bg-primary/10 text-primary' : 'border-default text-muted hover:bg-elevated'"
96
+ @click="model = icon"
97
+ >
98
+ <UIcon :name="icon" class="size-4" />
99
+ </button>
100
+ </UTooltip>
101
+ </div>
102
+ <div v-if="custom" class="flex flex-col gap-1">
103
+ <div class="flex items-center gap-2">
104
+ <span class="grid size-8 shrink-0 place-items-center rounded-md border border-default text-muted" aria-hidden="true">
105
+ <UIcon v-if="model && !invalid" :name="model" class="size-4" />
106
+ </span>
107
+ <UInput
108
+ :id="customId"
109
+ v-model="model"
110
+ size="sm"
111
+ placeholder="i-ph-package"
112
+ class="flex-1 font-mono"
113
+ :aria-label="$t('dms_automation.iconPicker.custom')"
114
+ :aria-invalid="invalid || undefined"
115
+ :aria-describedby="invalid ? `${customId}-error` : unknown ? `${customId}-unknown` : undefined"
116
+ />
117
+ </div>
118
+ <DmsFieldError :id="`${customId}-error`" :message="invalid ? $t('dms_automation.iconPicker.invalid') : null" />
119
+ <p v-if="unknown" :id="`${customId}-unknown`" class="text-xs text-warning">{{ $t('dms_automation.iconPicker.unknown') }}</p>
120
+ </div>
121
+ </div>
122
+ </template>
@@ -0,0 +1,20 @@
1
+ <script setup lang="ts">
2
+ // Keeps a live page in step with its realtime topics: each event refreshes
3
+ // every block of the page, through the page's Live / Pause like any refresh
4
+ // nobody asked for. Draws nothing.
5
+
6
+ const props = defineProps<{
7
+ realtimeTopic: string[]
8
+ }>()
9
+
10
+ for (const topic of props.realtimeTopic) {
11
+ useRealtimeTopic(topic, (event) => {
12
+ // A presence snapshot names no `type`: nothing changed.
13
+ if ('type' in event) refreshLivePageBlocks()
14
+ })
15
+ }
16
+ </script>
17
+
18
+ <template>
19
+ <span hidden />
20
+ </template>
@@ -0,0 +1,115 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import type { RunDetail } from '../../composables/useAutomationRuns'
4
+ import { describeDateTime, describeDuration, stepTitle } from '../../utils/describe'
5
+
6
+ // Each step of this run next to the same step in the last successful run,
7
+ // every iteration added up: what got slower, by how much, and the steps the
8
+ // last success went through that this run never reached.
9
+
10
+ const props = defineProps<{ run: RunDetail; traceUrl: string }>()
11
+
12
+ const { processI18n } = useTranslation()
13
+ const { dateTimeFormat } = useRegionalFormat()
14
+
15
+ // A gap under this share of the last success's time, or under a few
16
+ // milliseconds, reads as noise.
17
+ const NOTABLE_GAP = 0.2
18
+ const NOTABLE_GAP_MS = 5
19
+
20
+ interface Row {
21
+ nodeId: string
22
+ name: string
23
+ before: number | null
24
+ now: number | null
25
+ /** This run never got to the step. */
26
+ notReached: boolean
27
+ tone: 'failed' | 'handled' | 'ok'
28
+ }
29
+
30
+ const rows = computed<Row[]>(() => {
31
+ const before = props.run.lastSuccess?.stepDurations ?? {}
32
+ const rowsById = new Map<string, Row>()
33
+ for (const step of props.run.trace.steps) {
34
+ const row = rowsById.get(step.nodeId) ?? {
35
+ nodeId: step.nodeId,
36
+ name: stepTitle(step.name, processI18n),
37
+ before: before[step.nodeId] ?? null,
38
+ now: null,
39
+ notReached: false,
40
+ tone: 'ok',
41
+ }
42
+ if (step.durationMs !== null) row.now = (row.now ?? 0) + step.durationMs
43
+ if (step.status === 'failed') row.tone = step.handled && row.tone !== 'failed' ? 'handled' : 'failed'
44
+ rowsById.set(step.nodeId, row)
45
+ }
46
+ const skippedNames = new Map(props.run.trace.skipped.map((s) => [s.nodeId, stepTitle(s.name, processI18n)]))
47
+ const labels = new Map((props.run.graph?.nodes ?? []).flatMap((n) => (n.label ? [[n.id, n.label] as const] : [])))
48
+ // A step this run never reached reads as one row, its inner steps (a
49
+ // group's) added up into it.
50
+ for (const [flatId, ms] of Object.entries(before)) {
51
+ if (rowsById.has(flatId)) continue
52
+ const nodeId = flatId.split('__')[0] ?? flatId
53
+ const row = rowsById.get(nodeId) ?? {
54
+ nodeId,
55
+ name: skippedNames.get(nodeId) ?? labels.get(nodeId) ?? nodeId,
56
+ before: null,
57
+ now: null,
58
+ notReached: true,
59
+ tone: 'ok',
60
+ }
61
+ if (row.notReached && ms !== null) row.before = (row.before ?? 0) + ms
62
+ rowsById.set(nodeId, row)
63
+ }
64
+ return [...rowsById.values()]
65
+ })
66
+
67
+ function gapOf(before: number | null, now: number | null): number | null {
68
+ return before === null || now === null ? null : now - before
69
+ }
70
+
71
+ function gapClass(before: number | null, now: number | null): string {
72
+ const gap = gapOf(before, now)
73
+ if (gap === null || before === null || Math.abs(gap) <= Math.max(before * NOTABLE_GAP, NOTABLE_GAP_MS)) return 'text-muted'
74
+ return gap > 0 ? 'text-warning' : 'text-success'
75
+ }
76
+
77
+ function describeGap(gap: number | null): string {
78
+ if (gap === null || Math.round(gap) === 0) return ''
79
+ return `${gap >= 0 ? '+' : '−'}${describeDuration(Math.abs(gap))}`
80
+ }
81
+
82
+ const NOW_CLASS = { failed: 'text-error', handled: 'text-warning', ok: 'text-toned' } as const
83
+
84
+ const GRID = 'grid grid-cols-[minmax(0,1fr)_auto_auto_auto] gap-x-3'
85
+ </script>
86
+
87
+ <template>
88
+ <div v-if="run.lastSuccess" class="flex flex-col">
89
+ <div :class="GRID" class="items-end border-b border-default pb-1.5 font-mono text-[10.5px] text-dimmed uppercase">
90
+ <span>{{ $t('dms_automation.trace.step') }}</span>
91
+ <DmsLink :to="`${traceUrl}?run=${encodeURIComponent(run.lastSuccess.runId)}`" class="flex flex-col text-right hover:text-highlighted">
92
+ <span>{{ $t('dms_automation.trace.compareLastSuccess') }}</span>
93
+ <span class="whitespace-nowrap normal-case">{{ describeDateTime(run.lastSuccess.startedAt, dateTimeFormat) }}</span>
94
+ </DmsLink>
95
+ <span class="text-right">{{ $t('dms_automation.trace.now') }}</span>
96
+ <span class="text-right">{{ $t('dms_automation.trace.compareGap') }}</span>
97
+ </div>
98
+ <div v-for="row in rows" :key="row.nodeId" :class="GRID" class="border-b border-default py-1.5 text-xs">
99
+ <span class="truncate" :class="row.notReached ? 'text-muted' : 'text-toned'">{{ row.name }}</span>
100
+ <span class="text-right font-mono text-muted tabular-nums">{{ describeDuration(row.before) }}</span>
101
+ <span v-if="row.notReached" class="text-right text-muted">{{ $t('dms_automation.trace.compareNotReached') }}</span>
102
+ <span v-else class="text-right font-mono tabular-nums" :class="NOW_CLASS[row.tone]">{{ describeDuration(row.now) }}</span>
103
+ <span class="text-right font-mono tabular-nums" :class="gapClass(row.before, row.now)">{{ describeGap(gapOf(row.before, row.now)) }}</span>
104
+ </div>
105
+ <div :class="GRID" class="pt-1.5 text-xs font-medium">
106
+ <span class="text-toned">{{ $t('dms_automation.trace.compareTotal') }}</span>
107
+ <span class="text-right font-mono text-muted tabular-nums">{{ describeDuration(run.lastSuccess.durationMs) }}</span>
108
+ <span class="text-right font-mono text-toned tabular-nums">{{ describeDuration(run.durationMs) }}</span>
109
+ <span class="text-right font-mono tabular-nums" :class="gapClass(run.lastSuccess.durationMs, run.durationMs)">
110
+ {{ describeGap(gapOf(run.lastSuccess.durationMs, run.durationMs)) }}
111
+ </span>
112
+ </div>
113
+ </div>
114
+ <p v-else class="text-xs text-muted">{{ $t('dms_automation.trace.noSuccessYet') }}</p>
115
+ </template>
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import type { RunDetail } from '../../composables/useAutomationRuns'
4
+ import { describeDuration, describeTime, stepTitle } from '../../utils/describe'
5
+
6
+ // Where and why a failed run stopped: the step by name, the error, how many
7
+ // runs in a row failed the same way, and a link to when it last worked.
8
+
9
+ const props = defineProps<{ run: RunDetail; traceUrl: string }>()
10
+
11
+ const { processI18n } = useTranslation()
12
+ const { dateTimeFormat } = useRegionalFormat()
13
+
14
+ const step = computed(() => stepTitle(props.run.failedStep, processI18n))
15
+
16
+ const lastSuccess = computed(() => {
17
+ const last = props.run.lastSuccess
18
+ return last
19
+ ? {
20
+ to: `${props.traceUrl}?run=${encodeURIComponent(last.runId)}`,
21
+ label: processI18n('$dms_automation.trace.lastSuccessAt', { time: describeTime(last.startedAt, dateTimeFormat) }),
22
+ id: last.runId.slice(0, 8),
23
+ }
24
+ : null
25
+ })
26
+ </script>
27
+
28
+ <template>
29
+ <div class="flex flex-col gap-3 rounded-lg border border-error/40 bg-error/5 p-4">
30
+ <div class="flex items-start gap-3">
31
+ <DmsIconWell icon="i-ph-x-circle" tone="error" size="sm" />
32
+ <div class="flex min-w-0 flex-col gap-1">
33
+ <p class="text-sm font-semibold text-highlighted">
34
+ {{ step ? $t('dms_automation.trace.failedAt', { step }) : $t('dms_automation.trace.failed') }}
35
+ </p>
36
+ <p class="text-xs text-muted">
37
+ {{ $t('dms_automation.trace.failedAfter', { duration: describeDuration(run.durationMs) }) }}
38
+ <template v-if="run.failuresInRow > 1">
39
+ {{ processI18n('$dms_automation.trace.failuresInRow', { count: run.failuresInRow }) }}
40
+ </template>
41
+ </p>
42
+ <DmsLink v-if="lastSuccess" :to="lastSuccess.to" class="inline-flex w-fit items-center gap-1 text-xs text-muted hover:text-highlighted">
43
+ <UIcon name="i-ph-check-circle" class="size-3.5 text-success" />
44
+ {{ lastSuccess.label }}
45
+ <span class="font-mono">{{ lastSuccess.id }}</span>
46
+ </DmsLink>
47
+ </div>
48
+ </div>
49
+ <pre class="max-h-48 overflow-auto rounded-md bg-default p-2 font-mono text-xs whitespace-pre-wrap text-error">{{ run.errorMessage }}</pre>
50
+ <div v-if="$slots.default" class="flex flex-wrap gap-2">
51
+ <slot />
52
+ </div>
53
+ </div>
54
+ </template>
@@ -0,0 +1,167 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, watch } from 'vue'
3
+ import { type LogEntry, type RunLog, useAutomationRuns } from '../../composables/useAutomationRuns'
4
+ import { describeDuration, prettyJson, stepTitle, type StepName } from '../../utils/describe'
5
+
6
+ // The run's log as a timed list, named by step instead of node id: every
7
+ // executor event and every message a step wrote. It can be narrowed to the
8
+ // warnings and errors or to the steps' own messages, searched, jumped to its
9
+ // first error and copied. Read with the run when it carries it, else on
10
+ // demand.
11
+
12
+ const props = defineProps<{
13
+ apiUrl: string
14
+ runId: string
15
+ /** The log, when the run came with it. */
16
+ log?: RunLog
17
+ names: Map<string, StepName>
18
+ }>()
19
+
20
+ const { processI18n } = useTranslation()
21
+ const { t } = useI18n()
22
+ const runs = useAutomationRuns(props.apiUrl)
23
+ const expanded = ref<Set<number>>(new Set())
24
+
25
+ const fetched = ref<RunLog | null>(null)
26
+ const loading = ref(false)
27
+ const error = ref<string | null>(null)
28
+ const log = computed(() => props.log ?? fetched.value)
29
+
30
+ async function load() {
31
+ if (props.log) return
32
+ loading.value = true
33
+ try {
34
+ fetched.value = await runs.getLogs(props.runId)
35
+ error.value = null
36
+ } catch (e) {
37
+ error.value = describeApiError(e)
38
+ } finally {
39
+ loading.value = false
40
+ }
41
+ }
42
+
43
+ watch(() => props.runId, () => void load(), { immediate: true })
44
+
45
+ const level = ref<'all' | 'problems' | 'errors'>('all')
46
+ const stepMessagesOnly = ref(false)
47
+ const search = ref('')
48
+
49
+ const levels = computed(() => [
50
+ { label: t('dms_automation.trace.logLevelAll'), value: 'all' },
51
+ { label: t('dms_automation.trace.logLevelProblems'), value: 'problems' },
52
+ { label: t('dms_automation.trace.logLevelErrors'), value: 'errors' },
53
+ ])
54
+
55
+ const LEVELS_SHOWN = {
56
+ all: ['info', 'warn', 'error'],
57
+ problems: ['warn', 'error'],
58
+ errors: ['error'],
59
+ } as const
60
+
61
+ const sorted = computed<LogEntry[]>(() =>
62
+ [...(log.value?.entries ?? [])].sort((a, b) => a.ts - b.ts || a.seq - b.seq),
63
+ )
64
+
65
+ function stepOf(entry: LogEntry): string {
66
+ if (!entry.nodeId) return entry.source
67
+ const name = props.names.get(entry.nodeId)
68
+ return name ? stepTitle(name, processI18n) : entry.nodeId
69
+ }
70
+
71
+ const entries = computed(() => {
72
+ const shown: readonly string[] = LEVELS_SHOWN[level.value]
73
+ const query = search.value.trim().toLowerCase()
74
+ return sorted.value.filter(
75
+ (entry) =>
76
+ shown.includes(entry.level) &&
77
+ (!stepMessagesOnly.value || entry.source === 'log') &&
78
+ (!query || `${entry.message} ${stepOf(entry)}`.toLowerCase().includes(query)),
79
+ )
80
+ })
81
+
82
+ const firstError = computed(() => entries.value.find((e) => e.level === 'error'))
83
+
84
+ function jumpToFirstError() {
85
+ const entry = firstError.value
86
+ if (!entry) return
87
+ document.getElementById(`log-entry-${entry.seq}`)?.scrollIntoView({ block: 'center', behavior: 'smooth' })
88
+ }
89
+
90
+ /** The entries shown, as text: what "Copy" puts on the clipboard. */
91
+ const asText = computed(() =>
92
+ entries.value
93
+ .map((e) => `+${describeDuration(e.ts)}\t${e.level.toUpperCase()}\t${stepOf(e)}\t${e.message}`)
94
+ .join('\n'),
95
+ )
96
+
97
+ const LEVEL_ICON = {
98
+ error: { name: 'i-ph-x-circle', class: 'text-error' },
99
+ warn: { name: 'i-ph-warning', class: 'text-warning' },
100
+ info: { name: 'i-ph-dot-outline', class: 'text-dimmed' },
101
+ } as const
102
+
103
+ function toggle(seq: number) {
104
+ const next = new Set(expanded.value)
105
+ if (next.has(seq)) next.delete(seq)
106
+ else next.add(seq)
107
+ expanded.value = next
108
+ }
109
+ </script>
110
+
111
+ <template>
112
+ <div class="@container flex flex-col">
113
+ <div v-if="loading" class="flex flex-col gap-2 p-3">
114
+ <USkeleton v-for="i in 4" :key="i" class="h-5 w-full" />
115
+ </div>
116
+ <p v-else-if="error" class="p-3 text-sm text-error">{{ $t('dms_automation.trace.logLoadError') }} {{ error }}</p>
117
+ <template v-else>
118
+ <div class="flex flex-wrap items-center gap-2 border-b border-default px-3 py-2">
119
+ <UInput
120
+ v-model="search"
121
+ size="xs"
122
+ icon="i-ph-magnifying-glass"
123
+ :placeholder="$t('dms_automation.trace.logSearch')"
124
+ :aria-label="$t('dms_automation.trace.logSearch')"
125
+ class="min-w-40 flex-1"
126
+ />
127
+ <USelect v-model="level" :items="levels" size="xs" class="w-44" :aria-label="$t('dms_automation.trace.logLevel')" />
128
+ <USwitch v-model="stepMessagesOnly" size="xs" :label="$t('dms_automation.trace.logStepMessages')" />
129
+ <div class="ms-auto flex items-center gap-1">
130
+ <UButton
131
+ v-if="firstError"
132
+ size="xs"
133
+ color="error"
134
+ variant="ghost"
135
+ icon="i-ph-arrow-down"
136
+ @click="jumpToFirstError"
137
+ >
138
+ {{ $t('dms_automation.trace.logFirstError') }}
139
+ </UButton>
140
+ <DmsCopyButton :value="asText" :aria-label="$t('dms_automation.trace.logCopy')" />
141
+ </div>
142
+ </div>
143
+ <div v-for="entry in entries" :id="`log-entry-${entry.seq}`" :key="entry.seq" class="border-b border-default">
144
+ <button
145
+ type="button"
146
+ class="grid w-full grid-cols-[4.5rem_1rem_minmax(0,1fr)] items-start gap-2 px-3 py-1.5 text-left font-mono text-xs hover:bg-elevated/60 @xl:grid-cols-[4.5rem_1rem_minmax(0,1fr)_minmax(0,12rem)]"
147
+ :disabled="entry.value === undefined"
148
+ @click="toggle(entry.seq)"
149
+ >
150
+ <span class="text-dimmed tabular-nums">+{{ describeDuration(entry.ts) }}</span>
151
+ <UIcon :name="LEVEL_ICON[entry.level].name" class="mt-0.5 size-3.5" :class="LEVEL_ICON[entry.level].class" />
152
+ <span class="break-words whitespace-pre-wrap" :class="entry.level === 'error' ? 'text-error' : 'text-toned'">{{ entry.message }}</span>
153
+ <span class="col-start-3 truncate text-dimmed @xl:col-start-auto @xl:text-right">{{ stepOf(entry) }}</span>
154
+ </button>
155
+ <pre
156
+ v-if="expanded.has(entry.seq)"
157
+ class="mx-3 mb-2 max-h-64 overflow-auto rounded-md bg-elevated p-2 font-mono text-xs text-toned"
158
+ >{{ prettyJson(entry.value) }}</pre>
159
+ </div>
160
+ <p v-if="sorted.length && !entries.length" class="px-3 py-4 text-center text-sm text-muted">{{ $t('dms_automation.trace.logNoMatch') }}</p>
161
+ <p class="px-3 py-2 font-mono text-[11px] text-dimmed">
162
+ {{ $t('dms_automation.trace.logComplete', { count: sorted.length }) }}
163
+ <template v-if="log?.truncated">· {{ $t('dms_automation.trace.logTruncated', { count: log.truncated }) }}</template>
164
+ </p>
165
+ </template>
166
+ </div>
167
+ </template>
@@ -0,0 +1,139 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { builderRunUrl, opensInBuilder, type RunDetail, type TraceStep } from '../../composables/useAutomationRuns'
4
+ import { stepTitle } from '../../utils/describe'
5
+
6
+ // The path the run took, read from its log as a list: each step once, in the
7
+ // order it first ran, indented under its loop or try, with how often it ran
8
+ // and the branch it chose; the branches it left aside under the step that
9
+ // chose. A step opens in the builder on this run. Read from the log, the path
10
+ // is the run's own even when the graph that ran was not kept: then only the
11
+ // branches left aside, which come from the graph, are not shown.
12
+
13
+ const props = defineProps<{
14
+ run: RunDetail
15
+ builderUrl?: string
16
+ }>()
17
+
18
+ const { processI18n } = useTranslation()
19
+
20
+ const topLevel = (id: string) => id.split('__')[0] ?? id
21
+
22
+ type State = 'ok' | 'failed' | 'handled' | 'running' | 'truncated'
23
+
24
+ interface PathItem {
25
+ nodeId: string
26
+ title: string
27
+ kind?: string
28
+ depth: number
29
+ runs: number
30
+ state: State
31
+ branch?: string
32
+ /** Branches the step could have taken, and where they led. */
33
+ notTaken: Array<{ branch: string; title: string }>
34
+ }
35
+
36
+ function stateOf(executions: TraceStep[]): State {
37
+ if (executions.some((s) => s.status === 'failed' && !s.handled)) return 'failed'
38
+ if (executions.some((s) => s.status === 'failed')) return 'handled'
39
+ if (executions.some((s) => s.status === 'running')) return 'running'
40
+ if (executions.some((s) => s.status === 'truncated')) return 'truncated'
41
+ return 'ok'
42
+ }
43
+
44
+ // Only a graph that is the one that ran says which branches were left aside.
45
+ const graph = computed(() => (props.run.graphOutdated ? null : props.run.graph))
46
+
47
+ const names = computed(() => {
48
+ const map = new Map<string, string>()
49
+ for (const s of [...props.run.trace.skipped, ...props.run.trace.steps]) map.set(s.nodeId, stepTitle(s.name, processI18n))
50
+ for (const node of graph.value?.nodes ?? []) if (!map.has(node.id) && node.label) map.set(node.id, node.label)
51
+ return map
52
+ })
53
+
54
+ function branchesNotTaken(nodeId: string): PathItem['notTaken'] {
55
+ const taken = new Set(props.run.trace.edgesTaken ?? [])
56
+ const ran = new Set(props.run.trace.steps.map((s) => topLevel(s.nodeId)))
57
+ return (graph.value?.triggerEdges ?? [])
58
+ .filter((e) => e.from.node === nodeId && !taken.has(e.id) && !ran.has(e.to.node))
59
+ .map((e) => ({ branch: e.from.branch ?? 'main', title: names.value.get(e.to.node) ?? e.to.node }))
60
+ }
61
+
62
+ // Steps that choose where the run goes on: the branches they left aside are
63
+ // listed under them.
64
+ const CHOOSING_KINDS = new Set(['if', 'switch', 'tryCatch', 'retry'])
65
+
66
+ const items = computed<PathItem[]>(() => {
67
+ const byNode = new Map<string, TraceStep[]>()
68
+ for (const step of props.run.trace.steps) byNode.set(step.nodeId, [...(byNode.get(step.nodeId) ?? []), step])
69
+ return [...byNode.entries()].map(([nodeId, executions]) => {
70
+ const first = executions[0]!
71
+ const branch = executions.map((s) => s.branch).find(Boolean)
72
+ return {
73
+ nodeId,
74
+ title: stepTitle(first.name, processI18n),
75
+ kind: first.name.kind,
76
+ depth: Math.min(...executions.map((s) => s.depth)),
77
+ runs: executions.length,
78
+ state: stateOf(executions),
79
+ branch,
80
+ notTaken: CHOOSING_KINDS.has(first.name.kind ?? '') ? branchesNotTaken(nodeId) : [],
81
+ }
82
+ })
83
+ })
84
+
85
+ const ICON: Record<State, { name: string; class: string }> = {
86
+ ok: { name: 'i-ph-check-circle', class: 'text-success' },
87
+ failed: { name: 'i-ph-x-circle', class: 'text-error' },
88
+ handled: { name: 'i-ph-warning-circle', class: 'text-warning' },
89
+ running: { name: 'i-ph-circle-notch', class: 'text-info' },
90
+ truncated: { name: 'i-ph-scissors', class: 'text-muted' },
91
+ }
92
+
93
+ // The builder opens the procedure on this run with the step selected; not
94
+ // when it cannot show the run, nor when the graph shown is not the one that
95
+ // ran.
96
+ function stepUrl(nodeId: string): string | undefined {
97
+ if (!props.builderUrl || !opensInBuilder(props.run) || props.run.graphOutdated) return undefined
98
+ return builderRunUrl(props.builderUrl, props.run, nodeId)
99
+ }
100
+ </script>
101
+
102
+ <template>
103
+ <div class="flex flex-col gap-2">
104
+ <ol v-if="items.length" class="flex max-h-96 flex-col overflow-auto" :aria-label="$t('dms_automation.trace.pathTaken')">
105
+ <li v-for="item in items" :key="item.nodeId" class="flex flex-col" :style="{ paddingInlineStart: `${Math.min(item.depth, 4)}rem` }">
106
+ <!-- DmsLink is registered globally: a link when the step opens in the builder. -->
107
+ <component
108
+ :is="stepUrl(item.nodeId) ? 'DmsLink' : 'span'"
109
+ :to="stepUrl(item.nodeId)"
110
+ class="flex min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-sm"
111
+ :class="stepUrl(item.nodeId) ? 'hover:bg-elevated' : ''"
112
+ >
113
+ <UIcon :name="ICON[item.state].name" class="size-4 shrink-0" :class="ICON[item.state].class" />
114
+ <span class="truncate text-highlighted">{{ item.title }}</span>
115
+ <span v-if="item.runs > 1" class="shrink-0 font-mono text-xs text-muted">×{{ item.runs }}</span>
116
+ <span v-if="item.branch" class="shrink-0 font-mono text-xs text-muted">→ {{ item.branch }}</span>
117
+ </component>
118
+ <p
119
+ v-for="other in item.notTaken"
120
+ :key="other.branch + other.title"
121
+ class="flex min-w-0 items-center gap-2 py-0.5 ps-8 text-xs text-muted"
122
+ >
123
+ <UIcon name="i-ph-circle-dashed" class="size-3.5 shrink-0" />
124
+ <span class="truncate">{{ $t('dms_automation.trace.branchLeft', { branch: other.branch, step: other.title }) }}</span>
125
+ </p>
126
+ </li>
127
+ </ol>
128
+ <p v-else class="p-2 text-center text-xs text-muted">{{ $t('dms_automation.trace.noSteps') }}</p>
129
+ <p v-if="!run.graph" class="text-xs text-muted">{{ $t('dms_automation.trace.noGraph') }}</p>
130
+ <p v-else-if="run.graphOutdated" class="flex items-start gap-1.5 text-xs text-warning">
131
+ <UIcon name="i-ph-info" class="mt-0.5 size-3.5 shrink-0" />
132
+ {{ $t('dms_automation.trace.pathWithoutGraph') }}
133
+ </p>
134
+ <p v-else-if="run.procedure && !opensInBuilder(run)" class="flex items-start gap-1.5 text-xs text-muted">
135
+ <UIcon name="i-ph-info" class="mt-0.5 size-3.5 shrink-0" />
136
+ {{ $t('dms_automation.trace.builderDraftHint') }}
137
+ </p>
138
+ </div>
139
+ </template>