@antelopejs/dms-automation 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +95 -0
- package/dist/cluster/bus.d.ts +17 -0
- package/dist/cluster/bus.js +82 -0
- package/dist/cluster/bus.js.map +1 -0
- package/dist/cluster/instance.d.ts +1 -0
- package/dist/cluster/instance.js +6 -0
- package/dist/cluster/instance.js.map +1 -0
- package/dist/cluster/leader.d.ts +7 -0
- package/dist/cluster/leader.js +123 -0
- package/dist/cluster/leader.js.map +1 -0
- package/dist/cluster/mode.d.ts +3 -0
- package/dist/cluster/mode.js +25 -0
- package/dist/cluster/mode.js.map +1 -0
- package/dist/data/procedures-table.d.ts +66 -0
- package/dist/data/procedures-table.js +271 -0
- package/dist/data/procedures-table.js.map +1 -0
- package/dist/data/runs-table.d.ts +23 -0
- package/dist/data/runs-table.js +125 -0
- package/dist/data/runs-table.js.map +1 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.js +24 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/models/automation_template.model.d.ts +58 -0
- package/dist/db/models/automation_template.model.js +134 -0
- package/dist/db/models/automation_template.model.js.map +1 -0
- package/dist/db/models/index.d.ts +3 -0
- package/dist/db/models/index.js +20 -0
- package/dist/db/models/index.js.map +1 -0
- package/dist/db/models/procedure.model.d.ts +25 -0
- package/dist/db/models/procedure.model.js +28 -0
- package/dist/db/models/procedure.model.js.map +1 -0
- package/dist/db/models/procedure_run.model.d.ts +34 -0
- package/dist/db/models/procedure_run.model.js +39 -0
- package/dist/db/models/procedure_run.model.js.map +1 -0
- package/dist/db/models/stats.model.d.ts +73 -0
- package/dist/db/models/stats.model.js +267 -0
- package/dist/db/models/stats.model.js.map +1 -0
- package/dist/db/models/type_config.model.d.ts +47 -0
- package/dist/db/models/type_config.model.js +51 -0
- package/dist/db/models/type_config.model.js.map +1 -0
- package/dist/db/tables/action_type_config.table.d.ts +7 -0
- package/dist/db/tables/action_type_config.table.js +35 -0
- package/dist/db/tables/action_type_config.table.js.map +1 -0
- package/dist/db/tables/automation_template.table.d.ts +11 -0
- package/dist/db/tables/automation_template.table.js +52 -0
- package/dist/db/tables/automation_template.table.js.map +1 -0
- package/dist/db/tables/index.d.ts +5 -0
- package/dist/db/tables/index.js +22 -0
- package/dist/db/tables/index.js.map +1 -0
- package/dist/db/tables/procedure.table.d.ts +10 -0
- package/dist/db/tables/procedure.table.js +48 -0
- package/dist/db/tables/procedure.table.js.map +1 -0
- package/dist/db/tables/procedure_run.table.d.ts +13 -0
- package/dist/db/tables/procedure_run.table.js +57 -0
- package/dist/db/tables/procedure_run.table.js.map +1 -0
- package/dist/db/tables/trigger_type_config.table.d.ts +7 -0
- package/dist/db/tables/trigger_type_config.table.js +35 -0
- package/dist/db/tables/trigger_type_config.table.js.map +1 -0
- package/dist/implementations/dms-automation/index.d.ts +19 -0
- package/dist/implementations/dms-automation/index.js +50 -0
- package/dist/implementations/dms-automation/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/builder.d.ts +10 -0
- package/dist/pages/builder.js +28 -0
- package/dist/pages/builder.js.map +1 -0
- package/dist/pages/category.d.ts +1 -0
- package/dist/pages/category.js +10 -0
- package/dist/pages/category.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +9 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/library.d.ts +10 -0
- package/dist/pages/library.js +28 -0
- package/dist/pages/library.js.map +1 -0
- package/dist/pages/overview.d.ts +10 -0
- package/dist/pages/overview.js +28 -0
- package/dist/pages/overview.js.map +1 -0
- package/dist/pages/procedures.d.ts +10 -0
- package/dist/pages/procedures.js +72 -0
- package/dist/pages/procedures.js.map +1 -0
- package/dist/pages/runs.d.ts +11 -0
- package/dist/pages/runs.js +61 -0
- package/dist/pages/runs.js.map +1 -0
- package/dist/routes/action-types.d.ts +23 -0
- package/dist/routes/action-types.js +80 -0
- package/dist/routes/action-types.js.map +1 -0
- package/dist/routes/data-node-types.d.ts +6 -0
- package/dist/routes/data-node-types.js +36 -0
- package/dist/routes/data-node-types.js.map +1 -0
- package/dist/routes/graphSchema.d.ts +92 -0
- package/dist/routes/graphSchema.js +60 -0
- package/dist/routes/graphSchema.js.map +1 -0
- package/dist/routes/index.d.ts +8 -0
- package/dist/routes/index.js +11 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/node-kinds.d.ts +9 -0
- package/dist/routes/node-kinds.js +35 -0
- package/dist/routes/node-kinds.js.map +1 -0
- package/dist/routes/procedures.d.ts +23 -0
- package/dist/routes/procedures.js +181 -0
- package/dist/routes/procedures.js.map +1 -0
- package/dist/routes/runs.d.ts +7 -0
- package/dist/routes/runs.js +81 -0
- package/dist/routes/runs.js.map +1 -0
- package/dist/routes/stats.d.ts +6 -0
- package/dist/routes/stats.js +35 -0
- package/dist/routes/stats.js.map +1 -0
- package/dist/routes/templates.d.ts +20 -0
- package/dist/routes/templates.js +243 -0
- package/dist/routes/templates.js.map +1 -0
- package/dist/routes/trigger-types.d.ts +24 -0
- package/dist/routes/trigger-types.js +80 -0
- package/dist/routes/trigger-types.js.map +1 -0
- package/dist/routes/typeConfigShared.d.ts +22 -0
- package/dist/routes/typeConfigShared.js +37 -0
- package/dist/routes/typeConfigShared.js.map +1 -0
- package/dist/runtime/builtins/actions/http.d.ts +13 -0
- package/dist/runtime/builtins/actions/http.js +47 -0
- package/dist/runtime/builtins/actions/http.js.map +1 -0
- package/dist/runtime/builtins/actions/index.d.ts +2 -0
- package/dist/runtime/builtins/actions/index.js +7 -0
- package/dist/runtime/builtins/actions/index.js.map +1 -0
- package/dist/runtime/builtins/actions/log.d.ts +13 -0
- package/dist/runtime/builtins/actions/log.js +49 -0
- package/dist/runtime/builtins/actions/log.js.map +1 -0
- package/dist/runtime/builtins/data/boolean.d.ts +2 -0
- package/dist/runtime/builtins/data/boolean.js +39 -0
- package/dist/runtime/builtins/data/boolean.js.map +1 -0
- package/dist/runtime/builtins/data/compare.d.ts +2 -0
- package/dist/runtime/builtins/data/compare.js +29 -0
- package/dist/runtime/builtins/data/compare.js.map +1 -0
- package/dist/runtime/builtins/data/constant.d.ts +2 -0
- package/dist/runtime/builtins/data/constant.js +29 -0
- package/dist/runtime/builtins/data/constant.js.map +1 -0
- package/dist/runtime/builtins/data/index.d.ts +2 -0
- package/dist/runtime/builtins/data/index.js +20 -0
- package/dist/runtime/builtins/data/index.js.map +1 -0
- package/dist/runtime/builtins/data/json.d.ts +2 -0
- package/dist/runtime/builtins/data/json.js +46 -0
- package/dist/runtime/builtins/data/json.js.map +1 -0
- package/dist/runtime/builtins/data/math.d.ts +2 -0
- package/dist/runtime/builtins/data/math.js +53 -0
- package/dist/runtime/builtins/data/math.js.map +1 -0
- package/dist/runtime/builtins/data/object.d.ts +2 -0
- package/dist/runtime/builtins/data/object.js +121 -0
- package/dist/runtime/builtins/data/object.js.map +1 -0
- package/dist/runtime/builtins/data/string.d.ts +2 -0
- package/dist/runtime/builtins/data/string.js +143 -0
- package/dist/runtime/builtins/data/string.js.map +1 -0
- package/dist/runtime/builtins/index.d.ts +17 -0
- package/dist/runtime/builtins/index.js +24 -0
- package/dist/runtime/builtins/index.js.map +1 -0
- package/dist/runtime/builtins/nodes/action.d.ts +1 -0
- package/dist/runtime/builtins/nodes/action.js +36 -0
- package/dist/runtime/builtins/nodes/action.js.map +1 -0
- package/dist/runtime/builtins/nodes/data.d.ts +1 -0
- package/dist/runtime/builtins/nodes/data.js +28 -0
- package/dist/runtime/builtins/nodes/data.js.map +1 -0
- package/dist/runtime/builtins/nodes/delay.d.ts +1 -0
- package/dist/runtime/builtins/nodes/delay.js +41 -0
- package/dist/runtime/builtins/nodes/delay.js.map +1 -0
- package/dist/runtime/builtins/nodes/forRange.d.ts +1 -0
- package/dist/runtime/builtins/nodes/forRange.js +52 -0
- package/dist/runtime/builtins/nodes/forRange.js.map +1 -0
- package/dist/runtime/builtins/nodes/foreach.d.ts +1 -0
- package/dist/runtime/builtins/nodes/foreach.js +31 -0
- package/dist/runtime/builtins/nodes/foreach.js.map +1 -0
- package/dist/runtime/builtins/nodes/groupInput.d.ts +1 -0
- package/dist/runtime/builtins/nodes/groupInput.js +11 -0
- package/dist/runtime/builtins/nodes/groupInput.js.map +1 -0
- package/dist/runtime/builtins/nodes/groupOutput.d.ts +1 -0
- package/dist/runtime/builtins/nodes/groupOutput.js +11 -0
- package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -0
- package/dist/runtime/builtins/nodes/if.d.ts +1 -0
- package/dist/runtime/builtins/nodes/if.js +23 -0
- package/dist/runtime/builtins/nodes/if.js.map +1 -0
- package/dist/runtime/builtins/nodes/parallel.d.ts +1 -0
- package/dist/runtime/builtins/nodes/parallel.js +34 -0
- package/dist/runtime/builtins/nodes/parallel.js.map +1 -0
- package/dist/runtime/builtins/nodes/retry.d.ts +1 -0
- package/dist/runtime/builtins/nodes/retry.js +46 -0
- package/dist/runtime/builtins/nodes/retry.js.map +1 -0
- package/dist/runtime/builtins/nodes/setVariable.d.ts +1 -0
- package/dist/runtime/builtins/nodes/setVariable.js +31 -0
- package/dist/runtime/builtins/nodes/setVariable.js.map +1 -0
- package/dist/runtime/builtins/nodes/switch.d.ts +1 -0
- package/dist/runtime/builtins/nodes/switch.js +33 -0
- package/dist/runtime/builtins/nodes/switch.js.map +1 -0
- package/dist/runtime/builtins/nodes/trigger.d.ts +1 -0
- package/dist/runtime/builtins/nodes/trigger.js +25 -0
- package/dist/runtime/builtins/nodes/trigger.js.map +1 -0
- package/dist/runtime/builtins/nodes/tryCatch.d.ts +1 -0
- package/dist/runtime/builtins/nodes/tryCatch.js +35 -0
- package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -0
- package/dist/runtime/builtins/triggers/cron.d.ts +9 -0
- package/dist/runtime/builtins/triggers/cron.js +52 -0
- package/dist/runtime/builtins/triggers/cron.js.map +1 -0
- package/dist/runtime/builtins/triggers/index.d.ts +2 -0
- package/dist/runtime/builtins/triggers/index.js +12 -0
- package/dist/runtime/builtins/triggers/index.js.map +1 -0
- package/dist/runtime/builtins/triggers/manual.d.ts +3 -0
- package/dist/runtime/builtins/triggers/manual.js +20 -0
- package/dist/runtime/builtins/triggers/manual.js.map +1 -0
- package/dist/runtime/builtins/triggers/webhook.d.ts +14 -0
- package/dist/runtime/builtins/triggers/webhook.js +90 -0
- package/dist/runtime/builtins/triggers/webhook.js.map +1 -0
- package/dist/runtime/executionResult.d.ts +6 -0
- package/dist/runtime/executionResult.js +3 -0
- package/dist/runtime/executionResult.js.map +1 -0
- package/dist/runtime/executor.d.ts +9 -0
- package/dist/runtime/executor.js +300 -0
- package/dist/runtime/executor.js.map +1 -0
- package/dist/runtime/flatten.d.ts +3 -0
- package/dist/runtime/flatten.js +188 -0
- package/dist/runtime/flatten.js.map +1 -0
- package/dist/runtime/nodeKinds.d.ts +64 -0
- package/dist/runtime/nodeKinds.js +43 -0
- package/dist/runtime/nodeKinds.js.map +1 -0
- package/dist/runtime/reconcileDiff.d.ts +9 -0
- package/dist/runtime/reconcileDiff.js +26 -0
- package/dist/runtime/reconcileDiff.js.map +1 -0
- package/dist/runtime/registry.d.ts +19 -0
- package/dist/runtime/registry.js +47 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/resolveInputs.d.ts +14 -0
- package/dist/runtime/resolveInputs.js +64 -0
- package/dist/runtime/resolveInputs.js.map +1 -0
- package/dist/runtime/resolveSubgraph.d.ts +7 -0
- package/dist/runtime/resolveSubgraph.js +15 -0
- package/dist/runtime/resolveSubgraph.js.map +1 -0
- package/dist/runtime/subscriptions.d.ts +16 -0
- package/dist/runtime/subscriptions.js +419 -0
- package/dist/runtime/subscriptions.js.map +1 -0
- package/dist/runtime/subwalk.d.ts +17 -0
- package/dist/runtime/subwalk.js +74 -0
- package/dist/runtime/subwalk.js.map +1 -0
- package/dist/runtime/topo.d.ts +3 -0
- package/dist/runtime/topo.js +75 -0
- package/dist/runtime/topo.js.map +1 -0
- package/dist/runtime/typeOrigin.d.ts +7 -0
- package/dist/runtime/typeOrigin.js +24 -0
- package/dist/runtime/typeOrigin.js.map +1 -0
- package/dist/runtime/validate.d.ts +10 -0
- package/dist/runtime/validate.js +185 -0
- package/dist/runtime/validate.js.map +1 -0
- package/dist/runtime/validateTemplate.d.ts +3 -0
- package/dist/runtime/validateTemplate.js +54 -0
- package/dist/runtime/validateTemplate.js.map +1 -0
- package/dist/types/constants.d.ts +6 -0
- package/dist/types/constants.js +10 -0
- package/dist/types/constants.js.map +1 -0
- package/dist/types/graph.d.ts +51 -0
- package/dist/types/graph.js +23 -0
- package/dist/types/graph.js.map +1 -0
- package/dist/types/pagination.d.ts +8 -0
- package/dist/types/pagination.js +3 -0
- package/dist/types/pagination.js.map +1 -0
- package/dist/types/runLog.d.ts +26 -0
- package/dist/types/runLog.js +3 -0
- package/dist/types/runLog.js.map +1 -0
- package/frontend-vue/.prettierignore +4 -0
- package/frontend-vue/app/components/Actions.vue +141 -0
- package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +166 -0
- package/frontend-vue/app/components/Catalog/TypeList.vue +198 -0
- package/frontend-vue/app/components/DataNodes.vue +259 -0
- package/frontend-vue/app/components/Editor/BuilderPalette.vue +234 -0
- package/frontend-vue/app/components/Editor/GraphCanvas.vue +994 -0
- package/frontend-vue/app/components/Editor/GroupPortEditor.vue +289 -0
- package/frontend-vue/app/components/Editor/JsonField.vue +63 -0
- package/frontend-vue/app/components/Editor/NodeInspector.vue +356 -0
- package/frontend-vue/app/components/Editor/ProcedureList.vue +156 -0
- package/frontend-vue/app/components/Editor/RunsDrawer.vue +312 -0
- package/frontend-vue/app/components/Editor/WiredField.vue +42 -0
- package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +161 -0
- package/frontend-vue/app/components/Editor/nodes/GroupInputNode.vue +19 -0
- package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +200 -0
- package/frontend-vue/app/components/Editor/nodes/GroupOutputNode.vue +19 -0
- package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +161 -0
- package/frontend-vue/app/components/Editor/nodes/styles.ts +53 -0
- package/frontend-vue/app/components/Editor.vue +2504 -0
- package/frontend-vue/app/components/Library.vue +67 -0
- package/frontend-vue/app/components/Overview.vue +503 -0
- package/frontend-vue/app/components/RunDetailDrawer.vue +165 -0
- package/frontend-vue/app/components/RunFireTree.vue +170 -0
- package/frontend-vue/app/components/RunTraceDrawer.vue +59 -0
- package/frontend-vue/app/components/RunsStats.vue +126 -0
- package/frontend-vue/app/components/RunsTimelineDisplay.vue +287 -0
- package/frontend-vue/app/components/Templates.vue +663 -0
- package/frontend-vue/app/components/Triggers.vue +137 -0
- package/frontend-vue/app/composables/useAutomationNodeKinds.ts +48 -0
- package/frontend-vue/app/composables/useAutomationRuns.ts +75 -0
- package/frontend-vue/app/composables/useGraphConnect.ts +542 -0
- package/frontend-vue/app/plugins/runs-timeline-display.client.ts +16 -0
- package/frontend-vue/app/utils/automation.ts +51 -0
- package/frontend-vue/dms.frontend.ts +26 -0
- package/frontend-vue/eslint.config.mjs +24 -0
- package/frontend-vue/i18n/locales/dms-automation-en-GB.json +369 -0
- package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +369 -0
- package/frontend-vue/package.json +33 -0
- package/frontend-vue/pnpm-lock.yaml +6483 -0
- package/frontend-vue/pnpm-workspace.yaml +2 -0
- package/package.json +81 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref } from 'vue'
|
|
3
|
+
import type { ProcedureRef, RunSummary } from '../composables/useAutomationRuns'
|
|
4
|
+
import { formatDuration } from '../utils/automation'
|
|
5
|
+
import RunTraceDrawer from './RunTraceDrawer.vue'
|
|
6
|
+
|
|
7
|
+
// Custom TableView display (registered in plugins/runs-timeline-display.client.ts):
|
|
8
|
+
// renders the run history as a timeline instead of a grid. It is ONLY the list —
|
|
9
|
+
// status tabs, the (native RelationType filter-only) procedure filter, search,
|
|
10
|
+
// export and the KPI header are owned by the TableView chrome / the page-level
|
|
11
|
+
// RunsStats component. Everything shown here comes from the shared TableView state
|
|
12
|
+
// via `context` (already filtered/sorted); the only extra fetch is the
|
|
13
|
+
// procedure-name lookup for display (the filter-only relation keeps the raw
|
|
14
|
+
// procedureId on the row, so we resolve the name client-side).
|
|
15
|
+
|
|
16
|
+
// Minimal slice of the dms `TableViewDisplayContext` we consume.
|
|
17
|
+
interface DisplayPagination {
|
|
18
|
+
pageIndex: number
|
|
19
|
+
pageSize: number
|
|
20
|
+
total: number
|
|
21
|
+
setPage: (index: number) => void
|
|
22
|
+
}
|
|
23
|
+
interface DisplayContext {
|
|
24
|
+
items: RunSummary[]
|
|
25
|
+
loading: boolean
|
|
26
|
+
refresh: () => void | Promise<void>
|
|
27
|
+
pagination: DisplayPagination
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = defineProps<{ context: DisplayContext }>()
|
|
31
|
+
|
|
32
|
+
const { listProcedures } = useAutomationRuns()
|
|
33
|
+
const { $authFetch } = useAuthFetch()
|
|
34
|
+
const { open: openRunDrawer } = useDrawer()
|
|
35
|
+
const { t } = useI18n()
|
|
36
|
+
const toast = useToast()
|
|
37
|
+
|
|
38
|
+
const rows = computed<RunSummary[]>(() => props.context.items ?? [])
|
|
39
|
+
const loading = computed(() => props.context.loading)
|
|
40
|
+
const pagination = computed(() => props.context.pagination)
|
|
41
|
+
const replayingId = ref<string | null>(null)
|
|
42
|
+
|
|
43
|
+
// Procedure-name lookup (the list rows only carry the raw procedureId).
|
|
44
|
+
const procedures = ref<ProcedureRef[]>([])
|
|
45
|
+
function procedureName(id: string): string {
|
|
46
|
+
return procedures.value.find((x) => x._id === id)?.name ?? id
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onMounted(async () => {
|
|
50
|
+
await listProcedures()
|
|
51
|
+
.then((p) => {
|
|
52
|
+
procedures.value = p
|
|
53
|
+
})
|
|
54
|
+
.catch(() => {
|
|
55
|
+
/* name lookup is best-effort; falls back to procedureId */
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// ---- Pagination ----
|
|
60
|
+
const pageNumber = computed(() => pagination.value.pageIndex + 1)
|
|
61
|
+
const hasPrev = computed(() => pagination.value.pageIndex > 0)
|
|
62
|
+
const hasNext = computed(
|
|
63
|
+
() =>
|
|
64
|
+
(pagination.value.pageIndex + 1) * pagination.value.pageSize <
|
|
65
|
+
pagination.value.total,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
// ---- Formatting ----
|
|
69
|
+
function isFailed(status: string): boolean {
|
|
70
|
+
return status === 'failed'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function fmtClock(ts: string): string {
|
|
74
|
+
try {
|
|
75
|
+
return new Date(ts).toLocaleTimeString([], {
|
|
76
|
+
hour: '2-digit',
|
|
77
|
+
minute: '2-digit',
|
|
78
|
+
})
|
|
79
|
+
} catch {
|
|
80
|
+
return ts
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function fmtDuration(
|
|
85
|
+
startedAt: string | Date | null | undefined,
|
|
86
|
+
endedAt: string | Date | null | undefined,
|
|
87
|
+
): string {
|
|
88
|
+
if (!startedAt || !endedAt) return '—'
|
|
89
|
+
const s = new Date(startedAt).getTime()
|
|
90
|
+
const e = new Date(endedAt).getTime()
|
|
91
|
+
if (Number.isNaN(s) || Number.isNaN(e)) return '—'
|
|
92
|
+
return formatDuration(e - s)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function runSummaryLine(r: RunSummary): string {
|
|
96
|
+
if (isFailed(r.status)) {
|
|
97
|
+
return r.errorMessage || t('dms_automation.runs.timeline.failed')
|
|
98
|
+
}
|
|
99
|
+
return t('dms_automation.runs.timeline.completed')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ---- Actions ----
|
|
103
|
+
// Track open trace drawers by container id so a rapid double-click doesn't stack
|
|
104
|
+
// two identical drawers sharing one container.
|
|
105
|
+
const openTraceIds = new Set<string>()
|
|
106
|
+
function openTrace(r: RunSummary) {
|
|
107
|
+
const containerId = `dms-automation-run-${r._id}`
|
|
108
|
+
if (openTraceIds.has(containerId)) return
|
|
109
|
+
openTraceIds.add(containerId)
|
|
110
|
+
const drawer = openRunDrawer({
|
|
111
|
+
containerId,
|
|
112
|
+
title: `${r.status.toUpperCase()} · ${procedureName(r.procedureId)}`,
|
|
113
|
+
description: new Date(r.startedAt).toLocaleString(),
|
|
114
|
+
direction: 'right',
|
|
115
|
+
component: RunTraceDrawer,
|
|
116
|
+
componentOptions: {
|
|
117
|
+
rowData: r,
|
|
118
|
+
procedureName: procedureName(r.procedureId),
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
void drawer.result.finally(() => openTraceIds.delete(containerId))
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function replay(r: RunSummary) {
|
|
125
|
+
if (replayingId.value) return
|
|
126
|
+
replayingId.value = r._id
|
|
127
|
+
try {
|
|
128
|
+
await $authFetch(`/api/automation/procedures/${r.procedureId}/run`, {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
body: {},
|
|
131
|
+
})
|
|
132
|
+
toast.add({
|
|
133
|
+
title: t('dms_automation.runs.timeline.replayQueued'),
|
|
134
|
+
color: 'success',
|
|
135
|
+
icon: 'i-ph-check-circle',
|
|
136
|
+
})
|
|
137
|
+
await props.context.refresh()
|
|
138
|
+
} catch (e) {
|
|
139
|
+
toast.add({
|
|
140
|
+
title: t('dms_automation.runs.timeline.replayFailed'),
|
|
141
|
+
description: (e as Error).message,
|
|
142
|
+
color: 'error',
|
|
143
|
+
icon: 'i-ph-warning',
|
|
144
|
+
})
|
|
145
|
+
} finally {
|
|
146
|
+
replayingId.value = null
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
150
|
+
|
|
151
|
+
<template>
|
|
152
|
+
<div class="flex flex-col pt-4">
|
|
153
|
+
<div v-if="loading && rows.length === 0" class="flex flex-col gap-3">
|
|
154
|
+
<USkeleton v-for="i in 6" :key="i" class="h-16 w-full" />
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div
|
|
158
|
+
v-else-if="rows.length === 0"
|
|
159
|
+
class="flex flex-col items-center gap-2 py-12 text-center"
|
|
160
|
+
>
|
|
161
|
+
<UIcon name="i-ph-list-bullets" class="size-7 text-dimmed" />
|
|
162
|
+
<p class="text-sm font-medium text-muted">{{ $t('dms_automation.runs.empty') }}</p>
|
|
163
|
+
<p class="text-xs text-dimmed">{{ $t('dms_automation.runs.emptyHint') }}</p>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<ol v-else class="flex flex-col">
|
|
167
|
+
<li v-for="(r, idx) in rows" :key="r._id" class="flex gap-3">
|
|
168
|
+
<!-- rail -->
|
|
169
|
+
<div class="flex flex-col items-center">
|
|
170
|
+
<span
|
|
171
|
+
class="grid size-7 shrink-0 place-items-center rounded-full ring-4 ring-default/40"
|
|
172
|
+
:class="
|
|
173
|
+
isFailed(r.status)
|
|
174
|
+
? 'bg-error/15 text-error'
|
|
175
|
+
: 'bg-success/15 text-success'
|
|
176
|
+
"
|
|
177
|
+
>
|
|
178
|
+
<UIcon
|
|
179
|
+
:name="isFailed(r.status) ? 'i-ph-x' : 'i-ph-check'"
|
|
180
|
+
class="size-3.5"
|
|
181
|
+
/>
|
|
182
|
+
</span>
|
|
183
|
+
<span v-if="idx < rows.length - 1" class="w-px flex-1 bg-default" />
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<!-- card -->
|
|
187
|
+
<div
|
|
188
|
+
class="mb-3 min-w-0 flex-1 rounded-xl border border-default bg-elevated/40 p-3.5"
|
|
189
|
+
>
|
|
190
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
191
|
+
<span class="truncate text-sm font-semibold text-highlighted">
|
|
192
|
+
{{ procedureName(r.procedureId) }}
|
|
193
|
+
</span>
|
|
194
|
+
<UBadge
|
|
195
|
+
v-if="r.triggerNodeId"
|
|
196
|
+
color="neutral"
|
|
197
|
+
variant="subtle"
|
|
198
|
+
size="xs"
|
|
199
|
+
class="gap-1"
|
|
200
|
+
>
|
|
201
|
+
<UIcon name="i-ph-lightning" class="size-3" />
|
|
202
|
+
{{ r.triggerNodeId }}
|
|
203
|
+
</UBadge>
|
|
204
|
+
<UBadge
|
|
205
|
+
:color="isFailed(r.status) ? 'error' : 'success'"
|
|
206
|
+
variant="subtle"
|
|
207
|
+
size="xs"
|
|
208
|
+
>
|
|
209
|
+
{{
|
|
210
|
+
isFailed(r.status)
|
|
211
|
+
? $t('dms_automation.runs.badge.failed')
|
|
212
|
+
: $t('dms_automation.runs.badge.success')
|
|
213
|
+
}}
|
|
214
|
+
</UBadge>
|
|
215
|
+
<time class="ml-auto text-xs tabular-nums text-dimmed">
|
|
216
|
+
{{ fmtClock(r.startedAt) }}
|
|
217
|
+
</time>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<p
|
|
221
|
+
class="mt-1.5 line-clamp-2 text-xs"
|
|
222
|
+
:class="isFailed(r.status) ? 'text-error' : 'text-muted'"
|
|
223
|
+
>
|
|
224
|
+
{{ runSummaryLine(r) }}
|
|
225
|
+
</p>
|
|
226
|
+
|
|
227
|
+
<div class="mt-2.5 flex flex-wrap items-center gap-3">
|
|
228
|
+
<span
|
|
229
|
+
class="inline-flex items-center gap-1 rounded-md bg-default/60 px-1.5 py-0.5 text-[11px] tabular-nums text-muted"
|
|
230
|
+
>
|
|
231
|
+
<UIcon name="i-ph-clock" class="size-3" />
|
|
232
|
+
{{ fmtDuration(r.startedAt, r.endedAt) }}
|
|
233
|
+
</span>
|
|
234
|
+
<button
|
|
235
|
+
type="button"
|
|
236
|
+
class="inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline"
|
|
237
|
+
@click="openTrace(r)"
|
|
238
|
+
>
|
|
239
|
+
<UIcon name="i-ph-eye" class="size-3.5" />
|
|
240
|
+
{{ $t('dms_automation.runs.timeline.trace') }}
|
|
241
|
+
</button>
|
|
242
|
+
<button
|
|
243
|
+
type="button"
|
|
244
|
+
class="inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline disabled:opacity-50"
|
|
245
|
+
:disabled="!!replayingId"
|
|
246
|
+
@click="replay(r)"
|
|
247
|
+
>
|
|
248
|
+
<UIcon
|
|
249
|
+
:name="replayingId === r._id ? 'i-ph-spinner' : 'i-ph-arrows-clockwise'"
|
|
250
|
+
class="size-3.5"
|
|
251
|
+
:class="{ 'animate-spin': replayingId === r._id }"
|
|
252
|
+
/>
|
|
253
|
+
{{ $t('dms_automation.runs.timeline.replay') }}
|
|
254
|
+
</button>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</li>
|
|
258
|
+
</ol>
|
|
259
|
+
|
|
260
|
+
<div
|
|
261
|
+
v-if="pagination.total > 0"
|
|
262
|
+
class="flex items-center justify-between gap-3 pt-3"
|
|
263
|
+
>
|
|
264
|
+
<UButton
|
|
265
|
+
size="sm"
|
|
266
|
+
color="neutral"
|
|
267
|
+
variant="ghost"
|
|
268
|
+
icon="i-ph-caret-left"
|
|
269
|
+
:label="$t('dms_automation.common.previous')"
|
|
270
|
+
:disabled="!hasPrev || loading"
|
|
271
|
+
@click="pagination.setPage(pagination.pageIndex - 1)"
|
|
272
|
+
/>
|
|
273
|
+
<span class="text-xs tabular-nums text-dimmed">
|
|
274
|
+
{{ $t('dms_automation.runs.pageLabel', { n: pageNumber }) }}
|
|
275
|
+
</span>
|
|
276
|
+
<UButton
|
|
277
|
+
size="sm"
|
|
278
|
+
color="neutral"
|
|
279
|
+
variant="ghost"
|
|
280
|
+
trailing-icon="i-ph-caret-right"
|
|
281
|
+
:label="$t('dms_automation.common.next')"
|
|
282
|
+
:disabled="!hasNext || loading"
|
|
283
|
+
@click="pagination.setPage(pagination.pageIndex + 1)"
|
|
284
|
+
/>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
</template>
|