@revenexx/integrations-node-devkit 0.4.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/integrations-node-devkit",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
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.5.1",
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).
13
+
14
+ Closing is the DIALOG's job here — the X, Esc or the backdrop. The inspector's
15
+ own footer buttons both mean "check this config"; see `onInspectorClose`.
12
16
  -->
13
17
  <template>
14
18
  <div class="ndx-page">
@@ -38,14 +42,23 @@
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) requestClose() }">
45
+ <Dialog :open="!!selection" @update:open="(v) => { if (!v) closeDialog() }">
42
46
  <DialogContent
43
- :show-close-button="false"
44
47
  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
48
  >
49
+ <!-- The inspector's own footer/header buttons all emit the same `close`,
50
+ which this page turns into "validate" (see onInspectorClose) — so say
51
+ so, and say where the real close is. -->
52
+ <div class="ndx-strip ndx-strip-info">
53
+ Devkit-Preview: <strong>Save</strong> und <strong>Cancel</strong> prüfen die Config gegen den Mock,
54
+ ohne zu schließen. Schließen: <strong>✕ oben rechts</strong> oder <strong>Esc</strong>.
55
+ </div>
46
56
  <div v-if="result === 'ok'" class="ndx-strip ndx-strip-ok">✓ Payload gültig — alles gut.</div>
47
57
  <div v-else-if="result === 'err'" class="ndx-strip ndx-strip-err">
48
- ✗ Payload ungültig — {{ errorCount }} Feld(er) prüfen (rot markiert).
58
+ <div>✗ Payload ungültig — {{ errorCount }} Feld(er) prüfen (rot markiert):</div>
59
+ <ul class="ndx-errs">
60
+ <li v-for="(msg, key) in refused" :key="key"><code>{{ key }}</code> — {{ msg }}</li>
61
+ </ul>
49
62
  </div>
50
63
  <div v-else-if="formError" class="ndx-strip ndx-strip-err">{{ formError }}</div>
51
64
  <IntegrationsNodeInspector
@@ -54,7 +67,7 @@
54
67
  :secret-keys="secretKeys"
55
68
  :refused-fields="refused"
56
69
  @update="onSubmit"
57
- @close="requestClose"
70
+ @close="onInspectorClose"
58
71
  />
59
72
  </DialogContent>
60
73
  </Dialog>
@@ -90,8 +103,8 @@ const secretKeys = ref<string[]>([])
90
103
  const refused = ref<Record<string, string>>({})
91
104
  const result = ref<string | null>(null)
92
105
  const formError = ref<string | null>(null)
93
- // Set synchronously in onSubmit so the inspector's own Save (it emits update THEN
94
- // close) does NOT close the dialog — we keep it open to show the verdict.
106
+ // Set synchronously in onSubmit so the `close` the inspector emits right after an
107
+ // `update` (Save with changes) does not validate the same config a second time.
95
108
  const validating = ref(false)
96
109
 
97
110
  const errorCount = computed(() => Object.keys(refused.value).length)
@@ -146,6 +159,10 @@ async function onSubmit(draft: any) {
146
159
  refused.value = {}
147
160
  result.value = null
148
161
  formError.value = null
162
+ // Adopt the draft as the page's selection (a copy — the inspector keeps its own
163
+ // object). That resets the inspector's `dirty`, so every FURTHER Save emits only
164
+ // `close` and is validated by onInspectorClose against exactly what is on screen.
165
+ selection.value = JSON.parse(JSON.stringify(draft))
149
166
  try {
150
167
  const slug = encodeURIComponent(draft.nodeSlug)
151
168
  const version = encodeURIComponent(draft.nodeVersion || 'latest')
@@ -174,11 +191,26 @@ async function onSubmit(draft: any) {
174
191
  }
175
192
  }
176
193
 
177
- // The inspector emits close on both Save and Cancel; the studio Dialog emits it
178
- // on Esc / backdrop. Hold the close while a Save-validation is in flight so the
179
- // dialog stays open to show the result; otherwise close (discard).
180
- function requestClose() {
181
- if (validating.value) return
194
+ /**
195
+ * The inspector's footer emits `close` on BOTH Save and Cancel, and studio's
196
+ * `save()` gates its `update` emit on `dirty` — so a Save on an untouched form
197
+ * (exactly the "required field is still empty" case) hands us nothing but a
198
+ * `close`, and the two are indistinguishable from here.
199
+ *
200
+ * There is nothing to persist in this preview, so both footer buttons mean the
201
+ * same thing: check this config. A `close` therefore validates and KEEPS THE
202
+ * DIALOG OPEN; leaving is the dialog's own X / Esc / backdrop.
203
+ *
204
+ * `validating` guards the Save-with-changes path, where `update` fired first
205
+ * (synchronously, before this `close`) and its validation is already in flight.
206
+ */
207
+ function onInspectorClose() {
208
+ if (validating.value || !selection.value) return
209
+ void onSubmit(selection.value)
210
+ }
211
+
212
+ /** Real close — the dialog's X, Esc or backdrop. Discards the draft. */
213
+ function closeDialog() {
182
214
  selection.value = null
183
215
  refused.value = {}
184
216
  result.value = null
@@ -203,6 +235,9 @@ function requestClose() {
203
235
 
204
236
  /* Verdict strip shown at the top of the reused dialog content (does not close). */
205
237
  .ndx-strip { flex: 0 0 auto; padding: .5rem 1rem; font-size: .85rem; font-weight: 600; }
238
+ .ndx-strip-info { background: #f3f4f6; color: #4b5563; font-weight: 400; }
206
239
  .ndx-strip-ok { background: #dcfce7; color: #166534; }
207
240
  .ndx-strip-err { background: #fee2e2; color: #991b1b; }
241
+ .ndx-errs { margin: .35rem 0 0; padding-left: 1.1rem; font-weight: 400; }
242
+ .ndx-errs code { font-weight: 600; }
208
243
  </style>