@scalio-cloud/ui 0.91.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/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/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
|
}
|