@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
|
@@ -7,14 +7,7 @@ import type {
|
|
|
7
7
|
DataNodeType,
|
|
8
8
|
GroupPort,
|
|
9
9
|
} from '../../composables/useGraphConnect'
|
|
10
|
-
import type
|
|
11
|
-
|
|
12
|
-
interface TemplateSummary {
|
|
13
|
-
_id: string
|
|
14
|
-
name: string
|
|
15
|
-
icon?: string
|
|
16
|
-
ports: GroupPort[]
|
|
17
|
-
}
|
|
10
|
+
import { PALETTE_DRAG_TYPE, type NodeKindEntry, type PaletteBlock, type TemplateSummary } from '../../composables/useAutomationNodeKinds'
|
|
18
11
|
|
|
19
12
|
const props = defineProps<{
|
|
20
13
|
nodeKinds: NodeKindEntry[]
|
|
@@ -31,6 +24,12 @@ const emit = defineEmits<{
|
|
|
31
24
|
|
|
32
25
|
const search = ref('')
|
|
33
26
|
|
|
27
|
+
// Registered type names may be `$`-prefixed DMS i18n keys shipped in the
|
|
28
|
+
// declaring module's locales; plain text is shown as written. Search matches
|
|
29
|
+
// the translated label, the type id, its data category and its description.
|
|
30
|
+
const { processI18n } = useTranslation()
|
|
31
|
+
const { t, te } = useI18n()
|
|
32
|
+
|
|
34
33
|
interface PaletteItem {
|
|
35
34
|
key: string
|
|
36
35
|
label: string
|
|
@@ -38,14 +37,21 @@ interface PaletteItem {
|
|
|
38
37
|
kind?: NodeKind
|
|
39
38
|
typeId?: string
|
|
40
39
|
template?: TemplateSummary
|
|
40
|
+
/** Data category of a data node. */
|
|
41
|
+
category?: string
|
|
42
|
+
/** Switched off in the Library: its steps fail when they run. */
|
|
43
|
+
off?: boolean
|
|
44
|
+
/** Lower-cased text the search looks in. */
|
|
45
|
+
keywords: string
|
|
41
46
|
}
|
|
42
47
|
// Items inside a category are bucketed by the module that registered them:
|
|
43
48
|
// one unlabeled leading section for our own built-ins (types the backend left
|
|
44
49
|
// unattributed, plus plain node kinds), then one labeled section per external
|
|
45
|
-
// module.
|
|
50
|
+
// module. Built-in data nodes are split further by their data category.
|
|
46
51
|
interface PaletteSection {
|
|
47
|
-
/**
|
|
52
|
+
/** Sub-header: a data category, or the id of the module that registered the types. */
|
|
48
53
|
label?: string
|
|
54
|
+
module?: boolean
|
|
49
55
|
items: PaletteItem[]
|
|
50
56
|
}
|
|
51
57
|
interface PaletteGroup {
|
|
@@ -59,11 +65,11 @@ interface PaletteGroup {
|
|
|
59
65
|
// reproduced here as a grouped, searchable left sidebar per autov2-builder.
|
|
60
66
|
const CATEGORY_ORDER = ['trigger', 'action', 'flow', 'helper', 'data'] as const
|
|
61
67
|
const CATEGORY_LABEL: Record<string, string> = {
|
|
62
|
-
trigger: '
|
|
63
|
-
action: '
|
|
64
|
-
flow: '
|
|
65
|
-
helper: '
|
|
66
|
-
data: '
|
|
68
|
+
trigger: '$dms_automation.builder.palette.groups.trigger',
|
|
69
|
+
action: '$dms_automation.builder.palette.groups.action',
|
|
70
|
+
flow: '$dms_automation.builder.palette.groups.flow',
|
|
71
|
+
helper: '$dms_automation.builder.palette.groups.helper',
|
|
72
|
+
data: '$dms_automation.builder.palette.groups.data',
|
|
67
73
|
}
|
|
68
74
|
const CATEGORY_ICON: Record<string, string> = {
|
|
69
75
|
trigger: 'i-ph-lightning',
|
|
@@ -78,6 +84,33 @@ const CATEGORY_ICON: Record<string, string> = {
|
|
|
78
84
|
// rather than under an invented "unknown" sub-header.
|
|
79
85
|
const BUILTIN_BUCKET = ''
|
|
80
86
|
|
|
87
|
+
// Order of the built-in data categories; any other one follows, A to Z.
|
|
88
|
+
const DATA_CATEGORY_ORDER = ['constant', 'math', 'compare', 'boolean', 'string', 'object', 'json']
|
|
89
|
+
|
|
90
|
+
function dataCategoryLabel(category: string): string {
|
|
91
|
+
const key = `dms_automation.types.dataCategories.${category}`
|
|
92
|
+
return te(key) ? t(key) : category
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function keywordsOf(...parts: Array<string | undefined>): string {
|
|
96
|
+
return parts.filter(Boolean).join(' ').toLowerCase()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Built-in data nodes, one section per data category.
|
|
100
|
+
function dataSections(items: PaletteItem[]): PaletteSection[] {
|
|
101
|
+
const rank = (c: string) => {
|
|
102
|
+
const i = DATA_CATEGORY_ORDER.indexOf(c)
|
|
103
|
+
return i === -1 ? DATA_CATEGORY_ORDER.length : i
|
|
104
|
+
}
|
|
105
|
+
const categories = [...new Set(items.map((it) => it.category ?? ''))].sort(
|
|
106
|
+
(a, b) => rank(a) - rank(b) || a.localeCompare(b),
|
|
107
|
+
)
|
|
108
|
+
return categories.map((category) => ({
|
|
109
|
+
label: dataCategoryLabel(category),
|
|
110
|
+
items: items.filter((it) => (it.category ?? '') === category),
|
|
111
|
+
}))
|
|
112
|
+
}
|
|
113
|
+
|
|
81
114
|
const groups = computed<PaletteGroup[]>(() => {
|
|
82
115
|
const out: PaletteGroup[] = []
|
|
83
116
|
|
|
@@ -104,22 +137,35 @@ const groups = computed<PaletteGroup[]>(() => {
|
|
|
104
137
|
for (const k of kinds) {
|
|
105
138
|
const ui = k.meta.ui!
|
|
106
139
|
const reg = ui.typeRegistry
|
|
107
|
-
if (reg === 'triggers') {
|
|
108
|
-
for (const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
140
|
+
if (reg === 'triggers' || reg === 'actions') {
|
|
141
|
+
for (const type of (reg === 'triggers' ? props.triggerTypes : props.actionTypes) ?? []) {
|
|
142
|
+
const label = processI18n(type.name)
|
|
143
|
+
push(type.module ?? BUILTIN_BUCKET, {
|
|
144
|
+
key: `${k.kind}:${type.id}`,
|
|
145
|
+
label,
|
|
146
|
+
icon: type.icon ?? groupIcon,
|
|
147
|
+
kind: k.kind,
|
|
148
|
+
typeId: type.id,
|
|
149
|
+
off: type.enabled === false,
|
|
150
|
+
keywords: keywordsOf(label, type.id, type.description && processI18n(type.description), type.module),
|
|
151
|
+
})
|
|
114
152
|
}
|
|
115
153
|
} else if (reg === 'dataNodes') {
|
|
116
|
-
// Flatten data-node sub-categories into the single "Data" group.
|
|
117
154
|
for (const d of props.dataNodeTypes ?? []) {
|
|
118
|
-
|
|
155
|
+
const label = processI18n(d.name)
|
|
156
|
+
push(d.module ?? BUILTIN_BUCKET, {
|
|
157
|
+
key: `${k.kind}:${d.id}`,
|
|
158
|
+
label,
|
|
159
|
+
icon: d.icon ?? groupIcon,
|
|
160
|
+
kind: k.kind,
|
|
161
|
+
typeId: d.id,
|
|
162
|
+
category: d.category,
|
|
163
|
+
keywords: keywordsOf(label, d.id, d.category, dataCategoryLabel(d.category), processI18n(d.description), d.module),
|
|
164
|
+
})
|
|
119
165
|
}
|
|
120
166
|
} else {
|
|
121
167
|
// 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 })
|
|
168
|
+
push(BUILTIN_BUCKET, { key: k.kind, label: ui.label, icon: ui.icon ?? groupIcon, kind: k.kind, keywords: keywordsOf(ui.label, k.kind) })
|
|
123
169
|
}
|
|
124
170
|
}
|
|
125
171
|
|
|
@@ -127,30 +173,31 @@ const groups = computed<PaletteGroup[]>(() => {
|
|
|
127
173
|
// one labeled section per external module, alphabetically.
|
|
128
174
|
const sections: PaletteSection[] = []
|
|
129
175
|
const builtins = byModule.get(BUILTIN_BUCKET)
|
|
130
|
-
if (builtins && builtins.length > 0)
|
|
176
|
+
if (builtins && builtins.length > 0) {
|
|
177
|
+
if (cat === 'data') sections.push(...dataSections(builtins))
|
|
178
|
+
else sections.push({ items: builtins })
|
|
179
|
+
}
|
|
131
180
|
const externalModules = [...byModule.keys()]
|
|
132
181
|
.filter((m) => m !== BUILTIN_BUCKET)
|
|
133
182
|
.sort()
|
|
134
183
|
for (const mod of externalModules) {
|
|
135
|
-
sections.push({ label: mod, items: byModule.get(mod)! })
|
|
184
|
+
sections.push({ label: mod, module: true, items: byModule.get(mod)! })
|
|
136
185
|
}
|
|
137
186
|
|
|
138
|
-
if (sections.length > 0) out.push({ key: cat, label: CATEGORY_LABEL[cat] ?? cat, icon: groupIcon, sections })
|
|
187
|
+
if (sections.length > 0) out.push({ key: cat, label: processI18n(CATEGORY_LABEL[cat] ?? cat), icon: groupIcon, sections })
|
|
139
188
|
}
|
|
140
189
|
|
|
141
190
|
if (props.templates && props.templates.length > 0) {
|
|
142
191
|
out.push({
|
|
143
192
|
key: 'templates',
|
|
144
|
-
label: '
|
|
193
|
+
label: processI18n('$dms_automation.builder.palette.groups.templates'),
|
|
145
194
|
icon: 'i-ph-package',
|
|
146
195
|
sections: [
|
|
147
196
|
{
|
|
148
|
-
items: props.templates.map((
|
|
149
|
-
|
|
150
|
-
label:
|
|
151
|
-
|
|
152
|
-
template: t,
|
|
153
|
-
})),
|
|
197
|
+
items: props.templates.map((tpl) => {
|
|
198
|
+
const label = tpl.name.trim() || t('dms_automation.builder.palette.untitledTemplate')
|
|
199
|
+
return { key: `tpl:${tpl._id}`, label, icon: tpl.icon ?? 'i-ph-package', template: tpl, keywords: keywordsOf(label) }
|
|
200
|
+
}),
|
|
154
201
|
},
|
|
155
202
|
],
|
|
156
203
|
})
|
|
@@ -166,7 +213,7 @@ const filteredGroups = computed<PaletteGroup[]>(() => {
|
|
|
166
213
|
.map((g) => ({
|
|
167
214
|
...g,
|
|
168
215
|
sections: g.sections
|
|
169
|
-
.map((s) => ({ ...s, items: s.items.filter((it) => it.
|
|
216
|
+
.map((s) => ({ ...s, items: s.items.filter((it) => it.keywords.includes(q)) }))
|
|
170
217
|
.filter((s) => s.items.length > 0),
|
|
171
218
|
}))
|
|
172
219
|
.filter((g) => g.sections.length > 0)
|
|
@@ -176,16 +223,23 @@ function onItem(item: PaletteItem) {
|
|
|
176
223
|
if (item.template) emit('add-template', item.template)
|
|
177
224
|
else if (item.kind) emit('add-node', { kind: item.kind, typeId: item.typeId })
|
|
178
225
|
}
|
|
226
|
+
|
|
227
|
+
// The canvas reads the block back on drop and places it there.
|
|
228
|
+
function onDragStart(event: DragEvent, item: PaletteItem) {
|
|
229
|
+
if (!event.dataTransfer) return
|
|
230
|
+
const block: PaletteBlock = item.template ? { template: item.template } : { kind: item.kind, typeId: item.typeId }
|
|
231
|
+
event.dataTransfer.setData(PALETTE_DRAG_TYPE, JSON.stringify(block))
|
|
232
|
+
event.dataTransfer.effectAllowed = 'copy'
|
|
233
|
+
}
|
|
179
234
|
</script>
|
|
180
235
|
|
|
181
236
|
<template>
|
|
182
237
|
<div
|
|
183
|
-
class="flex h-full flex-col overflow-hidden
|
|
238
|
+
class="flex h-full flex-col overflow-hidden bg-elevated/40"
|
|
184
239
|
>
|
|
185
240
|
<div class="border-b border-default p-2.5">
|
|
186
|
-
<
|
|
241
|
+
<DmsSearchInput
|
|
187
242
|
v-model="search"
|
|
188
|
-
icon="i-ph-magnifying-glass"
|
|
189
243
|
size="sm"
|
|
190
244
|
:placeholder="$t('dms_automation.builder.palette.search')"
|
|
191
245
|
class="w-full"
|
|
@@ -197,25 +251,29 @@ function onItem(item: PaletteItem) {
|
|
|
197
251
|
class="px-2 pb-1 pt-2 font-mono text-[10px] font-medium uppercase tracking-[0.12em] text-dimmed"
|
|
198
252
|
>
|
|
199
253
|
{{ group.label }}
|
|
254
|
+
<span class="ml-1 text-dimmed/70">{{ group.sections.reduce((n, s) => n + s.items.length, 0) }}</span>
|
|
200
255
|
</div>
|
|
201
256
|
<template v-for="section in group.sections" :key="section.label ?? ''">
|
|
202
257
|
<div
|
|
203
258
|
v-if="section.label"
|
|
204
259
|
class="flex items-center gap-1.5 px-2 pb-0.5 pt-1.5 text-[10px] font-medium text-dimmed"
|
|
205
260
|
>
|
|
206
|
-
<UIcon name="i-ph-puzzle-piece" class="size-3 shrink-0" />
|
|
261
|
+
<UIcon v-if="section.module" name="i-ph-puzzle-piece" class="size-3 shrink-0" />
|
|
207
262
|
<span class="truncate">{{ section.label }}</span>
|
|
208
263
|
</div>
|
|
209
264
|
<button
|
|
210
265
|
v-for="item in section.items"
|
|
211
266
|
:key="item.key"
|
|
212
267
|
type="button"
|
|
213
|
-
draggable="
|
|
214
|
-
|
|
268
|
+
draggable="true"
|
|
269
|
+
:title="item.off ? $t('dms_automation.builder.palette.offHint') : undefined"
|
|
270
|
+
class="group flex w-full cursor-grab 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
271
|
@click="onItem(item)"
|
|
272
|
+
@dragstart="onDragStart($event, item)"
|
|
216
273
|
>
|
|
217
|
-
<UIcon :name="item.icon" class="size-4 shrink-0 text-primary" />
|
|
218
|
-
<span class="min-w-0 flex-1 truncate">{{ item.label }}</span>
|
|
274
|
+
<UIcon :name="item.icon" class="size-4 shrink-0" :class="item.off ? 'text-dimmed' : 'text-primary'" />
|
|
275
|
+
<span class="min-w-0 flex-1 truncate" :class="{ 'text-dimmed': item.off }">{{ item.label }}</span>
|
|
276
|
+
<UBadge v-if="item.off" size="sm" color="neutral" variant="subtle">{{ $t('dms_automation.builder.palette.off') }}</UBadge>
|
|
219
277
|
<UIcon
|
|
220
278
|
name="i-ph-plus"
|
|
221
279
|
class="size-3.5 shrink-0 text-dimmed opacity-0 transition-opacity group-hover:opacity-100"
|
|
@@ -230,5 +288,8 @@ function onItem(item: PaletteItem) {
|
|
|
230
288
|
{{ $t('dms_automation.builder.palette.empty') }}
|
|
231
289
|
</div>
|
|
232
290
|
</div>
|
|
291
|
+
<p class="border-t border-default px-3 py-2 text-[11px] text-dimmed">
|
|
292
|
+
{{ $t('dms_automation.builder.palette.hintDrag') }}
|
|
293
|
+
</p>
|
|
233
294
|
</div>
|
|
234
295
|
</template>
|