@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.
- package/README.md +46 -2
- package/dist/data/procedures-table.d.ts +38 -4
- package/dist/data/procedures-table.js +264 -82
- package/dist/data/procedures-table.js.map +1 -1
- package/dist/data/runs-table.d.ts +19 -3
- package/dist/data/runs-table.js +254 -19
- package/dist/data/runs-table.js.map +1 -1
- package/dist/db/index.d.ts +1 -2
- package/dist/db/index.js +1 -2
- package/dist/db/index.js.map +1 -1
- package/dist/db/models/automation_template.model.d.ts +16 -1
- package/dist/db/models/automation_template.model.js +31 -11
- package/dist/db/models/automation_template.model.js.map +1 -1
- package/dist/db/models/index.d.ts +1 -1
- package/dist/db/models/index.js +1 -1
- package/dist/db/models/procedure.model.d.ts +1 -0
- package/dist/db/models/procedure.model.js +7 -0
- package/dist/db/models/procedure.model.js.map +1 -1
- package/dist/db/models/procedure_run.model.d.ts +16 -9
- package/dist/db/models/procedure_run.model.js +96 -17
- package/dist/db/models/procedure_run.model.js.map +1 -1
- package/dist/db/models/stats.model.d.ts +60 -61
- package/dist/db/models/stats.model.js +189 -236
- package/dist/db/models/stats.model.js.map +1 -1
- package/dist/db/models/type_switch.model.d.ts +25 -0
- package/dist/db/models/type_switch.model.js +25 -0
- package/dist/db/models/type_switch.model.js.map +1 -0
- package/dist/db/tables/index.d.ts +1 -2
- package/dist/db/tables/index.js +1 -2
- package/dist/db/tables/index.js.map +1 -1
- package/dist/db/tables/procedure.table.d.ts +6 -0
- package/dist/db/tables/procedure.table.js +24 -0
- package/dist/db/tables/procedure.table.js.map +1 -1
- package/dist/db/tables/procedure_run.table.d.ts +15 -1
- package/dist/db/tables/procedure_run.table.js +54 -0
- package/dist/db/tables/procedure_run.table.js.map +1 -1
- package/dist/db/tables/type_switch.table.d.ts +8 -0
- package/dist/db/tables/{trigger_type_config.table.js → type_switch.table.js} +16 -15
- package/dist/db/tables/type_switch.table.js.map +1 -0
- package/dist/displays/index.d.ts +14 -0
- package/dist/displays/index.js +23 -0
- package/dist/displays/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/pages/builder.d.ts +1 -1
- package/dist/pages/builder.js +10 -3
- package/dist/pages/builder.js.map +1 -1
- package/dist/pages/index.d.ts +2 -1
- package/dist/pages/index.js +2 -1
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/library.d.ts +2 -1
- package/dist/pages/library.js +54 -4
- package/dist/pages/library.js.map +1 -1
- package/dist/pages/overview.d.ts +6 -1
- package/dist/pages/overview.js +121 -2
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/procedures.js +106 -16
- package/dist/pages/procedures.js.map +1 -1
- package/dist/pages/runs.d.ts +4 -1
- package/dist/pages/runs.js +109 -13
- package/dist/pages/runs.js.map +1 -1
- package/dist/pages/shared.d.ts +18 -0
- package/dist/pages/shared.js +238 -0
- package/dist/pages/shared.js.map +1 -0
- package/dist/pages/trace.d.ts +10 -0
- package/dist/pages/trace.js +41 -0
- package/dist/pages/trace.js.map +1 -0
- package/dist/realtime.d.ts +3 -0
- package/dist/realtime.js +14 -0
- package/dist/realtime.js.map +1 -0
- package/dist/routes/action-types.d.ts +2 -14
- package/dist/routes/action-types.js +2 -32
- package/dist/routes/action-types.js.map +1 -1
- package/dist/routes/deleteConfirm.d.ts +3 -0
- package/dist/routes/deleteConfirm.js +64 -0
- package/dist/routes/deleteConfirm.js.map +1 -0
- package/dist/routes/graphSchema.d.ts +3 -90
- package/dist/routes/graphSchema.js +36 -9
- package/dist/routes/graphSchema.js.map +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/library.d.ts +40 -0
- package/dist/routes/library.js +147 -0
- package/dist/routes/library.js.map +1 -0
- package/dist/routes/procedureChecks.d.ts +16 -0
- package/dist/routes/procedureChecks.js +72 -0
- package/dist/routes/procedureChecks.js.map +1 -0
- package/dist/routes/procedureRuns.d.ts +21 -0
- package/dist/routes/procedureRuns.js +45 -0
- package/dist/routes/procedureRuns.js.map +1 -0
- package/dist/routes/procedureSchemas.d.ts +107 -0
- package/dist/routes/procedureSchemas.js +61 -0
- package/dist/routes/procedureSchemas.js.map +1 -0
- package/dist/routes/procedures.d.ts +125 -7
- package/dist/routes/procedures.js +363 -67
- package/dist/routes/procedures.js.map +1 -1
- package/dist/routes/requests.d.ts +15 -0
- package/dist/routes/requests.js +35 -0
- package/dist/routes/requests.js.map +1 -0
- package/dist/routes/runs.d.ts +107 -2
- package/dist/routes/runs.js +340 -37
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/stats.d.ts +19 -1
- package/dist/routes/stats.js +160 -4
- package/dist/routes/stats.js.map +1 -1
- package/dist/routes/templates.d.ts +6 -2
- package/dist/routes/templates.js +106 -36
- package/dist/routes/templates.js.map +1 -1
- package/dist/routes/trigger-types.d.ts +2 -15
- package/dist/routes/trigger-types.js +2 -32
- package/dist/routes/trigger-types.js.map +1 -1
- package/dist/routes/typeConfigShared.d.ts +7 -11
- package/dist/routes/typeConfigShared.js +25 -15
- package/dist/routes/typeConfigShared.js.map +1 -1
- package/dist/runtime/armErrors.d.ts +16 -0
- package/dist/runtime/armErrors.js +69 -0
- package/dist/runtime/armErrors.js.map +1 -0
- package/dist/runtime/boundRunLog.d.ts +24 -0
- package/dist/runtime/boundRunLog.js +202 -10
- package/dist/runtime/boundRunLog.js.map +1 -1
- package/dist/runtime/builtins/actions/http.d.ts +10 -1
- package/dist/runtime/builtins/actions/http.js +306 -19
- package/dist/runtime/builtins/actions/http.js.map +1 -1
- package/dist/runtime/builtins/actions/log.js +2 -2
- package/dist/runtime/builtins/actions/log.js.map +1 -1
- package/dist/runtime/builtins/data/boolean.d.ts +1 -0
- package/dist/runtime/builtins/data/boolean.js +18 -10
- package/dist/runtime/builtins/data/boolean.js.map +1 -1
- package/dist/runtime/builtins/data/compare.js +60 -11
- package/dist/runtime/builtins/data/compare.js.map +1 -1
- package/dist/runtime/builtins/data/constant.js +9 -12
- package/dist/runtime/builtins/data/constant.js.map +1 -1
- package/dist/runtime/builtins/data/json.js +4 -4
- package/dist/runtime/builtins/data/json.js.map +1 -1
- package/dist/runtime/builtins/data/math.js +44 -24
- package/dist/runtime/builtins/data/math.js.map +1 -1
- package/dist/runtime/builtins/data/object.js +10 -10
- package/dist/runtime/builtins/data/object.js.map +1 -1
- package/dist/runtime/builtins/data/string.js +31 -20
- package/dist/runtime/builtins/data/string.js.map +1 -1
- package/dist/runtime/builtins/nodes/action.js +4 -0
- package/dist/runtime/builtins/nodes/action.js.map +1 -1
- package/dist/runtime/builtins/nodes/delay.js +1 -1
- package/dist/runtime/builtins/nodes/delay.js.map +1 -1
- package/dist/runtime/builtins/nodes/forRange.d.ts +1 -1
- package/dist/runtime/builtins/nodes/forRange.js +10 -4
- package/dist/runtime/builtins/nodes/forRange.js.map +1 -1
- package/dist/runtime/builtins/nodes/if.js +2 -1
- package/dist/runtime/builtins/nodes/if.js.map +1 -1
- package/dist/runtime/builtins/nodes/parallel.js +9 -2
- package/dist/runtime/builtins/nodes/parallel.js.map +1 -1
- package/dist/runtime/builtins/nodes/retry.js +1 -1
- package/dist/runtime/builtins/nodes/retry.js.map +1 -1
- package/dist/runtime/builtins/nodes/setVariable.js +1 -3
- package/dist/runtime/builtins/nodes/setVariable.js.map +1 -1
- package/dist/runtime/builtins/triggers/cron.d.ts +3 -0
- package/dist/runtime/builtins/triggers/cron.js +21 -7
- package/dist/runtime/builtins/triggers/cron.js.map +1 -1
- package/dist/runtime/builtins/triggers/manual.js +2 -2
- package/dist/runtime/builtins/triggers/manual.js.map +1 -1
- package/dist/runtime/builtins/triggers/webhook.d.ts +14 -1
- package/dist/runtime/builtins/triggers/webhook.js +116 -30
- package/dist/runtime/builtins/triggers/webhook.js.map +1 -1
- package/dist/runtime/describe.d.ts +23 -0
- package/dist/runtime/describe.js +114 -0
- package/dist/runtime/describe.js.map +1 -0
- package/dist/runtime/executionResult.d.ts +1 -0
- package/dist/runtime/executor.js +82 -5
- package/dist/runtime/executor.js.map +1 -1
- package/dist/runtime/graphIssues.d.ts +20 -0
- package/dist/runtime/graphIssues.js +290 -0
- package/dist/runtime/graphIssues.js.map +1 -0
- package/dist/runtime/graphVersion.d.ts +2 -0
- package/dist/runtime/graphVersion.js +43 -0
- package/dist/runtime/graphVersion.js.map +1 -0
- package/dist/runtime/nodeKinds.d.ts +4 -4
- package/dist/runtime/nodeKinds.js +1 -2
- package/dist/runtime/nodeKinds.js.map +1 -1
- package/dist/runtime/registry.d.ts +2 -1
- package/dist/runtime/registry.js +1 -2
- package/dist/runtime/registry.js.map +1 -1
- package/dist/runtime/resolveInputs.d.ts +3 -1
- package/dist/runtime/resolveInputs.js +12 -2
- package/dist/runtime/resolveInputs.js.map +1 -1
- package/dist/runtime/resolveSubgraph.d.ts +12 -1
- package/dist/runtime/resolveSubgraph.js +36 -0
- package/dist/runtime/resolveSubgraph.js.map +1 -1
- package/dist/runtime/retention.d.ts +6 -0
- package/dist/runtime/retention.js +54 -0
- package/dist/runtime/retention.js.map +1 -0
- package/dist/runtime/runProcedure.d.ts +12 -0
- package/dist/runtime/runProcedure.js +130 -0
- package/dist/runtime/runProcedure.js.map +1 -0
- package/dist/runtime/schedule.d.ts +2 -0
- package/dist/runtime/schedule.js +139 -0
- package/dist/runtime/schedule.js.map +1 -0
- package/dist/runtime/subscriptions.d.ts +11 -1
- package/dist/runtime/subscriptions.js +91 -125
- package/dist/runtime/subscriptions.js.map +1 -1
- package/dist/runtime/subwalk.js +2 -3
- package/dist/runtime/subwalk.js.map +1 -1
- package/dist/runtime/templateUsages.d.ts +4 -0
- package/dist/runtime/templateUsages.js +102 -0
- package/dist/runtime/templateUsages.js.map +1 -0
- package/dist/runtime/topo.d.ts +1 -0
- package/dist/runtime/topo.js +23 -0
- package/dist/runtime/topo.js.map +1 -1
- package/dist/runtime/trace.d.ts +44 -0
- package/dist/runtime/trace.js +240 -0
- package/dist/runtime/trace.js.map +1 -0
- package/dist/runtime/typeSwitches.d.ts +3 -0
- package/dist/runtime/typeSwitches.js +27 -0
- package/dist/runtime/typeSwitches.js.map +1 -0
- package/dist/runtime/validate.d.ts +11 -0
- package/dist/runtime/validate.js +118 -61
- package/dist/runtime/validate.js.map +1 -1
- package/dist/runtime/webhookRoutes.d.ts +4 -0
- package/dist/runtime/webhookRoutes.js +68 -0
- package/dist/runtime/webhookRoutes.js.map +1 -0
- package/dist/runtime/withTimeout.d.ts +1 -0
- package/dist/runtime/withTimeout.js +17 -0
- package/dist/runtime/withTimeout.js.map +1 -0
- package/dist/runtime/wording.d.ts +10 -0
- package/dist/runtime/wording.js +118 -0
- package/dist/runtime/wording.js.map +1 -0
- package/dist/stats/health-banner.d.ts +13 -0
- package/dist/stats/health-banner.js +149 -0
- package/dist/stats/health-banner.js.map +1 -0
- package/dist/stats/health.d.ts +49 -0
- package/dist/stats/health.js +130 -0
- package/dist/stats/health.js.map +1 -0
- package/dist/stats/kpi.d.ts +21 -0
- package/dist/stats/kpi.js +101 -0
- package/dist/stats/kpi.js.map +1 -0
- package/dist/stats/overview.d.ts +94 -0
- package/dist/stats/overview.js +244 -0
- package/dist/stats/overview.js.map +1 -0
- package/dist/types/constants.d.ts +0 -1
- package/dist/types/constants.js +1 -2
- package/dist/types/constants.js.map +1 -1
- package/dist/types/runLog.d.ts +2 -0
- package/dist/types/runLog.js +4 -0
- package/dist/types/runLog.js.map +1 -1
- package/frontend-vue/app/components/AttentionList.vue +276 -0
- package/frontend-vue/app/components/Catalog/SchemaTable.vue +127 -0
- package/frontend-vue/app/components/Catalog.vue +457 -0
- package/frontend-vue/app/components/Editor/BottomDock.vue +188 -0
- package/frontend-vue/app/components/Editor/BuilderPalette.vue +105 -44
- package/frontend-vue/app/components/Editor/GraphCanvas.vue +822 -207
- package/frontend-vue/app/components/Editor/GroupPortEditor.vue +29 -18
- package/frontend-vue/app/components/Editor/JsonField.vue +3 -3
- package/frontend-vue/app/components/Editor/NewProcedureDialog.vue +108 -0
- package/frontend-vue/app/components/Editor/NodeInspector.vue +382 -104
- package/frontend-vue/app/components/Editor/ProcedureSwitcher.vue +147 -0
- package/frontend-vue/app/components/Editor/RunNowDialog.vue +145 -0
- package/frontend-vue/app/components/Editor/WiredField.vue +3 -3
- package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +97 -91
- package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +5 -6
- package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +3 -2
- package/frontend-vue/app/components/Editor/nodes/styles.ts +14 -18
- package/frontend-vue/app/components/Editor.vue +1894 -705
- package/frontend-vue/app/components/IconPicker.vue +122 -0
- package/frontend-vue/app/components/LiveTopics.vue +20 -0
- package/frontend-vue/app/components/Run/RunCompare.vue +115 -0
- package/frontend-vue/app/components/Run/RunFailure.vue +54 -0
- package/frontend-vue/app/components/Run/RunLogList.vue +167 -0
- package/frontend-vue/app/components/Run/RunPathTaken.vue +139 -0
- package/frontend-vue/app/components/Run/RunPayload.vue +85 -0
- package/frontend-vue/app/components/Run/RunWaterfall.vue +374 -0
- package/frontend-vue/app/components/RunPeek.vue +132 -0
- package/frontend-vue/app/components/RunTrace.vue +462 -0
- package/frontend-vue/app/components/Templates.vue +382 -537
- package/frontend-vue/app/components/WebhookEndpoint.vue +81 -0
- package/frontend-vue/app/composables/useAutomationNodeKinds.ts +23 -6
- package/frontend-vue/app/composables/useAutomationRuns.ts +160 -25
- package/frontend-vue/app/composables/useGraphConnect.ts +103 -51
- package/frontend-vue/app/composables/useRunActions.ts +60 -0
- package/frontend-vue/app/plugins/cell-displays.ts +169 -0
- package/frontend-vue/app/utils/automation.ts +4 -36
- package/frontend-vue/app/utils/describe.ts +252 -0
- package/frontend-vue/app/utils/redactedHeaders.ts +31 -0
- package/frontend-vue/dms.frontend.build.ts +7 -0
- package/frontend-vue/dms.frontend.ts +7 -4
- package/frontend-vue/i18n/locales/dms-automation-en-GB.json +1149 -309
- package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +1154 -314
- package/frontend-vue/package.json +1 -1
- package/package.json +8 -5
- package/dist/db/models/type_config.model.d.ts +0 -47
- package/dist/db/models/type_config.model.js +0 -51
- package/dist/db/models/type_config.model.js.map +0 -1
- package/dist/db/tables/action_type_config.table.d.ts +0 -7
- package/dist/db/tables/action_type_config.table.js +0 -35
- package/dist/db/tables/action_type_config.table.js.map +0 -1
- package/dist/db/tables/trigger_type_config.table.d.ts +0 -7
- package/dist/db/tables/trigger_type_config.table.js.map +0 -1
- package/frontend-vue/app/components/Actions.vue +0 -151
- package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +0 -166
- package/frontend-vue/app/components/Catalog/TypeList.vue +0 -198
- package/frontend-vue/app/components/DataNodes.vue +0 -272
- package/frontend-vue/app/components/Editor/ProcedureList.vue +0 -156
- package/frontend-vue/app/components/Editor/RunsDrawer.vue +0 -312
- package/frontend-vue/app/components/Library.vue +0 -69
- package/frontend-vue/app/components/Overview.vue +0 -503
- package/frontend-vue/app/components/RunDetailDrawer.vue +0 -165
- package/frontend-vue/app/components/RunFireTree.vue +0 -170
- package/frontend-vue/app/components/RunTraceDrawer.vue +0 -59
- package/frontend-vue/app/components/RunsStats.vue +0 -126
- package/frontend-vue/app/components/RunsTimelineDisplay.vue +0 -287
- package/frontend-vue/app/components/Triggers.vue +0 -147
- package/frontend-vue/app/plugins/runs-timeline-display.client.ts +0 -16
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { parsePayload, prettyJson } from '../../utils/describe'
|
|
4
|
+
|
|
5
|
+
// A run's trigger payload, pretty-printed and copyable. A body received as
|
|
6
|
+
// text (plain text, XML) is shown as it came, apart, with its own copy
|
|
7
|
+
// button. A payload too large to keep shows its stored preview, as text,
|
|
8
|
+
// with the size it had.
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
raw: string | undefined
|
|
12
|
+
kept: boolean
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const { locale } = useI18n()
|
|
16
|
+
|
|
17
|
+
const parsed = computed(() => parsePayload(props.raw ?? 'null'))
|
|
18
|
+
|
|
19
|
+
/** What the backend keeps of a payload too large: its size and a preview. */
|
|
20
|
+
const preview = computed(() => {
|
|
21
|
+
if (props.kept) return null
|
|
22
|
+
const marker = parsed.value as { originalBytes?: unknown; preview?: unknown } | null
|
|
23
|
+
return {
|
|
24
|
+
text: typeof marker?.preview === 'string' ? marker.preview : '',
|
|
25
|
+
bytes: typeof marker?.originalBytes === 'number' ? marker.originalBytes : null,
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
/** A webhook body that is text, not JSON: shown as received. */
|
|
30
|
+
const textBody = computed(() => {
|
|
31
|
+
if (!props.kept) return null
|
|
32
|
+
const envelope = parsed.value as { body?: unknown; headers?: Record<string, unknown> } | null
|
|
33
|
+
if (typeof envelope?.body !== 'string') return null
|
|
34
|
+
const type = envelope.headers?.['content-type']
|
|
35
|
+
return { text: envelope.body, type: typeof type === 'string' ? type : null }
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const text = computed(() => {
|
|
39
|
+
if (!textBody.value) return prettyJson(parsed.value)
|
|
40
|
+
// The body is shown on its own; the rest of the envelope stays JSON.
|
|
41
|
+
const { body: _body, ...rest } = parsed.value as Record<string, unknown>
|
|
42
|
+
return prettyJson(rest)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const bytes = computed(() => preview.value?.bytes ?? new Blob([props.raw ?? '']).size)
|
|
46
|
+
|
|
47
|
+
function describeBytes(value: number): string {
|
|
48
|
+
return `${new Intl.NumberFormat(locale.value, { maximumFractionDigits: 1 }).format(value / 1024)} kB`
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<div class="flex flex-col gap-2">
|
|
54
|
+
<template v-if="preview">
|
|
55
|
+
<DmsBanner
|
|
56
|
+
size="sm"
|
|
57
|
+
tone="warning"
|
|
58
|
+
icon="i-ph-warning"
|
|
59
|
+
:title="$t('dms_automation.trace.payloadTooLarge')"
|
|
60
|
+
:description="$t('dms_automation.trace.payloadTooLargeHint')"
|
|
61
|
+
/>
|
|
62
|
+
<div class="flex items-center justify-between gap-2 font-mono text-[10.5px] text-dimmed">
|
|
63
|
+
<span>{{ $t('dms_automation.trace.payloadPreview', { chars: preview.text.length, size: describeBytes(bytes) }) }}</span>
|
|
64
|
+
<DmsCopyButton :value="preview.text" />
|
|
65
|
+
</div>
|
|
66
|
+
<pre class="max-h-[28rem] overflow-auto rounded-md border border-default bg-elevated p-3 font-mono text-xs break-all whitespace-pre-wrap text-toned">{{ preview.text }}</pre>
|
|
67
|
+
</template>
|
|
68
|
+
<template v-else>
|
|
69
|
+
<div class="relative">
|
|
70
|
+
<pre class="max-h-[28rem] overflow-auto rounded-md border border-default bg-elevated p-3 font-mono text-xs text-toned">{{ text }}</pre>
|
|
71
|
+
<div class="absolute top-2 right-2 flex items-center gap-2">
|
|
72
|
+
<span class="font-mono text-[10.5px] text-dimmed">{{ describeBytes(bytes) }}</span>
|
|
73
|
+
<DmsCopyButton :value="textBody ? text : (raw ?? '')" />
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<template v-if="textBody">
|
|
77
|
+
<div class="flex items-center justify-between gap-2 font-mono text-[10.5px] text-dimmed uppercase">
|
|
78
|
+
<span>{{ $t('dms_automation.trace.payloadBody') }}<template v-if="textBody.type"> · <span class="normal-case">{{ textBody.type }}</span></template></span>
|
|
79
|
+
<DmsCopyButton :value="textBody.text" />
|
|
80
|
+
</div>
|
|
81
|
+
<pre class="max-h-[28rem] overflow-auto rounded-md border border-default bg-elevated p-3 font-mono text-xs break-words whitespace-pre-wrap text-toned">{{ textBody.text }}</pre>
|
|
82
|
+
</template>
|
|
83
|
+
</template>
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import type { SkippedStep, TraceStep } from '../../composables/useAutomationRuns'
|
|
4
|
+
import { describeDuration, prettyJson, stepTitle } from '../../utils/describe'
|
|
5
|
+
|
|
6
|
+
// The steps of a run on a time line: one row per step execution, named, with
|
|
7
|
+
// its duration bar placed where it ran. A click opens what it received and
|
|
8
|
+
// produced. The iterations of a loop (the attempts of a retry) fold under it,
|
|
9
|
+
// numbered; the failed ones stay visible when folded. A failure a Try/Catch
|
|
10
|
+
// or a Retry caught reads apart from the one that stopped the run. Steps that
|
|
11
|
+
// never ran are listed after the others, with why.
|
|
12
|
+
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
steps: TraceStep[]
|
|
15
|
+
skipped: SkippedStep[]
|
|
16
|
+
totalMs: number | null
|
|
17
|
+
/** Draw only the steps that ran (the "Path only" switch). */
|
|
18
|
+
pathOnly?: boolean
|
|
19
|
+
/** Log entries dropped to keep the run small: the time line has a gap. */
|
|
20
|
+
truncated?: number
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const { processI18n } = useTranslation()
|
|
24
|
+
const open = ref<Set<number>>(new Set())
|
|
25
|
+
// Groups of iterations the reader folded or unfolded, against their default.
|
|
26
|
+
const toggledGroups = ref<Set<number>>(new Set())
|
|
27
|
+
|
|
28
|
+
const KIND_ICONS: Record<string, string> = {
|
|
29
|
+
trigger: 'i-ph-lightning',
|
|
30
|
+
action: 'i-ph-play-circle',
|
|
31
|
+
if: 'i-ph-git-branch',
|
|
32
|
+
switch: 'i-ph-arrows-split',
|
|
33
|
+
foreach: 'i-ph-repeat',
|
|
34
|
+
forRange: 'i-ph-repeat',
|
|
35
|
+
retry: 'i-ph-arrow-clockwise',
|
|
36
|
+
tryCatch: 'i-ph-shield-check',
|
|
37
|
+
parallel: 'i-ph-git-fork',
|
|
38
|
+
delay: 'i-ph-hourglass',
|
|
39
|
+
setVariable: 'i-ph-pencil-simple',
|
|
40
|
+
group: 'i-ph-stack',
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// A loop with this many iterations or fewer shows them unfolded.
|
|
44
|
+
const UNFOLDED_ITERATIONS = 3
|
|
45
|
+
// Deeper nesting stops indenting, so the names keep their room.
|
|
46
|
+
const MAX_INDENT = 6
|
|
47
|
+
|
|
48
|
+
type Tone = 'ok' | 'failed' | 'handled' | 'running' | 'truncated'
|
|
49
|
+
|
|
50
|
+
function toneOf(step: TraceStep): Tone {
|
|
51
|
+
if (step.status === 'failed') return step.handled ? 'handled' : 'failed'
|
|
52
|
+
return step.status
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const BAR_CLASS: Record<Tone, string> = {
|
|
56
|
+
ok: 'bg-success/70',
|
|
57
|
+
failed: 'bg-error',
|
|
58
|
+
handled: 'bg-warning',
|
|
59
|
+
running: 'bg-info animate-pulse',
|
|
60
|
+
truncated: 'bg-accented',
|
|
61
|
+
}
|
|
62
|
+
const TEXT_CLASS: Record<Tone, string> = {
|
|
63
|
+
ok: 'text-muted',
|
|
64
|
+
failed: 'text-error',
|
|
65
|
+
handled: 'text-warning',
|
|
66
|
+
running: 'text-muted',
|
|
67
|
+
truncated: 'text-muted',
|
|
68
|
+
}
|
|
69
|
+
const ROW_CLASS: Record<Tone, string> = { ok: '', failed: 'bg-error/5', handled: 'bg-warning/5', running: '', truncated: '' }
|
|
70
|
+
|
|
71
|
+
const span = computed(() => {
|
|
72
|
+
const ends = props.steps.map((s) => s.startMs + (s.durationMs ?? 0))
|
|
73
|
+
return Math.max(props.totalMs ?? 0, ...ends, 1)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
function barStyle(startMs: number, durationMs: number | null) {
|
|
77
|
+
const left = (startMs / span.value) * 100
|
|
78
|
+
const width = Math.max(((durationMs ?? 0) / span.value) * 100, 0.6)
|
|
79
|
+
return { left: `${left}%`, width: `${Math.min(width, 100 - left)}%` }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function indent(depth: number) {
|
|
83
|
+
return { paddingInlineStart: `${Math.min(depth, MAX_INDENT)}rem` }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The steps each step started (a loop's body, a try, a retry's attempts). */
|
|
87
|
+
const children = computed(() => {
|
|
88
|
+
const map = new Map<number, number[]>()
|
|
89
|
+
props.steps.forEach((step, index) => {
|
|
90
|
+
if (step.parent === undefined) return
|
|
91
|
+
const list = map.get(step.parent) ?? []
|
|
92
|
+
list.push(index)
|
|
93
|
+
map.set(step.parent, list)
|
|
94
|
+
})
|
|
95
|
+
return map
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
/** The fires holding a failure, at any depth, the ones that stopped the run apart. */
|
|
99
|
+
function firesWith(failure: (step: TraceStep) => boolean): Set<string> {
|
|
100
|
+
const fires = new Set<string>()
|
|
101
|
+
for (const step of props.steps) {
|
|
102
|
+
if (!failure(step)) continue
|
|
103
|
+
let current: TraceStep | undefined = step
|
|
104
|
+
while (current) {
|
|
105
|
+
fires.add(current.fireId)
|
|
106
|
+
current = current.parent === undefined ? undefined : props.steps[current.parent]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return fires
|
|
110
|
+
}
|
|
111
|
+
// Iterations holding a failure stay visible when folded.
|
|
112
|
+
const failingFires = computed(() => firesWith((s) => s.status === 'failed'))
|
|
113
|
+
const fatalFires = computed(() => firesWith((s) => s.status === 'failed' && !s.handled))
|
|
114
|
+
|
|
115
|
+
interface StepRow {
|
|
116
|
+
type: 'step'
|
|
117
|
+
index: number
|
|
118
|
+
step: TraceStep
|
|
119
|
+
/** "#3", "attempt 2", or the port (try, catch) the step ran under. */
|
|
120
|
+
tag?: string
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface GroupRow {
|
|
124
|
+
type: 'group'
|
|
125
|
+
parent: number
|
|
126
|
+
depth: number
|
|
127
|
+
count: number
|
|
128
|
+
attempts: boolean
|
|
129
|
+
failed: number
|
|
130
|
+
/** Every failure in it was caught. */
|
|
131
|
+
handled: boolean
|
|
132
|
+
startMs: number
|
|
133
|
+
durationMs: number
|
|
134
|
+
unfolded: boolean
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function tagOf(step: TraceStep): string | undefined {
|
|
138
|
+
const parent = step.parent === undefined ? undefined : props.steps[step.parent]
|
|
139
|
+
if (step.iteration !== undefined) {
|
|
140
|
+
return parent?.name.kind === 'retry'
|
|
141
|
+
? processI18n('$dms_automation.trace.attempt', { n: step.iteration + 1 })
|
|
142
|
+
: `#${step.iteration + 1}`
|
|
143
|
+
}
|
|
144
|
+
return step.port && step.port !== 'body' ? step.port : undefined
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** The fires a step started, in order, each with its direct steps. */
|
|
148
|
+
function firesUnder(index: number) {
|
|
149
|
+
const fires = new Map<string, number[]>()
|
|
150
|
+
for (const child of children.value.get(index) ?? []) {
|
|
151
|
+
const fireId = props.steps[child]!.fireId
|
|
152
|
+
fires.set(fireId, [...(fires.get(fireId) ?? []), child])
|
|
153
|
+
}
|
|
154
|
+
return [...fires.entries()]
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function groupRow(index: number, fires: Array<[string, number[]]>, unfolded: boolean): GroupRow {
|
|
158
|
+
const kids = fires.flatMap(([, list]) => list).map((i) => props.steps[i]!)
|
|
159
|
+
const startMs = Math.min(...kids.map((s) => s.startMs))
|
|
160
|
+
const endMs = Math.max(...kids.map((s) => s.startMs + (s.durationMs ?? 0)))
|
|
161
|
+
return {
|
|
162
|
+
type: 'group',
|
|
163
|
+
parent: index,
|
|
164
|
+
depth: props.steps[index]!.depth + 1,
|
|
165
|
+
count: fires.length,
|
|
166
|
+
attempts: props.steps[index]!.name.kind === 'retry',
|
|
167
|
+
failed: fires.filter(([fireId]) => failingFires.value.has(fireId)).length,
|
|
168
|
+
handled: !fires.some(([fireId]) => fatalFires.value.has(fireId)),
|
|
169
|
+
startMs,
|
|
170
|
+
durationMs: endMs - startMs,
|
|
171
|
+
unfolded,
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const rows = computed(() => {
|
|
176
|
+
const out: Array<StepRow | GroupRow> = []
|
|
177
|
+
const visit = (index: number) => {
|
|
178
|
+
const step = props.steps[index]!
|
|
179
|
+
out.push({ type: 'step', index, step, tag: tagOf(step) })
|
|
180
|
+
const fires = firesUnder(index)
|
|
181
|
+
const iterated = fires.length > 1 && props.steps[fires[0]![1][0]!]!.iteration !== undefined
|
|
182
|
+
if (!iterated) {
|
|
183
|
+
for (const [, list] of fires) list.forEach(visit)
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
const unfolded = (fires.length <= UNFOLDED_ITERATIONS) !== toggledGroups.value.has(index)
|
|
187
|
+
out.push(groupRow(index, fires, unfolded))
|
|
188
|
+
for (const [fireId, list] of fires) {
|
|
189
|
+
if (unfolded || failingFires.value.has(fireId)) list.forEach(visit)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
props.steps.forEach((step, index) => {
|
|
193
|
+
if (step.parent === undefined) visit(index)
|
|
194
|
+
})
|
|
195
|
+
return out
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
function toggle(index: number) {
|
|
199
|
+
const next = new Set(open.value)
|
|
200
|
+
if (next.has(index)) next.delete(index)
|
|
201
|
+
else next.add(index)
|
|
202
|
+
open.value = next
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function toggleGroup(parent: number) {
|
|
206
|
+
const next = new Set(toggledGroups.value)
|
|
207
|
+
if (next.has(parent)) next.delete(parent)
|
|
208
|
+
else next.add(parent)
|
|
209
|
+
toggledGroups.value = next
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** One line saying what the step produced, or the branch it took. */
|
|
213
|
+
function outcome(step: TraceStep): string {
|
|
214
|
+
if (step.status === 'failed') return step.error ?? ''
|
|
215
|
+
if (step.status === 'truncated') return processI18n('$dms_automation.trace.cutFromLog')
|
|
216
|
+
if (step.branch) return `→ ${step.branch}`
|
|
217
|
+
const output = (step.output as { value?: unknown } | undefined)?.value
|
|
218
|
+
if (output === undefined || output === null) return ''
|
|
219
|
+
if (typeof output !== 'object') return `→ ${String(output)}`
|
|
220
|
+
const status = (output as Record<string, unknown>).status
|
|
221
|
+
if (typeof status === 'number') return `→ ${status}`
|
|
222
|
+
const keys = Object.keys(output)
|
|
223
|
+
return keys.length ? `→ { ${keys.slice(0, 3).join(', ')}${keys.length > 3 ? ', …' : ''} }` : ''
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function unwrap(described: unknown): unknown {
|
|
227
|
+
if (!described || typeof described !== 'object') return described
|
|
228
|
+
if ('value' in described && 'type' in described) return (described as { value: unknown }).value
|
|
229
|
+
return Object.fromEntries(
|
|
230
|
+
Object.entries(described as Record<string, unknown>).map(([k, v]) => [k, unwrap(v)]),
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Five ticks on a wide time line, three on a narrow one; a run of a few
|
|
235
|
+
// milliseconds gets only its start and its end, never the same tick twice.
|
|
236
|
+
const QUARTERS = [0, 0.25, 0.5, 0.75, 1]
|
|
237
|
+
const SHORT_SPAN_MS = 10
|
|
238
|
+
const ticks = computed(() => {
|
|
239
|
+
const fractions = span.value < SHORT_SPAN_MS ? [0, 1] : QUARTERS
|
|
240
|
+
const seen = new Set<string>()
|
|
241
|
+
return fractions
|
|
242
|
+
.map((f) => ({ label: describeDuration(span.value * f), quarter: f === 0.25 || f === 0.75 }))
|
|
243
|
+
.filter((tick) => !seen.has(tick.label) && seen.add(tick.label))
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
// The row layout: the name and the time on one line and the bar under them
|
|
247
|
+
// in a narrow column (a phone, the side panel); name, bar and time side by
|
|
248
|
+
// side when there is room.
|
|
249
|
+
const ROW_GRID = 'grid grid-cols-[minmax(0,1fr)_4.5rem] items-center gap-x-3 gap-y-1.5 @xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_4.5rem]'
|
|
250
|
+
const BAR_CELL = 'order-last col-span-2 @xl:order-none @xl:col-span-1'
|
|
251
|
+
</script>
|
|
252
|
+
|
|
253
|
+
<template>
|
|
254
|
+
<div class="@container flex flex-col">
|
|
255
|
+
<DmsBanner
|
|
256
|
+
v-if="truncated"
|
|
257
|
+
size="sm"
|
|
258
|
+
tone="warning"
|
|
259
|
+
icon="i-ph-scissors"
|
|
260
|
+
class="m-3"
|
|
261
|
+
:title="$t('dms_automation.trace.truncatedTitle', { count: truncated })"
|
|
262
|
+
:description="$t('dms_automation.trace.truncatedHint')"
|
|
263
|
+
/>
|
|
264
|
+
|
|
265
|
+
<div :class="ROW_GRID" class="border-b border-default px-3 pb-2 font-mono text-[10.5px] text-dimmed uppercase">
|
|
266
|
+
<span>{{ $t('dms_automation.trace.step') }}</span>
|
|
267
|
+
<span :class="BAR_CELL" class="flex justify-between normal-case">
|
|
268
|
+
<span v-for="tick in ticks" :key="tick.label" :class="tick.quarter ? '@max-xl:hidden' : ''">{{ tick.label }}</span>
|
|
269
|
+
</span>
|
|
270
|
+
<span class="text-right">{{ $t('dms_automation.trace.time') }}</span>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<template v-for="row in rows" :key="row.type === 'step' ? `s${row.index}` : `g${row.parent}`">
|
|
274
|
+
<button
|
|
275
|
+
v-if="row.type === 'group'"
|
|
276
|
+
type="button"
|
|
277
|
+
:class="ROW_GRID"
|
|
278
|
+
class="border-b border-default px-3 py-1.5 text-left hover:bg-elevated/60"
|
|
279
|
+
:aria-expanded="row.unfolded"
|
|
280
|
+
@click="toggleGroup(row.parent)"
|
|
281
|
+
>
|
|
282
|
+
<span class="flex min-w-0 items-center gap-2 text-xs text-muted" :style="indent(row.depth)">
|
|
283
|
+
<UIcon :name="row.unfolded ? 'i-ph-caret-down' : 'i-ph-caret-right'" class="size-3.5 shrink-0" />
|
|
284
|
+
<span class="truncate">
|
|
285
|
+
{{ $t(row.attempts ? 'dms_automation.trace.attempts' : 'dms_automation.trace.iterations', { count: row.count }, row.count) }}
|
|
286
|
+
<template v-if="row.failed">
|
|
287
|
+
· <span :class="row.handled ? 'text-warning' : 'text-error'">{{ $t('dms_automation.trace.iterationsFailed', { count: row.failed }) }}</span>
|
|
288
|
+
</template>
|
|
289
|
+
</span>
|
|
290
|
+
</span>
|
|
291
|
+
<span :class="BAR_CELL" class="relative h-1.5 rounded-full bg-elevated">
|
|
292
|
+
<span class="absolute top-0 h-1.5 rounded-full bg-accented" :style="barStyle(row.startMs, row.durationMs)" />
|
|
293
|
+
</span>
|
|
294
|
+
<span class="text-right font-mono text-xs text-muted tabular-nums">{{ describeDuration(row.durationMs) }}</span>
|
|
295
|
+
</button>
|
|
296
|
+
|
|
297
|
+
<template v-else>
|
|
298
|
+
<button
|
|
299
|
+
type="button"
|
|
300
|
+
:class="[ROW_GRID, ROW_CLASS[toneOf(row.step)]]"
|
|
301
|
+
class="border-b border-default px-3 py-2 text-left hover:bg-elevated/60"
|
|
302
|
+
:aria-expanded="open.has(row.index)"
|
|
303
|
+
@click="toggle(row.index)"
|
|
304
|
+
>
|
|
305
|
+
<span class="flex min-w-0 items-center gap-2" :style="indent(row.step.depth)">
|
|
306
|
+
<UIcon
|
|
307
|
+
:name="KIND_ICONS[row.step.name.kind ?? ''] ?? 'i-ph-circle'"
|
|
308
|
+
class="size-4 shrink-0"
|
|
309
|
+
:class="TEXT_CLASS[toneOf(row.step)]"
|
|
310
|
+
/>
|
|
311
|
+
<span class="flex min-w-0 flex-col">
|
|
312
|
+
<span class="flex min-w-0 items-center gap-1.5">
|
|
313
|
+
<span class="truncate text-sm text-highlighted">{{ stepTitle(row.step.name, processI18n) }}</span>
|
|
314
|
+
<UBadge v-if="row.tag" color="neutral" variant="soft" size="sm" class="shrink-0 font-mono">{{ row.tag }}</UBadge>
|
|
315
|
+
<UBadge v-if="row.step.handled" color="warning" variant="subtle" size="sm" class="shrink-0">
|
|
316
|
+
{{ $t('dms_automation.trace.handled') }}
|
|
317
|
+
</UBadge>
|
|
318
|
+
</span>
|
|
319
|
+
<span class="truncate font-mono text-[11px]" :class="row.step.status === 'failed' ? TEXT_CLASS[toneOf(row.step)] : 'text-muted'">
|
|
320
|
+
{{ outcome(row.step) || (row.step.name.typeName ? processI18n(row.step.name.typeName) : row.step.name.kind) }}
|
|
321
|
+
</span>
|
|
322
|
+
</span>
|
|
323
|
+
</span>
|
|
324
|
+
<span :class="BAR_CELL" class="relative h-2 rounded-full bg-elevated">
|
|
325
|
+
<span class="absolute top-0 h-2 rounded-full" :class="BAR_CLASS[toneOf(row.step)]" :style="barStyle(row.step.startMs, row.step.durationMs)" />
|
|
326
|
+
</span>
|
|
327
|
+
<span class="text-right font-mono text-xs tabular-nums" :class="TEXT_CLASS[toneOf(row.step)]">
|
|
328
|
+
{{ describeDuration(row.step.durationMs) }}
|
|
329
|
+
</span>
|
|
330
|
+
</button>
|
|
331
|
+
<div v-if="open.has(row.index)" class="grid gap-3 border-b border-default bg-elevated/40 px-3 py-3 @2xl:grid-cols-2">
|
|
332
|
+
<div class="flex min-w-0 flex-col gap-1">
|
|
333
|
+
<span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.trace.input') }}</span>
|
|
334
|
+
<pre class="max-h-64 overflow-auto rounded-md bg-default p-2 font-mono text-xs text-toned">{{ prettyJson(unwrap(row.step.inputs)) || '—' }}</pre>
|
|
335
|
+
</div>
|
|
336
|
+
<div class="flex min-w-0 flex-col gap-1">
|
|
337
|
+
<span class="font-mono text-[10.5px] text-dimmed uppercase">
|
|
338
|
+
{{ row.step.status === 'failed' ? $t('dms_automation.trace.error') : $t('dms_automation.trace.output') }}
|
|
339
|
+
</span>
|
|
340
|
+
<pre
|
|
341
|
+
class="max-h-64 overflow-auto rounded-md bg-default p-2 font-mono text-xs whitespace-pre-wrap"
|
|
342
|
+
:class="row.step.status === 'failed' ? TEXT_CLASS[toneOf(row.step)] : 'text-toned'"
|
|
343
|
+
>{{ row.step.status === 'failed' ? row.step.error : prettyJson(unwrap(row.step.output)) || '—' }}</pre>
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
</template>
|
|
347
|
+
</template>
|
|
348
|
+
|
|
349
|
+
<template v-if="!pathOnly">
|
|
350
|
+
<div
|
|
351
|
+
v-for="step in skipped"
|
|
352
|
+
:key="`skipped-${step.nodeId}`"
|
|
353
|
+
:class="ROW_GRID"
|
|
354
|
+
class="border-b border-default px-3 py-2"
|
|
355
|
+
>
|
|
356
|
+
<span class="flex min-w-0 items-center gap-2">
|
|
357
|
+
<UIcon name="i-ph-circle-dashed" class="size-4 shrink-0 text-muted" />
|
|
358
|
+
<span class="flex min-w-0 flex-col">
|
|
359
|
+
<span class="truncate text-sm text-muted">{{ stepTitle(step.name, processI18n) }}</span>
|
|
360
|
+
<span class="truncate font-mono text-[11px] text-muted">
|
|
361
|
+
{{ step.reason === 'stopped' ? $t('dms_automation.trace.notReached') : $t('dms_automation.trace.branchNotTaken') }}
|
|
362
|
+
</span>
|
|
363
|
+
</span>
|
|
364
|
+
</span>
|
|
365
|
+
<span :class="BAR_CELL" class="h-2 rounded-full border border-dashed border-default" />
|
|
366
|
+
<span class="text-right font-mono text-xs text-muted">{{ $t('dms_automation.trace.skipped') }}</span>
|
|
367
|
+
</div>
|
|
368
|
+
</template>
|
|
369
|
+
|
|
370
|
+
<p v-if="steps.length === 0" class="px-3 py-6 text-center text-sm text-muted">
|
|
371
|
+
{{ $t('dms_automation.trace.noSteps') }}
|
|
372
|
+
</p>
|
|
373
|
+
</div>
|
|
374
|
+
</template>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watch } from 'vue'
|
|
3
|
+
import { builderRunUrl, opensInBuilder, type RunDetail, useAutomationRuns } from '../composables/useAutomationRuns'
|
|
4
|
+
import { useRunActions } from '../composables/useRunActions'
|
|
5
|
+
import { describeDateTime, describeDuration } from '../utils/describe'
|
|
6
|
+
|
|
7
|
+
// The quick look at a run, in the run history's side panel: what it did, where
|
|
8
|
+
// it failed, the path it took and its payload, with the next actions. The DMS
|
|
9
|
+
// panel draws the header, "Run x of y" and the J / K navigation.
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
rowData?: { _id?: string }
|
|
13
|
+
apiUrl: string
|
|
14
|
+
traceUrl: string
|
|
15
|
+
builderUrl: string
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const router = useDmsRouter()
|
|
19
|
+
const { processText } = useComposedText()
|
|
20
|
+
const { t, locale } = useI18n()
|
|
21
|
+
const { dateTimeFormat } = useRegionalFormat()
|
|
22
|
+
const runs = useAutomationRuns(props.apiUrl)
|
|
23
|
+
const { rerun, rerunning } = useRunActions({ apiUrl: props.apiUrl, traceUrl: props.traceUrl })
|
|
24
|
+
|
|
25
|
+
const run = ref<RunDetail | null>(null)
|
|
26
|
+
const loading = ref(true)
|
|
27
|
+
const error = ref<string | null>(null)
|
|
28
|
+
const section = ref<'summary' | 'payload' | 'logs'>('summary')
|
|
29
|
+
|
|
30
|
+
async function load(id: string | undefined) {
|
|
31
|
+
if (!id) return
|
|
32
|
+
loading.value = true
|
|
33
|
+
try {
|
|
34
|
+
run.value = await runs.getRun(id)
|
|
35
|
+
error.value = null
|
|
36
|
+
} catch (e) {
|
|
37
|
+
error.value = describeApiError(e)
|
|
38
|
+
} finally {
|
|
39
|
+
loading.value = false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
watch(() => props.rowData?._id, (id) => void load(id), { immediate: true })
|
|
44
|
+
|
|
45
|
+
const failed = computed(() => run.value?.status === 'failed')
|
|
46
|
+
const procedureName = computed(
|
|
47
|
+
() => run.value?.procedure?.name ?? run.value?.procedureName ?? t('dms_automation.feed.deletedProcedure'),
|
|
48
|
+
)
|
|
49
|
+
const names = computed(() => new Map((run.value?.trace.steps ?? []).map((s) => [s.nodeId, s.name])))
|
|
50
|
+
|
|
51
|
+
const when = computed(() => describeDateTime(run.value?.startedAt, dateTimeFormat))
|
|
52
|
+
|
|
53
|
+
const sections = computed(() => [
|
|
54
|
+
{ label: t('dms_automation.trace.tabs.summary'), value: 'summary' },
|
|
55
|
+
{ label: t('dms_automation.trace.tabs.payload'), value: 'payload' },
|
|
56
|
+
{ label: t('dms_automation.trace.tabs.logs'), value: 'logs', badge: run.value?.logCount ?? run.value?.logs?.entries.length },
|
|
57
|
+
])
|
|
58
|
+
|
|
59
|
+
function go(url: string) {
|
|
60
|
+
void router.push(url)
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<div class="flex flex-col gap-4">
|
|
66
|
+
<div v-if="loading && !run" class="flex flex-col gap-3">
|
|
67
|
+
<USkeleton class="h-6 w-60" />
|
|
68
|
+
<USkeleton class="h-24 w-full" />
|
|
69
|
+
<USkeleton class="h-40 w-full" />
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<DmsEmptyState v-else-if="error && !run" variant="error" :title="$t('dms_automation.trace.loadError')" :description="error" />
|
|
73
|
+
|
|
74
|
+
<template v-else-if="run">
|
|
75
|
+
<div class="flex flex-col gap-1">
|
|
76
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
77
|
+
<h3 class="text-base font-semibold text-highlighted">{{ procedureName }}</h3>
|
|
78
|
+
<DmsStatusPill
|
|
79
|
+
:tone="failed ? 'error' : 'success'"
|
|
80
|
+
:label="failed ? $t('dms_automation.runs.status.failed') : $t('dms_automation.runs.status.ok')"
|
|
81
|
+
size="sm"
|
|
82
|
+
/>
|
|
83
|
+
<UBadge v-if="run.kind === 'test'" color="info" variant="subtle" size="sm">{{ $t('dms_automation.runs.kind.test') }}</UBadge>
|
|
84
|
+
<UBadge v-if="!run.procedure" color="neutral" variant="subtle" size="sm">{{ $t('dms_automation.trace.deleted') }}</UBadge>
|
|
85
|
+
</div>
|
|
86
|
+
<p class="text-xs text-muted">
|
|
87
|
+
{{ when }} · {{ describeDuration(run.durationMs, locale) }} · {{ processText(run.triggerText) }}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<UTabs v-model="section" :items="sections" variant="link" :content="false" size="sm" />
|
|
92
|
+
|
|
93
|
+
<template v-if="section === 'summary'">
|
|
94
|
+
<DmsAutomationRunFailure v-if="failed" :run="run" :trace-url="traceUrl" />
|
|
95
|
+
<div class="flex flex-col gap-2">
|
|
96
|
+
<DmsEyebrow as="h4" :label="$t('dms_automation.trace.pathTaken')" />
|
|
97
|
+
<DmsAutomationRunPathTaken :run="run" :builder-url="builderUrl" />
|
|
98
|
+
</div>
|
|
99
|
+
<div class="flex flex-col gap-2">
|
|
100
|
+
<DmsEyebrow as="h4" :label="$t('dms_automation.trace.tabs.steps')" />
|
|
101
|
+
<DmsAutomationRunWaterfall :steps="run.trace.steps" :skipped="[]" :total-ms="run.durationMs" :truncated="run.trace.truncated" path-only />
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
<DmsAutomationRunPayload v-else-if="section === 'payload'" :raw="run.triggerPayload" :kept="run.payloadKept" />
|
|
105
|
+
<DmsAutomationRunLogList v-else :api-url="apiUrl" :run-id="run._id" :log="run.logs" :names="names" />
|
|
106
|
+
|
|
107
|
+
<!-- One line in a narrow panel: Re-run as an icon, its name in a tooltip. -->
|
|
108
|
+
<div class="sticky bottom-0 flex items-center gap-2 border-t border-default bg-default pt-3">
|
|
109
|
+
<UTooltip v-if="run.procedure && run.payloadKept" :text="$t('dms_automation.runs.rerunWithPayload')">
|
|
110
|
+
<UButton
|
|
111
|
+
color="neutral"
|
|
112
|
+
variant="outline"
|
|
113
|
+
icon="i-ph-arrow-clockwise"
|
|
114
|
+
:aria-label="$t('dms_automation.runs.rerunWithPayload')"
|
|
115
|
+
:loading="rerunning"
|
|
116
|
+
@click="rerun(run._id, procedureName)"
|
|
117
|
+
/>
|
|
118
|
+
</UTooltip>
|
|
119
|
+
<UButton color="neutral" variant="outline" icon="i-ph-path" @click="go(`${traceUrl}?run=${encodeURIComponent(run._id)}`)">
|
|
120
|
+
{{ $t('dms_automation.runs.trace') }}
|
|
121
|
+
</UButton>
|
|
122
|
+
<UTooltip v-if="run.procedure" :text="opensInBuilder(run) ? '' : $t('dms_automation.trace.builderDraftHint')" :disabled="opensInBuilder(run)">
|
|
123
|
+
<span class="ml-auto inline-flex">
|
|
124
|
+
<UButton color="primary" icon="i-ph-bug" :disabled="!opensInBuilder(run)" @click="go(builderRunUrl(builderUrl, run))">
|
|
125
|
+
{{ $t('dms_automation.trace.debugInBuilder') }}
|
|
126
|
+
</UButton>
|
|
127
|
+
</span>
|
|
128
|
+
</UTooltip>
|
|
129
|
+
</div>
|
|
130
|
+
</template>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|