@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,457 @@
1
+ <script setup lang="ts">
2
+ import { computed, nextTick, onMounted, ref, useTemplateRef, watch } from 'vue'
3
+ import type { NodeKindEntry, PortRef } from '../composables/useAutomationNodeKinds'
4
+ import type { JsonSchema } from '../composables/useGraphConnect'
5
+
6
+ // One catalog of the library (triggers, actions, data nodes, or the flow and
7
+ // helper blocks): its entries grouped by the module that registered them, and
8
+ // the picked one's detail — where it is used first, then what disabling it
9
+ // does, its settings, inputs and outputs as tables. The picked entry is kept
10
+ // in the URL (`?item=`), so going back to the library lands on it again.
11
+
12
+ type CatalogKind = 'triggers' | 'actions' | 'dataNodes' | 'flow'
13
+
14
+ interface CatalogEntry {
15
+ id: string
16
+ name: string
17
+ description?: string
18
+ icon?: string
19
+ module?: string
20
+ category?: string
21
+ cluster?: 'replicated' | 'singleton'
22
+ configSchema?: JsonSchema
23
+ inputSchema?: JsonSchema
24
+ outputSchema?: JsonSchema
25
+ enabled?: boolean
26
+ }
27
+
28
+ type ProcedureState = 'failing' | 'degraded' | 'healthy' | 'paused' | 'draft'
29
+
30
+ interface TypeUsage {
31
+ procedureId: string
32
+ procedureName: string
33
+ enabled: boolean
34
+ state: ProcedureState
35
+ nodeId: string
36
+ nodeLabel: string | null
37
+ groupPath: string[]
38
+ groupLabel: string | null
39
+ viaTemplate: { id: string; name: string } | null
40
+ method?: string
41
+ path?: string
42
+ cron?: string
43
+ timeZone?: string
44
+ /** The schedule in words, by the server. */
45
+ cronText?: BlockText
46
+ }
47
+
48
+ const props = defineProps<{
49
+ kind: CatalogKind
50
+ apiUrl: string
51
+ builderUrl: string
52
+ }>()
53
+
54
+ const ENDPOINTS: Record<CatalogKind, string> = {
55
+ triggers: 'trigger-types',
56
+ actions: 'action-types',
57
+ dataNodes: 'data-node-types',
58
+ flow: 'node-kinds',
59
+ }
60
+
61
+ /** The palette categories the Flow catalog lists. */
62
+ const FLOW_CATEGORIES = ['flow', 'helper']
63
+
64
+ const STATE_TONES = {
65
+ failing: 'error',
66
+ degraded: 'warning',
67
+ healthy: 'success',
68
+ paused: 'neutral',
69
+ draft: 'info',
70
+ } as const
71
+
72
+ // Procedures needing attention first.
73
+ const STATE_ORDER: ProcedureState[] = ['failing', 'degraded', 'healthy', 'paused', 'draft']
74
+
75
+ /** Procedures listed under "Used by" before "Show all". */
76
+ const USES_SHOWN = 8
77
+
78
+ const { $authFetch } = useAuthFetch()
79
+ const { processI18n } = useTranslation()
80
+ const { processText } = useComposedText()
81
+ const { t, te } = useI18n()
82
+ const toast = useToast()
83
+ const { confirm } = useConfirm()
84
+ const route = useDmsRoute()
85
+ const router = useDmsRouter()
86
+
87
+ const entries = ref<CatalogEntry[]>([])
88
+ const usage = ref<Record<string, TypeUsage[]>>({})
89
+ const loading = ref(true)
90
+ const error = ref<string | null>(null)
91
+ const selectedId = ref<string | null>(null)
92
+ const query = ref('')
93
+ const saving = ref(false)
94
+ const showAllUses = ref(false)
95
+ const detail = useTemplateRef<HTMLElement>('detail')
96
+ const list = useTemplateRef<HTMLElement>('list')
97
+
98
+ const configurable = computed(() => props.kind === 'triggers' || props.kind === 'actions')
99
+
100
+ function portsSchema(ports: PortRef[] | undefined): JsonSchema | undefined {
101
+ if (!ports?.length) return undefined
102
+ return { properties: Object.fromEntries(ports.map((p) => [p.name, { type: p.type }])) }
103
+ }
104
+
105
+ function flowEntries(kinds: NodeKindEntry[]): CatalogEntry[] {
106
+ return kinds.flatMap(({ kind, meta: { ui } }) => {
107
+ if (!ui?.category || !FLOW_CATEGORIES.includes(ui.category)) return []
108
+ const descriptionKey = `dms_automation.library.flowBlocks.${kind}`
109
+ return [
110
+ {
111
+ id: kind,
112
+ name: ui.label,
113
+ icon: ui.icon,
114
+ category: ui.category,
115
+ description: te(descriptionKey) ? t(descriptionKey) : undefined,
116
+ configSchema: ui.configSchema,
117
+ inputSchema: portsSchema(ui.staticDataIns),
118
+ outputSchema: portsSchema(ui.staticDataOuts),
119
+ },
120
+ ]
121
+ })
122
+ }
123
+
124
+ function queryItem(): string | null {
125
+ const q = route.query.item
126
+ return typeof q === 'string' && q ? q : null
127
+ }
128
+
129
+ async function load() {
130
+ loading.value = true
131
+ try {
132
+ const [listed, uses] = await Promise.all([
133
+ $authFetch<CatalogEntry[] | NodeKindEntry[]>(`${props.apiUrl}/${ENDPOINTS[props.kind]}`),
134
+ $authFetch<Record<string, TypeUsage[]>>(`${props.apiUrl}/library/usage/${props.kind}`),
135
+ ])
136
+ entries.value = props.kind === 'flow' ? flowEntries(listed as NodeKindEntry[]) : (listed as CatalogEntry[])
137
+ usage.value = uses
138
+ error.value = null
139
+ const wanted = selectedId.value ?? queryItem()
140
+ selectedId.value = entries.value.some((e) => e.id === wanted) ? wanted : (groups.value[0]?.[1][0]?.id ?? null)
141
+ } catch (e) {
142
+ error.value = describeApiError(e)
143
+ } finally {
144
+ loading.value = false
145
+ }
146
+ }
147
+
148
+ onMounted(load)
149
+
150
+ /**
151
+ * The heading an entry is listed under: its module (built-in first), and for
152
+ * data nodes and flow blocks their category within it.
153
+ */
154
+ function groupOf(entry: CatalogEntry): string {
155
+ if (props.kind === 'flow') return processI18n(`$dms_automation.builder.palette.groups.${entry.category}`)
156
+ const module = entry.module ?? t('dms_automation.library.builtIn')
157
+ if (props.kind !== 'dataNodes') return module
158
+ return `${module} · ${categoryLabel(entry.category)}`
159
+ }
160
+
161
+ function categoryLabel(category: string | undefined): string {
162
+ if (!category) return t('dms_automation.library.other')
163
+ const key = `dms_automation.types.dataCategories.${category}`
164
+ return te(key) ? t(key) : category
165
+ }
166
+
167
+ const groups = computed(() => {
168
+ const q = query.value.trim().toLowerCase()
169
+ const visible = entries.value.filter(
170
+ (e) =>
171
+ !q ||
172
+ [e.id, processI18n(e.name), processI18n(e.description ?? ''), groupOf(e), e.module ?? '', e.category ?? ''].some((text) =>
173
+ text.toLowerCase().includes(q),
174
+ ),
175
+ )
176
+ const map = new Map<string, CatalogEntry[]>()
177
+ for (const entry of visible) {
178
+ const group = groupOf(entry)
179
+ map.set(group, [...(map.get(group) ?? []), entry])
180
+ }
181
+ const builtIn = t('dms_automation.library.builtIn')
182
+ const rank = (group: string) => (group.startsWith(builtIn) ? 0 : 1)
183
+ return [...map.entries()].sort(([a], [b]) => rank(a) - rank(b) || a.localeCompare(b))
184
+ })
185
+
186
+ // A search hiding the picked entry moves the detail to the first one shown.
187
+ watch(groups, (shown) => {
188
+ if (loading.value || shown.length === 0) return
189
+ if (!shown.some(([, items]) => items.some((e) => e.id === selectedId.value))) {
190
+ selectedId.value = shown[0]![1][0]!.id
191
+ }
192
+ })
193
+
194
+ const selected = computed(() => entries.value.find((e) => e.id === selectedId.value) ?? null)
195
+
196
+ watch(selectedId, (id) => {
197
+ showAllUses.value = false
198
+ if (id && id !== queryItem()) void router.replace({ query: { ...route.query, item: id } })
199
+ })
200
+
201
+ /** Below the two-column width the detail sits under the list: bring it into view. */
202
+ async function select(id: string) {
203
+ selectedId.value = id
204
+ await nextTick()
205
+ if (detail.value && list.value && detail.value.offsetTop > list.value.offsetTop) {
206
+ detail.value.scrollIntoView({ behavior: 'smooth', block: 'start' })
207
+ }
208
+ }
209
+
210
+ function backToList() {
211
+ list.value?.scrollIntoView({ behavior: 'smooth', block: 'start' })
212
+ }
213
+
214
+ const uses = computed(() => (selected.value ? (usage.value[selected.value.id] ?? []) : []))
215
+ const enabledUses = computed(() => new Set(uses.value.filter((u) => u.enabled).map((u) => u.procedureId)).size)
216
+
217
+ /** "Used by", one line per procedure with the nodes placing the entry under it, by state then name. */
218
+ const procedureUses = computed(() => {
219
+ const byProcedure = new Map<string, TypeUsage[]>()
220
+ for (const use of uses.value) byProcedure.set(use.procedureId, [...(byProcedure.get(use.procedureId) ?? []), use])
221
+ return [...byProcedure.values()].sort(
222
+ ([a], [b]) => STATE_ORDER.indexOf(a!.state) - STATE_ORDER.indexOf(b!.state) || a!.procedureName.localeCompare(b!.procedureName),
223
+ )
224
+ })
225
+ const shownProcedureUses = computed(() => (showAllUses.value ? procedureUses.value : procedureUses.value.slice(0, USES_SHOWN)))
226
+
227
+ function useCount(id: string): number {
228
+ return new Set((usage.value[id] ?? []).map((u) => u.procedureId)).size
229
+ }
230
+
231
+ const settingsSchema = computed(() => (props.kind === 'actions' ? selected.value?.inputSchema : selected.value?.configSchema))
232
+ const inputSchema = computed(() => (props.kind === 'dataNodes' || props.kind === 'flow' ? selected.value?.inputSchema : undefined))
233
+
234
+ async function setEnabled(enabled: boolean) {
235
+ const entry = selected.value
236
+ if (!entry) return
237
+ saving.value = true
238
+ try {
239
+ await $authFetch(`${props.apiUrl}/${ENDPOINTS[props.kind]}/${encodeURIComponent(entry.id)}/config`, {
240
+ method: 'PUT',
241
+ body: { enabled },
242
+ })
243
+ entry.enabled = enabled
244
+ toast.add({
245
+ title: t(enabled ? 'dms_automation.library.enabledToast' : 'dms_automation.library.disabledToast', {
246
+ name: processI18n(entry.name),
247
+ }),
248
+ color: 'success',
249
+ icon: 'i-ph-check-circle',
250
+ })
251
+ } catch (e) {
252
+ toast.add({ title: t('dms_automation.common.actionFailed'), description: describeApiError(e), color: 'error', icon: 'i-ph-warning' })
253
+ } finally {
254
+ saving.value = false
255
+ }
256
+ }
257
+
258
+ async function toggleEnabled(enabled: boolean) {
259
+ const entry = selected.value
260
+ if (!entry) return
261
+ if (!enabled && enabledUses.value > 0) {
262
+ const ok = await confirm({
263
+ title: t('dms_automation.library.disableTitle', { name: processI18n(entry.name) }),
264
+ description: t('dms_automation.library.disableImpact', { count: enabledUses.value }),
265
+ color: 'warning',
266
+ confirmLabel: t('dms_automation.library.disable'),
267
+ })
268
+ if (!ok) return
269
+ }
270
+ await setEnabled(enabled)
271
+ }
272
+
273
+ /** Which node of the procedure it is: its label, else the block's name, and where it sits. */
274
+ function where(use: TypeUsage): string {
275
+ if (use.cronText) return processText(use.cronText)
276
+ const node = use.nodeLabel ?? processI18n(selected.value?.name ?? '')
277
+ if (use.viaTemplate) return `${node} · ${t('dms_automation.library.viaTemplate', { name: use.viaTemplate.name })}`
278
+ if (use.groupPath.length === 0) return node
279
+ const group = use.groupLabel
280
+ ? t('dms_automation.library.inGroup', { name: use.groupLabel })
281
+ : t('dms_automation.library.inUnnamedGroup')
282
+ return `${node} · ${group}`
283
+ }
284
+
285
+ function open(use: TypeUsage) {
286
+ const path = use.groupPath.length ? `&path=${use.groupPath.map(encodeURIComponent).join(',')}` : ''
287
+ void router.push(`${props.builderUrl}?selected=${use.procedureId}&node=${encodeURIComponent(use.nodeId)}${path}`)
288
+ }
289
+ </script>
290
+
291
+ <template>
292
+ <div class="@container">
293
+ <div class="grid grid-cols-1 items-start gap-5 @5xl:grid-cols-[20rem_minmax(0,1fr)]">
294
+ <div ref="list" class="dms-card flex flex-col gap-2 p-2">
295
+ <DmsSearchInput
296
+ v-model="query"
297
+ size="sm"
298
+ :placeholder="$t('dms_automation.library.search')"
299
+ class="w-full"
300
+ />
301
+ <div v-if="loading && entries.length === 0" class="flex flex-col gap-2 p-1">
302
+ <USkeleton v-for="i in 4" :key="i" class="h-12 w-full" />
303
+ </div>
304
+ <DmsEmptyState
305
+ v-else-if="error"
306
+ size="sm"
307
+ variant="error"
308
+ :title="$t('dms_automation.library.loadError')"
309
+ :description="error"
310
+ :actions="[{ label: $t('dms_automation.common.retry'), onClick: load }]"
311
+ />
312
+ <template v-else>
313
+ <div v-for="[group, items] in groups" :key="group" class="flex flex-col gap-1">
314
+ <p class="px-2.5 pt-2 pb-0.5 font-mono text-[10px] tracking-widest text-dimmed uppercase">{{ group }}</p>
315
+ <button
316
+ v-for="entry in items"
317
+ :key="entry.id"
318
+ type="button"
319
+ class="flex w-full items-start gap-3 rounded-md border px-3 py-2.5 text-left transition-colors"
320
+ :class="entry.id === selectedId ? 'border-primary bg-primary/10' : 'border-transparent hover:bg-elevated'"
321
+ :aria-current="entry.id === selectedId ? 'true' : undefined"
322
+ @click="select(entry.id)"
323
+ >
324
+ <UIcon :name="entry.icon || 'i-ph-cube'" class="mt-0.5 size-4 shrink-0 text-muted" />
325
+ <span class="flex min-w-0 flex-1 flex-col">
326
+ <span class="flex items-center gap-2">
327
+ <span class="truncate text-sm font-medium text-highlighted">{{ processI18n(entry.name) }}</span>
328
+ <UBadge v-if="entry.enabled === false" size="sm" color="neutral" variant="subtle">
329
+ {{ $t('dms_automation.library.off') }}
330
+ </UBadge>
331
+ </span>
332
+ <span v-if="entry.description" class="truncate text-xs text-muted">{{ processI18n(entry.description) }}</span>
333
+ </span>
334
+ <span class="shrink-0 font-mono text-[11px] text-dimmed">
335
+ {{ $t('dms_automation.library.uses', { count: useCount(entry.id) }) }}
336
+ </span>
337
+ </button>
338
+ </div>
339
+ <p v-if="groups.length === 0" class="p-3 text-center text-xs text-dimmed">{{ $t('dms_automation.library.noMatch') }}</p>
340
+ </template>
341
+ </div>
342
+
343
+ <div v-if="selected" ref="detail" class="flex scroll-mt-4 flex-col gap-4">
344
+ <UButton
345
+ class="self-start @5xl:hidden"
346
+ size="sm"
347
+ variant="ghost"
348
+ color="neutral"
349
+ icon="i-ph-arrow-up"
350
+ @click="backToList"
351
+ >
352
+ {{ $t('dms_automation.library.backToList') }}
353
+ </UButton>
354
+ <DmsCard>
355
+ <div class="flex flex-wrap items-start gap-4">
356
+ <DmsIconWell :icon="selected.icon || 'i-ph-cube'" tone="primary" size="xl" />
357
+ <div class="flex min-w-0 flex-1 flex-col gap-1">
358
+ <div class="flex flex-wrap items-center gap-2">
359
+ <h2 class="text-lg font-semibold text-highlighted">{{ processI18n(selected.name) }}</h2>
360
+ <UBadge size="sm" color="neutral" variant="outline">{{ groupOf(selected) }}</UBadge>
361
+ </div>
362
+ <p v-if="selected.description" class="text-sm text-muted">{{ processI18n(selected.description) }}</p>
363
+ <p class="font-mono text-xs break-all text-dimmed">
364
+ id · {{ selected.id }}
365
+ <template v-if="selected.cluster"> · cluster · {{ selected.cluster }}</template>
366
+ </p>
367
+ </div>
368
+ <div v-if="configurable" class="flex items-center gap-2">
369
+ <span class="text-sm text-muted" aria-hidden="true">
370
+ {{ selected.enabled !== false ? $t('dms_automation.library.enabled') : $t('dms_automation.library.disabled') }}
371
+ </span>
372
+ <USwitch
373
+ :model-value="selected.enabled !== false"
374
+ :loading="saving"
375
+ :aria-label="$t('dms_automation.library.switchLabel', { name: processI18n(selected.name) })"
376
+ @update:model-value="toggleEnabled"
377
+ />
378
+ </div>
379
+ </div>
380
+ <p v-if="kind === 'flow'" class="mt-3 text-xs text-muted">{{ $t('dms_automation.library.flowAlwaysOn') }}</p>
381
+ </DmsCard>
382
+
383
+ <DmsCard :title="$t('dms_automation.library.usedBy')" :count="procedureUses.length">
384
+ <p v-if="configurable && enabledUses > 0" class="mb-3 text-xs text-muted">
385
+ {{ $t('dms_automation.library.disableImpact', { count: enabledUses }) }}
386
+ </p>
387
+ <ul v-if="procedureUses.length" class="divide-y divide-default">
388
+ <li v-for="nodes in shownProcedureUses" :key="nodes[0]!.procedureId" class="flex items-start gap-3 py-2">
389
+ <DmsStatusPill
390
+ :tone="STATE_TONES[nodes[0]!.state]"
391
+ :label="$t(`dms_automation.procedures.status.${nodes[0]!.state}`)"
392
+ size="sm"
393
+ class="mt-0.5"
394
+ />
395
+ <div class="flex min-w-0 flex-1 flex-col">
396
+ <span class="truncate text-sm text-highlighted">{{ nodes[0]!.procedureName }}</span>
397
+ <div v-for="use in nodes" :key="`${use.nodeId}-${use.groupPath.join('/')}`" class="flex min-w-0 items-center gap-2">
398
+ <DmsAutomationWebhookEndpoint
399
+ v-if="use.path"
400
+ class="flex-1"
401
+ compact
402
+ :path="use.path"
403
+ :method="use.method"
404
+ :api-url="apiUrl"
405
+ />
406
+ <span v-else class="min-w-0 flex-1 truncate text-xs text-muted">{{ where(use) }}</span>
407
+ <UButton size="xs" variant="ghost" color="neutral" trailing-icon="i-ph-arrow-up-right" @click="open(use)">
408
+ {{ $t('dms_automation.library.open') }}
409
+ </UButton>
410
+ </div>
411
+ </div>
412
+ </li>
413
+ </ul>
414
+ <p v-else class="text-xs text-dimmed">{{ $t('dms_automation.library.unused') }}</p>
415
+ <UButton
416
+ v-if="procedureUses.length > USES_SHOWN"
417
+ class="mt-2"
418
+ size="xs"
419
+ variant="ghost"
420
+ color="neutral"
421
+ :trailing-icon="showAllUses ? 'i-ph-caret-up' : 'i-ph-caret-down'"
422
+ @click="showAllUses = !showAllUses"
423
+ >
424
+ {{ showAllUses ? $t('dms_automation.library.showLess') : $t('dms_automation.library.showAll', { count: procedureUses.length }) }}
425
+ </UButton>
426
+ </DmsCard>
427
+
428
+ <DmsCard v-if="settingsSchema" :title="kind === 'actions' ? $t('dms_automation.library.inputs') : $t('dms_automation.library.settings')">
429
+ <p class="mb-3 text-xs text-muted">{{ $t('dms_automation.library.settingsHint') }}</p>
430
+ <DmsAutomationSchemaTable :schema="settingsSchema" />
431
+ </DmsCard>
432
+
433
+ <DmsCard v-if="inputSchema" :title="$t('dms_automation.library.inputs')">
434
+ <DmsAutomationSchemaTable :schema="inputSchema" />
435
+ </DmsCard>
436
+
437
+ <DmsCard :title="$t('dms_automation.library.outputs')">
438
+ <DmsAutomationSchemaTable :schema="selected.outputSchema" />
439
+ </DmsCard>
440
+
441
+ <DmsBanner
442
+ v-if="selected.cluster"
443
+ size="sm"
444
+ tone="info"
445
+ icon="i-ph-hard-drives"
446
+ :title="$t(`dms_automation.library.cluster.${selected.cluster}`)"
447
+ :description="$t(`dms_automation.library.cluster.${selected.cluster}Hint`)"
448
+ />
449
+ </div>
450
+ <DmsEmptyState
451
+ v-else-if="!loading && !error"
452
+ :title="$t('dms_automation.library.nothingSelected')"
453
+ :description="$t('dms_automation.library.nothingSelectedHint')"
454
+ />
455
+ </div>
456
+ </div>
457
+ </template>
@@ -0,0 +1,188 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import type { TraceStep } from '../../composables/useAutomationRuns'
4
+ import { describeDuration, describeTime, stepTitle, type StepName } from '../../utils/describe'
5
+ import { redactedHeadersOf } from '../../utils/redactedHeaders'
6
+
7
+ // The builder's bottom dock: the graph's problems (each one selects its node),
8
+ // this procedure's last runs (same rows as the run history, each opening its
9
+ // trace), the payload Test run sends, and the steps of the test run on screen.
10
+
11
+ export interface DockIssue {
12
+ severity: 'error' | 'warning'
13
+ message: string
14
+ nodeId?: string
15
+ nodeName?: string
16
+ }
17
+
18
+ export interface DockRun {
19
+ _id: string
20
+ startedAt: string
21
+ endedAt?: string | null
22
+ status: string
23
+ errorMessage?: string | null
24
+ kind?: string
25
+ failedStep?: StepName | null
26
+ }
27
+
28
+ export type DockTab = 'problems' | 'runs' | 'payload' | 'test'
29
+
30
+ const props = defineProps<{
31
+ issues: DockIssue[]
32
+ runs: DockRun[]
33
+ testSteps: TraceStep[] | null
34
+ payloadSource: string | null
35
+ runsUrl: string
36
+ /** The triggers a test run can start from; a picker shows when there are several. */
37
+ triggers?: Array<{ label: string; value: string }>
38
+ }>()
39
+
40
+ const tab = defineModel<DockTab>('tab', { default: 'problems' })
41
+ const payload = defineModel<string>('payload', { default: '{}' })
42
+ const collapsed = defineModel<boolean>('collapsed', { default: false })
43
+ const trigger = defineModel<string | undefined>('trigger')
44
+
45
+ const emit = defineEmits<{
46
+ (e: 'select-node', id: string): void
47
+ (e: 'open-trace', runId: string): void
48
+ }>()
49
+
50
+ const { processI18n } = useTranslation()
51
+ const { dateTimeFormat } = useRegionalFormat()
52
+
53
+ // Real runs only: a failed test of a draft says nothing of the procedure.
54
+ const failedRuns = computed(() => props.runs.filter((r) => r.status === 'failed' && r.kind !== 'test').length)
55
+ // A payload prefilled from a stored run says which secret headers it lacks.
56
+ const redactedHeaders = computed(() => redactedHeadersOf(payload.value))
57
+
58
+ const payloadError = computed(() => {
59
+ try {
60
+ JSON.parse(payload.value || 'null')
61
+ return null
62
+ } catch (e) {
63
+ return (e as Error).message
64
+ }
65
+ })
66
+
67
+ const tabs = computed(() => [
68
+ ...(props.testSteps ? [{ label: processI18n('$dms_automation.editor.dock.testRun'), value: 'test' }] : []),
69
+ { label: processI18n('$dms_automation.editor.dock.problems'), value: 'problems', badge: props.issues.length || undefined },
70
+ {
71
+ label: processI18n('$dms_automation.editor.dock.recentRuns'),
72
+ value: 'runs',
73
+ badge: failedRuns.value ? processI18n('$dms_automation.editor.dock.failedCount', { count: failedRuns.value }) : undefined,
74
+ },
75
+ { label: processI18n('$dms_automation.editor.dock.payload'), value: 'payload' },
76
+ ])
77
+
78
+ function durationOf(run: DockRun): number | null {
79
+ return run.endedAt ? new Date(run.endedAt).getTime() - new Date(run.startedAt).getTime() : null
80
+ }
81
+
82
+ function runLine(run: DockRun): string {
83
+ if (run.status !== 'failed') return processI18n('$dms_automation.feed.completedPlain')
84
+ const step = stepTitle(run.failedStep, processI18n)
85
+ return step ? `${step} · ${run.errorMessage ?? ''}` : (run.errorMessage ?? '')
86
+ }
87
+ </script>
88
+
89
+ <template>
90
+ <div class="flex min-h-0 flex-col border-t border-default bg-default" :class="collapsed ? '' : 'h-48'">
91
+ <div class="flex items-center justify-between gap-2 px-3">
92
+ <UTabs v-model="tab" :items="tabs" variant="link" size="xs" :content="false" @update:model-value="collapsed = false" />
93
+ <UButton
94
+ size="xs"
95
+ variant="ghost"
96
+ color="neutral"
97
+ :icon="collapsed ? 'i-ph-caret-up' : 'i-ph-caret-down'"
98
+ :aria-label="$t('dms_automation.editor.dock.toggle')"
99
+ @click="collapsed = !collapsed"
100
+ />
101
+ </div>
102
+ <div v-if="!collapsed" class="min-h-0 flex-1 overflow-y-auto border-t border-default">
103
+ <template v-if="tab === 'problems'">
104
+ <p v-if="issues.length === 0" class="flex items-center gap-2 p-3 text-xs text-muted">
105
+ <UIcon name="i-ph-check-circle" class="size-4 text-success" />
106
+ {{ $t('dms_automation.editor.dock.noProblems') }}
107
+ </p>
108
+ <div v-for="(issue, index) in issues" :key="index" class="flex items-center gap-3 border-b border-default px-3 py-2 text-xs">
109
+ <UIcon name="i-ph-warning" class="size-4 shrink-0" :class="issue.severity === 'error' ? 'text-error' : 'text-warning'" />
110
+ <span class="min-w-0 flex-1">
111
+ <span v-if="issue.nodeName" class="font-medium text-highlighted">{{ issue.nodeName }} — </span>
112
+ <span class="text-toned">{{ issue.message }}</span>
113
+ </span>
114
+ <UButton v-if="issue.nodeId" size="xs" variant="soft" color="neutral" @click="emit('select-node', issue.nodeId!)">
115
+ {{ $t('dms_automation.editor.dock.selectNode') }}
116
+ </UButton>
117
+ </div>
118
+ </template>
119
+
120
+ <template v-else-if="tab === 'runs'">
121
+ <p v-if="runs.length === 0" class="p-3 text-xs text-muted">{{ $t('dms_automation.editor.dock.noRuns') }}</p>
122
+ <button
123
+ v-for="run in runs"
124
+ :key="run._id"
125
+ type="button"
126
+ class="flex w-full items-center gap-3 border-b border-default px-3 py-2 text-left text-xs hover:bg-elevated/60"
127
+ @click="emit('open-trace', run._id)"
128
+ >
129
+ <UIcon
130
+ :name="run.status === 'failed' ? 'i-ph-x-circle' : 'i-ph-check-circle'"
131
+ class="size-4 shrink-0"
132
+ :class="run.status === 'failed' ? 'text-error' : 'text-success'"
133
+ />
134
+ <span class="min-w-0 flex-1 truncate" :class="run.status === 'failed' ? 'text-error' : 'text-toned'">{{ runLine(run) }}</span>
135
+ <UBadge v-if="run.kind === 'test'" size="sm" variant="subtle" color="info">{{ $t('dms_automation.runs.kind.test') }}</UBadge>
136
+ <span class="font-mono text-muted">{{ describeDuration(durationOf(run)) }}</span>
137
+ <span class="w-24 text-right font-mono text-dimmed">{{ describeTime(run.startedAt, dateTimeFormat) }}</span>
138
+ </button>
139
+ <DmsLink :to="runsUrl" class="block px-3 py-2 text-xs text-primary hover:underline">
140
+ {{ $t('dms_automation.editor.dock.allRuns') }}
141
+ </DmsLink>
142
+ </template>
143
+
144
+ <div v-else-if="tab === 'payload'" class="flex h-full flex-col gap-2 p-3">
145
+ <div v-if="(triggers?.length ?? 0) > 1" class="flex items-center gap-2 text-xs">
146
+ <label for="dock-test-trigger" class="shrink-0 text-muted">{{ $t('dms_automation.editor.dock.fromTrigger') }}</label>
147
+ <DmsSelect id="dock-test-trigger" v-model="trigger" :items="triggers" size="xs" class="min-w-48" />
148
+ </div>
149
+ <div class="flex items-center justify-between gap-2 text-xs">
150
+ <span class="text-muted">
151
+ {{ payloadSource ? $t('dms_automation.editor.dock.payloadFrom', { run: payloadSource.slice(-6) }) : $t('dms_automation.editor.dock.payloadHint') }}
152
+ </span>
153
+ <span v-if="payloadError" class="text-error">{{ $t('dms_automation.editor.dock.invalidJson') }}</span>
154
+ </div>
155
+ <p v-if="redactedHeaders.length" class="flex items-center gap-2 text-xs text-warning">
156
+ <UIcon name="i-ph-key" class="size-4 shrink-0" />
157
+ {{ $t('dms_automation.editor.dock.redactedHeaders', { headers: redactedHeaders.join(', ') }) }}
158
+ </p>
159
+ <UTextarea v-model="payload" :rows="5" class="w-full flex-1 font-mono text-xs" autoresize :maxrows="12" />
160
+ </div>
161
+
162
+ <div v-else-if="tab === 'test' && testSteps">
163
+ <p class="flex items-center gap-2 border-b border-default px-3 py-2 text-xs text-warning">
164
+ <UIcon name="i-ph-warning" class="size-4" />
165
+ {{ $t('dms_automation.editor.dock.sideEffects') }}
166
+ </p>
167
+ <button
168
+ v-for="(step, index) in testSteps"
169
+ :key="`${step.nodeId}-${index}`"
170
+ type="button"
171
+ class="flex w-full items-center gap-3 border-b border-default px-3 py-2 text-left text-xs hover:bg-elevated/60"
172
+ @click="emit('select-node', step.nodeId.split('__')[0]!)"
173
+ >
174
+ <UIcon
175
+ :name="step.status === 'failed' ? 'i-ph-x-circle' : 'i-ph-check-circle'"
176
+ class="size-4 shrink-0"
177
+ :class="step.status === 'failed' ? 'text-error' : 'text-success'"
178
+ />
179
+ <span class="min-w-0 flex-1 truncate" :class="step.status === 'failed' ? 'text-error' : 'text-toned'">
180
+ {{ stepTitle(step.name, processI18n) }}<template v-if="step.error"> · {{ step.error }}</template>
181
+ </span>
182
+ <span class="font-mono text-muted">{{ describeDuration(step.durationMs) }}</span>
183
+ <span class="w-16 text-right font-mono text-dimmed">+{{ step.startMs }} ms</span>
184
+ </button>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ </template>