@scalio-cloud/ui 0.90.0 → 0.92.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 +3 -3
- package/package.json +1 -1
- package/react/license.js +6 -6
- package/react/mail.js +5 -4
- package/react/nav.js +13 -1
- package/react/saas_updates.js +6 -5
- package/react/tenancy.js +26 -17
package/README.md
CHANGED
|
@@ -232,11 +232,11 @@ app's tabs. `<TenantList tenants columns actions appName limit onAdd />` is the
|
|
|
232
232
|
columns Tenant, Organisation (only with several), Verbindungsart, Zugang, Status, then the app's columns; buttons
|
|
233
233
|
Bearbeiten (opens `TenantEditDialog` with all tabs, since 0.81.0) and Entfernen; «+ Tenant» stops at `limits.tenants`). `<TenantWizard>` adds a
|
|
234
234
|
tenant in four steps (Name und Organisation → Verbindung und Zugang → `<App>`-Einstellungen → Prüfen; the tenant is
|
|
235
|
-
created
|
|
235
|
+
created only at the end («Prüfen») by `onCreate` (steps before only check with `onValidate` and keep values in memory; cancel creates nothing), `renderConnect(null, values, set)` embeds the connection, `appStep` is the app's step, locked
|
|
236
236
|
methods stay visible with their reason). `<TenantEditDialog>` shows the same parts as tabs.
|
|
237
237
|
`<TenancySelect organizations tenants tenantId onSelect manage />` (0.81.0) is the selection at the top: the
|
|
238
|
-
organization (
|
|
239
|
-
one organization only the tenant select (only with several). The app keeps one value, the tenant id.
|
|
238
|
+
organization (from two organizations on, whatever their tenant counts) and, when the chosen organization has more than one tenant, its tenant; with
|
|
239
|
+
one organization only the tenant select (only with several). `hideAll` drops «Alle …». The app keeps one value, the tenant id.
|
|
240
240
|
`organizationSetupStep({value, onChange, onSave, prefilled})` is the setup step «Organisation» (name, short code,
|
|
241
241
|
classification, language; prefilled from the Microsoft sign-in). `showOrganizationSelect` / `showTenantSelect`: the
|
|
242
242
|
selects at the top only with more than one (ADR 0128 O5). Never show prices in these parts.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.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/license.js
CHANGED
|
@@ -271,12 +271,12 @@ function LicensePanel(props) {
|
|
|
271
271
|
: m.managed
|
|
272
272
|
? null
|
|
273
273
|
: h(
|
|
274
|
-
"
|
|
275
|
-
{ key: "form", className: "scalio-license-form" },
|
|
274
|
+
"form",
|
|
275
|
+
{ key: "form", className: "scalio-license-form", onSubmit: (e) => { e.preventDefault(); if (!busy && addon.trim()) addAddon(); } },
|
|
276
276
|
h("textarea", { className: "scalio-input scalio-textarea", rows: 2, value: addon, placeholder: L.addonPlaceholder, disabled: busy,
|
|
277
277
|
"aria-label": L.addonPlaceholder, "data-testid": "license-addon-input", onChange: (e) => setAddon(e.target.value) }),
|
|
278
278
|
h("div", { className: "scalio-license-actions" },
|
|
279
|
-
h("button", { type: "
|
|
279
|
+
h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || !addon.trim(), "data-testid": "license-addon-add" },
|
|
280
280
|
h(Icons.Plus, { className: "scalio-icon" }), L.add))
|
|
281
281
|
),
|
|
282
282
|
];
|
|
@@ -284,14 +284,14 @@ function LicensePanel(props) {
|
|
|
284
284
|
const keyCard = m.keyReadOnly
|
|
285
285
|
? h("div", { className: "scalio-notice is-info", "data-testid": "license-key-readonly" }, m.keyReadOnly)
|
|
286
286
|
: h(
|
|
287
|
-
"
|
|
288
|
-
{ className: "scalio-license-form" },
|
|
287
|
+
"form",
|
|
288
|
+
{ className: "scalio-license-form", onSubmit: (e) => { e.preventDefault(); if (!busy && key.trim()) activate(); } },
|
|
289
289
|
h("textarea", { className: "scalio-input scalio-textarea", rows: 3, value: key, placeholder: L.keyPlaceholder, disabled: busy,
|
|
290
290
|
"aria-label": L.keyPlaceholder, "data-testid": "license-key-input", onChange: (e) => setKey(e.target.value) }),
|
|
291
291
|
h(
|
|
292
292
|
"div",
|
|
293
293
|
{ className: "scalio-license-actions" },
|
|
294
|
-
h("button", { type: "
|
|
294
|
+
h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || !key.trim(), "data-testid": "license-activate" },
|
|
295
295
|
h(Icons.ShieldCheck, { className: "scalio-icon" }), L.activate),
|
|
296
296
|
m.keyPresent
|
|
297
297
|
? h("button", { type: "button", className: "scalio-btn is-danger", disabled: busy, onClick: remove, "data-testid": "license-remove" },
|
package/react/mail.js
CHANGED
|
@@ -752,7 +752,7 @@ function MailTemplates(props) {
|
|
|
752
752
|
}
|
|
753
753
|
setBusy(false);
|
|
754
754
|
};
|
|
755
|
-
const
|
|
755
|
+
const saveTemplate = () => run(async () => apply(await client.saveTemplate(kind, tlang, { subject, body }), kind, tlang), L.templateSaved);
|
|
756
756
|
const reset = () => run(async () => apply(await client.resetTemplate(kind, tlang), kind, tlang), L.templateReset);
|
|
757
757
|
const testMe = () => run(() => client.testTemplate({ kind, lang: tlang, subject, body }), (r) => L.testSent.replace("{to}", (r && r.to) || ""));
|
|
758
758
|
const toggle = (on) => run(async () => {
|
|
@@ -767,9 +767,10 @@ function MailTemplates(props) {
|
|
|
767
767
|
: h("textarea", { id: "mail-template-body", className: "scalio-input scalio-textarea scalio-mail-body", rows: 14, value: body, maxLength: 50000,
|
|
768
768
|
"data-testid": "mail-template-body", onChange: (e) => setBody(e.target.value) });
|
|
769
769
|
|
|
770
|
+
const onSubmit = (e) => { e.preventDefault(); if (!busy && subject.trim() && body.trim()) saveTemplate(); };
|
|
770
771
|
return section(h(
|
|
771
|
-
"
|
|
772
|
-
{ className: "scalio-settings-form" },
|
|
772
|
+
"form",
|
|
773
|
+
{ className: "scalio-settings-form", onSubmit },
|
|
773
774
|
provider === "off" ? h("div", { className: "scalio-notice is-info", "data-testid": "mail-templates-off" }, L.off) : null,
|
|
774
775
|
h("div", { className: "scalio-mail-grid" },
|
|
775
776
|
h(Field, { id: "mail-template-kind", label: L.kind, hint: meta.description[lang === "en" ? "en" : "de"] },
|
|
@@ -810,7 +811,7 @@ function MailTemplates(props) {
|
|
|
810
811
|
: null,
|
|
811
812
|
h("button", { type: "button", className: "scalio-btn", onClick: testMe, disabled: busy || provider === "off", "data-testid": "mail-template-test" },
|
|
812
813
|
h(Icons.CornerDownLeft, { className: "scalio-icon" }), L.testToMe),
|
|
813
|
-
h("button", { type: "
|
|
814
|
+
h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || !subject.trim() || !body.trim(), "data-testid": "mail-template-save" },
|
|
814
815
|
h(Icons.Check, { className: "scalio-icon" }), L.saveTemplate))
|
|
815
816
|
));
|
|
816
817
|
}
|
package/react/nav.js
CHANGED
|
@@ -512,14 +512,26 @@ function SupportDrawer({ open, onClose, onSubmit, client, page, context, lang, l
|
|
|
512
512
|
const [description, setDescription] = React.useState("");
|
|
513
513
|
const [busy, setBusy] = React.useState(false);
|
|
514
514
|
const [error, setError] = React.useState("");
|
|
515
|
+
const panel = React.useRef(null);
|
|
516
|
+
// ADR 0095 K2: Escape closes, Tab stays inside the drawer.
|
|
515
517
|
React.useEffect(() => {
|
|
516
518
|
if (!open) return undefined;
|
|
517
519
|
function onKey(e) {
|
|
518
520
|
if (e.key === "Escape" && onClose) onClose();
|
|
521
|
+
else if (e.key === "Tab") require("./wizard").trapTab(e, panel.current);
|
|
519
522
|
}
|
|
520
523
|
document.addEventListener("keydown", onKey);
|
|
521
524
|
return () => document.removeEventListener("keydown", onKey);
|
|
522
525
|
}, [open, onClose]);
|
|
526
|
+
// The focus moves into the drawer on open and returns to the trigger on close.
|
|
527
|
+
React.useEffect(() => {
|
|
528
|
+
if (!open) return undefined;
|
|
529
|
+
const before = document.activeElement;
|
|
530
|
+
const node = panel.current;
|
|
531
|
+
const first = node && (node.querySelector("input,textarea") || node.querySelector("button"));
|
|
532
|
+
if (first) first.focus();
|
|
533
|
+
return () => { if (before && typeof before.focus === "function" && document.contains(before)) before.focus(); };
|
|
534
|
+
}, [open]);
|
|
523
535
|
if (!open) return null;
|
|
524
536
|
const submit = async (e) => {
|
|
525
537
|
e.preventDefault();
|
|
@@ -542,7 +554,7 @@ function SupportDrawer({ open, onClose, onSubmit, client, page, context, lang, l
|
|
|
542
554
|
h("div", { className: "scalio-drawer-backdrop", onClick: onClose }),
|
|
543
555
|
h(
|
|
544
556
|
"div",
|
|
545
|
-
{ className: "scalio-support", role: "dialog", "aria-modal": "true", "aria-label": L.supportTitle, "data-testid": "scalio-support-drawer" },
|
|
557
|
+
{ ref: panel, className: "scalio-support", role: "dialog", "aria-modal": "true", "aria-label": L.supportTitle, "data-testid": "scalio-support-drawer" },
|
|
546
558
|
h(
|
|
547
559
|
"div",
|
|
548
560
|
{ className: "scalio-support-head" },
|
package/react/saas_updates.js
CHANGED
|
@@ -424,11 +424,11 @@ function SaasUpdatesPanel(props) {
|
|
|
424
424
|
h(Icons.Download, { className: "scalio-icon" }), L.now)));
|
|
425
425
|
// Postponing only makes sense against a deadline; a pre-release has none.
|
|
426
426
|
if (offer.due_at || !pre) rows.push(h(Field, { key: "post", id: "saas-updates-until", label: L.postpone },
|
|
427
|
-
h("
|
|
427
|
+
h("form", { style: { display: "flex", gap: "0.5rem" },
|
|
428
|
+
onSubmit: (e) => { e.preventDefault(); if (!busy && until) act("postpone", { until: new Date(`${until}T00:00:00`).toISOString() }); } },
|
|
428
429
|
h("input", { id: "saas-updates-until", type: "date", className: "scalio-input", value: until, max: due, disabled: busy,
|
|
429
430
|
"data-testid": "saas-updates-until", onChange: (e) => setUntil(e.target.value) }),
|
|
430
|
-
h("button", { type: "
|
|
431
|
-
onClick: () => act("postpone", { until: new Date(`${until}T00:00:00`).toISOString() }) }, L.postponeGo))));
|
|
431
|
+
h("button", { type: "submit", className: "scalio-btn", disabled: busy || !until, "data-testid": "saas-updates-postpone" }, L.postponeGo))));
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
if (preSwitch) rows.push(preSwitch);
|
|
@@ -439,6 +439,7 @@ function SaasUpdatesPanel(props) {
|
|
|
439
439
|
h("span", null, m === "auto" ? L.modeAuto : L.modeManual)))));
|
|
440
440
|
const toggleDay = (d) => setWin(Object.assign({}, win, { days: win.days.includes(d) ? win.days.filter((x) => x !== d) : win.days.concat([d]).sort() }));
|
|
441
441
|
rows.push(h(Field, { key: "win", label: `${L.window} (${st.own_window ? L.ownWindow : L.defaultWindow})`, hint: L.windowHint },
|
|
442
|
+
h("form", { onSubmit: (e) => { e.preventDefault(); if (!busy) act("window", { window: win }); } },
|
|
442
443
|
h("div", { className: "scalio-settings-text" }, L.days),
|
|
443
444
|
h("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.75rem" } },
|
|
444
445
|
L.weekdays.map((name, d) => h("label", { key: d, className: "scalio-settings-check" },
|
|
@@ -452,8 +453,8 @@ function SaasUpdatesPanel(props) {
|
|
|
452
453
|
h("label", null, L.tz, " ", h("input", { className: "scalio-input", value: win.tz, disabled: busy, "data-testid": "saas-updates-tz",
|
|
453
454
|
onChange: (e) => setWin(Object.assign({}, win, { tz: e.target.value })) }))),
|
|
454
455
|
h("div", { className: "scalio-settings-section-footer" },
|
|
455
|
-
h("button", { type: "
|
|
456
|
-
st.own_window ? h("button", { type: "button", className: "scalio-btn", disabled: busy, "data-testid": "saas-updates-default-window", onClick: () => act("window", {}) }, L.useDefault) : null)));
|
|
456
|
+
h("button", { type: "submit", className: "scalio-btn", disabled: busy, "data-testid": "saas-updates-save-window" }, L.save),
|
|
457
|
+
st.own_window ? h("button", { type: "button", className: "scalio-btn", disabled: busy, "data-testid": "saas-updates-default-window", onClick: () => act("window", {}) }, L.useDefault) : null))));
|
|
457
458
|
if (st.last) rows.push(h(Field, { key: "last", label: L.last },
|
|
458
459
|
h("div", { className: "scalio-settings-text", "data-testid": "saas-updates-last" },
|
|
459
460
|
fill(st.last.state === "done" ? L.lastDone : L.lastError, { version: st.last.version, at: when(st.last.at, props.lang) }))));
|
package/react/tenancy.js
CHANGED
|
@@ -471,26 +471,27 @@ function ConnectionChoice({ value, onChange, methods, locked, writeLocked, write
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
// «Tenant hinzufügen» in four steps (ADR 0128 point 6): Name und Organisation → Verbindung und Zugang →
|
|
474
|
-
// <App>-Einstellungen → Prüfen.
|
|
475
|
-
//
|
|
476
|
-
// {content, canNext?, onNext?} or null
|
|
474
|
+
// <App>-Einstellungen → Prüfen. Nothing is created before the last step: the steps before only check
|
|
475
|
+
// (`onValidate(values)`, throws to stay on step 1) and keep the values in memory (`renderConnect(null, values, setValues)`,
|
|
476
|
+
// `appStep(null, values, setValues)` return {content, canNext?, onNext?} or null for no step 3). On «Prüfen» the wizard
|
|
477
|
+
// calls `onCreate(values) -> tenant` and then `onFinish(tenant, values)` (connect, app settings). Cancel creates nothing.
|
|
477
478
|
function TenantWizard(props) {
|
|
478
479
|
const { open, onClose, organizations, defaultOrganization, methods, locked, writeLocked, writeHidden, methodText,
|
|
479
|
-
appName, appStep, renderConnect, onCreate, onFinish, lang, labels, review } = props;
|
|
480
|
+
appName, appStep, renderConnect, onValidate, onCreate, onFinish, lang, labels, review } = props;
|
|
480
481
|
const L = tenancyLabels(lang, labels);
|
|
481
482
|
const orgs = organizations || [];
|
|
482
483
|
const first = () => ({ name: "", domain: "", organization_id: defaultOrganization || (orgs[0] && orgs[0].id) || "",
|
|
483
484
|
method: (methods || ["direct"]).find((m) => !(locked || {})[m]) || "direct", write: false });
|
|
484
485
|
const [step, setStep] = React.useState(0);
|
|
485
486
|
const [values, setValues] = React.useState(first);
|
|
486
|
-
const
|
|
487
|
-
React.useEffect(() => { if (open) { setStep(0); setValues(first());
|
|
487
|
+
const tenant = null; // nothing exists before the last step
|
|
488
|
+
React.useEffect(() => { if (open) { setStep(0); setValues(first()); } }, [open]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
488
489
|
if (!open) return null;
|
|
489
490
|
const set = (patch) => setValues((s) => Object.assign({}, s, patch));
|
|
490
491
|
const app = appStep ? appStep(tenant, values, set) : null;
|
|
491
492
|
const steps = [
|
|
492
493
|
{ id: "name", label: L.stepName, title: L.stepName, canNext: !!values.name.trim() && (!orgs.length || !!values.organization_id),
|
|
493
|
-
onNext: async () => { if (
|
|
494
|
+
onNext: async () => { if (onValidate) await onValidate(values); },
|
|
494
495
|
content: h("div", { className: "scalio-tenancy-grid" },
|
|
495
496
|
h(Field, { label: L.tenantName, hint: L.tenantNameHint },
|
|
496
497
|
h("input", { className: "scalio-input", value: values.name, onChange: (e) => set({ name: e.target.value }), "data-testid": "tenant-wizard-name" })),
|
|
@@ -502,7 +503,7 @@ function TenantWizard(props) {
|
|
|
502
503
|
{ id: "connection", label: L.stepConnection, title: L.stepConnection,
|
|
503
504
|
content: h(React.Fragment, null,
|
|
504
505
|
h(ConnectionChoice, { value: values, onChange: setValues, methods, locked, writeLocked, writeHidden, methodText, lang, labels }),
|
|
505
|
-
renderConnect &&
|
|
506
|
+
renderConnect && values.method !== "simulated" ? h("div", { className: "scalio-tenancy-connect", "data-testid": "tenant-wizard-connect" }, renderConnect(tenant, values, set)) : null) },
|
|
506
507
|
];
|
|
507
508
|
if (app) steps.push(Object.assign({ id: "app", label: fill(L.settings, { app: appName || "App" }), title: fill(L.settings, { app: appName || "App" }) }, app));
|
|
508
509
|
const rows = [[L.tenantName, values.name], [L.domain, values.domain], orgs.length ? [L.organization, (orgs.find((o) => o.id === values.organization_id) || {}).name] : null,
|
|
@@ -514,7 +515,10 @@ function TenantWizard(props) {
|
|
|
514
515
|
return h(SetupWizard, {
|
|
515
516
|
open, title: L.addTenantTitle, steps, step, onStepChange: setStep, onClose, wide: true, lang, testId: "tenant-wizard",
|
|
516
517
|
success: { title: L.finished, text: L.finishedText },
|
|
517
|
-
onFinish: () =>
|
|
518
|
+
onFinish: async () => {
|
|
519
|
+
const created = onCreate ? await onCreate(values) : null;
|
|
520
|
+
if (onFinish) await onFinish(created, values);
|
|
521
|
+
},
|
|
518
522
|
onDone: onClose,
|
|
519
523
|
});
|
|
520
524
|
}
|
|
@@ -560,24 +564,29 @@ function TenantEditDialog({ tenant, organizations, onSave, onClose, renderConnec
|
|
|
560
564
|
// The selection at the top of every app (ADR 0128 O5, Markus 2026-11-15): first the organization, and only when the
|
|
561
565
|
// chosen organization has more than one tenant also its tenant. With one organization only the tenant select (when
|
|
562
566
|
// there are several). The app keeps one value, the tenant id ("" = all): choosing an organization with one tenant picks
|
|
563
|
-
// that tenant, one with several picks its first
|
|
567
|
+
// that tenant, one with several picks its first, one without tenants picks none (""). The organization select shows
|
|
568
|
+
// from two organizations on, whatever their tenant counts. `hideAll` drops «Alle …» (apps where it has no effect, e.g.
|
|
569
|
+
// Citadel, Foundry). `manage` = {label?, onSelect} adds «Mandanten verwalten …».
|
|
564
570
|
const MANAGE = "__scalio_manage";
|
|
565
|
-
function TenancySelect({ organizations, tenants, tenantId, onSelect, manage, lang, labels, hint }) {
|
|
571
|
+
function TenancySelect({ organizations, tenants, tenantId, onSelect, manage, lang, labels, hint, hideAll }) {
|
|
566
572
|
const { ContextSelect } = require("./nav");
|
|
567
573
|
const L = tenancyLabels(lang, labels);
|
|
568
574
|
const list = tenants || [];
|
|
569
|
-
const
|
|
575
|
+
const orgs = organizations || [];
|
|
570
576
|
const current = list.find((t) => t.id === tenantId);
|
|
571
|
-
|
|
577
|
+
// An organization without tenants has no tenant id to carry it, so the choice is kept here until a tenant is picked.
|
|
578
|
+
const [chosenOrg, setChosenOrg] = React.useState("");
|
|
579
|
+
let orgId = current ? current.organization_id : (orgs.some((o) => o.id === chosenOrg) ? chosenOrg : "");
|
|
580
|
+
if (!orgId && hideAll && orgs.length) orgId = orgs[0].id;
|
|
572
581
|
const inOrg = orgId ? list.filter((t) => t.organization_id === orgId) : list;
|
|
573
582
|
const manageOpt = manage ? [{ value: MANAGE, label: manage.label || L.manage }] : [];
|
|
574
583
|
const pick = (fn) => (v) => (v === MANAGE ? manage.onSelect() : fn(v));
|
|
575
584
|
const tenantHint = hint === undefined ? (current && current.domain) || "" : hint;
|
|
576
|
-
if (showOrganizationSelect(
|
|
585
|
+
if (showOrganizationSelect(orgs)) {
|
|
577
586
|
const org = h(ContextSelect, {
|
|
578
587
|
key: "org", id: "scalio-organization-select", label: L.organization, value: orgId, testId: "organization-switcher",
|
|
579
|
-
options: [{ value: "", label: L.allOrganizations }].concat(
|
|
580
|
-
onChange: pick((id) => onSelect(id ? (list.find((t) => t.organization_id === id) || {}).id || "" : "")),
|
|
588
|
+
options: (hideAll ? [] : [{ value: "", label: L.allOrganizations }]).concat(orgs.map((o) => ({ value: o.id, label: o.name })), manageOpt),
|
|
589
|
+
onChange: pick((id) => { setChosenOrg(id); onSelect(id ? (list.find((t) => t.organization_id === id) || {}).id || "" : ""); }),
|
|
581
590
|
hint: orgId && !showTenantSelect(inOrg) ? tenantHint : undefined,
|
|
582
591
|
});
|
|
583
592
|
const ten = orgId && showTenantSelect(inOrg) ? h(ContextSelect, {
|
|
@@ -589,7 +598,7 @@ function TenancySelect({ organizations, tenants, tenantId, onSelect, manage, lan
|
|
|
589
598
|
if (!showTenantSelect(list)) return null;
|
|
590
599
|
return h(ContextSelect, {
|
|
591
600
|
id: "scalio-tenant-select", label: L.tenant, value: tenantId || "", testId: "tenant-switcher", hint: tenantHint,
|
|
592
|
-
options: [{ value: "", label: L.allTenants }].concat(list.map((t) => ({ value: t.id, label: t.name })), manageOpt),
|
|
601
|
+
options: (hideAll ? [] : [{ value: "", label: L.allTenants }]).concat(list.map((t) => ({ value: t.id, label: t.name })), manageOpt),
|
|
593
602
|
onChange: pick(onSelect),
|
|
594
603
|
});
|
|
595
604
|
}
|