@antelopejs/dms-automation 0.2.7 → 0.3.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/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 +111 -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 +101 -45
- package/frontend-vue/app/components/Editor/GraphCanvas.vue +818 -206
- 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 +373 -101
- 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 -6
- 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 -170
- package/frontend-vue/app/components/Catalog/TypeList.vue +0 -203
- package/frontend-vue/app/components/DataNodes.vue +0 -275
- package/frontend-vue/app/components/Editor/ProcedureList.vue +0 -156
- package/frontend-vue/app/components/Editor/RunsDrawer.vue +0 -312
- package/frontend-vue/app/components/Library.vue +0 -69
- package/frontend-vue/app/components/Overview.vue +0 -503
- package/frontend-vue/app/components/RunDetailDrawer.vue +0 -165
- package/frontend-vue/app/components/RunFireTree.vue +0 -170
- package/frontend-vue/app/components/RunTraceDrawer.vue +0 -59
- package/frontend-vue/app/components/RunsStats.vue +0 -126
- package/frontend-vue/app/components/RunsTimelineDisplay.vue +0 -287
- package/frontend-vue/app/components/Triggers.vue +0 -147
- package/frontend-vue/app/plugins/runs-timeline-display.client.ts +0 -16
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { describeRelative, describeTime, stepTitle, type StepName } from '../utils/describe'
|
|
4
|
+
|
|
5
|
+
// "Needs attention": the procedures someone should look at, each saying why
|
|
6
|
+
// and offering the next action — open the failing trace, edit the procedure,
|
|
7
|
+
// resume a paused one, dismiss a degraded one that recovered.
|
|
8
|
+
|
|
9
|
+
interface FailureRef {
|
|
10
|
+
runId: string
|
|
11
|
+
startedAt: string
|
|
12
|
+
error: string
|
|
13
|
+
step: StepName | null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface AttentionRow {
|
|
17
|
+
procedureId: string
|
|
18
|
+
name: string
|
|
19
|
+
state: 'failing' | 'degraded' | 'paused'
|
|
20
|
+
runs: number
|
|
21
|
+
failed: number
|
|
22
|
+
streak: number
|
|
23
|
+
since: string | null
|
|
24
|
+
lastRunId: string | null
|
|
25
|
+
lastFailure: FailureRef | null
|
|
26
|
+
recovered: boolean
|
|
27
|
+
/** Why a trigger did not arm: a problem code, its params, the English message. */
|
|
28
|
+
armError: { code: string; params?: Record<string, string | number>; message: string } | null
|
|
29
|
+
pausedAt: string | null
|
|
30
|
+
pausedBy: string | null
|
|
31
|
+
triggerType: string | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const props = defineProps<{
|
|
35
|
+
fetchUrl: string
|
|
36
|
+
/** The period selector whose period the degraded rows are read over. */
|
|
37
|
+
periodScope?: string
|
|
38
|
+
proceduresUrl: string
|
|
39
|
+
builderUrl: string
|
|
40
|
+
traceUrl: string
|
|
41
|
+
apiUrl: string
|
|
42
|
+
}>()
|
|
43
|
+
|
|
44
|
+
const { $authFetch } = useAuthFetch()
|
|
45
|
+
const { processI18n } = useTranslation()
|
|
46
|
+
const { t, te } = useI18n()
|
|
47
|
+
const { dateTimeFormat } = useRegionalFormat()
|
|
48
|
+
const toast = useToast()
|
|
49
|
+
|
|
50
|
+
// Read like the DMS cards: over the page's period, on its refreshes, through
|
|
51
|
+
// its Live / Pause.
|
|
52
|
+
const { data, isLoading, error, refresh } = useChartFetch<{ items: AttentionRow[]; total: number }>({
|
|
53
|
+
fetchUrl: props.fetchUrl,
|
|
54
|
+
periodScope: props.periodScope,
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const rows = computed(() => data.value?.items ?? [])
|
|
58
|
+
const total = computed(() => data.value?.total ?? rows.value.length)
|
|
59
|
+
const hasError = computed(() => !isLoading.value && data.value === null && Boolean(error.value))
|
|
60
|
+
const errorDetail = computed(() => (error.value ? describeApiError(error.value) : undefined))
|
|
61
|
+
const busy = ref<string | null>(null)
|
|
62
|
+
|
|
63
|
+
const TONES = { failing: 'error', degraded: 'warning', paused: 'neutral' } as const
|
|
64
|
+
|
|
65
|
+
function reason(row: AttentionRow): string {
|
|
66
|
+
const f = row.lastFailure
|
|
67
|
+
const step = stepTitle(f?.step, processI18n)
|
|
68
|
+
const error = f?.error ?? ''
|
|
69
|
+
if (row.armError) {
|
|
70
|
+
const key = `dms_automation.editor.problems.codes.${row.armError.code}`
|
|
71
|
+
const error = te(key) ? t(key, row.armError.params ?? {}) : row.armError.message
|
|
72
|
+
return processI18n('$dms_automation.procedures.detail.triggerError', { error })
|
|
73
|
+
}
|
|
74
|
+
if (row.state === 'failing') {
|
|
75
|
+
const key = step ? 'failingAt' : 'failing'
|
|
76
|
+
return processI18n(`$dms_automation.attention.${key}`, {
|
|
77
|
+
count: row.streak,
|
|
78
|
+
step,
|
|
79
|
+
error,
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
if (row.state === 'degraded') {
|
|
83
|
+
return processI18n('$dms_automation.attention.degradedInPeriod', {
|
|
84
|
+
count: row.failed,
|
|
85
|
+
failed: row.failed,
|
|
86
|
+
runs: row.runs,
|
|
87
|
+
when: f ? describeTime(f.startedAt, dateTimeFormat) : '—',
|
|
88
|
+
error,
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
if (row.pausedAt) {
|
|
92
|
+
return processI18n(
|
|
93
|
+
row.pausedBy ? '$dms_automation.attention.pausedBy' : '$dms_automation.attention.pausedAt',
|
|
94
|
+
{ name: row.pausedBy ?? '', ago: describeRelative(row.pausedAt) },
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
return processI18n('$dms_automation.attention.paused')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface Change {
|
|
101
|
+
method: 'POST' | 'PUT' | 'DELETE'
|
|
102
|
+
url: string
|
|
103
|
+
body?: Record<string, unknown>
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function failed(e: unknown) {
|
|
107
|
+
toast.add({
|
|
108
|
+
title: processI18n('$dms_automation.common.actionFailed'),
|
|
109
|
+
description: describeApiError(e),
|
|
110
|
+
color: 'error',
|
|
111
|
+
icon: 'i-ph-warning',
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Applies a change, then refreshes the page: the banner, the counts and this
|
|
117
|
+
* list all move. The toast offers to put it back, since a dismiss or a resume
|
|
118
|
+
* applies to everyone at once.
|
|
119
|
+
*/
|
|
120
|
+
async function act(row: AttentionRow, change: Change, undo: Change, message: string) {
|
|
121
|
+
busy.value = row.procedureId
|
|
122
|
+
try {
|
|
123
|
+
await $authFetch(change.url, { method: change.method, body: change.body })
|
|
124
|
+
refreshPageBlocks()
|
|
125
|
+
toast.add({
|
|
126
|
+
title: processI18n(message, { name: row.name }),
|
|
127
|
+
color: 'success',
|
|
128
|
+
icon: 'i-ph-check-circle',
|
|
129
|
+
actions: [
|
|
130
|
+
{
|
|
131
|
+
label: processI18n('$dms_automation.attention.undo'),
|
|
132
|
+
color: 'neutral',
|
|
133
|
+
variant: 'outline',
|
|
134
|
+
onClick: () => {
|
|
135
|
+
$authFetch(undo.url, { method: undo.method, body: undo.body }).then(refreshPageBlocks, failed)
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
})
|
|
140
|
+
} catch (e) {
|
|
141
|
+
failed(e)
|
|
142
|
+
} finally {
|
|
143
|
+
busy.value = null
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function resume(row: AttentionRow) {
|
|
148
|
+
const url = `${props.apiUrl}/procedures/${row.procedureId}/enabled`
|
|
149
|
+
// Undo puts the pause back as it was: who paused it, and when.
|
|
150
|
+
void act(
|
|
151
|
+
row,
|
|
152
|
+
{ method: 'PUT', url, body: { enabled: true } },
|
|
153
|
+
{ method: 'PUT', url, body: { enabled: false, restorePause: true } },
|
|
154
|
+
'$dms_automation.attention.resumed',
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function dismiss(row: AttentionRow) {
|
|
159
|
+
const url = `${props.apiUrl}/procedures/${row.procedureId}/dismiss-attention`
|
|
160
|
+
void act(row, { method: 'POST', url, body: {} }, { method: 'DELETE', url }, '$dms_automation.attention.dismissed')
|
|
161
|
+
}
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<template>
|
|
165
|
+
<DmsCard :title="$t('dms_automation.attention.title')" :count="total || undefined" :padded="false" class="h-full">
|
|
166
|
+
<template #actions>
|
|
167
|
+
<UButton size="xs" variant="ghost" color="neutral" trailing-icon="i-ph-arrow-right" :to="proceduresUrl">
|
|
168
|
+
{{ $t('dms_automation.attention.allProcedures') }}
|
|
169
|
+
</UButton>
|
|
170
|
+
</template>
|
|
171
|
+
|
|
172
|
+
<div v-if="isLoading && data === null" class="flex flex-col gap-3 p-4">
|
|
173
|
+
<USkeleton v-for="i in 3" :key="i" class="h-12 w-full" />
|
|
174
|
+
</div>
|
|
175
|
+
<div v-else-if="hasError" class="p-4" :title="errorDetail">
|
|
176
|
+
<DmsEmptyState
|
|
177
|
+
variant="error"
|
|
178
|
+
size="sm"
|
|
179
|
+
:title="$t('dms_automation.attention.loadError')"
|
|
180
|
+
:description="$t('dms_automation.attention.loadErrorHint')"
|
|
181
|
+
:actions="[{ label: $t('dms_automation.common.retry'), icon: 'i-ph-arrow-clockwise', onClick: refresh }]"
|
|
182
|
+
/>
|
|
183
|
+
</div>
|
|
184
|
+
<div v-else-if="rows.length === 0" class="p-4">
|
|
185
|
+
<DmsEmptyState
|
|
186
|
+
size="sm"
|
|
187
|
+
icon="i-ph-check-circle"
|
|
188
|
+
tone="success"
|
|
189
|
+
:title="$t('dms_automation.attention.empty')"
|
|
190
|
+
:description="$t('dms_automation.attention.emptyHint')"
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
<template v-else>
|
|
194
|
+
<ul class="divide-y divide-default">
|
|
195
|
+
<!-- On a phone the actions go under the text, which keeps the full width. -->
|
|
196
|
+
<li v-for="row in rows" :key="row.procedureId" class="flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-3">
|
|
197
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1">
|
|
198
|
+
<div class="flex min-w-0 items-center gap-2">
|
|
199
|
+
<span class="truncate text-sm font-medium text-highlighted">{{ row.name }}</span>
|
|
200
|
+
<DmsStatusPill
|
|
201
|
+
:tone="TONES[row.state]"
|
|
202
|
+
:label="$t(`dms_automation.procedures.status.${row.state}`)"
|
|
203
|
+
size="sm"
|
|
204
|
+
/>
|
|
205
|
+
</div>
|
|
206
|
+
<p
|
|
207
|
+
class="line-clamp-2 text-xs"
|
|
208
|
+
:class="row.state === 'failing' ? 'text-error' : 'text-muted'"
|
|
209
|
+
>
|
|
210
|
+
{{ reason(row) }}
|
|
211
|
+
</p>
|
|
212
|
+
</div>
|
|
213
|
+
<div class="flex flex-wrap items-center gap-1 sm:shrink-0 sm:flex-nowrap">
|
|
214
|
+
<UButton
|
|
215
|
+
v-if="row.state !== 'paused' && row.lastFailure"
|
|
216
|
+
size="xs"
|
|
217
|
+
:color="row.state === 'failing' ? 'error' : 'neutral'"
|
|
218
|
+
variant="soft"
|
|
219
|
+
icon="i-ph-path"
|
|
220
|
+
:to="`${traceUrl}?run=${row.lastFailure.runId}`"
|
|
221
|
+
>
|
|
222
|
+
{{ $t('dms_automation.attention.openTrace') }}
|
|
223
|
+
</UButton>
|
|
224
|
+
<UButton
|
|
225
|
+
v-if="row.state === 'degraded'"
|
|
226
|
+
size="xs"
|
|
227
|
+
color="neutral"
|
|
228
|
+
variant="ghost"
|
|
229
|
+
:loading="busy === row.procedureId"
|
|
230
|
+
@click="dismiss(row)"
|
|
231
|
+
>
|
|
232
|
+
{{ $t('dms_automation.attention.dismiss') }}
|
|
233
|
+
</UButton>
|
|
234
|
+
<UButton
|
|
235
|
+
v-if="row.state === 'paused'"
|
|
236
|
+
size="xs"
|
|
237
|
+
color="primary"
|
|
238
|
+
variant="soft"
|
|
239
|
+
icon="i-ph-play"
|
|
240
|
+
:loading="busy === row.procedureId"
|
|
241
|
+
@click="resume(row)"
|
|
242
|
+
>
|
|
243
|
+
{{ $t('dms_automation.attention.resume') }}
|
|
244
|
+
</UButton>
|
|
245
|
+
<!-- A trigger that did not arm has no run to open: the fix is in the builder. -->
|
|
246
|
+
<UButton
|
|
247
|
+
v-if="row.armError"
|
|
248
|
+
size="xs"
|
|
249
|
+
color="error"
|
|
250
|
+
variant="soft"
|
|
251
|
+
icon="i-ph-pencil-simple"
|
|
252
|
+
:to="`${builderUrl}?selected=${row.procedureId}`"
|
|
253
|
+
>
|
|
254
|
+
{{ $t('dms_automation.attention.edit') }}
|
|
255
|
+
</UButton>
|
|
256
|
+
<UTooltip v-else :text="$t('dms_automation.attention.edit')">
|
|
257
|
+
<UButton
|
|
258
|
+
size="xs"
|
|
259
|
+
color="neutral"
|
|
260
|
+
variant="ghost"
|
|
261
|
+
icon="i-ph-pencil-simple"
|
|
262
|
+
:aria-label="$t('dms_automation.attention.edit')"
|
|
263
|
+
:to="`${builderUrl}?selected=${row.procedureId}`"
|
|
264
|
+
/>
|
|
265
|
+
</UTooltip>
|
|
266
|
+
</div>
|
|
267
|
+
</li>
|
|
268
|
+
</ul>
|
|
269
|
+
<div v-if="total > rows.length" class="border-t border-default px-4 py-2">
|
|
270
|
+
<UButton size="xs" variant="link" color="neutral" trailing-icon="i-ph-arrow-right" :to="proceduresUrl">
|
|
271
|
+
{{ $t('dms_automation.attention.showAll', { count: total }) }}
|
|
272
|
+
</UButton>
|
|
273
|
+
</div>
|
|
274
|
+
</template>
|
|
275
|
+
</DmsCard>
|
|
276
|
+
</template>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
// The properties of a JSON schema as a typed table: name, type (with its enum
|
|
5
|
+
// values or default), description. Used for a type's settings, inputs and
|
|
6
|
+
// outputs in the library. Nested object properties read `parent.child`, an
|
|
7
|
+
// array its item type (`string[]`), and fields of which one is required are
|
|
8
|
+
// named under the table.
|
|
9
|
+
|
|
10
|
+
interface JsonSchemaProperty {
|
|
11
|
+
type?: string | string[]
|
|
12
|
+
title?: string
|
|
13
|
+
description?: string
|
|
14
|
+
enum?: unknown[]
|
|
15
|
+
default?: unknown
|
|
16
|
+
format?: string
|
|
17
|
+
items?: JsonSchemaProperty
|
|
18
|
+
properties?: Record<string, JsonSchemaProperty>
|
|
19
|
+
required?: string[]
|
|
20
|
+
anyOf?: JsonSchemaProperty[]
|
|
21
|
+
oneOf?: JsonSchemaProperty[]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
schema?: JsonSchemaProperty | null
|
|
26
|
+
}>()
|
|
27
|
+
|
|
28
|
+
const { processI18n } = useTranslation()
|
|
29
|
+
|
|
30
|
+
// Deep enough for any real settings form; stops a self-similar schema.
|
|
31
|
+
const MAX_DEPTH = 3
|
|
32
|
+
|
|
33
|
+
function typeOf(p: JsonSchemaProperty): string {
|
|
34
|
+
if (Array.isArray(p.type)) return p.type.join(' | ')
|
|
35
|
+
if (p.type === 'array') return p.items ? `${typeOf(p.items)}[]` : 'array'
|
|
36
|
+
if (p.type) return p.type
|
|
37
|
+
const alternatives = p.anyOf ?? p.oneOf
|
|
38
|
+
if (alternatives?.some((a) => a.type)) return alternatives.map(typeOf).join(' | ')
|
|
39
|
+
return p.enum ? 'enum' : 'any'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface Row {
|
|
43
|
+
name: string
|
|
44
|
+
depth: number
|
|
45
|
+
type: string
|
|
46
|
+
required: boolean
|
|
47
|
+
description: string
|
|
48
|
+
details: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function rowsOf(schema: JsonSchemaProperty | null | undefined, prefix: string, depth: number): Row[] {
|
|
52
|
+
const required = new Set(schema?.required ?? [])
|
|
53
|
+
return Object.entries(schema?.properties ?? {}).flatMap(([key, p]) => {
|
|
54
|
+
const details: string[] = []
|
|
55
|
+
if (p.enum) details.push(p.enum.map(String).join(' · '))
|
|
56
|
+
if (p.default !== undefined && p.default !== '') details.push(`default ${JSON.stringify(p.default)}`)
|
|
57
|
+
const type = typeOf(p)
|
|
58
|
+
const row: Row = {
|
|
59
|
+
name: `${prefix}${key}`,
|
|
60
|
+
depth,
|
|
61
|
+
type: p.format ? `${type} (${p.format})` : type,
|
|
62
|
+
required: required.has(key),
|
|
63
|
+
description: [p.title, p.description].filter(Boolean).map((t) => processI18n(String(t))).join(' — '),
|
|
64
|
+
details: details.join(', '),
|
|
65
|
+
}
|
|
66
|
+
const nested = p.type === 'array' ? p.items : p
|
|
67
|
+
const children = depth < MAX_DEPTH ? rowsOf(nested, `${row.name}${p.type === 'array' ? '[].' : '.'}`, depth + 1) : []
|
|
68
|
+
return [row, ...children]
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const rows = computed(() => rowsOf(props.schema, '', 0))
|
|
73
|
+
const hasDescriptions = computed(() => rows.value.some((r) => r.description || r.details))
|
|
74
|
+
|
|
75
|
+
// "userIds or roleIds": the alternatives of the schema that each require
|
|
76
|
+
// fields, as `anyOf: [{ required: ['userIds'] }, { required: ['roleIds'] }]`.
|
|
77
|
+
const oneOf = computed(() =>
|
|
78
|
+
(props.schema?.anyOf ?? props.schema?.oneOf ?? [])
|
|
79
|
+
.map((a) => (a.required ?? []).join(' + '))
|
|
80
|
+
.filter(Boolean)
|
|
81
|
+
.join(', '),
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
/** Text with its `inline code` spans apart, to render them as code. */
|
|
85
|
+
function segments(text: string): { code: boolean; text: string }[] {
|
|
86
|
+
return text
|
|
87
|
+
.split(/`([^`]+)`/)
|
|
88
|
+
.map((part, index) => ({ code: index % 2 === 1, text: part }))
|
|
89
|
+
.filter((s) => s.text)
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<div v-if="rows.length" class="flex flex-col gap-2">
|
|
95
|
+
<div class="overflow-hidden rounded-md border border-default">
|
|
96
|
+
<table class="w-full text-left text-xs">
|
|
97
|
+
<thead class="bg-elevated/60 font-mono text-[10.5px] text-dimmed uppercase">
|
|
98
|
+
<tr>
|
|
99
|
+
<th class="px-3 py-1.5 font-normal">{{ $t('dms_automation.library.schema.name') }}</th>
|
|
100
|
+
<th class="px-3 py-1.5 font-normal">{{ $t('dms_automation.library.schema.type') }}</th>
|
|
101
|
+
<th v-if="hasDescriptions" class="px-3 py-1.5 font-normal">{{ $t('dms_automation.library.schema.description') }}</th>
|
|
102
|
+
</tr>
|
|
103
|
+
</thead>
|
|
104
|
+
<tbody class="divide-y divide-default">
|
|
105
|
+
<tr v-for="row in rows" :key="row.name">
|
|
106
|
+
<td class="px-3 py-1.5 font-mono text-highlighted" :style="row.depth ? { paddingInlineStart: `${0.75 + row.depth}rem` } : undefined">
|
|
107
|
+
{{ row.name }}
|
|
108
|
+
</td>
|
|
109
|
+
<td class="px-3 py-1.5 font-mono text-muted">
|
|
110
|
+
{{ row.type }}
|
|
111
|
+
<span v-if="row.required" class="text-warning">· {{ $t('dms_automation.library.schema.required') }}</span>
|
|
112
|
+
</td>
|
|
113
|
+
<td v-if="hasDescriptions" class="px-3 py-1.5 text-toned">
|
|
114
|
+
<template v-for="(segment, index) in segments(row.description)" :key="index">
|
|
115
|
+
<code v-if="segment.code" class="rounded bg-elevated px-1 font-mono text-[11px]">{{ segment.text }}</code>
|
|
116
|
+
<template v-else>{{ segment.text }}</template>
|
|
117
|
+
</template>
|
|
118
|
+
<span v-if="row.details" class="block font-mono text-[11px] text-dimmed">{{ row.details }}</span>
|
|
119
|
+
</td>
|
|
120
|
+
</tr>
|
|
121
|
+
</tbody>
|
|
122
|
+
</table>
|
|
123
|
+
</div>
|
|
124
|
+
<p v-if="oneOf" class="text-xs text-muted">{{ $t('dms_automation.library.schemaOneOf', { fields: oneOf }) }}</p>
|
|
125
|
+
</div>
|
|
126
|
+
<p v-else class="text-xs text-dimmed">{{ $t('dms_automation.library.schema.none') }}</p>
|
|
127
|
+
</template>
|