@revenexx/integrations-node-devkit 0.4.0 → 0.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenexx/integrations-node-devkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Local development kit for Revenexx integration node packages — a mock Integrations API for previewing nodes/credentials/templates in the Cockpit UI, plus a unit-testing harness. Dev/CI only, never bundled.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"revenexx",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@dagrejs/dagre": "^3.0.0",
|
|
12
12
|
"@revenexx/studio": "^0.1.3",
|
|
13
|
-
"@revenexx/studio-integrations": "0.
|
|
13
|
+
"@revenexx/studio-integrations": "0.6.0",
|
|
14
14
|
"@revenexx/studio-shared": "^0.2.0",
|
|
15
15
|
"@solar-icons/nuxt": "^1.2.1",
|
|
16
16
|
"@tiptap/core": "^3.28.0",
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
On Save the dialog is kept OPEN and the verdict shown: a success strip, or
|
|
10
10
|
per-field errors fed back through the inspector's `refusedFields` prop so the
|
|
11
|
-
wrong fields highlight in place
|
|
11
|
+
wrong fields highlight in place, plus an explicit list (a refused field can be
|
|
12
|
+
scrolled out of view). Cancel, the header ✕, Esc and the backdrop all close.
|
|
13
|
+
|
|
14
|
+
That split relies on Save always emitting `update` before `close`, which the
|
|
15
|
+
inspector only does while it considers itself dirty — see `keepInspectorDirty`.
|
|
12
16
|
-->
|
|
13
17
|
<template>
|
|
14
18
|
<div class="ndx-page">
|
|
@@ -38,18 +42,22 @@
|
|
|
38
42
|
<!-- REUSE of the exact editor lightbox: mirrors WorkflowEditor.vue's
|
|
39
43
|
<Dialog><DialogContent><NodeInspector/> block, including the sizing
|
|
40
44
|
classes, so the preview looks identical to the canvas. -->
|
|
41
|
-
<Dialog :open="!!selection" @update:open="(v) => { if (!v)
|
|
45
|
+
<Dialog :open="!!selection" @update:open="(v) => { if (!v) closeDialog() }">
|
|
42
46
|
<DialogContent
|
|
43
47
|
:show-close-button="false"
|
|
44
48
|
class="flex h-[min(680px,86vh)] w-[min(1100px,94vw)] max-w-none flex-col gap-0 overflow-hidden rounded-lg p-0 sm:max-w-none"
|
|
45
49
|
>
|
|
46
50
|
<div v-if="result === 'ok'" class="ndx-strip ndx-strip-ok">✓ Payload gültig — alles gut.</div>
|
|
47
51
|
<div v-else-if="result === 'err'" class="ndx-strip ndx-strip-err">
|
|
48
|
-
|
|
52
|
+
<div>✗ Payload ungültig — {{ errorCount }} Feld(er) prüfen (rot markiert):</div>
|
|
53
|
+
<ul class="ndx-errs">
|
|
54
|
+
<li v-for="(msg, key) in refused" :key="key"><code>{{ key }}</code> — {{ msg }}</li>
|
|
55
|
+
</ul>
|
|
49
56
|
</div>
|
|
50
57
|
<div v-else-if="formError" class="ndx-strip ndx-strip-err">{{ formError }}</div>
|
|
51
58
|
<IntegrationsNodeInspector
|
|
52
59
|
v-if="selection"
|
|
60
|
+
ref="inspector"
|
|
53
61
|
:selection="selection"
|
|
54
62
|
:secret-keys="secretKeys"
|
|
55
63
|
:refused-fields="refused"
|
|
@@ -62,7 +70,7 @@
|
|
|
62
70
|
</template>
|
|
63
71
|
|
|
64
72
|
<script setup lang="ts">
|
|
65
|
-
import { computed, onMounted, ref } from 'vue'
|
|
73
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
66
74
|
import { Dialog, DialogContent } from '@revenexx/studio'
|
|
67
75
|
|
|
68
76
|
interface ApiNode {
|
|
@@ -90,10 +98,40 @@ const secretKeys = ref<string[]>([])
|
|
|
90
98
|
const refused = ref<Record<string, string>>({})
|
|
91
99
|
const result = ref<string | null>(null)
|
|
92
100
|
const formError = ref<string | null>(null)
|
|
93
|
-
// Set synchronously in onSubmit so the
|
|
94
|
-
//
|
|
101
|
+
// Set synchronously in onSubmit so the `close` the inspector emits right after an
|
|
102
|
+
// `update` (i.e. Save) does NOT close the dialog — we keep it open for the verdict.
|
|
95
103
|
const validating = ref(false)
|
|
96
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Key stamped onto `selection` to hold the inspector permanently "dirty".
|
|
107
|
+
*
|
|
108
|
+
* `NodeInspector.save()` emits `update` only when its draft differs from
|
|
109
|
+
* `selection` (a JSON string compare), then always emits `close`. On an untouched
|
|
110
|
+
* form — exactly the "is this field required?" case — Save therefore emits nothing
|
|
111
|
+
* but `close`, which is byte-for-byte what Cancel emits, and the page cannot tell
|
|
112
|
+
* them apart: it either closes on both (the old bug) or on neither (Cancel stops
|
|
113
|
+
* working). Making the comparison permanently unequal restores the distinction —
|
|
114
|
+
* Save always emits `update` first, so a bare `close` can only be Cancel, the
|
|
115
|
+
* header ✕, Esc or the backdrop.
|
|
116
|
+
*
|
|
117
|
+
* The inspector clones its draft from `selection` in setup and renders from that
|
|
118
|
+
* clone alone, so the key is stamped on afterwards (once the component ref exists),
|
|
119
|
+
* never appears in the form, and never reaches a validated payload. Its one visible
|
|
120
|
+
* trace is a permanent "Unsaved changes" in the footer — which in a preview that
|
|
121
|
+
* persists nothing is not even wrong.
|
|
122
|
+
*
|
|
123
|
+
* The proper fix belongs upstream: a `save` event on the inspector that fires
|
|
124
|
+
* regardless of `dirty`. Until studio-integrations has one, this stays.
|
|
125
|
+
*/
|
|
126
|
+
const ALWAYS_DIRTY = '__devkitPreviewProbe'
|
|
127
|
+
|
|
128
|
+
const inspector = ref<unknown>(null)
|
|
129
|
+
watch(inspector, (instance) => {
|
|
130
|
+
if (instance && selection.value && !(ALWAYS_DIRTY in selection.value)) {
|
|
131
|
+
selection.value = { ...selection.value, [ALWAYS_DIRTY]: true }
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
97
135
|
const errorCount = computed(() => Object.keys(refused.value).length)
|
|
98
136
|
|
|
99
137
|
function label(n: ApiNode): string {
|
|
@@ -146,6 +184,9 @@ async function onSubmit(draft: any) {
|
|
|
146
184
|
refused.value = {}
|
|
147
185
|
result.value = null
|
|
148
186
|
formError.value = null
|
|
187
|
+
// `selection` is deliberately NOT updated from the draft: it carries the
|
|
188
|
+
// ALWAYS_DIRTY key, and adopting the draft would drop it and silence the next
|
|
189
|
+
// Save. The draft arrives here on every Save anyway, so there is nothing to sync.
|
|
149
190
|
try {
|
|
150
191
|
const slug = encodeURIComponent(draft.nodeSlug)
|
|
151
192
|
const version = encodeURIComponent(draft.nodeVersion || 'latest')
|
|
@@ -174,11 +215,20 @@ async function onSubmit(draft: any) {
|
|
|
174
215
|
}
|
|
175
216
|
}
|
|
176
217
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
218
|
+
/**
|
|
219
|
+
* The inspector emits `close` on Save, on Cancel and on its header ✕. Save is the
|
|
220
|
+
* only one that emits `update` first — synchronously, and ALWAYS, because
|
|
221
|
+
* ALWAYS_DIRTY keeps it dirty — so `validating` is already set by the time this
|
|
222
|
+
* runs and marks the close as Save's. Hold it, and the dialog stays open for the
|
|
223
|
+
* verdict. Anything else is a genuine close.
|
|
224
|
+
*/
|
|
180
225
|
function requestClose() {
|
|
181
226
|
if (validating.value) return
|
|
227
|
+
closeDialog()
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Esc, the backdrop, Cancel, the header ✕ — discards the draft. */
|
|
231
|
+
function closeDialog() {
|
|
182
232
|
selection.value = null
|
|
183
233
|
refused.value = {}
|
|
184
234
|
result.value = null
|
|
@@ -205,4 +255,6 @@ function requestClose() {
|
|
|
205
255
|
.ndx-strip { flex: 0 0 auto; padding: .5rem 1rem; font-size: .85rem; font-weight: 600; }
|
|
206
256
|
.ndx-strip-ok { background: #dcfce7; color: #166534; }
|
|
207
257
|
.ndx-strip-err { background: #fee2e2; color: #991b1b; }
|
|
258
|
+
.ndx-errs { margin: .35rem 0 0; padding-left: 1.1rem; font-weight: 400; }
|
|
259
|
+
.ndx-errs code { font-weight: 600; }
|
|
208
260
|
</style>
|