@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,234 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import type {
|
|
4
|
+
NodeKind,
|
|
5
|
+
TriggerType,
|
|
6
|
+
ActionType,
|
|
7
|
+
DataNodeType,
|
|
8
|
+
GroupPort,
|
|
9
|
+
} from '../../composables/useGraphConnect'
|
|
10
|
+
import type { NodeKindEntry } from '../../composables/useAutomationNodeKinds'
|
|
11
|
+
|
|
12
|
+
interface TemplateSummary {
|
|
13
|
+
_id: string
|
|
14
|
+
name: string
|
|
15
|
+
icon?: string
|
|
16
|
+
ports: GroupPort[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
nodeKinds: NodeKindEntry[]
|
|
21
|
+
triggerTypes: TriggerType[]
|
|
22
|
+
actionTypes: ActionType[]
|
|
23
|
+
dataNodeTypes: DataNodeType[]
|
|
24
|
+
templates?: TemplateSummary[]
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits<{
|
|
28
|
+
(e: 'add-node', payload: { kind: NodeKind; typeId?: string }): void
|
|
29
|
+
(e: 'add-template', template: TemplateSummary): void
|
|
30
|
+
}>()
|
|
31
|
+
|
|
32
|
+
const search = ref('')
|
|
33
|
+
|
|
34
|
+
interface PaletteItem {
|
|
35
|
+
key: string
|
|
36
|
+
label: string
|
|
37
|
+
icon: string
|
|
38
|
+
kind?: NodeKind
|
|
39
|
+
typeId?: string
|
|
40
|
+
template?: TemplateSummary
|
|
41
|
+
}
|
|
42
|
+
// Items inside a category are bucketed by the module that registered them:
|
|
43
|
+
// one unlabeled leading section for our own built-ins (types the backend left
|
|
44
|
+
// unattributed, plus plain node kinds), then one labeled section per external
|
|
45
|
+
// module.
|
|
46
|
+
interface PaletteSection {
|
|
47
|
+
/** Module id shown as a sub-header; undefined for the built-in section. */
|
|
48
|
+
label?: string
|
|
49
|
+
items: PaletteItem[]
|
|
50
|
+
}
|
|
51
|
+
interface PaletteGroup {
|
|
52
|
+
key: string
|
|
53
|
+
label: string
|
|
54
|
+
icon: string
|
|
55
|
+
sections: PaletteSection[]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Same category ordering / labels / icons the old "Add node" dropdown used —
|
|
59
|
+
// reproduced here as a grouped, searchable left sidebar per autov2-builder.
|
|
60
|
+
const CATEGORY_ORDER = ['trigger', 'action', 'flow', 'helper', 'data'] as const
|
|
61
|
+
const CATEGORY_LABEL: Record<string, string> = {
|
|
62
|
+
trigger: 'Triggers',
|
|
63
|
+
action: 'Actions',
|
|
64
|
+
flow: 'Flow',
|
|
65
|
+
helper: 'Helpers',
|
|
66
|
+
data: 'Data',
|
|
67
|
+
}
|
|
68
|
+
const CATEGORY_ICON: Record<string, string> = {
|
|
69
|
+
trigger: 'i-ph-lightning',
|
|
70
|
+
action: 'i-ph-gear',
|
|
71
|
+
flow: 'i-ph-git-fork',
|
|
72
|
+
helper: 'i-ph-toolbox',
|
|
73
|
+
data: 'i-ph-function',
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Bucket key for the unlabeled built-in section. The backend omits `module`
|
|
77
|
+
// for our own types and for any it couldn't attribute, so both land here
|
|
78
|
+
// rather than under an invented "unknown" sub-header.
|
|
79
|
+
const BUILTIN_BUCKET = ''
|
|
80
|
+
|
|
81
|
+
const groups = computed<PaletteGroup[]>(() => {
|
|
82
|
+
const out: PaletteGroup[] = []
|
|
83
|
+
|
|
84
|
+
const kindsByCategory = new Map<string, NodeKindEntry[]>()
|
|
85
|
+
for (const k of props.nodeKinds ?? []) {
|
|
86
|
+
const cat = k.meta.ui?.category
|
|
87
|
+
if (!cat) continue
|
|
88
|
+
const arr = kindsByCategory.get(cat) ?? []
|
|
89
|
+
arr.push(k)
|
|
90
|
+
kindsByCategory.set(cat, arr)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
for (const cat of CATEGORY_ORDER) {
|
|
94
|
+
const kinds = kindsByCategory.get(cat)
|
|
95
|
+
if (!kinds || kinds.length === 0) continue
|
|
96
|
+
const groupIcon = CATEGORY_ICON[cat] ?? 'i-ph-circle'
|
|
97
|
+
const byModule = new Map<string, PaletteItem[]>()
|
|
98
|
+
const push = (bucket: string, item: PaletteItem) => {
|
|
99
|
+
const arr = byModule.get(bucket) ?? []
|
|
100
|
+
arr.push(item)
|
|
101
|
+
byModule.set(bucket, arr)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (const k of kinds) {
|
|
105
|
+
const ui = k.meta.ui!
|
|
106
|
+
const reg = ui.typeRegistry
|
|
107
|
+
if (reg === 'triggers') {
|
|
108
|
+
for (const t of props.triggerTypes ?? []) {
|
|
109
|
+
push(t.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${t.id}`, label: t.name, icon: t.icon ?? groupIcon, kind: k.kind, typeId: t.id })
|
|
110
|
+
}
|
|
111
|
+
} else if (reg === 'actions') {
|
|
112
|
+
for (const a of props.actionTypes ?? []) {
|
|
113
|
+
push(a.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${a.id}`, label: a.name, icon: a.icon ?? groupIcon, kind: k.kind, typeId: a.id })
|
|
114
|
+
}
|
|
115
|
+
} else if (reg === 'dataNodes') {
|
|
116
|
+
// Flatten data-node sub-categories into the single "Data" group.
|
|
117
|
+
for (const d of props.dataNodeTypes ?? []) {
|
|
118
|
+
push(d.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${d.id}`, label: d.name, icon: d.icon ?? groupIcon, kind: k.kind, typeId: d.id })
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
// Plain node kinds (flow / helpers) are built into this module.
|
|
122
|
+
push(BUILTIN_BUCKET, { key: k.kind, label: ui.label, icon: ui.icon ?? groupIcon, kind: k.kind })
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Built-ins first (they're the defaults shipped with the module), then
|
|
127
|
+
// one labeled section per external module, alphabetically.
|
|
128
|
+
const sections: PaletteSection[] = []
|
|
129
|
+
const builtins = byModule.get(BUILTIN_BUCKET)
|
|
130
|
+
if (builtins && builtins.length > 0) sections.push({ items: builtins })
|
|
131
|
+
const externalModules = [...byModule.keys()]
|
|
132
|
+
.filter((m) => m !== BUILTIN_BUCKET)
|
|
133
|
+
.sort()
|
|
134
|
+
for (const mod of externalModules) {
|
|
135
|
+
sections.push({ label: mod, items: byModule.get(mod)! })
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (sections.length > 0) out.push({ key: cat, label: CATEGORY_LABEL[cat] ?? cat, icon: groupIcon, sections })
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (props.templates && props.templates.length > 0) {
|
|
142
|
+
out.push({
|
|
143
|
+
key: 'templates',
|
|
144
|
+
label: 'Templates',
|
|
145
|
+
icon: 'i-ph-package',
|
|
146
|
+
sections: [
|
|
147
|
+
{
|
|
148
|
+
items: props.templates.map((t) => ({
|
|
149
|
+
key: `tpl:${t._id}`,
|
|
150
|
+
label: t.name,
|
|
151
|
+
icon: t.icon ?? 'i-ph-package',
|
|
152
|
+
template: t,
|
|
153
|
+
})),
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return out
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const filteredGroups = computed<PaletteGroup[]>(() => {
|
|
163
|
+
const q = search.value.trim().toLowerCase()
|
|
164
|
+
if (!q) return groups.value
|
|
165
|
+
return groups.value
|
|
166
|
+
.map((g) => ({
|
|
167
|
+
...g,
|
|
168
|
+
sections: g.sections
|
|
169
|
+
.map((s) => ({ ...s, items: s.items.filter((it) => it.label.toLowerCase().includes(q)) }))
|
|
170
|
+
.filter((s) => s.items.length > 0),
|
|
171
|
+
}))
|
|
172
|
+
.filter((g) => g.sections.length > 0)
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
function onItem(item: PaletteItem) {
|
|
176
|
+
if (item.template) emit('add-template', item.template)
|
|
177
|
+
else if (item.kind) emit('add-node', { kind: item.kind, typeId: item.typeId })
|
|
178
|
+
}
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<template>
|
|
182
|
+
<div
|
|
183
|
+
class="flex h-full flex-col overflow-hidden rounded-lg border border-default bg-elevated/40"
|
|
184
|
+
>
|
|
185
|
+
<div class="border-b border-default p-2.5">
|
|
186
|
+
<UInput
|
|
187
|
+
v-model="search"
|
|
188
|
+
icon="i-ph-magnifying-glass"
|
|
189
|
+
size="sm"
|
|
190
|
+
:placeholder="$t('dms_automation.builder.palette.search')"
|
|
191
|
+
class="w-full"
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
<div class="flex-1 overflow-y-auto p-2">
|
|
195
|
+
<div v-for="group in filteredGroups" :key="group.key" class="mb-2 last:mb-0">
|
|
196
|
+
<div
|
|
197
|
+
class="px-2 pb-1 pt-2 font-mono text-[10px] font-medium uppercase tracking-[0.12em] text-dimmed"
|
|
198
|
+
>
|
|
199
|
+
{{ group.label }}
|
|
200
|
+
</div>
|
|
201
|
+
<template v-for="section in group.sections" :key="section.label ?? ''">
|
|
202
|
+
<div
|
|
203
|
+
v-if="section.label"
|
|
204
|
+
class="flex items-center gap-1.5 px-2 pb-0.5 pt-1.5 text-[10px] font-medium text-dimmed"
|
|
205
|
+
>
|
|
206
|
+
<UIcon name="i-ph-puzzle-piece" class="size-3 shrink-0" />
|
|
207
|
+
<span class="truncate">{{ section.label }}</span>
|
|
208
|
+
</div>
|
|
209
|
+
<button
|
|
210
|
+
v-for="item in section.items"
|
|
211
|
+
:key="item.key"
|
|
212
|
+
type="button"
|
|
213
|
+
draggable="false"
|
|
214
|
+
class="group flex w-full items-center gap-2.5 rounded-md border border-transparent px-2.5 py-2 text-left text-sm text-toned transition-colors hover:border-primary/40 hover:bg-primary/5 hover:text-highlighted"
|
|
215
|
+
@click="onItem(item)"
|
|
216
|
+
>
|
|
217
|
+
<UIcon :name="item.icon" class="size-4 shrink-0 text-primary" />
|
|
218
|
+
<span class="min-w-0 flex-1 truncate">{{ item.label }}</span>
|
|
219
|
+
<UIcon
|
|
220
|
+
name="i-ph-plus"
|
|
221
|
+
class="size-3.5 shrink-0 text-dimmed opacity-0 transition-opacity group-hover:opacity-100"
|
|
222
|
+
/>
|
|
223
|
+
</button>
|
|
224
|
+
</template>
|
|
225
|
+
</div>
|
|
226
|
+
<div
|
|
227
|
+
v-if="filteredGroups.length === 0"
|
|
228
|
+
class="px-2 py-6 text-center text-xs text-dimmed"
|
|
229
|
+
>
|
|
230
|
+
{{ $t('dms_automation.builder.palette.empty') }}
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</template>
|