@scalio-cloud/ui 0.66.0 → 0.68.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/nav.css +9 -0
- package/package.json +1 -1
- package/react/mail.js +117 -9
- package/react/nav.js +40 -11
package/nav.css
CHANGED
|
@@ -139,6 +139,7 @@
|
|
|
139
139
|
.scalio-switcher-item.is-active { background: #002FA7; color: #fff; }
|
|
140
140
|
.scalio-switcher-item.is-off, .scalio-switcher-item.is-soon { cursor: not-allowed; }
|
|
141
141
|
.scalio-switcher-item.is-soon { color: #52525b; }
|
|
142
|
+
.scalio-switcher-sep { width: 1px; height: 14px; margin: 0 0.375rem; background: #3f3f46; flex: none; }
|
|
142
143
|
.scalio-switcher-icon { width: 0.75rem; height: 0.75rem; }
|
|
143
144
|
.scalio-switcher-soon { margin-left: 0.125rem; padding: 0 0.25rem; border: 1px solid #3f3f46; border-radius: 2px; font-size: 9px; line-height: 14px; text-transform: none; letter-spacing: normal; color: #71717a; }
|
|
144
145
|
|
|
@@ -953,3 +954,11 @@ ul.scalio-notice { flex-direction: column; gap: 0.25rem; padding-left: 2rem; lis
|
|
|
953
954
|
.scalio-md-table th, .scalio-md-table td { padding: 0.375rem 0.75rem; border: 1px solid hsl(var(--border)); vertical-align: top; }
|
|
954
955
|
.scalio-md-table thead { background: hsl(var(--secondary)); }
|
|
955
956
|
.scalio-md-table th { font-weight: 700; }
|
|
957
|
+
/* Mail setup steps (BL-449): way, mailbox, send right, test mail */
|
|
958
|
+
.scalio-mail-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.5rem; margin: 0 0 1rem; padding: 0; list-style: none; }
|
|
959
|
+
.scalio-mail-step { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: 2px; background: hsl(var(--card)); font-size: 0.875rem; }
|
|
960
|
+
.scalio-mail-step.is-open { border-color: hsl(var(--primary) / 0.45); }
|
|
961
|
+
.scalio-mail-step.is-check { border-color: rgb(217 119 6 / 0.45); }
|
|
962
|
+
.scalio-mail-step-name { font-weight: 600; }
|
|
963
|
+
.scalio-mail-step-state { margin-left: auto; font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
|
|
964
|
+
.scalio-mail-rights-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.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/mail.js
CHANGED
|
@@ -10,6 +10,20 @@ const { SettingsSection, SettingsField: Field } = require("./settings");
|
|
|
10
10
|
const LABELS = {
|
|
11
11
|
de: {
|
|
12
12
|
transportTitle: "E-Mail-Versand",
|
|
13
|
+
steps: ["Weg", "Postfach", "Senderecht", "Testmail"],
|
|
14
|
+
stepsTitle: "Einrichtung",
|
|
15
|
+
stepState: { done: "erledigt", open: "offen", check: "prüfen", none: "nicht nötig" },
|
|
16
|
+
mailboxPick: "Postfach, das sendet",
|
|
17
|
+
mailboxOther: "Andere Adresse eingeben",
|
|
18
|
+
mailboxHint: "Ein freigegebenes Postfach (Shared Mailbox) braucht keine Lizenz.",
|
|
19
|
+
autoTitle: "Senderecht automatisch setzen",
|
|
20
|
+
autoHint: "Die App richtet das Senderecht mit ihrer Verbindung zum Tenant selbst ein, nur für dieses Postfach («RBAC for Applications»). Exchange übernimmt es nach bis zu zwei Stunden.",
|
|
21
|
+
autoGrant: "Senderecht setzen",
|
|
22
|
+
autoGranted: "Senderecht gesetzt",
|
|
23
|
+
rightsCheck: "Status prüfen",
|
|
24
|
+
rightsState: { ok: "Senderecht vorhanden", missing: "Senderecht fehlt", unknown: "Senderecht nicht prüfbar, die Testmail zeigt es" },
|
|
25
|
+
rightsScriptAlso: "Lieber selbst ausführen? Skript anzeigen",
|
|
26
|
+
testFirst: "Speichern Sie zuerst Weg und Postfach.",
|
|
13
27
|
transportHint: "Über welchen Server die App Mails schickt. Passwort und Client-Secret werden verschlüsselt gespeichert und nie angezeigt.",
|
|
14
28
|
provider: "Mails senden mit",
|
|
15
29
|
providers: { default: "Vorgabe verwenden (empfohlen)", off: "Aus", smtp: "SMTP-Server", graph: "Microsoft 365", tenant: "Microsoft 365 über die Tenant-Verbindung" },
|
|
@@ -83,6 +97,20 @@ const LABELS = {
|
|
|
83
97
|
},
|
|
84
98
|
en: {
|
|
85
99
|
transportTitle: "E-mail sending",
|
|
100
|
+
steps: ["Way", "Mailbox", "Send right", "Test mail"],
|
|
101
|
+
stepsTitle: "Setup",
|
|
102
|
+
stepState: { done: "done", open: "open", check: "check", none: "not needed" },
|
|
103
|
+
mailboxPick: "Mailbox that sends",
|
|
104
|
+
mailboxOther: "Enter another address",
|
|
105
|
+
mailboxHint: "A shared mailbox needs no license.",
|
|
106
|
+
autoTitle: "Set the send right automatically",
|
|
107
|
+
autoHint: "The app sets up the send right itself with its connection to the tenant, for this mailbox only (RBAC for Applications). Exchange applies it within up to two hours.",
|
|
108
|
+
autoGrant: "Set send right",
|
|
109
|
+
autoGranted: "Send right set",
|
|
110
|
+
rightsCheck: "Check status",
|
|
111
|
+
rightsState: { ok: "Send right in place", missing: "Send right missing", unknown: "Send right can not be checked, the test mail shows it" },
|
|
112
|
+
rightsScriptAlso: "Rather run it yourself? Show script",
|
|
113
|
+
testFirst: "Save the way and the mailbox first.",
|
|
86
114
|
transportHint: "Which server the app sends mail through. Password and client secret are stored encrypted and never shown.",
|
|
87
115
|
provider: "Send mail with",
|
|
88
116
|
providers: { default: "Use the default (recommended)", off: "Off", smtp: "SMTP server", graph: "Microsoft 365", tenant: "Microsoft 365 through the tenant connection" },
|
|
@@ -199,6 +227,10 @@ function mailApi(api, base) {
|
|
|
199
227
|
preview: (body) => api.post(`${b}/templates/preview`, body).then(data),
|
|
200
228
|
testTemplate: (body) => api.post(`${b}/templates/test`, body).then(data),
|
|
201
229
|
sendRights: () => api.get(`${b}/send-rights`).then(data),
|
|
230
|
+
// scalio-platform 0.43.0 (BL-449); an older backend answers 404 and the page falls back to the script
|
|
231
|
+
mailboxes: (tenantId) => api.get(`${b}/mailboxes`, { params: { tenant_id: tenantId || "" } }).then(data),
|
|
232
|
+
rightsStatus: () => api.get(`${b}/send-rights/status`).then(data),
|
|
233
|
+
grantRights: () => api.post(`${b}/send-rights/grant`, {}).then(data),
|
|
202
234
|
};
|
|
203
235
|
}
|
|
204
236
|
|
|
@@ -253,18 +285,40 @@ function MailTransport(props) {
|
|
|
253
285
|
const [script, setScript] = React.useState(null);
|
|
254
286
|
const [scriptBusy, setScriptBusy] = React.useState(false);
|
|
255
287
|
const [scriptMsg, setScriptMsg] = React.useState(null);
|
|
288
|
+
const [rightsInfo, setRightsInfo] = React.useState(null); // {mode, state, detail, sender} (scalio-platform 0.43.0)
|
|
289
|
+
const [granting, setGranting] = React.useState(false);
|
|
290
|
+
const [mbxList, setMbxList] = React.useState(null); // shared mailboxes of the chosen tenant, or null
|
|
291
|
+
const [mbxOther, setMbxOther] = React.useState(false);
|
|
292
|
+
const [testOk, setTestOk] = React.useState(false);
|
|
256
293
|
const showOutbox = props.outbox !== false;
|
|
257
294
|
|
|
258
295
|
const loadOutbox = React.useCallback(() => {
|
|
259
296
|
if (!showOutbox) return Promise.resolve();
|
|
260
297
|
return client.outbox().then((r) => setRows(r || [])).catch(() => setRows([]));
|
|
261
298
|
}, [client, showOutbox]);
|
|
299
|
+
const loadRights = React.useCallback(() => {
|
|
300
|
+
if (!client.rightsStatus) return Promise.resolve();
|
|
301
|
+
return client.rightsStatus().then((r) => setRightsInfo(r && r.mode ? r : null)).catch(() => setRightsInfo(null));
|
|
302
|
+
}, [client]);
|
|
262
303
|
React.useEffect(() => {
|
|
263
304
|
let alive = true;
|
|
264
|
-
client.settings().then((d) => alive
|
|
305
|
+
client.settings().then((d) => { if (alive) { setForm(d); if (d && d.send_rights) loadRights(); } }).catch((e) => alive && m.fail(e));
|
|
265
306
|
loadOutbox();
|
|
266
307
|
return () => { alive = false; };
|
|
267
308
|
}, [client]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
309
|
+
// Step 2: the shared mailboxes of the tenant that sends (only when the app can list them)
|
|
310
|
+
const mbxTenant = form && form.provider === "tenant"
|
|
311
|
+
? (Array.isArray(form.tenants) ? (form.graph.tenant_id || (form.tenants.length === 1 ? form.tenants[0].id : "")) : "-")
|
|
312
|
+
: "";
|
|
313
|
+
React.useEffect(() => {
|
|
314
|
+
let alive = true;
|
|
315
|
+
setMbxList(null);
|
|
316
|
+
if (!mbxTenant || !client.mailboxes) return undefined;
|
|
317
|
+
client.mailboxes(mbxTenant === "-" ? "" : mbxTenant)
|
|
318
|
+
.then((r) => alive && setMbxList(r && Array.isArray(r.mailboxes) && r.mailboxes.length ? r.mailboxes : null))
|
|
319
|
+
.catch(() => alive && setMbxList(null));
|
|
320
|
+
return () => { alive = false; };
|
|
321
|
+
}, [client, mbxTenant]);
|
|
268
322
|
|
|
269
323
|
if (!form) return h(SettingsSection, { id: "mail", title: L.transportTitle, description: L.transportHint, testId: "mail-transport" }, h(Notice, { msg: m.msg, testId: "mail-message" }));
|
|
270
324
|
|
|
@@ -283,10 +337,14 @@ function MailTransport(props) {
|
|
|
283
337
|
if (form.provider === "graph") body.graph = form.graph;
|
|
284
338
|
if (form.provider === "tenant") {
|
|
285
339
|
body.graph = { sender: form.graph.sender };
|
|
286
|
-
if (Array.isArray(form.tenants)) body.graph.tenant_id =
|
|
340
|
+
if (Array.isArray(form.tenants)) body.graph.tenant_id = mbxTenant || "";
|
|
287
341
|
}
|
|
288
|
-
|
|
342
|
+
const saved = await client.save(body);
|
|
343
|
+
setForm(saved);
|
|
289
344
|
setScript(null);
|
|
345
|
+
setTestOk(false);
|
|
346
|
+
setRightsInfo(null);
|
|
347
|
+
if (saved && saved.send_rights) loadRights();
|
|
290
348
|
m.ok(L.saved);
|
|
291
349
|
} catch (err) {
|
|
292
350
|
m.fail(err);
|
|
@@ -299,6 +357,7 @@ function MailTransport(props) {
|
|
|
299
357
|
try {
|
|
300
358
|
const r = await client.test(to.trim());
|
|
301
359
|
const text = L.testSent.replace("{to}", (r && r.to) || to);
|
|
360
|
+
setTestOk(true);
|
|
302
361
|
if (props.notify) props.notify(text, "success");
|
|
303
362
|
else setTestMsg({ tone: "ok", text });
|
|
304
363
|
loadOutbox();
|
|
@@ -332,6 +391,21 @@ function MailTransport(props) {
|
|
|
332
391
|
if (props.notify) props.notify(text, tone);
|
|
333
392
|
else setScriptMsg({ tone: tone === "error" ? "error" : "ok", text });
|
|
334
393
|
};
|
|
394
|
+
const grant = async () => {
|
|
395
|
+
setGranting(true);
|
|
396
|
+
setScriptMsg(null);
|
|
397
|
+
try {
|
|
398
|
+
const r = await client.grantRights();
|
|
399
|
+
setRightsInfo(r);
|
|
400
|
+
if (props.notify) props.notify(L.autoGranted, "success");
|
|
401
|
+
else setScriptMsg({ tone: "ok", text: L.autoGranted });
|
|
402
|
+
} catch (err) {
|
|
403
|
+
const text = (props.formatError || errorText)(err);
|
|
404
|
+
if (props.notify) props.notify(text, "error");
|
|
405
|
+
else setScriptMsg({ tone: "error", text });
|
|
406
|
+
}
|
|
407
|
+
setGranting(false);
|
|
408
|
+
};
|
|
335
409
|
const tenants = Array.isArray(form.tenants) ? form.tenants : null;
|
|
336
410
|
|
|
337
411
|
const providers = (form.providers || ["off", "smtp", "graph"]).filter((id) => L.providers[id]);
|
|
@@ -413,8 +487,13 @@ function MailTransport(props) {
|
|
|
413
487
|
(tenants.length === 1 ? [] : [["", L.tenantChoose]]).concat(tenants.map((t) => [t.id, t.name || t.id])),
|
|
414
488
|
part("graph", "tenant_id"), { disabled: busy }))
|
|
415
489
|
: null,
|
|
416
|
-
|
|
417
|
-
{
|
|
490
|
+
mbxList && !mbxOther
|
|
491
|
+
? h(Field, { id: "mail-tenant-sender", label: L.mailboxPick, hint: L.mailboxHint },
|
|
492
|
+
select("mail-tenant-sender", mbxList.some((x) => x.address === (form.graph.sender || "").toLowerCase()) ? form.graph.sender.toLowerCase() : "",
|
|
493
|
+
[["", L.tenantChoose]].concat(mbxList.map((x) => [x.address, x.name ? `${x.name} (${x.address})` : x.address]), [["__other", L.mailboxOther]]),
|
|
494
|
+
(v) => (v === "__other" ? setMbxOther(true) : part("graph", "sender")(v)), { disabled: busy }))
|
|
495
|
+
: h(Field, { id: "mail-tenant-sender", label: L.sender }, input("mail-tenant-sender", form.graph.sender, part("graph", "sender"),
|
|
496
|
+
{ type: "email", maxLength: 254, placeholder: "it@example.com", disabled: busy }))),
|
|
418
497
|
h("p", { className: "scalio-settings-help" }, props.tenantHint || L.tenantHint))
|
|
419
498
|
: null,
|
|
420
499
|
h(Notice, { msg: m.msg, testId: "mail-message" }),
|
|
@@ -434,10 +513,22 @@ function MailTransport(props) {
|
|
|
434
513
|
h(Notice, { msg: testMsg, testId: "mail-test-message" })
|
|
435
514
|
);
|
|
436
515
|
|
|
516
|
+
const auto = !!(rightsInfo && rightsInfo.mode === "auto" && client.grantRights);
|
|
437
517
|
const rights = form.send_rights && (form.provider === "graph" || form.provider === "tenant" || form.provider === "default")
|
|
438
518
|
? h(
|
|
439
519
|
SettingsSection,
|
|
440
|
-
{ id: "mail-rights", title: L.rightsTitle, description: L.rightsHint, testId: "mail-rights" },
|
|
520
|
+
{ id: "mail-rights", title: L.rightsTitle, description: auto ? L.autoHint : L.rightsHint, testId: "mail-rights" },
|
|
521
|
+
rightsInfo && rightsInfo.mode !== "none"
|
|
522
|
+
? h("div", { className: "scalio-mail-rights-state" },
|
|
523
|
+
h("span", { className: `scalio-badge is-${{ ok: "ok", missing: "warn" }[rightsInfo.state] || "neutral"}`, "data-testid": "mail-rights-state" },
|
|
524
|
+
L.rightsState[rightsInfo.state] || rightsInfo.state),
|
|
525
|
+
h("button", { type: "button", className: "scalio-btn is-ghost", onClick: loadRights, "data-testid": "mail-rights-check" }, L.rightsCheck))
|
|
526
|
+
: null,
|
|
527
|
+
auto
|
|
528
|
+
? h("div", { className: "scalio-settings-section-footer" },
|
|
529
|
+
h("button", { type: "button", className: "scalio-btn is-primary", onClick: grant, disabled: granting, "data-testid": "mail-rights-grant" },
|
|
530
|
+
h(Icons.Check, { className: "scalio-icon" }), L.autoGrant))
|
|
531
|
+
: null,
|
|
441
532
|
script
|
|
442
533
|
? h(React.Fragment, null,
|
|
443
534
|
h("pre", { className: "scalio-mail-script", "data-testid": "mail-rights-script" }, script),
|
|
@@ -445,8 +536,8 @@ function MailTransport(props) {
|
|
|
445
536
|
h("button", { type: "button", className: "scalio-btn", onClick: copyScript, "data-testid": "mail-rights-copy" },
|
|
446
537
|
h(Icons.Copy, { className: "scalio-icon" }), L.copy)))
|
|
447
538
|
: h("div", { className: "scalio-settings-section-footer" },
|
|
448
|
-
h("button", { type: "button", className: "scalio-btn", onClick: showScript, disabled: scriptBusy, "data-testid": "mail-rights-show" },
|
|
449
|
-
L.showScript)),
|
|
539
|
+
h("button", { type: "button", className: auto ? "scalio-btn is-ghost" : "scalio-btn", onClick: showScript, disabled: scriptBusy, "data-testid": "mail-rights-show" },
|
|
540
|
+
auto ? L.rightsScriptAlso : L.showScript)),
|
|
450
541
|
h(Notice, { msg: scriptMsg, testId: "mail-rights-message" })
|
|
451
542
|
)
|
|
452
543
|
: null;
|
|
@@ -471,7 +562,24 @@ function MailTransport(props) {
|
|
|
471
562
|
)
|
|
472
563
|
: null;
|
|
473
564
|
|
|
474
|
-
|
|
565
|
+
// The four steps on top (like the Nexus assistant): way, mailbox, send right, test mail
|
|
566
|
+
const needsMailbox = ["graph", "tenant"].includes(form.provider);
|
|
567
|
+
const sender = (form.graph && form.graph.sender) || "";
|
|
568
|
+
const wayDone = form.provider !== "off" && (form.provider !== "default" || defaultUsable);
|
|
569
|
+
const stepStates = [
|
|
570
|
+
wayDone ? "done" : "open",
|
|
571
|
+
!needsMailbox ? "none" : (sender ? "done" : "open"),
|
|
572
|
+
!form.send_rights ? "none" : (rightsInfo && rightsInfo.state === "ok" ? "done" : (rightsInfo && rightsInfo.state === "missing" ? "open" : "check")),
|
|
573
|
+
testOk ? "done" : "open",
|
|
574
|
+
];
|
|
575
|
+
const steps = locked ? null : h("ol", { className: "scalio-mail-steps", "aria-label": L.stepsTitle, "data-testid": "mail-steps" },
|
|
576
|
+
L.steps.map((name, i) => h("li", { key: name, className: `scalio-mail-step is-${stepStates[i]}`, "data-testid": `mail-step-${i + 1}`, "data-state": stepStates[i] },
|
|
577
|
+
h("span", { className: `scalio-wizard-dot ${stepStates[i] === "done" ? "is-done" : ""}`.trim() },
|
|
578
|
+
stepStates[i] === "done" ? h(Icons.Check, { width: 14, height: 14 }) : i + 1),
|
|
579
|
+
h("span", { className: "scalio-mail-step-name" }, name),
|
|
580
|
+
h("span", { className: "scalio-mail-step-state" }, L.stepState[stepStates[i]]))));
|
|
581
|
+
|
|
582
|
+
return h(React.Fragment, null, steps, transport, rights, testBlock, props.children || null, outbox);
|
|
475
583
|
}
|
|
476
584
|
|
|
477
585
|
// Props: client (mailApi), lang, labels, notify, formatError, editor (the app's rich text editor: a component with
|
package/react/nav.js
CHANGED
|
@@ -304,18 +304,36 @@ function ContextSelect({ label, value, options, onChange, hint, after, testId, i
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
// --- Product switcher -------------------------------------------------------------------------
|
|
307
|
-
// Display order of the app group
|
|
307
|
+
// Display order of the app group, in groups (Markus 2026-11-12): identity | M365 governance | devices and
|
|
308
|
+
// desktops | work. A thin divider separates the groups. Compass is not part of it (decided 2026-10-26).
|
|
308
309
|
const PRODUCTS = [
|
|
309
|
-
{ key: "nexus", name: "Nexus", icon: Icons.Fingerprint },
|
|
310
|
-
{ key: "rosetta", name: "Rosetta", icon: Icons.FileStack },
|
|
311
|
-
{ key: "foundry", name: "Foundry", icon: Icons.Hammer },
|
|
312
|
-
{ key: "citadel", name: "Citadel", icon: Icons.ShieldCheck },
|
|
313
|
-
{ key: "
|
|
314
|
-
{ key: "
|
|
315
|
-
{ key: "
|
|
316
|
-
{ key: "
|
|
310
|
+
{ key: "nexus", name: "Nexus", icon: Icons.Fingerprint, group: "identity" },
|
|
311
|
+
{ key: "rosetta", name: "Rosetta", icon: Icons.FileStack, group: "governance" },
|
|
312
|
+
{ key: "foundry", name: "Foundry", icon: Icons.Hammer, group: "governance" },
|
|
313
|
+
{ key: "citadel", name: "Citadel", icon: Icons.ShieldCheck, group: "governance" },
|
|
314
|
+
{ key: "pulse", name: "Pulse", icon: Icons.Activity, group: "devices" },
|
|
315
|
+
{ key: "atrium", name: "Atrium", icon: Icons.Monitor, group: "devices" },
|
|
316
|
+
{ key: "beacon", name: "Beacon", icon: Icons.RadioTower, group: "work" },
|
|
317
|
+
{ key: "folio", name: "Folio", icon: Icons.Library, group: "work" },
|
|
317
318
|
];
|
|
318
319
|
|
|
320
|
+
// Each app opens in its own tab, named after the app: a second click finds that tab again instead of opening
|
|
321
|
+
// another one. The current tab takes the name of its app, so a tab opened from the switcher is found as well.
|
|
322
|
+
// Browsers only find tabs that are related (opened from one another); a tab the person opened by hand opens anew.
|
|
323
|
+
function switcherTarget(key) {
|
|
324
|
+
return `scalio-${key}`;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function nameCurrentTab(current) {
|
|
328
|
+
if (typeof window === "undefined" || !current) return;
|
|
329
|
+
try {
|
|
330
|
+
const name = window.name || "";
|
|
331
|
+
if (!name || name.startsWith("scalio-")) window.name = switcherTarget(current);
|
|
332
|
+
} catch (e) {
|
|
333
|
+
/* window.name is not writable in some sandboxes */
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
319
337
|
function productStatus(product, current) {
|
|
320
338
|
if (product.key === current) return "active";
|
|
321
339
|
return product.soon ? "soon" : "available";
|
|
@@ -352,6 +370,16 @@ function scalioFeatures(answer) {
|
|
|
352
370
|
function ProductSwitcher({ current, links, stage, sso, lang, labels, products, testId }) {
|
|
353
371
|
const L = labelsFor(lang, labels);
|
|
354
372
|
const badge = stageBadge(stage);
|
|
373
|
+
React.useEffect(() => nameCurrentTab(current), [current]);
|
|
374
|
+
const list = products || PRODUCTS;
|
|
375
|
+
const items = [];
|
|
376
|
+
list.forEach((product, i) => {
|
|
377
|
+
const prev = list[i - 1];
|
|
378
|
+
if (prev && product.group && prev.group && product.group !== prev.group) {
|
|
379
|
+
items.push(h("span", { key: `sep-${product.key}`, className: "scalio-switcher-sep", "aria-hidden": "true", "data-testid": "switcher-separator" }));
|
|
380
|
+
}
|
|
381
|
+
items.push(product);
|
|
382
|
+
});
|
|
355
383
|
return h(
|
|
356
384
|
"div",
|
|
357
385
|
{ className: "scalio-switcher", "data-testid": testId || "scalio-product-switcher" },
|
|
@@ -359,7 +387,8 @@ function ProductSwitcher({ current, links, stage, sso, lang, labels, products, t
|
|
|
359
387
|
badge
|
|
360
388
|
? h("span", { className: `scalio-stage scalio-stage-${stage}`, title: L.stageHint, "data-testid": "scalio-stage-badge", "data-stage": stage }, badge)
|
|
361
389
|
: null,
|
|
362
|
-
|
|
390
|
+
items.map((product) => {
|
|
391
|
+
if (React.isValidElement(product)) return product;
|
|
363
392
|
const status = productStatus(product, current);
|
|
364
393
|
const Icon = product.icon;
|
|
365
394
|
const href = switcherHref(product, links, sso, current);
|
|
@@ -370,7 +399,7 @@ function ProductSwitcher({ current, links, stage, sso, lang, labels, products, t
|
|
|
370
399
|
status === "soon" ? h("span", { key: "s", className: "scalio-switcher-soon", "data-testid": `product-soon-${product.key}` }, L.soon) : null,
|
|
371
400
|
];
|
|
372
401
|
if (href) {
|
|
373
|
-
return h("a", Object.assign({ href, title: L.switchTo, className: "scalio-switcher-item is-link" }, common), content);
|
|
402
|
+
return h("a", Object.assign({ href, target: switcherTarget(product.key), title: L.switchTo, className: "scalio-switcher-item is-link" }, common), content);
|
|
374
403
|
}
|
|
375
404
|
const title = status === "active" ? L.activeApp : status === "soon" ? L.comingSoon : L.notSetUp;
|
|
376
405
|
return h(
|