@scalio-cloud/ui 0.76.0 → 0.79.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 +14 -0
- package/nav.css +38 -0
- package/package.json +1 -1
- package/react/agents.js +62 -9
- package/react/index.js +1 -1
- package/react/labels.js +2 -2
- package/react/settings.js +1 -1
- package/react/tenancy.js +573 -0
package/README.md
CHANGED
|
@@ -223,6 +223,20 @@ only one of them takes the code). After a connect, check or removal a view calls
|
|
|
223
223
|
every view that uses `useTenantChange(reload)` reads its state again; `TenantConnectStep` does both by itself. An
|
|
224
224
|
app with its own connection block does the same, else the wizard keeps showing «Nicht verbunden».
|
|
225
225
|
|
|
226
|
+
Einstellungen → «Mandanten» (scalio-docs ADR 0128, 0.79.0) is the same in Citadel, Pulse, Foundry, Atrium and
|
|
227
|
+
Rosetta: `tenancySettingsGroup({lang})` gives the settings group (first in every app) with «Organisationen» and
|
|
228
|
+
«Tenants». `<OrganizationsPanel client={organizationsApi(api)} msp={hasMsp} tabs={[...]} />` shows the form of the one
|
|
229
|
+
organization without the feature `msp`, else the list with «+ Organisation» and a detail with «Stammdaten» plus the
|
|
230
|
+
app's tabs. `<TenantList tenants columns actions appName limit onAdd />` is the tenant list (template Foundry: base
|
|
231
|
+
columns Tenant, Organisation (only with several), Verbindungsart, Zugang, Status, then the app's columns; buttons
|
|
232
|
+
Verbindung, App-Einstellungen, Bearbeiten, Entfernen; «+ Tenant» stops at `limits.tenants`). `<TenantWizard>` adds a
|
|
233
|
+
tenant in four steps (Name und Organisation → Verbindung und Zugang → `<App>`-Einstellungen → Prüfen; the tenant is
|
|
234
|
+
created after step 1 by `onCreate`, `renderConnect` embeds the connection, `appStep` is the app's step, locked
|
|
235
|
+
methods stay visible with their reason). `<TenantEditDialog>` shows the same parts as tabs.
|
|
236
|
+
`organizationSetupStep({value, onChange, onSave, prefilled})` is the setup step «Organisation» (name, short code,
|
|
237
|
+
classification, language; prefilled from the Microsoft sign-in). `showOrganizationSelect` / `showTenantSelect`: the
|
|
238
|
+
selects at the top only with more than one (ADR 0128 O5). Never show prices in these parts.
|
|
239
|
+
|
|
226
240
|
`<FirstAdminSetup microsoft={...} codeFrom="portal" onSubmit={...} onMicrosoft={...} lang={lang} />` is the first-run
|
|
227
241
|
form «Ersten Administrator anlegen» inside `AuthLayout`, with the same texts in every app (Citadel, Beacon and Pulse
|
|
228
242
|
are the reference). «Mit Microsoft anmelden» is always there: greyed with a hint while the instance has no Scalio ID
|
package/nav.css
CHANGED
|
@@ -982,3 +982,41 @@ ul.scalio-notice { flex-direction: column; gap: 0.25rem; padding-left: 2rem; lis
|
|
|
982
982
|
.scalio-mail-step-name { font-weight: 600; }
|
|
983
983
|
.scalio-mail-step-state { margin-left: auto; font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
|
|
984
984
|
.scalio-mail-rights-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
|
|
985
|
+
|
|
986
|
+
/* Einstellungen → Mandanten (ADR 0128): organizations, tenant list, tenant wizard. */
|
|
987
|
+
.scalio-tenancy { display: flex; flex-direction: column; gap: 1rem; font-size: 0.875rem; min-width: 0; }
|
|
988
|
+
.scalio-tenancy-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
|
|
989
|
+
.scalio-tenancy-hint { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
|
|
990
|
+
.scalio-tenancy-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
|
|
991
|
+
@media (min-width: 768px) { .scalio-tenancy-grid { grid-template-columns: 1fr 1fr; } }
|
|
992
|
+
.scalio-tenancy-field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
|
|
993
|
+
.scalio-tenancy-field .scalio-field-label { margin-top: 0; }
|
|
994
|
+
.scalio-tenancy-form, .scalio-tenancy-step { display: flex; flex-direction: column; gap: 1rem; }
|
|
995
|
+
.scalio-tenancy-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; }
|
|
996
|
+
.scalio-tenancy-row-actions { text-align: right; white-space: nowrap; }
|
|
997
|
+
.scalio-tenancy-detail { display: flex; flex-direction: column; gap: 1rem; }
|
|
998
|
+
.scalio-tenancy-title { margin: 0; font-family: 'Chivo', sans-serif; font-weight: 900; text-transform: uppercase; font-size: 1.125rem; letter-spacing: -0.01em; }
|
|
999
|
+
.scalio-tenancy-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid hsl(var(--border)); }
|
|
1000
|
+
.scalio-tenancy-tab { padding: 0.5rem 0.875rem; border: 0; border-bottom: 2px solid transparent; background: transparent; color: hsl(var(--muted-foreground)); font: inherit; cursor: pointer; }
|
|
1001
|
+
.scalio-tenancy-tab.is-active { color: hsl(var(--foreground)); font-weight: 600; border-bottom-color: hsl(var(--primary)); }
|
|
1002
|
+
.scalio-tenancy-options { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
|
|
1003
|
+
@media (min-width: 768px) { .scalio-tenancy-options { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); } }
|
|
1004
|
+
.scalio-tenancy-option { display: flex; gap: 0.625rem; align-items: flex-start; padding: 0.75rem; border: 1px solid hsl(var(--border)); border-radius: 2px; cursor: pointer; }
|
|
1005
|
+
.scalio-tenancy-option.is-selected { border-color: hsl(var(--primary)); box-shadow: 0 0 0 1px hsl(var(--primary)); }
|
|
1006
|
+
.scalio-tenancy-option.is-locked { opacity: 0.55; cursor: not-allowed; background: hsl(var(--muted)); }
|
|
1007
|
+
.scalio-tenancy-option input { margin-top: 0.2rem; accent-color: hsl(var(--primary)); }
|
|
1008
|
+
.scalio-tenancy-option-title { display: block; font-weight: 600; }
|
|
1009
|
+
.scalio-tenancy-option-text { display: block; font-size: 0.75rem; color: hsl(var(--muted-foreground)); margin-top: 0.125rem; }
|
|
1010
|
+
.scalio-tenancy-lock { margin-left: 0.5rem; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--muted-foreground)); }
|
|
1011
|
+
.scalio-tenancy-chips { display: inline-flex; gap: 0.25rem; white-space: nowrap; }
|
|
1012
|
+
.scalio-tenancy-chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.0625rem 0.5rem; border: 1px solid hsl(var(--border)); border-radius: 999px; font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
|
|
1013
|
+
.scalio-tenancy-chip.is-on { border-color: rgb(16 185 129 / 0.45); color: rgb(4 120 87); }
|
|
1014
|
+
.scalio-tenancy-method { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
|
|
1015
|
+
.scalio-tenancy-status { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 2px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
|
|
1016
|
+
.scalio-tenancy-status.is-ok { background: rgb(16 185 129 / 0.12); color: rgb(4 120 87); }
|
|
1017
|
+
.scalio-tenancy-status.is-warn { background: rgb(245 158 11 / 0.15); color: rgb(146 64 14); }
|
|
1018
|
+
.scalio-tenancy-status.is-off { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
|
|
1019
|
+
.scalio-tenancy-status.is-info { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); }
|
|
1020
|
+
.dark .scalio-tenancy-chip.is-on, .dark .scalio-tenancy-status.is-ok { color: rgb(110 231 183); }
|
|
1021
|
+
.dark .scalio-tenancy-status.is-warn { color: rgb(252 211 77); }
|
|
1022
|
+
.scalio-tenancy-connect { margin-top: 1rem; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.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/index.js
CHANGED
|
@@ -386,6 +386,6 @@ module.exports = {
|
|
|
386
386
|
TEST_IDS,
|
|
387
387
|
initials,
|
|
388
388
|
};
|
|
389
|
-
Object.assign(module.exports, Nav, Blocks, require("./settings"), require("./support"), require("./beacon"), require("./security"), require("./license"), require("./palette"), require("./unify"), require("./profile"), require("./actions"), require("./selftest"), require("./users"), require("./customers"), require("./roles"), require("./wizard"), require("./maintenance"), require("./backup"), require("./audit"), require("./mail"), require("./saas_updates"), require("./pages"), require("./tenant"), require("./fields"), require("./dialog"), require("./keyboard"), require("./agents"), require("./agent_scripts"), require("./ai"), require("./markdown"));
|
|
389
|
+
Object.assign(module.exports, Nav, Blocks, require("./settings"), require("./support"), require("./beacon"), require("./security"), require("./license"), require("./palette"), require("./unify"), require("./profile"), require("./actions"), require("./selftest"), require("./users"), require("./customers"), require("./roles"), require("./wizard"), require("./maintenance"), require("./backup"), require("./audit"), require("./mail"), require("./saas_updates"), require("./pages"), require("./tenant"), require("./fields"), require("./dialog"), require("./keyboard"), require("./agents"), require("./agent_scripts"), require("./ai"), require("./markdown"), require("./tenancy"));
|
|
390
390
|
// After the exports above: auth.js uses LanguageToggle and ThemeToggle from this module.
|
|
391
391
|
Object.assign(module.exports, require("./auth"), require("./session"), require("./setup"), require("./clientErrors"));
|
package/react/labels.js
CHANGED
|
@@ -118,7 +118,7 @@ const LABELS = {
|
|
|
118
118
|
tenant: "Tenant",
|
|
119
119
|
customer: "Kunde",
|
|
120
120
|
// Settings page (fixed groups, same order in every app)
|
|
121
|
-
settingsGroups: { general: "Allgemein", connections: "Verbindungen", notifications: "Benachrichtigungen", security: "Sicherheit", system: "System" },
|
|
121
|
+
settingsGroups: { tenancy: "Mandanten", general: "Allgemein", connections: "Verbindungen", notifications: "Benachrichtigungen", security: "Sicherheit", system: "System" },
|
|
122
122
|
searchSettings: "Einstellung suchen",
|
|
123
123
|
noSettingsMatch: "Kein Bereich gefunden",
|
|
124
124
|
settingsArea: "Bereich",
|
|
@@ -692,7 +692,7 @@ const LABELS = {
|
|
|
692
692
|
paletteHint: "Arrow keys to choose, Enter to open, Esc to close",
|
|
693
693
|
tenant: "Tenant",
|
|
694
694
|
customer: "Customer",
|
|
695
|
-
settingsGroups: { general: "General", connections: "Connections", notifications: "Notifications", security: "Security", system: "System" },
|
|
695
|
+
settingsGroups: { tenancy: "Tenancy", general: "General", connections: "Connections", notifications: "Notifications", security: "Security", system: "System" },
|
|
696
696
|
searchSettings: "Find a setting",
|
|
697
697
|
noSettingsMatch: "No area found",
|
|
698
698
|
settingsArea: "Area",
|
package/react/settings.js
CHANGED
|
@@ -13,7 +13,7 @@ function cx() {
|
|
|
13
13
|
|
|
14
14
|
// Fixed order: Allgemein first, then the app's own groups, then Verbindungen, Benachrichtigungen,
|
|
15
15
|
// Sicherheit, System. Labels of the fixed groups come from LABELS; app groups bring their own.
|
|
16
|
-
const FIXED_HEAD = ["general"];
|
|
16
|
+
const FIXED_HEAD = ["tenancy", "general"]; // «Mandanten» first (ADR 0128)
|
|
17
17
|
const FIXED_TAIL = ["connections", "notifications", "security", "system"];
|
|
18
18
|
|
|
19
19
|
function orderGroups(groups) {
|
package/react/tenancy.js
ADDED
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Einstellungen → Mandanten (scalio-docs ADR 0128 `orgten`, concepts/org-tenants.md): Organisationen and Tenants look
|
|
3
|
+
// the same in Citadel, Pulse, Foundry, Atrium and Rosetta. The data lives in scalio-tenant (`Store`); the app gives
|
|
4
|
+
// its routes as a client, its own table columns and its own wizard step («<App>-Einstellungen»).
|
|
5
|
+
//
|
|
6
|
+
// Licence (ADR 0128 O2/7): without the feature `msp` there is exactly one organization (its form, no list) and the
|
|
7
|
+
// tenants stop at `limits.tenants`; GDAP and more organizations only with `msp`. Locked options stay visible with the
|
|
8
|
+
// edition that has them. Never show prices.
|
|
9
|
+
const React = require("react");
|
|
10
|
+
const h = React.createElement;
|
|
11
|
+
const Icons = require("./icons");
|
|
12
|
+
const { Notice } = require("./blocks");
|
|
13
|
+
const { SetupWizard } = require("./wizard");
|
|
14
|
+
const { askConfirm } = require("./dialog");
|
|
15
|
+
|
|
16
|
+
const CLASSIFICATIONS = ["Öffentlich", "Intern", "Vertraulich", "Streng vertraulich"];
|
|
17
|
+
const LANGUAGES = ["de", "en"];
|
|
18
|
+
const METHODS = ["direct", "gdap", "simulated"];
|
|
19
|
+
|
|
20
|
+
const LABELS = {
|
|
21
|
+
de: {
|
|
22
|
+
group: "Mandanten",
|
|
23
|
+
organizations: "Organisationen",
|
|
24
|
+
organizationsHint: "Name, Kürzel, Klassifizierung, Sprache",
|
|
25
|
+
tenant: "Tenant",
|
|
26
|
+
tenants: "Tenants",
|
|
27
|
+
tenantsHint: "Microsoft-Tenants, Verbindung und Zugang",
|
|
28
|
+
organization: "Organisation",
|
|
29
|
+
allOrganizations: "Alle Organisationen",
|
|
30
|
+
own: "Eigene",
|
|
31
|
+
name: "Name",
|
|
32
|
+
shortCode: "Kürzel",
|
|
33
|
+
shortCodeHint: "Grossbuchstaben, Ziffern, Bindestrich. Für Dateinamen und Tickets.",
|
|
34
|
+
classification: "Klassifizierung",
|
|
35
|
+
language: "Sprache",
|
|
36
|
+
languageHint: "Sprache der Berichte, Mails und Dokumente.",
|
|
37
|
+
languages: { de: "Deutsch", en: "Englisch" },
|
|
38
|
+
classifications: { "Öffentlich": "Öffentlich", Intern: "Intern", Vertraulich: "Vertraulich", "Streng vertraulich": "Streng vertraulich" },
|
|
39
|
+
save: "Speichern",
|
|
40
|
+
saved: "Gespeichert",
|
|
41
|
+
cancel: "Abbrechen",
|
|
42
|
+
close: "Schliessen",
|
|
43
|
+
back: "Zurück zur Liste",
|
|
44
|
+
edit: "Bearbeiten",
|
|
45
|
+
remove: "Entfernen",
|
|
46
|
+
addOrganization: "Organisation",
|
|
47
|
+
newOrganization: "Neue Organisation",
|
|
48
|
+
removeOrganization: "Organisation «{name}» entfernen?",
|
|
49
|
+
removeOrganizationText: "Nur möglich, solange ihr kein Tenant zugewiesen ist.",
|
|
50
|
+
singleOrganization: "Ihre Lizenz enthält eine Organisation. Mehrere Organisationen gibt es mit MSP oder Enterprise.",
|
|
51
|
+
orgCount: "{n} Organisationen",
|
|
52
|
+
tenantCount: "Tenants",
|
|
53
|
+
noTenant: "Kein Tenant",
|
|
54
|
+
masterData: "Stammdaten",
|
|
55
|
+
setupTitle: "Ihre Organisation",
|
|
56
|
+
setupText: "Daraus legen wir Ihre Organisation an. Sie können die Angaben später unter Einstellungen → Mandanten → Organisationen ändern.",
|
|
57
|
+
setupPrefilled: "Name aus Ihrer Microsoft-Anmeldung übernommen.",
|
|
58
|
+
// tenants
|
|
59
|
+
addTenant: "Tenant",
|
|
60
|
+
addTenantTitle: "Tenant hinzufügen",
|
|
61
|
+
editTenantTitle: "Tenant bearbeiten",
|
|
62
|
+
tenantName: "Name des Tenants",
|
|
63
|
+
tenantNameHint: "So erscheint der Tenant in der Liste und in der Auswahl oben.",
|
|
64
|
+
domain: "Domain",
|
|
65
|
+
domainHint: "Wird nach der Verbindung von Microsoft übernommen.",
|
|
66
|
+
method: "Verbindungsart",
|
|
67
|
+
access: "Zugang",
|
|
68
|
+
status: "Status",
|
|
69
|
+
methods: { direct: "Direkt", gdap: "GDAP", simulated: "Simuliert" },
|
|
70
|
+
methodText: {
|
|
71
|
+
direct: "App-Zustimmung im Tenant des Kunden («Scalio Lesen» / «Scalio Schreiben»).",
|
|
72
|
+
gdap: "Delegierte Verwaltung über Ihren Partner-Tenant. Der Kunde muss nichts installieren.",
|
|
73
|
+
simulated: "Übungs-Tenant ohne Microsoft, zum Ausprobieren.",
|
|
74
|
+
},
|
|
75
|
+
read: "Scalio Lesen",
|
|
76
|
+
readShort: "Lesen",
|
|
77
|
+
readText: "Nur Leserechte. Pflicht für jede Verbindung.",
|
|
78
|
+
write: "Scalio Schreiben",
|
|
79
|
+
writeShort: "Schreiben",
|
|
80
|
+
writeText: "Schreibrechte nur für die Funktionen, die Sie im nächsten Schritt einschalten.",
|
|
81
|
+
onlyMsp: "nur MSP",
|
|
82
|
+
statuses: { connected: "Verbunden", check: "Prüfung nötig", off: "Nicht verbunden", simulated: "Simuliert" },
|
|
83
|
+
connect: "Verbindung",
|
|
84
|
+
settings: "{app}-Einstellungen",
|
|
85
|
+
general: "Allgemein",
|
|
86
|
+
connection: "Verbindung",
|
|
87
|
+
stepName: "Name und Organisation",
|
|
88
|
+
stepConnection: "Verbindung und Zugang",
|
|
89
|
+
stepReview: "Prüfen",
|
|
90
|
+
reviewHint: "Alles lässt sich später in der Liste ändern.",
|
|
91
|
+
limitReached: "Ihre Lizenz enthält {n} Tenant(s). Mehr Tenants gibt es mit MSP oder Enterprise.",
|
|
92
|
+
limitOf: "{n} von {limit}",
|
|
93
|
+
noTenants: "Noch keine Tenants.",
|
|
94
|
+
removeTenant: "Tenant «{name}» entfernen?",
|
|
95
|
+
finished: "Tenant gespeichert",
|
|
96
|
+
finishedText: "Der Tenant steht in der Liste. Verbindung und Einstellungen können Sie dort jederzeit ändern.",
|
|
97
|
+
yes: "ja",
|
|
98
|
+
no: "nein",
|
|
99
|
+
},
|
|
100
|
+
en: {
|
|
101
|
+
group: "Tenancy",
|
|
102
|
+
organizations: "Organizations",
|
|
103
|
+
organizationsHint: "Name, short code, classification, language",
|
|
104
|
+
tenant: "Tenant",
|
|
105
|
+
tenants: "Tenants",
|
|
106
|
+
tenantsHint: "Microsoft tenants, connection and access",
|
|
107
|
+
organization: "Organization",
|
|
108
|
+
allOrganizations: "All organizations",
|
|
109
|
+
own: "Own",
|
|
110
|
+
name: "Name",
|
|
111
|
+
shortCode: "Short code",
|
|
112
|
+
shortCodeHint: "Capitals, digits, hyphen. Used in file names and tickets.",
|
|
113
|
+
classification: "Classification",
|
|
114
|
+
language: "Language",
|
|
115
|
+
languageHint: "Language of reports, mails and documents.",
|
|
116
|
+
languages: { de: "German", en: "English" },
|
|
117
|
+
classifications: { "Öffentlich": "Public", Intern: "Internal", Vertraulich: "Confidential", "Streng vertraulich": "Strictly confidential" },
|
|
118
|
+
save: "Save",
|
|
119
|
+
saved: "Saved",
|
|
120
|
+
cancel: "Cancel",
|
|
121
|
+
close: "Close",
|
|
122
|
+
back: "Back to the list",
|
|
123
|
+
edit: "Edit",
|
|
124
|
+
remove: "Remove",
|
|
125
|
+
addOrganization: "Organization",
|
|
126
|
+
newOrganization: "New organization",
|
|
127
|
+
removeOrganization: "Remove organization «{name}»?",
|
|
128
|
+
removeOrganizationText: "Only possible while no tenant belongs to it.",
|
|
129
|
+
singleOrganization: "Your licence includes one organization. Several organizations come with MSP or Enterprise.",
|
|
130
|
+
orgCount: "{n} organizations",
|
|
131
|
+
tenantCount: "Tenants",
|
|
132
|
+
noTenant: "No tenant",
|
|
133
|
+
masterData: "Master data",
|
|
134
|
+
setupTitle: "Your organization",
|
|
135
|
+
setupText: "We create your organization from this. You can change it later under Settings → Tenancy → Organizations.",
|
|
136
|
+
setupPrefilled: "Name taken from your Microsoft sign-in.",
|
|
137
|
+
addTenant: "Tenant",
|
|
138
|
+
addTenantTitle: "Add tenant",
|
|
139
|
+
editTenantTitle: "Edit tenant",
|
|
140
|
+
tenantName: "Tenant name",
|
|
141
|
+
tenantNameHint: "This is how the tenant shows in the list and in the selection at the top.",
|
|
142
|
+
domain: "Domain",
|
|
143
|
+
domainHint: "Taken from Microsoft once connected.",
|
|
144
|
+
method: "Connection method",
|
|
145
|
+
access: "Access",
|
|
146
|
+
status: "Status",
|
|
147
|
+
methods: { direct: "Direct", gdap: "GDAP", simulated: "Simulated" },
|
|
148
|
+
methodText: {
|
|
149
|
+
direct: "App consent in the customer's tenant («Scalio Lesen» / «Scalio Schreiben»).",
|
|
150
|
+
gdap: "Delegated administration through your partner tenant. The customer installs nothing.",
|
|
151
|
+
simulated: "Practice tenant without Microsoft, to try things out.",
|
|
152
|
+
},
|
|
153
|
+
read: "Scalio Lesen",
|
|
154
|
+
readShort: "Read",
|
|
155
|
+
readText: "Read permissions only. Needed for every connection.",
|
|
156
|
+
write: "Scalio Schreiben",
|
|
157
|
+
writeShort: "Write",
|
|
158
|
+
writeText: "Write permissions only for the functions you switch on in the next step.",
|
|
159
|
+
onlyMsp: "MSP only",
|
|
160
|
+
statuses: { connected: "Connected", check: "Check needed", off: "Not connected", simulated: "Simulated" },
|
|
161
|
+
connect: "Connection",
|
|
162
|
+
settings: "{app} settings",
|
|
163
|
+
general: "General",
|
|
164
|
+
connection: "Connection",
|
|
165
|
+
stepName: "Name and organization",
|
|
166
|
+
stepConnection: "Connection and access",
|
|
167
|
+
stepReview: "Review",
|
|
168
|
+
reviewHint: "You can change everything later in the list.",
|
|
169
|
+
limitReached: "Your licence includes {n} tenant(s). More tenants come with MSP or Enterprise.",
|
|
170
|
+
limitOf: "{n} of {limit}",
|
|
171
|
+
noTenants: "No tenants yet.",
|
|
172
|
+
removeTenant: "Remove tenant «{name}»?",
|
|
173
|
+
finished: "Tenant saved",
|
|
174
|
+
finishedText: "The tenant is in the list. You can change its connection and settings there at any time.",
|
|
175
|
+
yes: "yes",
|
|
176
|
+
no: "no",
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
function tenancyLabels(lang, overrides) {
|
|
181
|
+
return Object.assign({}, LABELS[lang === "en" ? "en" : "de"], overrides || {});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function fill(text, values) {
|
|
185
|
+
return Object.keys(values || {}).reduce((t, k) => t.split(`{${k}}`).join(String(values[k])), text || "");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function errorText(err) {
|
|
189
|
+
const d = err && err.response && err.response.data && err.response.data.detail;
|
|
190
|
+
if (typeof d === "string") return d;
|
|
191
|
+
if (d && typeof d.message === "string") return d.message;
|
|
192
|
+
return (err && err.message) || String(err);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// The client every app gives (routes of scalio-tenant's Store through the app): list, create, update, remove.
|
|
196
|
+
function organizationsApi(api, base) {
|
|
197
|
+
const b = base || "/organizations";
|
|
198
|
+
const data = (r) => (r && r.data !== undefined ? r.data : r);
|
|
199
|
+
return {
|
|
200
|
+
list: () => api.get(b).then(data),
|
|
201
|
+
create: (body) => api.post(b, body).then(data),
|
|
202
|
+
update: (id, body) => api.patch(`${b}/${encodeURIComponent(id)}`, body).then(data),
|
|
203
|
+
remove: (id) => api.delete(`${b}/${encodeURIComponent(id)}`).then(data),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ADR 0128 O5: the organization select at the top only with more than one organization, the tenant select only with
|
|
208
|
+
// more than one tenant (in the chosen organization).
|
|
209
|
+
function showOrganizationSelect(organizations) {
|
|
210
|
+
return (organizations || []).length > 1;
|
|
211
|
+
}
|
|
212
|
+
function showTenantSelect(tenants) {
|
|
213
|
+
return (tenants || []).length > 1;
|
|
214
|
+
}
|
|
215
|
+
// Room for one more tenant? limit null/undefined/-1 = no limit.
|
|
216
|
+
function canAddTenant(count, limit) {
|
|
217
|
+
return limit === null || limit === undefined || limit < 0 || (count || 0) < limit;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// A short code made from a name, like scalio-tenant `short_code_base` (the backend makes it unique).
|
|
221
|
+
function suggestShortCode(name) {
|
|
222
|
+
const map = { Ä: "AE", Ö: "OE", Ü: "UE", ä: "AE", ö: "OE", ü: "UE" };
|
|
223
|
+
const base = String(name || "").replace(/[ÄÖÜäöü]/g, (c) => map[c]).toUpperCase().replace(/[^A-Z0-9]/g, "").slice(0, 8);
|
|
224
|
+
return base.length >= 2 ? base : "";
|
|
225
|
+
}
|
|
226
|
+
function shortCodeValid(code) {
|
|
227
|
+
return /^[A-Z0-9][A-Z0-9-]{1,11}$/.test(String(code || ""));
|
|
228
|
+
}
|
|
229
|
+
function organizationValid(v) {
|
|
230
|
+
return !!(v && String(v.name || "").trim() && shortCodeValid(v.short_code) && LANGUAGES.indexOf(v.language) >= 0
|
|
231
|
+
&& String(v.classification || "").trim());
|
|
232
|
+
}
|
|
233
|
+
function emptyOrganization(name) {
|
|
234
|
+
return { name: name || "", short_code: suggestShortCode(name), classification: "Vertraulich", language: "de" };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function Field({ label, hint, children, testId }) {
|
|
238
|
+
return h("label", { className: "scalio-tenancy-field", "data-testid": testId },
|
|
239
|
+
h("span", { className: "scalio-field-label" }, label),
|
|
240
|
+
children,
|
|
241
|
+
hint ? h("span", { className: "scalio-tenancy-hint" }, hint) : null);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Name, Kürzel, Klassifizierung, Sprache. The short code follows the name until someone types one.
|
|
245
|
+
function OrganizationFields({ value, onChange, lang, labels, testId, disabled }) {
|
|
246
|
+
const L = tenancyLabels(lang, labels);
|
|
247
|
+
const v = value || emptyOrganization();
|
|
248
|
+
const [ownCode, setOwnCode] = React.useState(!!(v.short_code && v.short_code !== suggestShortCode(v.name)));
|
|
249
|
+
const set = (patch) => onChange(Object.assign({}, v, patch));
|
|
250
|
+
const id = testId || "organization";
|
|
251
|
+
const classes = CLASSIFICATIONS.indexOf(v.classification) < 0 && v.classification
|
|
252
|
+
? CLASSIFICATIONS.concat([v.classification]) : CLASSIFICATIONS;
|
|
253
|
+
return h("div", { className: "scalio-tenancy-grid", "data-testid": `${id}-fields` },
|
|
254
|
+
h(Field, { label: L.name, testId: `${id}-name-field` },
|
|
255
|
+
h("input", { className: "scalio-input", value: v.name, disabled, "data-testid": `${id}-name`,
|
|
256
|
+
onChange: (e) => set(ownCode ? { name: e.target.value } : { name: e.target.value, short_code: suggestShortCode(e.target.value) }) })),
|
|
257
|
+
h(Field, { label: L.shortCode, hint: L.shortCodeHint, testId: `${id}-code-field` },
|
|
258
|
+
h("input", { className: "scalio-input scalio-mono", value: v.short_code, disabled, maxLength: 12, "data-testid": `${id}-code`,
|
|
259
|
+
"aria-invalid": v.short_code && !shortCodeValid(v.short_code) ? "true" : undefined,
|
|
260
|
+
onChange: (e) => { setOwnCode(true); set({ short_code: e.target.value.toUpperCase() }); } })),
|
|
261
|
+
h(Field, { label: L.classification, testId: `${id}-classification-field` },
|
|
262
|
+
h("select", { className: "scalio-input", value: v.classification, disabled, "data-testid": `${id}-classification`,
|
|
263
|
+
onChange: (e) => set({ classification: e.target.value }) },
|
|
264
|
+
classes.map((c) => h("option", { key: c, value: c }, L.classifications[c] || c)))),
|
|
265
|
+
h(Field, { label: L.language, hint: L.languageHint, testId: `${id}-language-field` },
|
|
266
|
+
h("select", { className: "scalio-input", value: v.language, disabled, "data-testid": `${id}-language`,
|
|
267
|
+
onChange: (e) => set({ language: e.target.value }) },
|
|
268
|
+
LANGUAGES.map((c) => h("option", { key: c, value: c }, L.languages[c])))));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Setup step «Organisation» (ADR 0128 O4): give it to SetupWizard as `content`. `prefilled` = name from the Microsoft
|
|
272
|
+
// sign-in, so the step is a confirmation, not an empty form.
|
|
273
|
+
function OrganizationStep({ value, onChange, prefilled, lang, labels }) {
|
|
274
|
+
const L = tenancyLabels(lang, labels);
|
|
275
|
+
return h("div", { className: "scalio-tenancy-step", "data-testid": "setup-organization" },
|
|
276
|
+
prefilled ? h("p", { className: "scalio-tenancy-hint", "data-testid": "setup-organization-prefilled" }, L.setupPrefilled) : null,
|
|
277
|
+
h(OrganizationFields, { value, onChange, lang, labels, testId: "setup-organization" }));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Setup-wizard step object: steps.push(organizationSetupStep({...})).
|
|
281
|
+
function organizationSetupStep({ value, onChange, onSave, prefilled, lang, labels }) {
|
|
282
|
+
const L = tenancyLabels(lang, labels);
|
|
283
|
+
return {
|
|
284
|
+
id: "organization", label: L.organization, title: L.setupTitle, description: L.setupText,
|
|
285
|
+
canNext: organizationValid(value), onNext: onSave,
|
|
286
|
+
content: h(OrganizationStep, { value, onChange, prefilled, lang, labels }),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function OrganizationForm({ initial, onSave, onCancel, lang, labels, testId }) {
|
|
291
|
+
const L = tenancyLabels(lang, labels);
|
|
292
|
+
const [v, setV] = React.useState(Object.assign(emptyOrganization(), initial || {}));
|
|
293
|
+
const [busy, setBusy] = React.useState(false);
|
|
294
|
+
const [error, setError] = React.useState("");
|
|
295
|
+
const [saved, setSaved] = React.useState(false);
|
|
296
|
+
const submit = async (e) => {
|
|
297
|
+
e.preventDefault();
|
|
298
|
+
if (!organizationValid(v)) return;
|
|
299
|
+
setBusy(true); setError(""); setSaved(false);
|
|
300
|
+
try {
|
|
301
|
+
await onSave({ name: v.name.trim(), short_code: v.short_code, classification: v.classification, language: v.language });
|
|
302
|
+
setSaved(true);
|
|
303
|
+
} catch (err) { setError(errorText(err)); } finally { setBusy(false); }
|
|
304
|
+
};
|
|
305
|
+
const id = testId || "organization-form";
|
|
306
|
+
return h("form", { className: "scalio-tenancy-form", onSubmit: submit, "data-testid": id },
|
|
307
|
+
h(OrganizationFields, { value: v, onChange: (x) => { setV(x); setSaved(false); }, lang, labels, testId: id }),
|
|
308
|
+
error ? h(Notice, { kind: "error", icon: false, lang, testId: `${id}-error` }, error) : null,
|
|
309
|
+
h("div", { className: "scalio-tenancy-actions" },
|
|
310
|
+
saved ? h("span", { className: "scalio-tenancy-hint", "data-testid": `${id}-saved` }, L.saved) : null,
|
|
311
|
+
onCancel ? h("button", { type: "button", className: "scalio-btn", onClick: onCancel, "data-testid": `${id}-cancel` }, L.cancel) : null,
|
|
312
|
+
h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || !organizationValid(v), "data-testid": `${id}-save` }, L.save)));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Einstellungen → Mandanten → Organisationen. Without `msp`: the form of the one organization. With `msp`: the list,
|
|
316
|
+
// «+ Organisation», a detail with the tab «Stammdaten» and the app's tabs ([{id, label, render(org)}], e.g. Rosetta
|
|
317
|
+
// «Automatisierung»). `tenantCount(org)` fills the column «Tenants».
|
|
318
|
+
function OrganizationsPanel({ client, msp, tabs, tenantCount, lang, labels, testId, readOnly }) {
|
|
319
|
+
const L = tenancyLabels(lang, labels);
|
|
320
|
+
const [orgs, setOrgs] = React.useState(null);
|
|
321
|
+
const [error, setError] = React.useState("");
|
|
322
|
+
const [open, setOpen] = React.useState(null); // org id, "new" or null
|
|
323
|
+
const [tab, setTab] = React.useState("master");
|
|
324
|
+
const load = React.useCallback(() => client.list().then((d) => setOrgs(Array.isArray(d) ? d : (d && d.organizations) || []))
|
|
325
|
+
.catch((err) => { setError(errorText(err)); setOrgs([]); }), [client]);
|
|
326
|
+
React.useEffect(() => { load(); }, [load]);
|
|
327
|
+
const id = testId || "organizations";
|
|
328
|
+
if (orgs === null) return h("div", { className: "scalio-tenancy", "data-testid": `${id}-loading` });
|
|
329
|
+
const count = (o) => (tenantCount ? tenantCount(o) : o.tenant_count);
|
|
330
|
+
// Without `msp` the one organization is the one with the tenant (older data may still have an empty own one).
|
|
331
|
+
const own = orgs.find((o) => count(o) > 0) || orgs.find((o) => o.kind === "own") || orgs[0];
|
|
332
|
+
const appTabs = (tabs || []).filter(Boolean);
|
|
333
|
+
|
|
334
|
+
const detail = (org) => h("div", { className: "scalio-tenancy-detail", "data-testid": `${id}-detail` },
|
|
335
|
+
msp ? h("button", { type: "button", className: "scalio-page-back", onClick: () => { setOpen(null); setTab("master"); }, "data-testid": `${id}-back` }, `← ${L.back}`) : null,
|
|
336
|
+
org ? h("div", { className: "scalio-tenancy-detail-head" },
|
|
337
|
+
h("h2", { className: "scalio-tenancy-title" }, org.name),
|
|
338
|
+
h("p", { className: "scalio-tenancy-hint" }, [org.short_code, L.classifications[org.classification] || org.classification, L.languages[org.language] || org.language].filter(Boolean).join(" · "))) : null,
|
|
339
|
+
org && appTabs.length ? h("div", { className: "scalio-tenancy-tabs", role: "tablist", "data-testid": `${id}-tabs` },
|
|
340
|
+
[{ id: "master", label: L.masterData }].concat(appTabs).map((t) => h("button", {
|
|
341
|
+
key: t.id, type: "button", role: "tab", "aria-selected": tab === t.id, className: `scalio-tenancy-tab${tab === t.id ? " is-active" : ""}`,
|
|
342
|
+
onClick: () => setTab(t.id), "data-testid": `${id}-tab-${t.id}` }, t.label))) : null,
|
|
343
|
+
tab === "master" || !org
|
|
344
|
+
? h(OrganizationForm, { key: org ? org.id : "new", initial: org || emptyOrganization(), lang, labels, testId: `${id}-form`,
|
|
345
|
+
onCancel: msp ? () => setOpen(null) : null,
|
|
346
|
+
onSave: async (body) => {
|
|
347
|
+
if (org) await client.update(org.id, body);
|
|
348
|
+
else { const made = await client.create(body); setOpen(made && made.id ? made.id : null); }
|
|
349
|
+
await load();
|
|
350
|
+
} })
|
|
351
|
+
: h("div", { "data-testid": `${id}-tabpanel-${tab}` }, appTabs.find((t) => t.id === tab).render(org)));
|
|
352
|
+
|
|
353
|
+
if (!msp) {
|
|
354
|
+
return h("div", { className: "scalio-tenancy", "data-testid": id },
|
|
355
|
+
error ? h(Notice, { kind: "error", icon: false, lang }, error) : null,
|
|
356
|
+
h(Notice, { kind: "info", lang, testId: `${id}-single` }, L.singleOrganization),
|
|
357
|
+
readOnly || !own ? null : detail(own));
|
|
358
|
+
}
|
|
359
|
+
if (open) return h("div", { className: "scalio-tenancy", "data-testid": id }, detail(open === "new" ? null : orgs.find((o) => o.id === open)));
|
|
360
|
+
|
|
361
|
+
const remove = async (o) => {
|
|
362
|
+
if (!(await askConfirm({ title: fill(L.removeOrganization, { name: o.name }), text: L.removeOrganizationText, danger: true, lang }))) return;
|
|
363
|
+
try { await client.remove(o.id); setError(""); } catch (err) { setError(errorText(err)); }
|
|
364
|
+
await load();
|
|
365
|
+
};
|
|
366
|
+
return h("div", { className: "scalio-tenancy", "data-testid": id },
|
|
367
|
+
h("div", { className: "scalio-tenancy-bar" },
|
|
368
|
+
h("span", { className: "scalio-tenancy-hint", "data-testid": `${id}-count` }, fill(L.orgCount, { n: orgs.length })),
|
|
369
|
+
readOnly ? null : h("button", { type: "button", className: "scalio-btn is-primary", onClick: () => setOpen("new"), "data-testid": `${id}-add` },
|
|
370
|
+
h(Icons.Plus, null), " ", L.addOrganization)),
|
|
371
|
+
error ? h(Notice, { kind: "error", icon: false, lang, testId: `${id}-error` }, error) : null,
|
|
372
|
+
h("div", { className: "scalio-users-table-wrap" },
|
|
373
|
+
h("table", { className: "scalio-users-table", "data-testid": `${id}-table` },
|
|
374
|
+
h("thead", null, h("tr", null, [L.organization, L.shortCode, L.classification, L.language, L.tenantCount, ""].map((c, i) => h("th", { key: i }, c)))),
|
|
375
|
+
h("tbody", null, orgs.map((o) => h("tr", { key: o.id, "data-testid": `${id}-row-${o.id}` },
|
|
376
|
+
h("td", null, h("strong", null, o.name), o.kind === "own" ? h("span", { className: "scalio-badge", style: { marginLeft: "0.5rem" } }, L.own) : null),
|
|
377
|
+
h("td", { className: "scalio-mono" }, o.short_code || ""),
|
|
378
|
+
h("td", null, L.classifications[o.classification] || o.classification || ""),
|
|
379
|
+
h("td", null, L.languages[o.language] || o.language || ""),
|
|
380
|
+
h("td", null, count(o) ? String(count(o)) : h("span", { className: "scalio-tenancy-hint" }, count(o) === 0 ? L.noTenant : "")),
|
|
381
|
+
h("td", { className: "scalio-tenancy-row-actions" },
|
|
382
|
+
h("button", { type: "button", className: "scalio-btn scalio-btn-icon is-ghost", title: L.edit, "aria-label": L.edit, onClick: () => setOpen(o.id), "data-testid": `${id}-edit-${o.id}` }, h(Icons.Pencil, null)),
|
|
383
|
+
readOnly || o.kind === "own" ? null : h("button", { type: "button", className: "scalio-btn scalio-btn-icon is-ghost", title: L.remove, "aria-label": L.remove, onClick: () => remove(o), "data-testid": `${id}-remove-${o.id}` }, h(Icons.Trash, null)))))))));
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function StatusChip({ status, L }) {
|
|
387
|
+
const tone = { connected: "is-ok", check: "is-warn", off: "is-off", simulated: "is-info" }[status] || "is-off";
|
|
388
|
+
return h("span", { className: `scalio-tenancy-status ${tone}`, "data-status": status }, L.statuses[status] || status || "");
|
|
389
|
+
}
|
|
390
|
+
function AccessChips({ t, L }) {
|
|
391
|
+
const chip = (on, text) => h("span", { className: `scalio-tenancy-chip${on ? " is-on" : ""}` }, on ? h(Icons.Check, { width: 11, height: 11 }) : h(Icons.X, { width: 11, height: 11 }), text);
|
|
392
|
+
return h("span", { className: "scalio-tenancy-chips" }, chip(!!t.read, L.readShort), chip(!!t.write, L.writeShort));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// The tenant list (template: Foundry). tenants: [{id, name, domain, organization_id, method, read, write, status}];
|
|
396
|
+
// columns: the app's columns [{id, label, render(t)}]; actions: {connect, settings, edit, remove} (each (t) => …,
|
|
397
|
+
// optional); limit: limits.tenants of the licence (null = none).
|
|
398
|
+
function TenantList({ tenants, organizations, columns, actions, appName, limit, onAdd, lang, labels, testId, readOnly }) {
|
|
399
|
+
const L = tenancyLabels(lang, labels);
|
|
400
|
+
const list = tenants || [];
|
|
401
|
+
const orgs = organizations || [];
|
|
402
|
+
const showOrg = showOrganizationSelect(orgs);
|
|
403
|
+
const orgName = (oid) => (orgs.find((o) => o.id === oid) || {}).name || "";
|
|
404
|
+
const roomLeft = canAddTenant(list.length, limit);
|
|
405
|
+
const id = testId || "tenants";
|
|
406
|
+
const a = actions || {};
|
|
407
|
+
const cols = (columns || []).filter(Boolean);
|
|
408
|
+
const iconBtn = (key, title, icon, fn, t) => fn ? h("button", {
|
|
409
|
+
key, type: "button", className: "scalio-btn scalio-btn-icon is-ghost", title, "aria-label": title,
|
|
410
|
+
onClick: () => fn(t), "data-testid": `${id}-${key}-${t.id}` }, h(icon, null)) : null;
|
|
411
|
+
return h("div", { className: "scalio-tenancy", "data-testid": id },
|
|
412
|
+
h("div", { className: "scalio-tenancy-bar" },
|
|
413
|
+
h("span", { className: "scalio-tenancy-hint", "data-testid": `${id}-count` },
|
|
414
|
+
limit !== null && limit !== undefined && limit >= 0 ? fill(L.limitOf, { n: list.length, limit }) : String(list.length)),
|
|
415
|
+
readOnly || !onAdd ? null : h("button", { type: "button", className: "scalio-btn is-primary", disabled: !roomLeft, onClick: onAdd, "data-testid": `${id}-add` },
|
|
416
|
+
h(Icons.Plus, null), " ", L.addTenant)),
|
|
417
|
+
!roomLeft && !readOnly ? h(Notice, { kind: "info", lang, testId: `${id}-limit` }, fill(L.limitReached, { n: limit })) : null,
|
|
418
|
+
h("div", { className: "scalio-users-table-wrap" },
|
|
419
|
+
h("table", { className: "scalio-users-table", "data-testid": `${id}-table` },
|
|
420
|
+
h("thead", null, h("tr", null,
|
|
421
|
+
h("th", null, L.tenant), showOrg ? h("th", null, L.organization) : null,
|
|
422
|
+
h("th", null, L.method), h("th", null, L.access), h("th", null, L.status),
|
|
423
|
+
cols.map((c) => h("th", { key: c.id }, c.label)), h("th", null))),
|
|
424
|
+
h("tbody", null,
|
|
425
|
+
list.length === 0 ? h("tr", null, h("td", { colSpan: 6 + cols.length, className: "scalio-tenancy-hint", "data-testid": `${id}-empty` }, L.noTenants)) : null,
|
|
426
|
+
list.map((t) => h("tr", { key: t.id, "data-testid": `${id}-row-${t.id}` },
|
|
427
|
+
h("td", null, h("div", null, h("strong", null, t.name)), t.domain ? h("div", { className: "scalio-mono scalio-tenancy-hint" }, t.domain) : null),
|
|
428
|
+
showOrg ? h("td", { "data-testid": `${id}-org-${t.id}` }, orgName(t.organization_id)) : null,
|
|
429
|
+
h("td", { "data-testid": `${id}-method-${t.id}` }, h("span", { className: "scalio-tenancy-method" }, L.methods[t.method] || t.method || "")),
|
|
430
|
+
h("td", null, h(AccessChips, { t, L })),
|
|
431
|
+
h("td", null, h(StatusChip, { status: t.status, L })),
|
|
432
|
+
cols.map((c) => h("td", { key: c.id }, c.render(t))),
|
|
433
|
+
h("td", { className: "scalio-tenancy-row-actions" },
|
|
434
|
+
iconBtn("connect", L.connect, Icons.Link2, a.connect, t),
|
|
435
|
+
iconBtn("settings", fill(L.settings, { app: appName || "App" }), Icons.Settings, a.settings, t),
|
|
436
|
+
readOnly ? null : iconBtn("edit", L.edit, Icons.Pencil, a.edit, t),
|
|
437
|
+
readOnly ? null : iconBtn("remove", L.remove, Icons.Trash, a.remove, t))))))));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function Option({ type, checked, locked, title, text, onSelect, testId }) {
|
|
441
|
+
return h("label", { className: `scalio-tenancy-option${checked ? " is-selected" : ""}${locked ? " is-locked" : ""}`, "data-testid": testId },
|
|
442
|
+
h("input", { type, checked: !!checked, disabled: !!locked, onChange: () => onSelect && onSelect(), "data-testid": testId && `${testId}-input` }),
|
|
443
|
+
h("span", null,
|
|
444
|
+
h("span", { className: "scalio-tenancy-option-title" }, title, locked ? h("span", { className: "scalio-tenancy-lock" }, locked) : null),
|
|
445
|
+
text ? h("span", { className: "scalio-tenancy-option-text" }, text) : null));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// Step 2 «Verbindung und Zugang». methods: the methods this app offers; locked: {method: reason} (e.g. gdap «nur MSP»);
|
|
449
|
+
// writeLocked: reason when «Scalio Schreiben» is not open (e.g. «ab Pro»), writeHidden for apps that only read.
|
|
450
|
+
function ConnectionChoice({ value, onChange, methods, locked, writeLocked, writeHidden, methodText, lang, labels }) {
|
|
451
|
+
const L = tenancyLabels(lang, labels);
|
|
452
|
+
const v = value || {};
|
|
453
|
+
const lk = locked || {};
|
|
454
|
+
const texts = Object.assign({}, L.methodText, methodText || {});
|
|
455
|
+
const set = (patch) => onChange(Object.assign({}, v, patch));
|
|
456
|
+
return h("div", { className: "scalio-tenancy-step", "data-testid": "tenant-connection-choice" },
|
|
457
|
+
h("span", { className: "scalio-field-label" }, L.method),
|
|
458
|
+
h("div", { className: "scalio-tenancy-options" }, (methods || ["direct"]).map((m) => h(Option, {
|
|
459
|
+
key: m, type: "radio", checked: v.method === m, locked: lk[m], title: L.methods[m] || m, text: texts[m],
|
|
460
|
+
onSelect: () => set({ method: m }), testId: `tenant-method-${m}` }))),
|
|
461
|
+
v.method === "simulated" ? null : h(React.Fragment, null,
|
|
462
|
+
h("span", { className: "scalio-field-label" }, L.access),
|
|
463
|
+
h("div", { className: "scalio-tenancy-options" },
|
|
464
|
+
h(Option, { type: "checkbox", checked: true, locked: null, title: L.read, text: L.readText, testId: "tenant-access-read" }),
|
|
465
|
+
writeHidden ? null : h(Option, { type: "checkbox", checked: !!v.write && !writeLocked, locked: writeLocked, title: L.write, text: L.writeText,
|
|
466
|
+
onSelect: () => set({ write: !v.write }), testId: "tenant-access-write" }))));
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// «Tenant hinzufügen» in four steps (ADR 0128 point 6): Name und Organisation → Verbindung und Zugang →
|
|
470
|
+
// <App>-Einstellungen → Prüfen. The tenant is created when step 1 is done (`onCreate(values) -> tenant`), so step 2 can
|
|
471
|
+
// connect it (`renderConnect(tenant, values)`, e.g. TenantConnectStep). `appStep(tenant, values, setValues)` returns
|
|
472
|
+
// {content, canNext?, onNext?} or null (no step 3). `onFinish(tenant, values)` saves the rest.
|
|
473
|
+
function TenantWizard(props) {
|
|
474
|
+
const { open, onClose, organizations, defaultOrganization, methods, locked, writeLocked, writeHidden, methodText,
|
|
475
|
+
appName, appStep, renderConnect, onCreate, onFinish, lang, labels, review } = props;
|
|
476
|
+
const L = tenancyLabels(lang, labels);
|
|
477
|
+
const orgs = organizations || [];
|
|
478
|
+
const first = () => ({ name: "", domain: "", organization_id: defaultOrganization || (orgs[0] && orgs[0].id) || "",
|
|
479
|
+
method: (methods || ["direct"]).find((m) => !(locked || {})[m]) || "direct", write: false });
|
|
480
|
+
const [step, setStep] = React.useState(0);
|
|
481
|
+
const [values, setValues] = React.useState(first);
|
|
482
|
+
const [tenant, setTenant] = React.useState(null);
|
|
483
|
+
React.useEffect(() => { if (open) { setStep(0); setValues(first()); setTenant(null); } }, [open]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
484
|
+
if (!open) return null;
|
|
485
|
+
const set = (patch) => setValues((s) => Object.assign({}, s, patch));
|
|
486
|
+
const app = appStep ? appStep(tenant, values, set) : null;
|
|
487
|
+
const steps = [
|
|
488
|
+
{ id: "name", label: L.stepName, title: L.stepName, canNext: !!values.name.trim() && (!orgs.length || !!values.organization_id),
|
|
489
|
+
onNext: async () => { if (!tenant) setTenant(await onCreate(values)); },
|
|
490
|
+
content: h("div", { className: "scalio-tenancy-grid" },
|
|
491
|
+
h(Field, { label: L.tenantName, hint: L.tenantNameHint },
|
|
492
|
+
h("input", { className: "scalio-input", value: values.name, onChange: (e) => set({ name: e.target.value }), "data-testid": "tenant-wizard-name" })),
|
|
493
|
+
h(Field, { label: L.domain, hint: L.domainHint },
|
|
494
|
+
h("input", { className: "scalio-input scalio-mono", value: values.domain, placeholder: "contoso.onmicrosoft.com", onChange: (e) => set({ domain: e.target.value }), "data-testid": "tenant-wizard-domain" })),
|
|
495
|
+
orgs.length ? h(Field, { label: L.organization },
|
|
496
|
+
h("select", { className: "scalio-input", value: values.organization_id, disabled: orgs.length < 2, onChange: (e) => set({ organization_id: e.target.value }), "data-testid": "tenant-wizard-org" },
|
|
497
|
+
orgs.map((o) => h("option", { key: o.id, value: o.id }, o.name)))) : null) },
|
|
498
|
+
{ id: "connection", label: L.stepConnection, title: L.stepConnection,
|
|
499
|
+
content: h(React.Fragment, null,
|
|
500
|
+
h(ConnectionChoice, { value: values, onChange: setValues, methods, locked, writeLocked, writeHidden, methodText, lang, labels }),
|
|
501
|
+
renderConnect && tenant && values.method !== "simulated" ? h("div", { className: "scalio-tenancy-connect", "data-testid": "tenant-wizard-connect" }, renderConnect(tenant, values)) : null) },
|
|
502
|
+
];
|
|
503
|
+
if (app) steps.push(Object.assign({ id: "app", label: fill(L.settings, { app: appName || "App" }), title: fill(L.settings, { app: appName || "App" }) }, app));
|
|
504
|
+
const rows = [[L.tenantName, values.name], [L.domain, values.domain], orgs.length ? [L.organization, (orgs.find((o) => o.id === values.organization_id) || {}).name] : null,
|
|
505
|
+
[L.method, L.methods[values.method]], values.method === "simulated" ? null : [L.access, [L.read, values.write && !writeLocked ? L.write : null].filter(Boolean).join(", ")]]
|
|
506
|
+
.concat(review ? review(tenant, values) : []).filter(Boolean);
|
|
507
|
+
steps.push({ id: "review", label: L.stepReview, title: L.stepReview, description: L.reviewHint,
|
|
508
|
+
content: h("div", { className: "scalio-users-table-wrap" }, h("table", { className: "scalio-users-table", "data-testid": "tenant-wizard-review" },
|
|
509
|
+
h("tbody", null, rows.map((r, i) => h("tr", { key: i }, h("td", { className: "scalio-tenancy-hint" }, r[0]), h("td", null, r[1] || "")))))) });
|
|
510
|
+
return h(SetupWizard, {
|
|
511
|
+
open, title: L.addTenantTitle, steps, step, onStepChange: setStep, onClose, wide: true, lang, testId: "tenant-wizard",
|
|
512
|
+
success: { title: L.finished, text: L.finishedText },
|
|
513
|
+
onFinish: () => onFinish && onFinish(tenant, values),
|
|
514
|
+
onDone: onClose,
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// «Tenant bearbeiten»: the parts of the wizard as tabs (Allgemein, Verbindung, <App>-Einstellungen). tabs: the app's
|
|
519
|
+
// [{id, label, render(tenant)}]; `general` (optional) replaces the default name/organization form.
|
|
520
|
+
function TenantEditDialog({ tenant, organizations, onSave, onClose, renderConnect, appName, renderApp, initialTab, lang, labels }) {
|
|
521
|
+
const L = tenancyLabels(lang, labels);
|
|
522
|
+
const orgs = organizations || [];
|
|
523
|
+
const [tab, setTab] = React.useState(initialTab || "general");
|
|
524
|
+
const [v, setV] = React.useState({ name: (tenant && tenant.name) || "", organization_id: (tenant && tenant.organization_id) || "" });
|
|
525
|
+
const [busy, setBusy] = React.useState(false);
|
|
526
|
+
const [error, setError] = React.useState("");
|
|
527
|
+
React.useEffect(() => { setTab(initialTab || "general"); }, [tenant && tenant.id, initialTab]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
528
|
+
if (!tenant) return null;
|
|
529
|
+
const tabs = [{ id: "general", label: L.general }, renderConnect ? { id: "connection", label: L.connection } : null,
|
|
530
|
+
renderApp ? { id: "app", label: fill(L.settings, { app: appName || "App" }) } : null].filter(Boolean);
|
|
531
|
+
const save = async () => {
|
|
532
|
+
setBusy(true); setError("");
|
|
533
|
+
try { await onSave(tenant, { name: v.name.trim(), organization_id: v.organization_id }); onClose(); } catch (err) { setError(errorText(err)); } finally { setBusy(false); }
|
|
534
|
+
};
|
|
535
|
+
return h("div", { className: "scalio-wizard-root", onMouseDown: (e) => { if (e.target === e.currentTarget && !busy) onClose(); } },
|
|
536
|
+
h("div", { className: "scalio-wizard is-wide", role: "dialog", "aria-modal": "true", "aria-label": tenant.name, "data-testid": "tenant-edit" },
|
|
537
|
+
h("div", { className: "scalio-wizard-head" },
|
|
538
|
+
h("div", null, h("h2", { className: "scalio-wizard-title" }, tenant.name), tenant.domain ? h("p", { className: "scalio-wizard-subtitle scalio-mono" }, tenant.domain) : null),
|
|
539
|
+
h("button", { type: "button", className: "scalio-btn scalio-btn-icon is-ghost", onClick: onClose, "aria-label": L.close, "data-testid": "tenant-edit-close" }, h(Icons.X, null))),
|
|
540
|
+
h("div", { className: "scalio-wizard-body" },
|
|
541
|
+
h("div", { className: "scalio-tenancy-tabs", role: "tablist" }, tabs.map((t) => h("button", {
|
|
542
|
+
key: t.id, type: "button", role: "tab", "aria-selected": tab === t.id, className: `scalio-tenancy-tab${tab === t.id ? " is-active" : ""}`,
|
|
543
|
+
onClick: () => setTab(t.id), "data-testid": `tenant-edit-tab-${t.id}` }, t.label))),
|
|
544
|
+
tab === "general" ? h("div", { className: "scalio-tenancy-grid", "data-testid": "tenant-edit-general" },
|
|
545
|
+
h(Field, { label: L.tenantName }, h("input", { className: "scalio-input", value: v.name, onChange: (e) => setV(Object.assign({}, v, { name: e.target.value })), "data-testid": "tenant-edit-name" })),
|
|
546
|
+
orgs.length > 1 ? h(Field, { label: L.organization }, h("select", { className: "scalio-input", value: v.organization_id, onChange: (e) => setV(Object.assign({}, v, { organization_id: e.target.value })), "data-testid": "tenant-edit-org" },
|
|
547
|
+
orgs.map((o) => h("option", { key: o.id, value: o.id }, o.name)))) : null) : null,
|
|
548
|
+
tab === "connection" ? h("div", { "data-testid": "tenant-edit-connection" }, renderConnect(tenant)) : null,
|
|
549
|
+
tab === "app" ? h("div", { "data-testid": "tenant-edit-app" }, renderApp(tenant)) : null,
|
|
550
|
+
error ? h(Notice, { kind: "error", icon: false, lang, testId: "tenant-edit-error" }, error) : null),
|
|
551
|
+
tab === "general" ? h("div", { className: "scalio-wizard-actions" },
|
|
552
|
+
h("button", { type: "button", className: "scalio-btn", onClick: onClose, disabled: busy }, L.close),
|
|
553
|
+
h("button", { type: "button", className: "scalio-btn is-primary", onClick: save, disabled: busy || !v.name.trim(), "data-testid": "tenant-edit-save" }, L.save)) : null));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// Settings group «Mandanten» for SettingsLayout: groups.unshift(tenancySettingsGroup({...})).
|
|
557
|
+
function tenancySettingsGroup({ lang, labels, hidden, base }) {
|
|
558
|
+
const L = tenancyLabels(lang, labels);
|
|
559
|
+
const b = base || "/settings";
|
|
560
|
+
return { id: "tenancy", label: L.group, items: [
|
|
561
|
+
{ id: "organizations", to: `${b}/organizations`, label: L.organizations, hint: L.organizationsHint, hidden },
|
|
562
|
+
{ id: "tenants", to: `${b}/tenants`, label: L.tenants, hint: L.tenantsHint, hidden },
|
|
563
|
+
] };
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const askRemoveTenant = (t, lang, labels) => askConfirm({ title: fill(tenancyLabels(lang, labels).removeTenant, { name: t.name }), danger: true, lang });
|
|
567
|
+
|
|
568
|
+
module.exports = {
|
|
569
|
+
OrganizationsPanel, OrganizationForm, OrganizationFields, OrganizationStep, organizationSetupStep, organizationsApi,
|
|
570
|
+
TenantList, TenantWizard, TenantEditDialog, ConnectionChoice, tenancySettingsGroup, tenancyLabels, askRemoveTenant,
|
|
571
|
+
showOrganizationSelect, showTenantSelect, canAddTenant, suggestShortCode, shortCodeValid, organizationValid,
|
|
572
|
+
emptyOrganization, TENANCY_LABELS: LABELS, CLASSIFICATIONS, TENANT_METHODS: METHODS,
|
|
573
|
+
};
|