@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,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>
|