@scalio-cloud/ui 0.75.0 → 0.78.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 +1 -1
- package/react/agents.js +62 -9
- package/react/mail.js +28 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
|
|
5
5
|
"license": "SEE LICENSE IN README.md",
|
|
6
6
|
"private": false,
|
package/react/agents.js
CHANGED
|
@@ -103,6 +103,9 @@ const LABELS = {
|
|
|
103
103
|
setNothing: "Keine Änderung.",
|
|
104
104
|
setSentAt: "Zuletzt gesendet: {at}",
|
|
105
105
|
setGate: "Schreibrecht",
|
|
106
|
+
setShared: "Gemeinsam",
|
|
107
|
+
setTitle: "Einstellungen · {name}",
|
|
108
|
+
setClose: "Schliessen",
|
|
106
109
|
updStates: { installing: "Wird aktualisiert auf {version}", verifying: "Prüft Version {version}", installed: "Aktualisiert auf {version}",
|
|
107
110
|
rolled_back: "Zurückgerollt auf {from} ({reason})", rollback_failed: "Rollback fehlgeschlagen ({reason})", failed: "Update fehlgeschlagen ({reason})",
|
|
108
111
|
refused: "Update abgelehnt ({reason})" },
|
|
@@ -195,6 +198,9 @@ const LABELS = {
|
|
|
195
198
|
setNothing: "No change.",
|
|
196
199
|
setSentAt: "Last sent: {at}",
|
|
197
200
|
setGate: "write permission",
|
|
201
|
+
setShared: "Shared",
|
|
202
|
+
setTitle: "Settings · {name}",
|
|
203
|
+
setClose: "Close",
|
|
198
204
|
updStates: { installing: "Updating to {version}", verifying: "Checking version {version}", installed: "Updated to {version}",
|
|
199
205
|
rolled_back: "Rolled back to {from} ({reason})", rollback_failed: "Rollback failed ({reason})", failed: "Update failed ({reason})",
|
|
200
206
|
refused: "Update refused ({reason})" },
|
|
@@ -272,8 +278,10 @@ function AgentSettings(props) {
|
|
|
272
278
|
const s = a.settings;
|
|
273
279
|
const [edit, setEdit] = React.useState({});
|
|
274
280
|
const [secrets, setSecrets] = React.useState({});
|
|
281
|
+
const [tab, setTab] = React.useState(null);
|
|
275
282
|
if (!s) return h("p", { className: "scalio-settings-text", "data-testid": `agent-settings-none-${a.id}` }, L.setNone);
|
|
276
283
|
const values = s.values || {};
|
|
284
|
+
const suggestions = (props.suggest && props.suggest(a)) || {};
|
|
277
285
|
const label = (d) => (d.label && (d.label[lang === "en" ? "en" : "de"] || d.label.de)) || d.name;
|
|
278
286
|
const hasGate = (s.catalog || []).some((d) => d.gate);
|
|
279
287
|
const current = (d) => (values[d.name] && values[d.name].source === "app" ? shownValue(d, values[d.name]) : "");
|
|
@@ -329,8 +337,13 @@ function AgentSettings(props) {
|
|
|
329
337
|
return h("select", Object.assign({}, common, { value: valueOf(d), onChange: (e) => set(d, e.target.value) }),
|
|
330
338
|
h("option", { value: "" }, L.setNotSet), opts.map(([k, t]) => h("option", { key: k, value: k }, t)));
|
|
331
339
|
}
|
|
332
|
-
|
|
333
|
-
|
|
340
|
+
const offer = d.kind === "text" ? (suggestions[d.name] || []).filter((x) => typeof x === "string" && x) : [];
|
|
341
|
+
const listId = offer.length ? `${tid}-choices` : undefined;
|
|
342
|
+
return [
|
|
343
|
+
h("input", Object.assign({}, common, { key: "i", type: d.kind === "number" ? "number" : "text", min: d.kind === "number" ? 1 : undefined,
|
|
344
|
+
maxLength: d.kind === "text" ? 1024 : undefined, list: listId, value: valueOf(d), onChange: (e) => set(d, e.target.value) })),
|
|
345
|
+
listId ? h("datalist", { key: "l", id: listId, "data-testid": `${tid}-choices` }, offer.map((o) => h("option", { key: o, value: o }))) : null,
|
|
346
|
+
];
|
|
334
347
|
};
|
|
335
348
|
const note = (d) => {
|
|
336
349
|
const v = values[d.name] || {};
|
|
@@ -339,20 +352,57 @@ function AgentSettings(props) {
|
|
|
339
352
|
return null;
|
|
340
353
|
};
|
|
341
354
|
|
|
342
|
-
|
|
355
|
+
// One tab per worker (Hyper-V, Proxmox, ...), settings of several workers on the tab «Gemeinsam» (Markus 2026-11-14).
|
|
356
|
+
const groupOf = (d) => ((d.workers || []).length === 1 ? d.workers[0] : "shared");
|
|
357
|
+
const groups = [];
|
|
358
|
+
(s.catalog || []).forEach((d) => { const g = groupOf(d); if (!groups.includes(g)) groups.push(g); });
|
|
359
|
+
groups.sort((x, y) => (x === "shared") - (y === "shared"));
|
|
360
|
+
const current_tab = groups.includes(tab) ? tab : groups[0];
|
|
361
|
+
const groupLabel = (g) => (g === "shared" ? L.setShared : (props.roleLabel ? props.roleLabel(g) : g));
|
|
362
|
+
|
|
363
|
+
return h("div", { "data-testid": `agent-settings-${a.id}`, style: { display: "grid", gap: "0.75rem" } },
|
|
343
364
|
hasGate && !s.remote_write ? h("div", { className: "scalio-notice is-info", role: "status", "data-testid": `agent-settings-nogate-${a.id}` },
|
|
344
365
|
h("div", { className: "scalio-notice-body" }, h("div", { className: "scalio-notice-text" }, L.setNoGate))) : null,
|
|
345
|
-
|
|
346
|
-
h("
|
|
347
|
-
|
|
366
|
+
groups.length > 1 ? h("div", { className: "scalio-tabs", role: "tablist", "aria-label": L.settings },
|
|
367
|
+
groups.map((g) => h("button", { key: g, type: "button", role: "tab", id: `agent-settings-tab-${a.id}-${g}`,
|
|
368
|
+
className: g === current_tab ? "scalio-tab is-active" : "scalio-tab", "aria-selected": g === current_tab ? "true" : "false",
|
|
369
|
+
"aria-controls": `agent-settings-panel-${a.id}-${g}`, "data-testid": `agent-settings-tab-${a.id}-${g}`, onClick: () => setTab(g) },
|
|
370
|
+
groupLabel(g)))) : null,
|
|
371
|
+
groups.map((g) => h("div", { key: g, role: groups.length > 1 ? "tabpanel" : undefined, id: `agent-settings-panel-${a.id}-${g}`,
|
|
372
|
+
"aria-labelledby": groups.length > 1 ? `agent-settings-tab-${a.id}-${g}` : undefined, hidden: g !== current_tab,
|
|
373
|
+
"data-testid": `agent-settings-panel-${a.id}-${g}`, style: { display: g === current_tab ? "grid" : "none", gap: "0.5rem" } },
|
|
374
|
+
(s.catalog || []).filter((d) => groupOf(d) === g).map((d) => h("div", { key: d.name, style: { display: "grid", gridTemplateColumns: "minmax(12rem, 1fr) minmax(12rem, 2fr)", gap: "0.5rem", alignItems: "center" } },
|
|
375
|
+
h("label", { htmlFor: `agent-setting-${a.id}-${d.name}` }, label(d), d.gate ? h("span", { className: "scalio-settings-text" }, ` (${L.setGate})`) : null),
|
|
376
|
+
h("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center", flexWrap: "wrap" } }, input(d), note(d)))))),
|
|
348
377
|
h("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center", flexWrap: "wrap" } },
|
|
349
378
|
h("button", { type: "button", className: "scalio-btn is-solid", disabled: busy || a.blocked, "data-testid": `agent-settings-save-${a.id}`, onClick: save },
|
|
350
379
|
h(Icons.Settings, { className: "scalio-icon" }), L.setSave),
|
|
351
380
|
a.settings_sent_at ? h("span", { className: "scalio-settings-text" }, fill(L.setSentAt, { at: when(a.settings_sent_at, lang) })) : null));
|
|
352
381
|
}
|
|
353
382
|
|
|
383
|
+
// The settings of one agent as a dialog (Markus 2026-11-14): closes with its button, the backdrop and Escape.
|
|
384
|
+
function SettingsDialog(props) {
|
|
385
|
+
const { agent: a, L, onClose } = props;
|
|
386
|
+
React.useEffect(() => {
|
|
387
|
+
const key = (e) => { if (e.key === "Escape") onClose(); };
|
|
388
|
+
document.addEventListener("keydown", key);
|
|
389
|
+
return () => document.removeEventListener("keydown", key);
|
|
390
|
+
}, [onClose]);
|
|
391
|
+
const title = fill(L.setTitle, { name: a.name || a.hostname || a.id });
|
|
392
|
+
return h("div", { className: "scalio-dialog-root" },
|
|
393
|
+
h("div", { className: "scalio-dialog-backdrop", onClick: onClose }),
|
|
394
|
+
h("div", { className: "scalio-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, style: { maxWidth: "52rem" },
|
|
395
|
+
"data-testid": `agent-settings-dialog-${a.id}` },
|
|
396
|
+
h("div", { className: "scalio-dialog-head" },
|
|
397
|
+
h("div", { className: "scalio-dialog-title" }, title),
|
|
398
|
+
h("button", { type: "button", className: "scalio-btn is-ghost scalio-btn-icon", onClick: onClose, "aria-label": L.setClose,
|
|
399
|
+
title: L.setClose, "data-testid": `agent-settings-close-${a.id}` }, h(Icons.X, { className: "scalio-icon" }))),
|
|
400
|
+
h("div", { className: "scalio-dialog-body" }, props.children)));
|
|
401
|
+
}
|
|
402
|
+
|
|
354
403
|
// Props: client (agentsApi), lang, labels, appUrl (address the agent connects to, default window.location.origin),
|
|
355
|
-
// downloadUrl (MSI), notify(message, tone), formatError(err), refreshMs (default 15000, 0 = off), copy(text)
|
|
404
|
+
// downloadUrl (MSI), notify(message, tone), formatError(err), refreshMs (default 15000, 0 = off), copy(text),
|
|
405
|
+
// suggest(agent) -> {SettingName: [values]} (choices the app read, e.g. switches or OUs; any other value stays possible).
|
|
356
406
|
function AgentsPanel(props) {
|
|
357
407
|
const L = labels(props.lang, props.labels);
|
|
358
408
|
const fmtErr = props.formatError || errorText;
|
|
@@ -584,8 +634,11 @@ function AgentsPanel(props) {
|
|
|
584
634
|
: h("div", { style: { overflowX: "auto" } },
|
|
585
635
|
h("table", { className: "scalio-users-table", "data-testid": "agents-table" },
|
|
586
636
|
h("thead", null, h("tr", null, [L.name, L.host, L.version, L.status, L.roles, L.workers, ""].map((t, i) => h("th", { key: i }, t)))),
|
|
587
|
-
h("tbody", null, agents.map((a) =>
|
|
588
|
-
|
|
637
|
+
h("tbody", null, agents.map((a) => agentRow(a)))))));
|
|
638
|
+
const openAgent = agents.find((a) => a.id === open);
|
|
639
|
+
if (openAgent) rows.push(h(SettingsDialog, { key: "settings-dialog", agent: openAgent, L, onClose: () => setOpen(null) },
|
|
640
|
+
h(AgentSettings, { agent: openAgent, L, lang: props.lang, busy, client: props.client, run, notify: props.notify,
|
|
641
|
+
suggest: props.suggest, roleLabel })));
|
|
589
642
|
|
|
590
643
|
// tasks
|
|
591
644
|
const nameOf = (id) => (agents.find((a) => a.id === id) || {}).name || "";
|
package/react/mail.js
CHANGED
|
@@ -26,7 +26,8 @@ const LABELS = {
|
|
|
26
26
|
identity: "Die App konnte ihre eigene Identität im Tenant nicht lesen. Prüfen Sie die Tenant-Verbindung oder führen Sie das Skript aus.",
|
|
27
27
|
},
|
|
28
28
|
rightsCheck: "Status prüfen",
|
|
29
|
-
rightsState: { ok: "Senderecht vorhanden", missing: "Senderecht fehlt"
|
|
29
|
+
rightsState: { ok: "Senderecht vorhanden", missing: "Senderecht fehlt" },
|
|
30
|
+
rightsUnknown: "Senden Sie eine Testmail, um das Senderecht zu bestätigen.",
|
|
30
31
|
rightsScriptAlso: "Lieber selbst ausführen? Skript anzeigen",
|
|
31
32
|
testFirst: "Speichern Sie zuerst Weg und Postfach.",
|
|
32
33
|
transportHint: "Über welchen Server die App Mails schickt. Passwort und Client-Secret werden verschlüsselt gespeichert und nie angezeigt.",
|
|
@@ -118,7 +119,8 @@ const LABELS = {
|
|
|
118
119
|
identity: "The app could not read its own identity in the tenant. Check the tenant connection or run the script.",
|
|
119
120
|
},
|
|
120
121
|
rightsCheck: "Check status",
|
|
121
|
-
rightsState: { ok: "Send right in place", missing: "Send right missing"
|
|
122
|
+
rightsState: { ok: "Send right in place", missing: "Send right missing" },
|
|
123
|
+
rightsUnknown: "Send a test mail to confirm the send right.",
|
|
122
124
|
rightsScriptAlso: "Rather run it yourself? Show script",
|
|
123
125
|
testFirst: "Save the way and the mailbox first.",
|
|
124
126
|
transportHint: "Which server the app sends mail through. Password and client secret are stored encrypted and never shown.",
|
|
@@ -364,6 +366,16 @@ function MailTransport(props) {
|
|
|
364
366
|
}
|
|
365
367
|
setBusy(false);
|
|
366
368
|
};
|
|
369
|
+
// After a test mail the status is read again (the backend may note Microsoft's answer). A test mail that went out
|
|
370
|
+
// through Microsoft 365 shows the right is there, also when the app can not ask Exchange (state «unknown»).
|
|
371
|
+
const confirmRights = (delivered) => {
|
|
372
|
+
if (!form || !form.send_rights || !client.rightsStatus) return Promise.resolve();
|
|
373
|
+
const viaM365 = form.provider === "graph" || form.provider === "tenant";
|
|
374
|
+
return client.rightsStatus().then((r) => {
|
|
375
|
+
if (!r || !r.mode) return;
|
|
376
|
+
setRightsInfo(delivered && viaM365 && r.state === "unknown" ? Object.assign({}, r, { state: "ok", detail: "" }) : r);
|
|
377
|
+
}).catch(() => undefined);
|
|
378
|
+
};
|
|
367
379
|
const test = async () => {
|
|
368
380
|
setTesting(true);
|
|
369
381
|
setTestMsg(null);
|
|
@@ -374,10 +386,12 @@ function MailTransport(props) {
|
|
|
374
386
|
if (props.notify) props.notify(text, "success");
|
|
375
387
|
else setTestMsg({ tone: "ok", text });
|
|
376
388
|
loadOutbox();
|
|
389
|
+
confirmRights(true);
|
|
377
390
|
} catch (err) {
|
|
378
391
|
const text = (props.formatError || errorText)(err);
|
|
379
392
|
if (props.notify) props.notify(text, "error");
|
|
380
393
|
else setTestMsg({ tone: "error", text });
|
|
394
|
+
confirmRights(false);
|
|
381
395
|
}
|
|
382
396
|
setTesting(false);
|
|
383
397
|
};
|
|
@@ -530,18 +544,25 @@ function MailTransport(props) {
|
|
|
530
544
|
// The button «Senderecht setzen» is there in every app (like Foundry); greyed out with the reason where the app's
|
|
531
545
|
// own connection may not set it (scalio-platform 0.45.0 `reason`). Not for an own app registration (provider graph).
|
|
532
546
|
const offReason = rightsInfo && rightsInfo.mode === "script" && L.grantOff[rightsInfo.reason] ? rightsInfo.reason : "";
|
|
533
|
-
const
|
|
547
|
+
const rightsOk = !!(rightsInfo && rightsInfo.state === "ok");
|
|
548
|
+
// Nothing to do once the right is there: no greyed-out «Senderecht setzen» next to «Senderecht vorhanden».
|
|
549
|
+
const showGrant = auto || (!rightsOk && !!offReason && !!client.grantRights);
|
|
550
|
+
const rightsKnown = !!(rightsInfo && (rightsInfo.state === "ok" || rightsInfo.state === "missing"));
|
|
534
551
|
const rights = form.send_rights && (form.provider === "graph" || form.provider === "tenant" || form.provider === "default")
|
|
535
552
|
? h(
|
|
536
553
|
SettingsSection,
|
|
537
554
|
{ id: "mail-rights", title: L.rightsTitle, description: auto ? L.autoHint : L.rightsHint, testId: "mail-rights" },
|
|
538
|
-
rightsInfo && rightsInfo.mode !== "none"
|
|
555
|
+
rightsInfo && rightsInfo.mode !== "none" && rightsKnown
|
|
539
556
|
? h("div", { className: "scalio-mail-rights-state" },
|
|
540
|
-
h("span", { className: `scalio-badge is-${{ ok: "ok", missing: "warn" }[rightsInfo.state]
|
|
541
|
-
L.rightsState[rightsInfo.state]
|
|
557
|
+
h("span", { className: `scalio-badge is-${{ ok: "ok", missing: "warn" }[rightsInfo.state]}`, "data-testid": "mail-rights-state" },
|
|
558
|
+
L.rightsState[rightsInfo.state]),
|
|
542
559
|
h("button", { type: "button", className: "scalio-btn is-ghost", onClick: loadRights, "data-testid": "mail-rights-check" }, L.rightsCheck))
|
|
543
560
|
: null,
|
|
544
|
-
|
|
561
|
+
// «unknown»: the app can not ask Exchange; no badge, one sentence what to do (the test mail confirms it)
|
|
562
|
+
rightsInfo && rightsInfo.mode !== "none" && !rightsKnown
|
|
563
|
+
? h("p", { className: "scalio-settings-help", "data-testid": "mail-rights-unknown" }, L.rightsUnknown)
|
|
564
|
+
: null,
|
|
565
|
+
rightsInfo && rightsInfo.detail && !rightsOk
|
|
545
566
|
? h("p", { className: "scalio-settings-help is-error", "data-testid": "mail-rights-detail" }, rightsInfo.detail)
|
|
546
567
|
: null,
|
|
547
568
|
showGrant
|