@antelopejs/dms-automation 0.7.0 → 0.8.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 +19 -5
- package/dist/cluster/bus.js +8 -6
- package/dist/cluster/bus.js.map +1 -1
- package/dist/cluster/leader.js.map +1 -1
- package/dist/data/procedures-query.d.ts +19 -0
- package/dist/data/procedures-query.js +105 -0
- package/dist/data/procedures-query.js.map +1 -0
- package/dist/data/procedures-table.d.ts +4 -20
- package/dist/data/procedures-table.js +10 -106
- package/dist/data/procedures-table.js.map +1 -1
- package/dist/data/runs-table.js.map +1 -1
- package/dist/db/models/automation_template.model.d.ts +2 -4
- package/dist/db/models/automation_template.model.js +13 -14
- package/dist/db/models/automation_template.model.js.map +1 -1
- package/dist/db/models/procedure_run.model.js.map +1 -1
- package/dist/db/models/stats.model.js.map +1 -1
- package/dist/db/tables/procedure_run.table.d.ts +2 -1
- package/dist/db/tables/procedure_run.table.js.map +1 -1
- package/dist/implementations/dms-automation/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pages/category.js.map +1 -1
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/procedures.js.map +1 -1
- package/dist/pages/runs.js.map +1 -1
- package/dist/pages/shared.js +1 -1
- package/dist/pages/shared.js.map +1 -1
- package/dist/realtime.d.ts +2 -1
- package/dist/realtime.js.map +1 -1
- package/dist/routes/action-types.d.ts +2 -1
- package/dist/routes/action-types.js.map +1 -1
- package/dist/routes/deleteConfirm.js +4 -3
- package/dist/routes/deleteConfirm.js.map +1 -1
- package/dist/routes/graphSchema.d.ts +2 -1
- package/dist/routes/graphSchema.js +8 -7
- package/dist/routes/graphSchema.js.map +1 -1
- package/dist/routes/procedureChecks.js +5 -5
- package/dist/routes/procedureChecks.js.map +1 -1
- package/dist/routes/procedureRuns.d.ts +2 -2
- package/dist/routes/procedureRuns.js +1 -1
- package/dist/routes/procedureRuns.js.map +1 -1
- package/dist/routes/procedures.d.ts +14 -13
- package/dist/routes/procedures.js +2 -1
- package/dist/routes/procedures.js.map +1 -1
- package/dist/routes/requests.d.ts +11 -5
- package/dist/routes/requests.js.map +1 -1
- package/dist/routes/runs.d.ts +7 -7
- package/dist/routes/runs.js +5 -3
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/stats.js.map +1 -1
- package/dist/routes/templates.d.ts +3 -2
- package/dist/routes/templates.js +2 -1
- package/dist/routes/templates.js.map +1 -1
- package/dist/routes/trigger-types.d.ts +2 -1
- package/dist/routes/trigger-types.js.map +1 -1
- package/dist/routes/typeConfigShared.d.ts +2 -1
- package/dist/routes/typeConfigShared.js.map +1 -1
- package/dist/runtime/armErrors.d.ts +0 -1
- package/dist/runtime/armErrors.js +0 -7
- package/dist/runtime/armErrors.js.map +1 -1
- package/dist/runtime/boundRunLog.d.ts +1 -0
- package/dist/runtime/boundRunLog.js +11 -11
- package/dist/runtime/boundRunLog.js.map +1 -1
- package/dist/runtime/builtins/actions/http.js +16 -9
- package/dist/runtime/builtins/actions/http.js.map +1 -1
- package/dist/runtime/builtins/actions/log.js.map +1 -1
- package/dist/runtime/builtins/data/boolean.js +4 -5
- package/dist/runtime/builtins/data/boolean.js.map +1 -1
- package/dist/runtime/builtins/data/compare.js +8 -10
- package/dist/runtime/builtins/data/compare.js.map +1 -1
- package/dist/runtime/builtins/data/constant.js +1 -1
- package/dist/runtime/builtins/data/constant.js.map +1 -1
- package/dist/runtime/builtins/data/json.js +4 -5
- package/dist/runtime/builtins/data/json.js.map +1 -1
- package/dist/runtime/builtins/data/math.js +4 -4
- package/dist/runtime/builtins/data/math.js.map +1 -1
- package/dist/runtime/builtins/data/object.js +12 -17
- package/dist/runtime/builtins/data/object.js.map +1 -1
- package/dist/runtime/builtins/data/string.js +13 -18
- package/dist/runtime/builtins/data/string.js.map +1 -1
- package/dist/runtime/builtins/nodes/action.js +5 -2
- package/dist/runtime/builtins/nodes/action.js.map +1 -1
- package/dist/runtime/builtins/nodes/data.js +2 -2
- package/dist/runtime/builtins/nodes/data.js.map +1 -1
- package/dist/runtime/builtins/nodes/delay.js +2 -2
- package/dist/runtime/builtins/nodes/delay.js.map +1 -1
- package/dist/runtime/builtins/nodes/forRange.js +2 -2
- package/dist/runtime/builtins/nodes/forRange.js.map +1 -1
- package/dist/runtime/builtins/nodes/foreach.js +2 -2
- package/dist/runtime/builtins/nodes/foreach.js.map +1 -1
- package/dist/runtime/builtins/nodes/groupInput.js +2 -2
- package/dist/runtime/builtins/nodes/groupInput.js.map +1 -1
- package/dist/runtime/builtins/nodes/groupOutput.js +2 -2
- package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -1
- package/dist/runtime/builtins/nodes/if.js +2 -2
- package/dist/runtime/builtins/nodes/if.js.map +1 -1
- package/dist/runtime/builtins/nodes/parallel.js +2 -2
- package/dist/runtime/builtins/nodes/parallel.js.map +1 -1
- package/dist/runtime/builtins/nodes/retry.js +5 -4
- package/dist/runtime/builtins/nodes/retry.js.map +1 -1
- package/dist/runtime/builtins/nodes/setVariable.js +2 -2
- package/dist/runtime/builtins/nodes/setVariable.js.map +1 -1
- package/dist/runtime/builtins/nodes/switch.js +2 -2
- package/dist/runtime/builtins/nodes/switch.js.map +1 -1
- package/dist/runtime/builtins/nodes/trigger.js +2 -2
- package/dist/runtime/builtins/nodes/trigger.js.map +1 -1
- package/dist/runtime/builtins/nodes/tryCatch.js +2 -2
- package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -1
- package/dist/runtime/builtins/triggers/cron.d.ts +2 -1
- package/dist/runtime/builtins/triggers/cron.js +5 -7
- package/dist/runtime/builtins/triggers/cron.js.map +1 -1
- package/dist/runtime/builtins/triggers/webhook.d.ts +6 -5
- package/dist/runtime/builtins/triggers/webhook.js +9 -6
- package/dist/runtime/builtins/triggers/webhook.js.map +1 -1
- package/dist/runtime/declaredProcedures.d.ts +2 -2
- package/dist/runtime/declaredProcedures.js +3 -2
- package/dist/runtime/declaredProcedures.js.map +1 -1
- package/dist/runtime/describe.js +11 -10
- package/dist/runtime/describe.js.map +1 -1
- package/dist/runtime/executor.js +10 -7
- package/dist/runtime/executor.js.map +1 -1
- package/dist/runtime/flatten.d.ts +1 -1
- package/dist/runtime/flatten.js +1 -1
- package/dist/runtime/flatten.js.map +1 -1
- package/dist/runtime/graphIssues.js +24 -22
- package/dist/runtime/graphIssues.js.map +1 -1
- package/dist/runtime/graphVersion.d.ts +1 -1
- package/dist/runtime/graphVersion.js +2 -1
- package/dist/runtime/graphVersion.js.map +1 -1
- package/dist/runtime/nodeKinds.d.ts +3 -2
- package/dist/runtime/nodeKinds.js.map +1 -1
- package/dist/runtime/reconcile.d.ts +3 -0
- package/dist/runtime/reconcile.js +178 -0
- package/dist/runtime/reconcile.js.map +1 -0
- package/dist/runtime/resolveInputs.d.ts +4 -2
- package/dist/runtime/resolveInputs.js +13 -12
- package/dist/runtime/resolveInputs.js.map +1 -1
- package/dist/runtime/resolveSubgraph.js +4 -5
- package/dist/runtime/resolveSubgraph.js.map +1 -1
- package/dist/runtime/retention.js.map +1 -1
- package/dist/runtime/runProcedure.d.ts +1 -1
- package/dist/runtime/runProcedure.js +2 -1
- package/dist/runtime/runProcedure.js.map +1 -1
- package/dist/runtime/schedule.js +3 -0
- package/dist/runtime/schedule.js.map +1 -1
- package/dist/runtime/schemaProperties.d.ts +11 -0
- package/dist/runtime/schemaProperties.js +7 -0
- package/dist/runtime/schemaProperties.js.map +1 -0
- package/dist/runtime/serialQueue.d.ts +1 -1
- package/dist/runtime/serialQueue.js +4 -4
- package/dist/runtime/serialQueue.js.map +1 -1
- package/dist/runtime/subscriptions.js +21 -180
- package/dist/runtime/subscriptions.js.map +1 -1
- package/dist/runtime/subwalk.js.map +1 -1
- package/dist/runtime/templateCacheState.d.ts +6 -0
- package/dist/runtime/templateCacheState.js +10 -0
- package/dist/runtime/templateCacheState.js.map +1 -0
- package/dist/runtime/templateUsages.js +4 -5
- package/dist/runtime/templateUsages.js.map +1 -1
- package/dist/runtime/topo.js +2 -4
- package/dist/runtime/topo.js.map +1 -1
- package/dist/runtime/trace.js +12 -9
- package/dist/runtime/trace.js.map +1 -1
- package/dist/runtime/triggerHandles.d.ts +3 -0
- package/dist/runtime/triggerHandles.js +8 -0
- package/dist/runtime/triggerHandles.js.map +1 -1
- package/dist/runtime/typeOrigin.js +12 -1
- package/dist/runtime/typeOrigin.js.map +1 -1
- package/dist/runtime/validate.js.map +1 -1
- package/dist/runtime/validateTemplate.js.map +1 -1
- package/dist/runtime/withTimeout.js.map +1 -1
- package/dist/runtime/wording.js +12 -8
- package/dist/runtime/wording.js.map +1 -1
- package/dist/stats/health-banner.js.map +1 -1
- package/dist/stats/health.js.map +1 -1
- package/dist/stats/kpi.js +1 -1
- package/dist/stats/kpi.js.map +1 -1
- package/dist/stats/overview.js +2 -1
- package/dist/stats/overview.js.map +1 -1
- package/dist/types/dataValue.d.ts +8 -0
- package/dist/types/dataValue.js +36 -0
- package/dist/types/dataValue.js.map +1 -0
- package/dist/types/graph.d.ts +8 -1
- package/dist/types/graph.js +8 -0
- package/dist/types/graph.js.map +1 -1
- package/dist/types/guards.d.ts +8 -0
- package/dist/types/guards.js +35 -0
- package/dist/types/guards.js.map +1 -0
- package/frontend-vue/app/build/components/editor/EditorBanners.vue +120 -0
- package/frontend-vue/app/build/components/editor/EditorChoiceModal.vue +44 -0
- package/frontend-vue/app/build/components/editor/EditorForkModal.vue +51 -0
- package/frontend-vue/app/build/components/editor/EditorHeader.vue +146 -0
- package/frontend-vue/app/build/components/editor/EditorSaveTemplateModal.vue +105 -0
- package/frontend-vue/app/build/components/editor/NodeInspectorDocs.vue +28 -0
- package/frontend-vue/app/build/components/editor/NodeInspectorRun.vue +48 -0
- package/frontend-vue/app/build/composables/editor/useBuilderMount.ts +129 -0
- package/frontend-vue/app/build/composables/editor/useBuilderSave.ts +256 -0
- package/frontend-vue/app/build/composables/editor/useBuilderShortcuts.ts +270 -0
- package/frontend-vue/app/build/composables/editor/useDraftProblems.ts +288 -0
- package/frontend-vue/app/build/composables/editor/useEditorContext.ts +388 -0
- package/frontend-vue/app/build/composables/editor/useEditorLoad.ts +158 -0
- package/frontend-vue/app/build/composables/editor/useForkToLocal.ts +193 -0
- package/frontend-vue/app/build/composables/editor/useGraphHistory.ts +113 -0
- package/frontend-vue/app/build/composables/editor/useGroupEditing.ts +445 -0
- package/frontend-vue/app/build/composables/editor/usePalette.ts +41 -0
- package/frontend-vue/app/build/composables/editor/useProcedureActions.ts +96 -0
- package/frontend-vue/app/build/composables/editor/useRunOverlay.ts +466 -0
- package/frontend-vue/app/build/composables/editor/useSaveAsTemplate.ts +172 -0
- package/frontend-vue/app/build/composables/editor/useSavedTriggers.ts +100 -0
- package/frontend-vue/app/build/composables/editor/useSubgraphNavigation.ts +270 -0
- package/frontend-vue/app/build/composables/editor/useUnsavedGuards.ts +233 -0
- package/frontend-vue/app/build/composables/graphCanvas/connect.ts +273 -0
- package/frontend-vue/app/build/composables/graphCanvas/edgeEvents.ts +172 -0
- package/frontend-vue/app/build/composables/graphCanvas/edges.ts +55 -0
- package/frontend-vue/app/build/composables/graphCanvas/handles.ts +181 -0
- package/frontend-vue/app/build/composables/graphCanvas/linkMenu.ts +123 -0
- package/frontend-vue/app/build/composables/graphCanvas/nodeData.ts +222 -0
- package/frontend-vue/app/build/composables/graphCanvas/placement.ts +248 -0
- package/frontend-vue/app/build/composables/graphCanvas/selection.ts +150 -0
- package/frontend-vue/app/build/composables/graphCanvas/types.ts +188 -0
- package/frontend-vue/app/build/composables/graphCanvas/view.ts +230 -0
- package/frontend-vue/app/build/types/editor.ts +94 -0
- package/frontend-vue/app/build/utils/editor/apiErrors.ts +74 -0
- package/frontend-vue/app/build/utils/editor/graphShape.ts +68 -0
- package/frontend-vue/app/build/utils/editor/groupPlan.ts +322 -0
- package/frontend-vue/app/build/utils/editor/groupPorts.ts +210 -0
- package/frontend-vue/app/build/utils/editor/keyboard.ts +22 -0
- package/frontend-vue/app/build/utils/inspectorFields.ts +117 -0
- package/frontend-vue/app/build/utils/templates.ts +88 -0
- package/frontend-vue/app/components/AttentionList.vue +2 -6
- package/frontend-vue/app/components/Catalog.vue +2 -1
- package/frontend-vue/app/components/Editor/GraphCanvas.vue +78 -1337
- package/frontend-vue/app/components/Editor/NodeInspector.vue +31 -123
- package/frontend-vue/app/components/Editor.vue +134 -3484
- package/frontend-vue/app/components/Templates.vue +14 -84
- package/frontend-vue/build/backend-boundary.ts +122 -0
- package/frontend-vue/dms.frontend.build.ts +2 -0
- package/frontend-vue/eslint-rules/index.mjs +103 -0
- package/frontend-vue/eslint.config.mjs +15 -0
- package/frontend-vue/package.json +7 -4
- package/frontend-vue/pnpm-lock.yaml +73 -59
- package/frontend-vue/tests/api-error-presentation.test.cjs +257 -0
- package/frontend-vue/tests/helpers/setup.cjs +44 -0
- package/package.json +4 -4
- package/skills/dms-automation/SKILL.md +2 -2
- package/skills/dms-automation/cases.json +58 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { nextTick } from 'vue'
|
|
3
|
+
import type { ChoiceQuestion } from '../../types/editor'
|
|
4
|
+
|
|
5
|
+
defineProps<{ dialog: ChoiceQuestion<string> & { open: boolean } }>()
|
|
6
|
+
|
|
7
|
+
const emit = defineEmits<{
|
|
8
|
+
'update:open': [open: boolean]
|
|
9
|
+
answer: [choice: string]
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
/** The dialog opens on its safe answer: Enter keeps the draft, runs nothing. */
|
|
13
|
+
function focusSafeChoice(event: Event) {
|
|
14
|
+
event.preventDefault()
|
|
15
|
+
void nextTick(() => document.querySelector<HTMLElement>('[data-safe-choice]')?.focus())
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<UModal
|
|
21
|
+
:open="dialog.open"
|
|
22
|
+
:title="dialog.title"
|
|
23
|
+
:content="{ onOpenAutoFocus: focusSafeChoice }"
|
|
24
|
+
@update:open="emit('update:open', $event)"
|
|
25
|
+
>
|
|
26
|
+
<template #body>
|
|
27
|
+
<p class="text-sm text-toned">{{ dialog.description }}</p>
|
|
28
|
+
</template>
|
|
29
|
+
<template #footer>
|
|
30
|
+
<div class="flex w-full justify-end gap-2">
|
|
31
|
+
<UButton
|
|
32
|
+
v-for="choice in dialog.choices"
|
|
33
|
+
:key="choice.value"
|
|
34
|
+
:color="choice.color ?? 'neutral'"
|
|
35
|
+
:variant="choice.variant ?? 'solid'"
|
|
36
|
+
:data-safe-choice="choice.value === dialog.dismiss || undefined"
|
|
37
|
+
@click="emit('answer', choice.value)"
|
|
38
|
+
>
|
|
39
|
+
{{ choice.label }}
|
|
40
|
+
</UButton>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
</UModal>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ApiErrorNotice } from '#dms-core/app/composables/useApiErrorPresenter'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
submitting: boolean
|
|
6
|
+
error: ApiErrorNotice | null
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits<{ submit: [] }>()
|
|
10
|
+
|
|
11
|
+
const open = defineModel<boolean>('open', { required: true })
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<UModal
|
|
16
|
+
v-model:open="open"
|
|
17
|
+
:title="$t('dms_automation.editor.forkModal.title')"
|
|
18
|
+
>
|
|
19
|
+
<template #body>
|
|
20
|
+
<div class="flex flex-col gap-3">
|
|
21
|
+
<p class="text-sm text-toned">
|
|
22
|
+
{{ $t('dms_automation.editor.forkModal.body') }}
|
|
23
|
+
</p>
|
|
24
|
+
<DmsBanner
|
|
25
|
+
v-if="error"
|
|
26
|
+
size="sm"
|
|
27
|
+
:tone="error.severity"
|
|
28
|
+
:title="error.message"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
<template #footer>
|
|
33
|
+
<div class="flex w-full justify-end gap-2">
|
|
34
|
+
<UButton
|
|
35
|
+
:label="$t('dms_automation.editor.forkModal.cancel')"
|
|
36
|
+
variant="outline"
|
|
37
|
+
color="neutral"
|
|
38
|
+
:disabled="submitting"
|
|
39
|
+
@click="open = false"
|
|
40
|
+
/>
|
|
41
|
+
<UButton
|
|
42
|
+
:label="$t('dms_automation.editor.forkModal.submit')"
|
|
43
|
+
color="primary"
|
|
44
|
+
icon="i-ph-git-fork"
|
|
45
|
+
:loading="submitting"
|
|
46
|
+
@click="emit('submit')"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
</UModal>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProcedureSummaryRow } from '../../../components/Editor/ProcedureSwitcher.vue'
|
|
3
|
+
import type { ProcedureGraph } from '../../../composables/useGraphConnect'
|
|
4
|
+
import type { ProcedureRecord } from '../../types/editor'
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
editorMode: 'procedure' | 'template'
|
|
8
|
+
libraryBackUrl: string
|
|
9
|
+
selected: ProcedureRecord | null
|
|
10
|
+
selectedId: string | null
|
|
11
|
+
currentGraph: ProcedureGraph | null
|
|
12
|
+
isCurrentGraphReadOnly: boolean
|
|
13
|
+
paletteHidden: boolean
|
|
14
|
+
nameInputId: string
|
|
15
|
+
nameMissing: boolean
|
|
16
|
+
currentSummary: ProcedureSummaryRow | null
|
|
17
|
+
changeCount: number
|
|
18
|
+
saveState: string
|
|
19
|
+
isDirty: boolean
|
|
20
|
+
saving: boolean
|
|
21
|
+
testing: boolean
|
|
22
|
+
runsUrl: string
|
|
23
|
+
formatShortcut: ReturnType<typeof useKeyboardPlatform>['formatShortcut']
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
'open-switcher': []
|
|
28
|
+
'toggle-palette': []
|
|
29
|
+
discard: []
|
|
30
|
+
'run-now': []
|
|
31
|
+
'test-run': []
|
|
32
|
+
save: []
|
|
33
|
+
create: []
|
|
34
|
+
export: []
|
|
35
|
+
delete: []
|
|
36
|
+
}>()
|
|
37
|
+
|
|
38
|
+
const procedureName = defineModel<string>('name', { required: true })
|
|
39
|
+
const procedureEnabled = defineModel<boolean>('enabled', { required: true })
|
|
40
|
+
|
|
41
|
+
const STATE_TONES = {
|
|
42
|
+
failing: 'error',
|
|
43
|
+
degraded: 'warning',
|
|
44
|
+
healthy: 'success',
|
|
45
|
+
paused: 'neutral',
|
|
46
|
+
draft: 'info',
|
|
47
|
+
} as const
|
|
48
|
+
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<header class="flex min-h-13 flex-wrap items-center gap-2 border-b border-default px-3 py-2">
|
|
53
|
+
<template v-if="editorMode === 'procedure'">
|
|
54
|
+
<UTooltip :text="$t('dms_automation.editor.switcher.title')" :kbds="['meta', 'p']">
|
|
55
|
+
<UButton
|
|
56
|
+
icon="i-ph-flow-arrow"
|
|
57
|
+
variant="ghost"
|
|
58
|
+
color="neutral"
|
|
59
|
+
:aria-label="$t('dms_automation.editor.switcher.title')"
|
|
60
|
+
@click="emit('open-switcher')"
|
|
61
|
+
/>
|
|
62
|
+
</UTooltip>
|
|
63
|
+
</template>
|
|
64
|
+
<template v-else>
|
|
65
|
+
<UButton icon="i-ph-arrow-left" variant="ghost" color="neutral" :to="libraryBackUrl">
|
|
66
|
+
{{ $t('dms_automation.library.title') }}
|
|
67
|
+
</UButton>
|
|
68
|
+
<UBadge color="info" variant="subtle">{{ $t('dms_automation.editor.templateBadge') }}</UBadge>
|
|
69
|
+
</template>
|
|
70
|
+
<UTooltip v-if="selected && currentGraph && !isCurrentGraphReadOnly" :text="paletteHidden ? $t('dms_automation.editor.showBlocks') : $t('dms_automation.editor.hideBlocks')">
|
|
71
|
+
<UButton
|
|
72
|
+
:icon="paletteHidden ? 'i-ph-sidebar-simple' : 'i-ph-sidebar-simple-fill'"
|
|
73
|
+
variant="ghost"
|
|
74
|
+
color="neutral"
|
|
75
|
+
:aria-label="paletteHidden ? $t('dms_automation.editor.showBlocks') : $t('dms_automation.editor.hideBlocks')"
|
|
76
|
+
:aria-pressed="!paletteHidden"
|
|
77
|
+
@click="emit('toggle-palette')"
|
|
78
|
+
/>
|
|
79
|
+
</UTooltip>
|
|
80
|
+
<UInput
|
|
81
|
+
v-if="selected"
|
|
82
|
+
:id="nameInputId"
|
|
83
|
+
v-model="procedureName"
|
|
84
|
+
variant="ghost"
|
|
85
|
+
:color="nameMissing ? 'error' : undefined"
|
|
86
|
+
:highlight="nameMissing"
|
|
87
|
+
:placeholder="editorMode === 'template' ? $t('dms_automation.editor.templateName') : $t('dms_automation.editor.procedureName')"
|
|
88
|
+
:aria-label="editorMode === 'template' ? $t('dms_automation.editor.templateName') : $t('dms_automation.editor.procedureName')"
|
|
89
|
+
:aria-invalid="nameMissing || undefined"
|
|
90
|
+
:aria-describedby="nameMissing ? `${nameInputId}-error` : undefined"
|
|
91
|
+
class="min-w-[12rem] max-w-sm flex-1 font-medium"
|
|
92
|
+
/>
|
|
93
|
+
<DmsFieldError v-if="nameMissing" :id="`${nameInputId}-error`" :message="$t('dms_automation.editor.nameRequired')" />
|
|
94
|
+
<DmsStatusPill
|
|
95
|
+
v-if="currentSummary && editorMode === 'procedure'"
|
|
96
|
+
:tone="STATE_TONES[currentSummary.status]"
|
|
97
|
+
:label="$t(`dms_automation.procedures.status.${currentSummary.status}`)"
|
|
98
|
+
size="sm"
|
|
99
|
+
/>
|
|
100
|
+
<label v-if="selected && editorMode === 'procedure'" class="flex items-center gap-2 text-sm text-muted">
|
|
101
|
+
<USwitch v-model="procedureEnabled" size="sm" />
|
|
102
|
+
{{ procedureEnabled ? $t('dms_automation.editor.enabled') : $t('dms_automation.editor.disabled') }}
|
|
103
|
+
</label>
|
|
104
|
+
<span v-if="selected" class="ml-1 inline-flex items-center gap-1 whitespace-nowrap text-xs" :class="changeCount > 0 ? 'text-warning' : 'text-dimmed'">
|
|
105
|
+
<UIcon :name="changeCount > 0 ? 'i-ph-circle-fill' : 'i-ph-check'" class="size-2.5 shrink-0" />
|
|
106
|
+
{{ saveState }}
|
|
107
|
+
</span>
|
|
108
|
+
<div class="ml-auto flex flex-wrap items-center gap-2">
|
|
109
|
+
<UButton
|
|
110
|
+
v-if="selected"
|
|
111
|
+
variant="ghost"
|
|
112
|
+
color="neutral"
|
|
113
|
+
:disabled="!isDirty || saving"
|
|
114
|
+
@click="emit('discard')"
|
|
115
|
+
>
|
|
116
|
+
{{ $t('dms_automation.editor.discard') }}
|
|
117
|
+
</UButton>
|
|
118
|
+
<template v-if="selected && editorMode === 'procedure'">
|
|
119
|
+
<UButton variant="outline" color="neutral" icon="i-ph-play" @click="emit('run-now')">
|
|
120
|
+
{{ $t('dms_automation.editor.runNowButton') }}
|
|
121
|
+
</UButton>
|
|
122
|
+
<UButton variant="outline" color="neutral" icon="i-ph-flask" :loading="testing" @click="emit('test-run')">
|
|
123
|
+
{{ $t('dms_automation.editor.testRun') }}
|
|
124
|
+
<UKbd :value="formatShortcut(['meta', '↵'])" size="sm" class="ml-1" />
|
|
125
|
+
</UButton>
|
|
126
|
+
</template>
|
|
127
|
+
<UButton v-if="selected" color="primary" icon="i-ph-floppy-disk" :disabled="!isDirty || nameMissing" :loading="saving" @click="emit('save')">
|
|
128
|
+
{{ $t('dms_automation.common.save') }}
|
|
129
|
+
<UKbd :value="formatShortcut(['meta', 's'])" size="sm" class="ml-1" />
|
|
130
|
+
</UButton>
|
|
131
|
+
<UDropdownMenu
|
|
132
|
+
v-if="selected && editorMode === 'procedure'"
|
|
133
|
+
:items="[
|
|
134
|
+
[
|
|
135
|
+
{ label: $t('dms_automation.newProcedure.title'), icon: 'i-ph-plus', onSelect: () => emit('create') },
|
|
136
|
+
{ label: $t('dms_automation.editor.exportJson'), icon: 'i-ph-download-simple', onSelect: () => emit('export') },
|
|
137
|
+
{ label: $t('dms_automation.editor.viewRuns'), icon: 'i-ph-list-bullets', to: `${runsUrl}?procedure=${selectedId}` },
|
|
138
|
+
],
|
|
139
|
+
[{ label: $t('dms_automation.editor.delete'), icon: 'i-ph-trash', color: 'error', onSelect: () => emit('delete') }],
|
|
140
|
+
]"
|
|
141
|
+
>
|
|
142
|
+
<UButton icon="i-ph-dots-three" variant="ghost" color="neutral" :aria-label="$t('dms_automation.editor.more')" />
|
|
143
|
+
</UDropdownMenu>
|
|
144
|
+
</div>
|
|
145
|
+
</header>
|
|
146
|
+
</template>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { GraphNode } from '../../../composables/useGraphConnect'
|
|
3
|
+
import { TEMPLATE_NAME_ID, TEMPLATE_ROW } from '../../composables/editor/useSaveAsTemplate'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
group: GraphNode | null
|
|
7
|
+
submitting: boolean
|
|
8
|
+
error: string | null
|
|
9
|
+
fieldErrors: ReturnType<typeof useFieldErrors<'name'>>
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const emit = defineEmits<{ submit: [] }>()
|
|
13
|
+
|
|
14
|
+
const open = defineModel<boolean>('open', { required: true })
|
|
15
|
+
const name = defineModel<string>('name', { required: true })
|
|
16
|
+
const description = defineModel<string>('description', { required: true })
|
|
17
|
+
const icon = defineModel<string>('icon', { required: true })
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<UModal
|
|
22
|
+
v-model:open="open"
|
|
23
|
+
:title="$t('dms_automation.editor.saveTemplateModal.title')"
|
|
24
|
+
>
|
|
25
|
+
<template #body>
|
|
26
|
+
<div class="flex flex-col gap-3">
|
|
27
|
+
<DmsFieldRow
|
|
28
|
+
v-bind="TEMPLATE_ROW"
|
|
29
|
+
:label="$t('dms_automation.editor.saveTemplateModal.name')"
|
|
30
|
+
:label-for="TEMPLATE_NAME_ID"
|
|
31
|
+
required
|
|
32
|
+
>
|
|
33
|
+
<div class="grid gap-1.5">
|
|
34
|
+
<DmsInputText
|
|
35
|
+
:id="TEMPLATE_NAME_ID"
|
|
36
|
+
v-model="name"
|
|
37
|
+
:placeholder="$t('dms_automation.editor.saveTemplateModal.namePlaceholder')"
|
|
38
|
+
class="w-full"
|
|
39
|
+
:disabled="submitting"
|
|
40
|
+
v-bind="fieldErrors.aria('name')"
|
|
41
|
+
/>
|
|
42
|
+
<DmsFieldError :id="fieldErrors.errorId('name')" :message="fieldErrors.errors.name" />
|
|
43
|
+
</div>
|
|
44
|
+
</DmsFieldRow>
|
|
45
|
+
<DmsFieldRow
|
|
46
|
+
v-bind="TEMPLATE_ROW"
|
|
47
|
+
:label="$t('dms_automation.editor.saveTemplateModal.description')"
|
|
48
|
+
label-for="save-template-description"
|
|
49
|
+
>
|
|
50
|
+
<DmsTextarea
|
|
51
|
+
id="save-template-description"
|
|
52
|
+
v-model="description"
|
|
53
|
+
:placeholder="$t('dms_automation.editor.saveTemplateModal.descriptionPlaceholder')"
|
|
54
|
+
class="w-full"
|
|
55
|
+
:rows="3"
|
|
56
|
+
:disabled="submitting"
|
|
57
|
+
/>
|
|
58
|
+
</DmsFieldRow>
|
|
59
|
+
<DmsFieldRow v-bind="TEMPLATE_ROW" :label="$t('dms_automation.editor.saveTemplateModal.icon')">
|
|
60
|
+
<DmsAutomationIconPicker v-model="icon" />
|
|
61
|
+
</DmsFieldRow>
|
|
62
|
+
<div v-if="group?.ports?.length" class="flex flex-col gap-1">
|
|
63
|
+
<span class="text-xs font-medium text-highlighted">{{ $t('dms_automation.editor.saveTemplateModal.ports') }}</span>
|
|
64
|
+
<div class="overflow-hidden rounded-md border border-default">
|
|
65
|
+
<div
|
|
66
|
+
v-for="port in group.ports"
|
|
67
|
+
:key="`${port.direction}-${port.kind}-${port.name}`"
|
|
68
|
+
class="flex items-center gap-2 border-b border-default px-2 py-1 font-mono text-xs last:border-0"
|
|
69
|
+
>
|
|
70
|
+
<UBadge size="sm" variant="subtle" :color="port.kind === 'trigger' ? 'info' : 'success'">{{ $t(`dms_automation.templates.ports.kind.${port.kind}`) }}</UBadge>
|
|
71
|
+
<span class="text-muted">{{ $t(`dms_automation.templates.ports.direction.${port.direction}`) }}</span>
|
|
72
|
+
<span class="text-highlighted">{{ port.name }}</span>
|
|
73
|
+
<span v-if="port.schema?.type" class="ml-auto text-dimmed">{{ port.schema.type }}</span>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<DmsBanner
|
|
78
|
+
v-if="error"
|
|
79
|
+
size="sm"
|
|
80
|
+
tone="error"
|
|
81
|
+
:title="$t('dms_automation.editor.saveTemplateModal.error')"
|
|
82
|
+
:description="error"
|
|
83
|
+
/>
|
|
84
|
+
<DmsFormRequiredLegend />
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
87
|
+
<template #footer>
|
|
88
|
+
<div class="flex w-full justify-end gap-2">
|
|
89
|
+
<UButton
|
|
90
|
+
:label="$t('dms_automation.editor.saveTemplateModal.cancel')"
|
|
91
|
+
variant="outline"
|
|
92
|
+
color="neutral"
|
|
93
|
+
:disabled="submitting"
|
|
94
|
+
@click="open = false"
|
|
95
|
+
/>
|
|
96
|
+
<UButton
|
|
97
|
+
:label="$t('dms_automation.editor.saveTemplateModal.submit')"
|
|
98
|
+
color="primary"
|
|
99
|
+
:loading="submitting"
|
|
100
|
+
@click="emit('submit')"
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
</UModal>
|
|
105
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { JsonSchema } from '../../../composables/useGraphConnect'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
description: string
|
|
6
|
+
inputSchema: JsonSchema | null
|
|
7
|
+
branches: string[]
|
|
8
|
+
outputSchema: JsonSchema | null
|
|
9
|
+
}>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div class="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4">
|
|
14
|
+
<p class="text-sm text-toned">{{ description || $t('dms_automation.editor.inspector.noDocs') }}</p>
|
|
15
|
+
<div class="flex flex-col gap-1">
|
|
16
|
+
<span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.library.inputs') }}</span>
|
|
17
|
+
<DmsAutomationSchemaTable :schema="inputSchema" />
|
|
18
|
+
</div>
|
|
19
|
+
<div v-if="branches.length" class="flex flex-col gap-1">
|
|
20
|
+
<span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.editor.inspector.branches') }}</span>
|
|
21
|
+
<p class="font-mono text-xs text-toned">{{ branches.join(' · ') }}</p>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="flex flex-col gap-1">
|
|
24
|
+
<span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.library.outputs') }}</span>
|
|
25
|
+
<DmsAutomationSchemaTable :schema="outputSchema" />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TraceStep } from '../../../composables/useAutomationRuns'
|
|
3
|
+
import { describeDuration, prettyJson } from '../../../utils/describe'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
runStep: TraceStep
|
|
7
|
+
/** Says which run that is ("Test run · just now", "Run 8f3a2c · 14:28"). */
|
|
8
|
+
runLabel?: string
|
|
9
|
+
/** Opens the trace of that run. */
|
|
10
|
+
runTraceUrl?: string
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
function unwrap(described: unknown): unknown {
|
|
14
|
+
if (!described || typeof described !== 'object') return described
|
|
15
|
+
if ('value' in described && 'type' in described) return (described as { value: unknown }).value
|
|
16
|
+
return Object.fromEntries(Object.entries(described as Record<string, unknown>).map(([k, v]) => [k, unwrap(v)]))
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4">
|
|
22
|
+
<div class="flex items-center justify-between gap-2">
|
|
23
|
+
<DmsStatusPill
|
|
24
|
+
:tone="runStep.status === 'failed' ? 'error' : 'success'"
|
|
25
|
+
:label="runStep.status === 'failed' ? $t('dms_automation.runs.status.failed') : $t('dms_automation.runs.status.ok')"
|
|
26
|
+
size="sm"
|
|
27
|
+
/>
|
|
28
|
+
<span class="font-mono text-xs text-muted">{{ describeDuration(runStep.durationMs) }}</span>
|
|
29
|
+
</div>
|
|
30
|
+
<p v-if="runLabel" class="text-xs text-muted">{{ runLabel }}</p>
|
|
31
|
+
<div class="flex flex-col gap-1">
|
|
32
|
+
<span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.trace.input') }}</span>
|
|
33
|
+
<pre class="max-h-56 overflow-auto rounded-md bg-elevated p-2 font-mono text-xs break-all whitespace-pre-wrap text-toned">{{ prettyJson(unwrap(runStep.inputs)) || '—' }}</pre>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="flex flex-col gap-1">
|
|
36
|
+
<span class="font-mono text-[10.5px] text-dimmed uppercase">
|
|
37
|
+
{{ runStep.status === 'failed' ? $t('dms_automation.trace.error') : $t('dms_automation.trace.output') }}
|
|
38
|
+
</span>
|
|
39
|
+
<pre
|
|
40
|
+
class="max-h-56 overflow-auto rounded-md bg-elevated p-2 font-mono text-xs break-all whitespace-pre-wrap"
|
|
41
|
+
:class="runStep.status === 'failed' ? 'text-error' : 'text-toned'"
|
|
42
|
+
>{{ runStep.status === 'failed' ? runStep.error : prettyJson(unwrap(runStep.output)) || '—' }}</pre>
|
|
43
|
+
</div>
|
|
44
|
+
<UButton v-if="runTraceUrl" size="xs" variant="ghost" color="neutral" trailing-icon="i-ph-arrow-up-right" :to="runTraceUrl" class="self-start">
|
|
45
|
+
{{ $t('dms_automation.trace.openFull') }}
|
|
46
|
+
</UButton>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { computed, onMounted, watch } from "vue";
|
|
2
|
+
import type { EditorContext } from "./useEditorContext";
|
|
3
|
+
import { type TriggerSummary } from "../../../utils/describe";
|
|
4
|
+
import type { SubgraphNavigation } from "./useSubgraphNavigation";
|
|
5
|
+
import type { DraftProblems } from "./useDraftProblems";
|
|
6
|
+
import type { RunOverlay } from "./useRunOverlay";
|
|
7
|
+
|
|
8
|
+
/** What the builder does when another procedure opens, when it mounts, and when its triggers change. */
|
|
9
|
+
export function useBuilderMount(
|
|
10
|
+
ctx: EditorContext,
|
|
11
|
+
nav: SubgraphNavigation,
|
|
12
|
+
problems: DraftProblems,
|
|
13
|
+
runs: RunOverlay,
|
|
14
|
+
) {
|
|
15
|
+
const {
|
|
16
|
+
builderPath,
|
|
17
|
+
draftTriggers,
|
|
18
|
+
editorMode,
|
|
19
|
+
missingProcedureId,
|
|
20
|
+
overlayRun,
|
|
21
|
+
processI18n,
|
|
22
|
+
processText,
|
|
23
|
+
queryValue,
|
|
24
|
+
route,
|
|
25
|
+
router,
|
|
26
|
+
selected,
|
|
27
|
+
selectedId,
|
|
28
|
+
selectedNodeId,
|
|
29
|
+
subgraphPath,
|
|
30
|
+
switcherOpen,
|
|
31
|
+
testTriggerNodeId,
|
|
32
|
+
triggerTypes,
|
|
33
|
+
} = ctx;
|
|
34
|
+
const { onGroupEnter } = nav;
|
|
35
|
+
const { selectNode } = problems;
|
|
36
|
+
const { openRunFromUrl } = runs;
|
|
37
|
+
|
|
38
|
+
// Another procedure opened: what the bar and the dock show follows it
|
|
39
|
+
// through their reads' URLs.
|
|
40
|
+
watch(selectedId, (id) => {
|
|
41
|
+
if (id) missingProcedureId.value = null;
|
|
42
|
+
overlayRun.value = null;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
function enterPathFromUrl(): boolean {
|
|
46
|
+
const ids = (queryValue("path") ?? "").split(",").filter(Boolean);
|
|
47
|
+
for (const id of ids) {
|
|
48
|
+
const depth = subgraphPath.value.length;
|
|
49
|
+
onGroupEnter({ id });
|
|
50
|
+
if (subgraphPath.value.length === depth) break;
|
|
51
|
+
}
|
|
52
|
+
return subgraphPath.value.length > 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onMounted(async () => {
|
|
56
|
+
if (missingProcedureId.value) switcherOpen.value = true;
|
|
57
|
+
const runId = queryValue("run");
|
|
58
|
+
if (runId) await openRunFromUrl(runId);
|
|
59
|
+
const nodeId = queryValue("node");
|
|
60
|
+
if (nodeId) {
|
|
61
|
+
if (enterPathFromUrl()) selectedNodeId.value = nodeId;
|
|
62
|
+
else selectNode(nodeId);
|
|
63
|
+
}
|
|
64
|
+
// The URL names the procedure on screen, to share or reload it.
|
|
65
|
+
if (
|
|
66
|
+
editorMode.value === "procedure" &&
|
|
67
|
+
selectedId.value &&
|
|
68
|
+
queryValue("selected") !== selectedId.value
|
|
69
|
+
) {
|
|
70
|
+
void router.replace({
|
|
71
|
+
path: builderPath(),
|
|
72
|
+
query: { ...route.query, selected: selectedId.value },
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const selectedTriggerSummaries = computed<TriggerSummary[]>(() =>
|
|
78
|
+
(selected.value?.graph.nodes ?? [])
|
|
79
|
+
.filter((n) => n.kind === "trigger" && n.typeId)
|
|
80
|
+
.map((n) => ({
|
|
81
|
+
nodeId: n.id,
|
|
82
|
+
typeId: n.typeId!,
|
|
83
|
+
typeName:
|
|
84
|
+
triggerTypes.value.find((x) => x.id === n.typeId)?.name ?? n.typeId!,
|
|
85
|
+
path: typeof n.config?.path === "string" ? n.config.path : undefined,
|
|
86
|
+
method:
|
|
87
|
+
typeof n.config?.method === "string" ? n.config.method : undefined,
|
|
88
|
+
cron: typeof n.config?.cron === "string" ? n.config.cron : undefined,
|
|
89
|
+
})),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// A draft trigger as the server words it, its type's name until it has.
|
|
93
|
+
function triggerLabel(trigger: TriggerSummary): string {
|
|
94
|
+
const worded = draftTriggers.value.find(
|
|
95
|
+
(tr) => tr.nodeId === trigger.nodeId,
|
|
96
|
+
);
|
|
97
|
+
return worded ? processText(worded.text) : processI18n(trigger.typeName);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Test run starts from the trigger picked in the dock: the manual one, else
|
|
101
|
+
// the first, until the user picks another; its last real payload prefills
|
|
102
|
+
// the test payload.
|
|
103
|
+
const testTriggerItems = computed(() =>
|
|
104
|
+
selectedTriggerSummaries.value.map((trigger) => ({
|
|
105
|
+
label: triggerLabel(trigger),
|
|
106
|
+
value: trigger.nodeId ?? "",
|
|
107
|
+
})),
|
|
108
|
+
);
|
|
109
|
+
watch(
|
|
110
|
+
selectedTriggerSummaries,
|
|
111
|
+
(triggers) => {
|
|
112
|
+
if (
|
|
113
|
+
triggers.some((trigger) => trigger.nodeId === testTriggerNodeId.value)
|
|
114
|
+
)
|
|
115
|
+
return;
|
|
116
|
+
testTriggerNodeId.value =
|
|
117
|
+
triggers.find((trigger) => trigger.typeId === "manual")?.nodeId ??
|
|
118
|
+
triggers[0]?.nodeId;
|
|
119
|
+
},
|
|
120
|
+
{ immediate: true },
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
selectedTriggerSummaries,
|
|
125
|
+
testTriggerItems,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type BuilderMount = ReturnType<typeof useBuilderMount>;
|