@scalio-cloud/ui 0.73.0 → 0.75.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 CHANGED
@@ -149,6 +149,10 @@ Texts are built in for `lang` `de` and `en` and can be overridden with `labels`.
149
149
  `TEST_IDS`. The components are plain CommonJS with `React.createElement`, so CRA, Vite and Jest need no extra config.
150
150
  Icons are inline (Lucide, ISC, see `licenses/`).
151
151
 
152
+ **Beta (ADR 0117 in scalio-docs):** apps sold as public beta (version 0.x) set `beta: true` in the brand object, in
153
+ the header (`AppHeader`) and on every sign-in page (`AuthLayout`). Both then show «Beta» next to the product name
154
+ (`BetaBadge`, hint on hover). Keep one brand object per app, so no page is missed, and remove the flag with 1.0.
155
+
152
156
  ## Sidebar, switcher and page blocks (React)
153
157
 
154
158
  Every app has the same frame (UISPEC "Navigation"): switcher, header with the context select on the left, then
@@ -616,6 +620,15 @@ Since 0.65.0 (scripts from the app U3, scalio-platform 0.40.0) every agent shows
616
620
  current}`: «aktuell» or «werden aktualisiert») and «Passwörter verschlüsselt» when it reported an encryption key
617
621
  (`sealed`). Test ID `agent-scripts-<id>`.
618
622
 
623
+ Since 0.75.0 (settings from the app, scalio-docs ADR 0122, scalio-platform 0.47.0) «Einstellungen» opens a form per
624
+ agent, built from the catalog the agent reports (`settings.catalog`: text, number, on/off, choice, secret). Only changed
625
+ values go to `PUT /agents/{id}/settings` (`client.setSettings`); an empty field deletes the app's value. A value set on
626
+ the server shows «lokal gesetzt» and cannot be changed; a write switch shows «wartet auf die Freigabe beim Kunden»
627
+ until the customer has set `RemoteWrite`, and a notice explains how. A secret is a password field, never shown, sent
628
+ only to an agent with a seal key (`sealed`). Test IDs: `agent-settings-open-<id>`, `agent-settings-<id>`,
629
+ `agent-setting-<id>-<name>`, `agent-setting-local|pending-<id>-<name>`, `agent-settings-save-<id>`,
630
+ `agent-settings-none-<id>`, `agent-settings-nogate-<id>`.
631
+
619
632
  ### Scripts des Agents (U5)
620
633
 
621
634
  Since 0.66.0 (customer customizations U5, scalio-platform 0.41.0) `AgentScriptsPanel` shows every script the app
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.73.0",
3
+ "version": "0.75.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
@@ -3,7 +3,8 @@
3
3
  // for admins. Backend: scalio-platform `agent.AgentHub.router` (GET /agent/v2/admin/agents, PATCH /agents/{id},
4
4
  // POST /agents/{id}/block|unblock, DELETE /agents/{id}, POST /agents/{id}/workers/{worker}/{restart|stop|start},
5
5
  // POST|GET /agent/v2/admin/codes, DELETE /codes/{id}, GET /agent/v2/admin/tasks; self-update U2: GET /update,
6
- // PUT /update/policy, POST /agents/{id}/update, POST /agents/{id}/update/retry).
6
+ // PUT /update/policy, POST /agents/{id}/update, POST /agents/{id}/update/retry; settings ADR 0122:
7
+ // PUT /agents/{id}/settings).
7
8
  // Shows every agent of this instance with its roles and worker states, creates one-time enrollment codes (the
8
9
  // code is shown once) and lists the last tasks without their data.
9
10
  const React = require("react");
@@ -85,6 +86,23 @@ const LABELS = {
85
86
  scriptsOld: "werden aktualisiert",
86
87
  sealed: "Passwörter verschlüsselt",
87
88
  customAllowed: "eigene Scripts erlaubt",
89
+ settings: "Einstellungen",
90
+ setNone: "Dieser Agent meldet noch keine Einstellungen. Eine neuere Version des Agents kann sie aus der App übernehmen.",
91
+ setNoGate: "Schalter mit Schreibrechten (z. B. Ein/Aus, neue Desktops, GPOs) wirken erst, wenn ein Administrator auf dem Server die Freigabe gesetzt hat: Häkchen «Schreibrechte aus der App erlauben» bei der Installation oder RemoteWrite = 1 in HKLM\\SOFTWARE\\Scalio\\Agent.",
92
+ setLocal: "lokal gesetzt, gilt vor der App",
93
+ setPending: "wartet auf die Freigabe beim Kunden",
94
+ setFromApp: "aus der App",
95
+ setNotSet: "nicht gesetzt",
96
+ setOn: "Ein",
97
+ setOff: "Aus",
98
+ setSecretSet: "gesetzt (verdeckt)",
99
+ setSecretNew: "Neuen Wert eingeben",
100
+ setSecretClear: "Entfernen",
101
+ setNoSeal: "Dieser Agent kann noch keine verschlüsselten Secrets annehmen.",
102
+ setSave: "Einstellungen senden",
103
+ setNothing: "Keine Änderung.",
104
+ setSentAt: "Zuletzt gesendet: {at}",
105
+ setGate: "Schreibrecht",
88
106
  updStates: { installing: "Wird aktualisiert auf {version}", verifying: "Prüft Version {version}", installed: "Aktualisiert auf {version}",
89
107
  rolled_back: "Zurückgerollt auf {from} ({reason})", rollback_failed: "Rollback fehlgeschlagen ({reason})", failed: "Update fehlgeschlagen ({reason})",
90
108
  refused: "Update abgelehnt ({reason})" },
@@ -160,6 +178,23 @@ const LABELS = {
160
178
  scriptsOld: "being updated",
161
179
  sealed: "passwords encrypted",
162
180
  customAllowed: "own scripts allowed",
181
+ settings: "Settings",
182
+ setNone: "This agent does not report settings yet. A newer version of the agent can take them from the app.",
183
+ setNoGate: "Switches that allow writing (e.g. power, new desktops, GPOs) only take effect once an administrator has allowed it on the server: the checkbox «Allow write permissions from the app» at install, or RemoteWrite = 1 in HKLM\\SOFTWARE\\Scalio\\Agent.",
184
+ setLocal: "set locally, wins over the app",
185
+ setPending: "waits for the customer's approval",
186
+ setFromApp: "from the app",
187
+ setNotSet: "not set",
188
+ setOn: "On",
189
+ setOff: "Off",
190
+ setSecretSet: "set (hidden)",
191
+ setSecretNew: "Enter a new value",
192
+ setSecretClear: "Remove",
193
+ setNoSeal: "This agent cannot accept encrypted secrets yet.",
194
+ setSave: "Send settings",
195
+ setNothing: "No change.",
196
+ setSentAt: "Last sent: {at}",
197
+ setGate: "write permission",
163
198
  updStates: { installing: "Updating to {version}", verifying: "Checking version {version}", installed: "Updated to {version}",
164
199
  rolled_back: "Rolled back to {from} ({reason})", rollback_failed: "Rollback failed ({reason})", failed: "Update failed ({reason})",
165
200
  refused: "Update refused ({reason})" },
@@ -209,6 +244,7 @@ function agentsApi(api, base) {
209
244
  setPolicy: (policy) => api.put(`${b}/update/policy`, policy).then((r) => r.data),
210
245
  updateNow: (id) => api.post(`${b}/agents/${id}/update`, {}).then((r) => r.data),
211
246
  retryUpdate: (id) => api.post(`${b}/agents/${id}/update/retry`, {}).then((r) => r.data),
247
+ setSettings: (id, body) => api.put(`${b}/agents/${id}/settings`, body).then((r) => r.data),
212
248
  };
213
249
  }
214
250
 
@@ -222,6 +258,99 @@ function statusOf(agent) {
222
258
  return agent.online ? "online" : "offline";
223
259
  }
224
260
 
261
+ // The current value of a setting as the form shows it ("" = not set); a secret never has one.
262
+ function shownValue(def, v) {
263
+ if (!v || v.value == null) return "";
264
+ if (def.kind === "bool") return v.value === "1" ? "1" : v.value === "0" ? "0" : "";
265
+ return String(v.value);
266
+ }
267
+
268
+ // Settings of one agent from the app (ADR 0122): built from the catalog the agent reports, only the changed values
269
+ // are sent. A local value wins and cannot be changed here; a write switch waits for the local opt-in RemoteWrite.
270
+ function AgentSettings(props) {
271
+ const { agent: a, L, lang, busy } = props;
272
+ const s = a.settings;
273
+ const [edit, setEdit] = React.useState({});
274
+ const [secrets, setSecrets] = React.useState({});
275
+ if (!s) return h("p", { className: "scalio-settings-text", "data-testid": `agent-settings-none-${a.id}` }, L.setNone);
276
+ const values = s.values || {};
277
+ const label = (d) => (d.label && (d.label[lang === "en" ? "en" : "de"] || d.label.de)) || d.name;
278
+ const hasGate = (s.catalog || []).some((d) => d.gate);
279
+ const current = (d) => (values[d.name] && values[d.name].source === "app" ? shownValue(d, values[d.name]) : "");
280
+ const valueOf = (d) => (Object.prototype.hasOwnProperty.call(edit, d.name) ? edit[d.name] : (values[d.name] && values[d.name].source === "local" ? shownValue(d, values[d.name]) : current(d)));
281
+ const set = (d, v) => setEdit(Object.assign({}, edit, { [d.name]: v }));
282
+
283
+ const change = () => {
284
+ const out = {};
285
+ const sec = {};
286
+ (s.catalog || []).forEach((d) => {
287
+ if (d.kind === "secret") {
288
+ if (secrets[d.name] === null) sec[d.name] = null;
289
+ else if (secrets[d.name]) sec[d.name] = secrets[d.name];
290
+ return;
291
+ }
292
+ if (!Object.prototype.hasOwnProperty.call(edit, d.name)) return;
293
+ const v = edit[d.name];
294
+ if (v === current(d)) return;
295
+ if (v === "") out[d.name] = null;
296
+ else if (d.kind === "bool") out[d.name] = v === "1";
297
+ else if (d.kind === "number") out[d.name] = Number(v);
298
+ else out[d.name] = v;
299
+ });
300
+ const body = {};
301
+ if (Object.keys(out).length) body.values = out;
302
+ if (Object.keys(sec).length) body.secrets = sec;
303
+ return body;
304
+ };
305
+ const save = async () => {
306
+ const body = change();
307
+ if (!body.values && !body.secrets) { if (props.notify) props.notify(L.setNothing, "info"); return; }
308
+ const res = await props.run(() => props.client.setSettings(a.id, body), L.sent);
309
+ if (res) { setEdit({}); setSecrets({}); }
310
+ };
311
+
312
+ const input = (d) => {
313
+ const v = values[d.name] || {};
314
+ const local = v.source === "local";
315
+ const tid = `agent-setting-${a.id}-${d.name}`;
316
+ const common = { id: tid, className: "scalio-input", disabled: busy || local || a.blocked, "data-testid": tid, "aria-label": label(d) };
317
+ if (d.kind === "secret") {
318
+ if (!a.sealed) return h("span", { className: "scalio-settings-text", "data-testid": tid }, v.set ? L.setSecretSet : L.setNotSet, " · ", L.setNoSeal);
319
+ return h("span", { style: { display: "flex", gap: "0.5rem", flexWrap: "wrap", alignItems: "center" } },
320
+ h("input", Object.assign({}, common, { type: "password", autoComplete: "new-password", placeholder: v.set ? L.setSecretSet : L.setSecretNew,
321
+ value: secrets[d.name] || "", onChange: (e) => setSecrets(Object.assign({}, secrets, { [d.name]: e.target.value })) })),
322
+ v.set && v.source === "app" ? h("label", { className: "scalio-settings-check" },
323
+ h("input", { type: "checkbox", checked: secrets[d.name] === null, disabled: busy, "data-testid": `${tid}-clear`,
324
+ onChange: () => setSecrets(Object.assign({}, secrets, { [d.name]: secrets[d.name] === null ? "" : null })) }),
325
+ h("span", null, L.setSecretClear)) : null);
326
+ }
327
+ if (d.kind === "bool" || d.kind === "choice") {
328
+ const opts = d.kind === "bool" ? [["1", L.setOn], ["0", L.setOff]] : (d.options || []).map((o) => [o, o]);
329
+ return h("select", Object.assign({}, common, { value: valueOf(d), onChange: (e) => set(d, e.target.value) }),
330
+ h("option", { value: "" }, L.setNotSet), opts.map(([k, t]) => h("option", { key: k, value: k }, t)));
331
+ }
332
+ return h("input", Object.assign({}, common, { type: d.kind === "number" ? "number" : "text", min: d.kind === "number" ? 1 : undefined,
333
+ maxLength: d.kind === "text" ? 1024 : undefined, value: valueOf(d), onChange: (e) => set(d, e.target.value) }));
334
+ };
335
+ const note = (d) => {
336
+ const v = values[d.name] || {};
337
+ if (v.source === "local") return h(StatusBadge, { tone: "neutral", testId: `agent-setting-local-${a.id}-${d.name}` }, L.setLocal);
338
+ if (v.pending) return h(StatusBadge, { tone: "warn", testId: `agent-setting-pending-${a.id}-${d.name}` }, L.setPending);
339
+ return null;
340
+ };
341
+
342
+ return h("div", { "data-testid": `agent-settings-${a.id}`, style: { display: "grid", gap: "0.5rem" } },
343
+ hasGate && !s.remote_write ? h("div", { className: "scalio-notice is-info", role: "status", "data-testid": `agent-settings-nogate-${a.id}` },
344
+ h("div", { className: "scalio-notice-body" }, h("div", { className: "scalio-notice-text" }, L.setNoGate))) : null,
345
+ (s.catalog || []).map((d) => h("div", { key: d.name, style: { display: "grid", gridTemplateColumns: "minmax(12rem, 1fr) minmax(12rem, 2fr)", gap: "0.5rem", alignItems: "center" } },
346
+ h("label", { htmlFor: `agent-setting-${a.id}-${d.name}` }, label(d), d.gate ? h("span", { className: "scalio-settings-text" }, ` (${L.setGate})`) : null),
347
+ h("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center", flexWrap: "wrap" } }, input(d), note(d)))),
348
+ h("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center", flexWrap: "wrap" } },
349
+ h("button", { type: "button", className: "scalio-btn is-solid", disabled: busy || a.blocked, "data-testid": `agent-settings-save-${a.id}`, onClick: save },
350
+ h(Icons.Settings, { className: "scalio-icon" }), L.setSave),
351
+ a.settings_sent_at ? h("span", { className: "scalio-settings-text" }, fill(L.setSentAt, { at: when(a.settings_sent_at, lang) })) : null));
352
+ }
353
+
225
354
  // Props: client (agentsApi), lang, labels, appUrl (address the agent connects to, default window.location.origin),
226
355
  // downloadUrl (MSI), notify(message, tone), formatError(err), refreshMs (default 15000, 0 = off), copy(text).
227
356
  function AgentsPanel(props) {
@@ -237,6 +366,7 @@ function AgentsPanel(props) {
237
366
  const [shown, setShown] = React.useState(null); // {code, expires_at} right after «Code erzeugen»
238
367
  const [upd, setUpd] = React.useState(null); // GET /update; stays null with an older backend
239
368
  const [policy, setPolicy] = React.useState(null); // the rule being edited
369
+ const [open, setOpen] = React.useState(null); // agent whose settings are open
240
370
 
241
371
  const load = React.useCallback(async () => {
242
372
  try {
@@ -438,6 +568,8 @@ function AgentsPanel(props) {
438
568
  ] : null);
439
569
  })),
440
570
  h("td", null,
571
+ h("button", { type: "button", className: "scalio-btn is-ghost", "aria-expanded": open === a.id, "data-testid": `agent-settings-open-${a.id}`,
572
+ onClick: () => setOpen(open === a.id ? null : a.id) }, h(Icons.Settings, { className: "scalio-icon" }), L.settings),
441
573
  h("button", { type: "button", className: "scalio-btn is-ghost", disabled: busy, "data-testid": `agent-block-${a.id}`,
442
574
  onClick: () => a.blocked
443
575
  ? run(() => props.client.block(a.id, false), L.saved)
@@ -452,7 +584,8 @@ function AgentsPanel(props) {
452
584
  : h("div", { style: { overflowX: "auto" } },
453
585
  h("table", { className: "scalio-users-table", "data-testid": "agents-table" },
454
586
  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)))),
455
- h("tbody", null, agents.map(agentRow))))));
587
+ h("tbody", null, agents.map((a) => [agentRow(a), open === a.id ? h("tr", { key: `${a.id}-settings` },
588
+ h("td", { colSpan: 7 }, h(AgentSettings, { agent: a, L, lang: props.lang, busy, client: props.client, run, notify: props.notify }))) : null]))))));
456
589
 
457
590
  // tasks
458
591
  const nameOf = (id) => (agents.find((a) => a.id === id) || {}).name || "";
package/react/auth.js CHANGED
@@ -91,13 +91,13 @@ function DemoAccounts({ accounts, onPick, lang, labels, className, testId }) {
91
91
  );
92
92
  }
93
93
 
94
- // brand: { mark: "N", name: "Scalio Nexus", claim, eyebrow, features: [..], color }
94
+ // brand: { mark: "N", name: "Scalio Nexus", claim, eyebrow, features: [..], color, beta }
95
95
  // version: shown small bottom left; left out = read from /version.json, false = hidden.
96
96
  function AuthLayout(props) {
97
97
  const brand = props.brand || {};
98
98
  const L = labelsFor(props.lang, props.labels);
99
99
  const words = String(brand.name || "").split(/\s+/).filter(Boolean);
100
- const { LanguageToggle, ThemeToggle } = require("./index");
100
+ const { LanguageToggle, ThemeToggle, BetaBadge } = require("./index");
101
101
  return h(
102
102
  "div",
103
103
  { className: cx("scalio-auth", props.className), "data-testid": props.testId || "auth-layout" },
@@ -111,6 +111,7 @@ function AuthLayout(props) {
111
111
  { className: "scalio-auth-hero" },
112
112
  h(BrandMark, { brand, className: "scalio-auth-mark-lg" }),
113
113
  h("h1", { className: "scalio-auth-title" }, words.map((w, i) => h(React.Fragment, { key: i }, i ? h("br") : null, w))),
114
+ brand.beta ? h(BetaBadge, { lang: props.lang, labels: props.labels, className: "scalio-beta-lg", testId: "auth-beta-badge" }) : null,
114
115
  brand.claim ? h("p", { className: "scalio-auth-claim" }, brand.claim) : null
115
116
  ),
116
117
  brand.features && brand.features.length
@@ -140,7 +141,8 @@ function AuthLayout(props) {
140
141
  "div",
141
142
  { className: "scalio-auth-mobile-brand" },
142
143
  h(BrandMark, { brand }),
143
- h("span", { className: "scalio-auth-mobile-name" }, brand.name)
144
+ h("span", { className: "scalio-auth-mobile-name" }, brand.name),
145
+ brand.beta ? h(BetaBadge, { lang: props.lang, labels: props.labels, testId: "auth-beta-badge-mobile" }) : null
144
146
  ),
145
147
  props.children
146
148
  )
package/react/index.js CHANGED
@@ -274,7 +274,13 @@ function DocsButton({ href, lang, labels, testId }) {
274
274
  );
275
275
  }
276
276
 
277
- function Brand({ brand }) {
277
+ // «Beta» next to the product name (ADR 0117): apps on 0.x set brand.beta, AppHeader and AuthLayout show it.
278
+ function BetaBadge({ lang, labels, testId, className }) {
279
+ const L = labelsFor(lang, labels);
280
+ return h("span", { className: cx("scalio-beta", className), title: L.betaHint, "data-testid": testId || "scalio-beta-badge" }, L.beta);
281
+ }
282
+
283
+ function Brand({ brand, lang, labels }) {
278
284
  if (!brand) return null;
279
285
  if (React.isValidElement(brand)) return brand;
280
286
  const inner = [
@@ -282,7 +288,7 @@ function Brand({ brand }) {
282
288
  h(
283
289
  "span",
284
290
  { key: "t", className: "scalio-brand-text" },
285
- h("span", { className: "scalio-brand-line" }, h("span", { className: "scalio-brand-name" }, brand.name), brand.badges || null),
291
+ h("span", { className: "scalio-brand-line" }, h("span", { className: "scalio-brand-name" }, brand.name), brand.beta ? h(BetaBadge, { lang, labels }) : null, brand.badges || null),
286
292
  brand.sub ? h("span", { className: "scalio-brand-sub" }, brand.sub) : null
287
293
  ),
288
294
  ];
@@ -311,7 +317,7 @@ function AppHeader(props) {
311
317
  h(Icons.Menu, { className: "scalio-icon" })
312
318
  )
313
319
  : null,
314
- h(Brand, { brand: props.brand }),
320
+ h(Brand, { brand: props.brand, lang: props.lang, labels: props.labels }),
315
321
  props.left ? h("div", { className: "scalio-header-left" }, props.left) : null,
316
322
  h("div", { className: "scalio-header-spacer" }),
317
323
  props.actions ? h("div", { className: "scalio-header-actions" }, props.actions) : null,
@@ -364,6 +370,7 @@ const VersionTag = Nav.VersionTag;
364
370
 
365
371
  module.exports = {
366
372
  AppHeader,
373
+ BetaBadge,
367
374
  UserMenu,
368
375
  LanguageToggle,
369
376
  ThemeToggle,
package/react/labels.js CHANGED
@@ -129,6 +129,8 @@ const LABELS = {
129
129
  comingSoon: "Bald verfügbar",
130
130
  notSetUp: "Für diese Installation nicht eingerichtet",
131
131
  stageHint: "Umgebung dieser Installation",
132
+ beta: "Beta",
133
+ betaHint: "Öffentliche Beta: Funktionen und Oberfläche können sich bis Version 1.0 noch ändern.",
132
134
  // Support request
133
135
  supportTitle: "Support-Anfrage",
134
136
  subject: "Betreff",
@@ -700,6 +702,8 @@ const LABELS = {
700
702
  comingSoon: "Coming soon",
701
703
  notSetUp: "Not set up for this installation",
702
704
  stageHint: "Environment of this installation",
705
+ beta: "Beta",
706
+ betaHint: "Public beta: features and screens may still change until version 1.0.",
703
707
  supportTitle: "Support request",
704
708
  subject: "Subject",
705
709
  description: "Description",
package/shell.css CHANGED
@@ -31,6 +31,15 @@
31
31
  @media (min-width: 1024px) { .scalio-brand-text { display: flex; } }
32
32
  /* Product name and its edition badges on one line (ADR 0042 A1). */
33
33
  .scalio-brand-line { display: flex; align-items: center; gap: 0.375rem; }
34
+ /* «Beta» next to the product name (ADR 0117); the large one sits under the title on the sign-in page. */
35
+ .scalio-beta {
36
+ display: inline-flex; align-items: center; padding: 0 0.3125rem; border-radius: 2px;
37
+ font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700; line-height: 1rem;
38
+ text-transform: uppercase; letter-spacing: 0.1em;
39
+ background: rgb(139 92 246 / 0.12); color: #7c3aed; box-shadow: inset 0 0 0 1px rgb(139 92 246 / 0.45);
40
+ }
41
+ .dark .scalio-beta, .scalio-auth-brand .scalio-beta { color: #c4b5fd; }
42
+ .scalio-beta-lg { margin-top: 1rem; font-size: 0.75rem; line-height: 1.5rem; padding: 0 0.625rem; }
34
43
  .scalio-edition-badges { display: inline-flex; align-items: center; gap: 0.25rem; }
35
44
  .scalio-edition-badge { font-size: 9px; padding: 0.0625rem 0.3125rem; }
36
45
  .scalio-api-status { gap: 0.25rem; }