@scalio-cloud/ui 0.81.0 → 0.82.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 +8 -0
- package/nav.css +10 -0
- package/package.json +1 -1
- package/react/agents.js +130 -88
package/README.md
CHANGED
|
@@ -625,6 +625,14 @@ list. Test IDs: `agents-panel`, `agents-code-create`, `agents-code-value`, `agen
|
|
|
625
625
|
`agent-role-<id>-<role>`, `agent-worker-state-<id>-<worker>`, `agent-worker-restart|stop|start-<id>-<worker>`,
|
|
626
626
|
`agent-block-<id>`, `agent-remove-<id>`, `agents-tasks`.
|
|
627
627
|
|
|
628
|
+
Since 0.82.0 (layout A, Markus 2026-11-15) the block is one column over the whole width, without the label column of
|
|
629
|
+
`SettingsSection`: a head with title, hint, «Agent herunterladen (MSI)» and «Agent hinzufügen» (a dialog with roles,
|
|
630
|
+
note and the one-time code), the open codes and the update rule each in one line, the agents with roles and worker
|
|
631
|
+
states in one column, and the last tasks with the filter «nur Fehler». The update line names the build the app brings
|
|
632
|
+
(`2.0.0rc4`), not only the release. Put it straight into the page: do not wrap it in a section with its own label
|
|
633
|
+
column. The props stay the same. New test IDs: `agents-add`, `agents-add-dialog`, `agents-add-close`,
|
|
634
|
+
`agents-tasks-errors`, `agents-no-errors`.
|
|
635
|
+
|
|
628
636
|
Since 0.64.0 (self-update U2, scalio-platform 0.39.0) the block also shows the agent version bundled in the app, the
|
|
629
637
|
update rule of the instance (automatic, maintenance window with days and times, or only on request; `GET|PUT
|
|
630
638
|
/update[/policy]`) and per agent the update state reported by the agent (updating, updated, rolled back with reason,
|
package/nav.css
CHANGED
|
@@ -471,6 +471,16 @@
|
|
|
471
471
|
.scalio-agent-worker { display: flex; align-items: center; gap: 0.35rem; flex-wrap: nowrap; white-space: nowrap; }
|
|
472
472
|
.scalio-agent-worker + .scalio-agent-worker { margin-top: 0.25rem; }
|
|
473
473
|
.scalio-agent-roles { display: flex; flex-direction: column; gap: 0.125rem; white-space: nowrap; }
|
|
474
|
+
/* AgentsPanel layout A (0.82.0, Markus 2026-11-15): one column over the whole width, no label column */
|
|
475
|
+
.scalio-agents { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
|
|
476
|
+
.scalio-agents-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; }
|
|
477
|
+
.scalio-agents-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
|
|
478
|
+
.scalio-agents-strip { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; padding: 0.625rem 1rem;
|
|
479
|
+
background: hsl(var(--muted) / 0.5); border: 1px solid hsl(var(--border)); font-size: 0.875rem; }
|
|
480
|
+
.scalio-agents-codes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
|
|
481
|
+
.scalio-agents-block { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
|
|
482
|
+
.scalio-agents-scroll { overflow-x: auto; border: 1px solid hsl(var(--border)); }
|
|
483
|
+
.scalio-agents-scroll .scalio-users-table { width: 100%; }
|
|
474
484
|
.scalio-users-table tr.is-pending { background: rgb(217 119 6 / 0.05); }
|
|
475
485
|
.scalio-users-table tr.is-locked .scalio-users-who { opacity: 0.6; }
|
|
476
486
|
.scalio-users-hide-sm, .scalio-users-hide-md { display: none; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.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
|
@@ -16,7 +16,6 @@ function shortVersion(v) {
|
|
|
16
16
|
return String(v || "").split("+")[0];
|
|
17
17
|
}
|
|
18
18
|
const { StatusBadge } = require("./blocks");
|
|
19
|
-
const { SettingsSection, SettingsField: Field } = require("./settings");
|
|
20
19
|
const { askConfirm } = require("./dialog");
|
|
21
20
|
|
|
22
21
|
const LABELS = {
|
|
@@ -25,6 +24,12 @@ const LABELS = {
|
|
|
25
24
|
hint: "Der Scalio Agent läuft als Windows-Dienst in Ihrem Netz und erledigt Aufgaben, die nur dort gehen (z. B. Active Directory). Er baut nur ausgehende Verbindungen auf. Sie können ihn auf mehreren Servern installieren und pro Server die Rollen wählen.",
|
|
26
25
|
download: "Agent herunterladen (MSI)",
|
|
27
26
|
newCode: "Registrierungscode erzeugen",
|
|
27
|
+
add: "Agent hinzufügen",
|
|
28
|
+
addHint: "Erzeugen Sie einen Einmal-Code und installieren Sie damit das MSI auf dem Server. Der Code gilt einmal und ist nur jetzt sichtbar.",
|
|
29
|
+
rolesWorkers: "Rollen und Worker",
|
|
30
|
+
onlyErrors: "nur Fehler",
|
|
31
|
+
noErrors: "Keine Fehler.",
|
|
32
|
+
updShort: "Updates",
|
|
28
33
|
codeRoles: "Rollen für den neuen Agent",
|
|
29
34
|
codeNote: "Notiz (z. B. Servername)",
|
|
30
35
|
codeTitle: "Registrierungscode",
|
|
@@ -120,6 +125,12 @@ const LABELS = {
|
|
|
120
125
|
hint: "The Scalio Agent runs as a Windows service in your network and does work that is only possible there (e.g. Active Directory). It only opens outgoing connections. You can install it on several servers and choose the roles per server.",
|
|
121
126
|
download: "Download the agent (MSI)",
|
|
122
127
|
newCode: "Create enrollment code",
|
|
128
|
+
add: "Add agent",
|
|
129
|
+
addHint: "Create a one-time code and install the MSI with it on the server. The code works once and is only shown now.",
|
|
130
|
+
rolesWorkers: "Roles and workers",
|
|
131
|
+
onlyErrors: "errors only",
|
|
132
|
+
noErrors: "No errors.",
|
|
133
|
+
updShort: "Updates",
|
|
123
134
|
codeRoles: "Roles of the new agent",
|
|
124
135
|
codeNote: "Note (e.g. server name)",
|
|
125
136
|
codeTitle: "Enrollment code",
|
|
@@ -385,23 +396,23 @@ function AgentSettings(props) {
|
|
|
385
396
|
a.settings_sent_at ? h("span", { className: "scalio-settings-text" }, fill(L.setSentAt, { at: when(a.settings_sent_at, lang) })) : null));
|
|
386
397
|
}
|
|
387
398
|
|
|
388
|
-
//
|
|
389
|
-
|
|
390
|
-
|
|
399
|
+
// A dialog of the panel (settings of one agent, Markus 2026-11-14; «Agent hinzufügen», layout A 2026-11-15):
|
|
400
|
+
// closes with its button, the backdrop and Escape.
|
|
401
|
+
function PanelDialog(props) {
|
|
402
|
+
const { title, onClose, L } = props;
|
|
391
403
|
React.useEffect(() => {
|
|
392
404
|
const key = (e) => { if (e.key === "Escape") onClose(); };
|
|
393
405
|
document.addEventListener("keydown", key);
|
|
394
406
|
return () => document.removeEventListener("keydown", key);
|
|
395
407
|
}, [onClose]);
|
|
396
|
-
const title = fill(L.setTitle, { name: a.name || a.hostname || a.id });
|
|
397
408
|
return h("div", { className: "scalio-dialog-root" },
|
|
398
409
|
h("div", { className: "scalio-dialog-backdrop", onClick: onClose }),
|
|
399
|
-
h("div", { className: "scalio-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, style: { maxWidth: "52rem" },
|
|
400
|
-
"data-testid":
|
|
410
|
+
h("div", { className: "scalio-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, style: { maxWidth: props.maxWidth || "52rem" },
|
|
411
|
+
"data-testid": props.testId },
|
|
401
412
|
h("div", { className: "scalio-dialog-head" },
|
|
402
413
|
h("div", { className: "scalio-dialog-title" }, title),
|
|
403
414
|
h("button", { type: "button", className: "scalio-btn is-ghost scalio-btn-icon", onClick: onClose, "aria-label": L.setClose,
|
|
404
|
-
title: L.setClose, "data-testid":
|
|
415
|
+
title: L.setClose, "data-testid": props.closeTestId }, h(Icons.X, { className: "scalio-icon" }))),
|
|
405
416
|
h("div", { className: "scalio-dialog-body" }, props.children)));
|
|
406
417
|
}
|
|
407
418
|
|
|
@@ -422,6 +433,8 @@ function AgentsPanel(props) {
|
|
|
422
433
|
const [upd, setUpd] = React.useState(null); // GET /update; stays null with an older backend
|
|
423
434
|
const [policy, setPolicy] = React.useState(null); // the rule being edited
|
|
424
435
|
const [open, setOpen] = React.useState(null); // agent whose settings are open
|
|
436
|
+
const [adding, setAdding] = React.useState(false); // dialog «Agent hinzufügen»
|
|
437
|
+
const [onlyErrors, setOnlyErrors] = React.useState(false);
|
|
425
438
|
|
|
426
439
|
const load = React.useCallback(async () => {
|
|
427
440
|
try {
|
|
@@ -487,63 +500,78 @@ function AgentsPanel(props) {
|
|
|
487
500
|
};
|
|
488
501
|
const appUrl = props.appUrl || (typeof window !== "undefined" ? window.location.origin : "");
|
|
489
502
|
|
|
503
|
+
// Layout A (Markus 2026-11-15): one column over the whole width, no label column. Head with the buttons, the update
|
|
504
|
+
// rule in one line, the agents, the last tasks; enrollment codes in the dialog «Agent hinzufügen».
|
|
490
505
|
const rows = [];
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
h(
|
|
501
|
-
onChange: () => setCodeRoles(selectedRoles.includes(r.name) ? selectedRoles.filter((x) => x !== r.name) : selectedRoles.concat([r.name])) }),
|
|
502
|
-
h("span", null, r.label || r.name)))) : null,
|
|
503
|
-
h("div", { style: { display: "flex", gap: "0.5rem", marginTop: "0.5rem", flexWrap: "wrap" } },
|
|
504
|
-
h("input", { className: "scalio-input", placeholder: L.codeNote, "aria-label": L.codeNote, value: note, maxLength: 200, disabled: busy,
|
|
505
|
-
"data-testid": "agents-code-note", onChange: (e) => setNote(e.target.value) }),
|
|
506
|
-
h("button", { type: "button", className: "scalio-btn is-solid", disabled: busy, "data-testid": "agents-code-create", onClick: createCode },
|
|
507
|
-
h(Icons.KeyRound, { className: "scalio-icon" }), L.newCode))));
|
|
508
|
-
|
|
509
|
-
if (shown) {
|
|
510
|
-
const cmd = installCommand(appUrl, shown.code);
|
|
511
|
-
rows.push(h("div", { key: "shown", className: "scalio-notice is-info", role: "status", "data-testid": "agents-code-shown" },
|
|
512
|
-
h("div", { className: "scalio-notice-body" },
|
|
513
|
-
h("div", { className: "scalio-notice-title" }, L.codeTitle),
|
|
514
|
-
h("div", { className: "scalio-notice-text" },
|
|
515
|
-
h("code", { "data-testid": "agents-code-value", style: { fontSize: "1.1em" } }, shown.code), " ",
|
|
516
|
-
h("button", { type: "button", className: "scalio-btn is-ghost", "data-testid": "agents-code-copy", onClick: () => copy(shown.code) },
|
|
517
|
-
h(Icons.Copy, { className: "scalio-icon" }), L.copy),
|
|
518
|
-
h("div", null, L.codeOnce),
|
|
519
|
-
h("div", { style: { marginTop: "0.5rem" } }, `${L.codeCommand}:`),
|
|
520
|
-
h("pre", { style: { whiteSpace: "pre-wrap", wordBreak: "break-all" }, "data-testid": "agents-code-command" }, cmd),
|
|
521
|
-
h("button", { type: "button", className: "scalio-btn is-ghost", "data-testid": "agents-code-command-copy", onClick: () => copy(cmd) },
|
|
522
|
-
h(Icons.Copy, { className: "scalio-icon" }), L.copy),
|
|
523
|
-
h("button", { type: "button", className: "scalio-btn", "data-testid": "agents-code-close", onClick: () => setShown(null) }, L.close)))));
|
|
524
|
-
}
|
|
506
|
+
const label = (text) => h("h3", { className: "scalio-field-label", style: { margin: 0 } }, text);
|
|
507
|
+
rows.push(h("div", { key: "head", className: "scalio-agents-head" },
|
|
508
|
+
h("div", { style: { minWidth: 0, flex: "1 1 20rem" } },
|
|
509
|
+
h("h2", { className: "scalio-profile-section-title", style: { margin: 0 } }, L.title),
|
|
510
|
+
h("p", { className: "scalio-profile-section-desc" }, L.hint)),
|
|
511
|
+
h("div", { className: "scalio-agents-buttons" },
|
|
512
|
+
props.downloadUrl ? h("a", { className: "scalio-btn", href: props.downloadUrl, "data-testid": "agents-download" },
|
|
513
|
+
h(Icons.Download, { className: "scalio-icon" }), L.download) : null,
|
|
514
|
+
h("button", { type: "button", className: "scalio-btn is-solid", disabled: busy, "data-testid": "agents-add", onClick: () => setAdding(true) },
|
|
515
|
+
h(Icons.Plus, { className: "scalio-icon" }), L.add))));
|
|
525
516
|
|
|
526
517
|
if (codes.length) {
|
|
527
|
-
rows.push(h(
|
|
528
|
-
h("
|
|
518
|
+
rows.push(h("div", { key: "codes", className: "scalio-agents-strip" },
|
|
519
|
+
h("span", { style: { fontWeight: 600 } }, L.openCodes),
|
|
520
|
+
h("ul", { className: "scalio-settings-text scalio-agents-codes", "data-testid": "agents-codes" },
|
|
529
521
|
codes.map((c) => h("li", { key: c.id, "data-testid": `agents-code-${c.id}` },
|
|
530
522
|
[c.note, (c.roles || []).join(", "), fill(L.codeExpires, { at: when(c.expires_at, props.lang) })].filter(Boolean).join(" · "), " ",
|
|
531
523
|
h("button", { type: "button", className: "scalio-btn is-ghost", disabled: busy, "data-testid": `agents-code-revoke-${c.id}`,
|
|
532
524
|
onClick: () => run(() => props.client.revokeCode(c.id)) }, L.revoke))))));
|
|
533
525
|
}
|
|
534
526
|
|
|
535
|
-
//
|
|
527
|
+
// «Agent hinzufügen»: roles, note, code; the code and the install command appear once in the same dialog
|
|
528
|
+
if (adding) {
|
|
529
|
+
const closeAdd = () => { setAdding(false); setShown(null); };
|
|
530
|
+
const cmd = shown ? installCommand(appUrl, shown.code) : "";
|
|
531
|
+
rows.push(h(PanelDialog, { key: "add", title: L.add, L, onClose: closeAdd, testId: "agents-add-dialog", closeTestId: "agents-add-close", maxWidth: "40rem" },
|
|
532
|
+
h("div", { style: { display: "grid", gap: "0.75rem" }, "data-testid": "agents-new-code" },
|
|
533
|
+
h("p", { className: "scalio-settings-text", style: { margin: 0 } }, L.addHint),
|
|
534
|
+
props.downloadUrl ? h("a", { className: "scalio-btn", href: props.downloadUrl, style: { justifySelf: "start" } },
|
|
535
|
+
h(Icons.Download, { className: "scalio-icon" }), L.download) : null,
|
|
536
|
+
offered.length > 1 ? h("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.75rem" } },
|
|
537
|
+
h("span", { className: "scalio-settings-text" }, `${L.codeRoles}:`),
|
|
538
|
+
offered.map((r) => h("label", { key: r.name, className: "scalio-settings-check" },
|
|
539
|
+
h("input", { type: "checkbox", checked: selectedRoles.includes(r.name), disabled: busy || !!shown, "data-testid": `agents-code-role-${r.name}`,
|
|
540
|
+
onChange: () => setCodeRoles(selectedRoles.includes(r.name) ? selectedRoles.filter((x) => x !== r.name) : selectedRoles.concat([r.name])) }),
|
|
541
|
+
h("span", null, r.label || r.name)))) : null,
|
|
542
|
+
shown ? null : h("div", { style: { display: "flex", gap: "0.5rem", flexWrap: "wrap" } },
|
|
543
|
+
h("input", { className: "scalio-input", placeholder: L.codeNote, "aria-label": L.codeNote, value: note, maxLength: 200, disabled: busy,
|
|
544
|
+
style: { flex: "1 1 14rem" }, "data-testid": "agents-code-note", onChange: (e) => setNote(e.target.value) }),
|
|
545
|
+
h("button", { type: "button", className: "scalio-btn is-solid", disabled: busy, "data-testid": "agents-code-create", onClick: createCode },
|
|
546
|
+
h(Icons.KeyRound, { className: "scalio-icon" }), L.newCode)),
|
|
547
|
+
shown ? h("div", { className: "scalio-notice is-info", role: "status", "data-testid": "agents-code-shown" },
|
|
548
|
+
h("div", { className: "scalio-notice-body" },
|
|
549
|
+
h("div", { className: "scalio-notice-title" }, L.codeTitle),
|
|
550
|
+
h("div", { className: "scalio-notice-text" },
|
|
551
|
+
h("code", { "data-testid": "agents-code-value", style: { fontSize: "1.1em" } }, shown.code), " ",
|
|
552
|
+
h("button", { type: "button", className: "scalio-btn is-ghost", "data-testid": "agents-code-copy", onClick: () => copy(shown.code) },
|
|
553
|
+
h(Icons.Copy, { className: "scalio-icon" }), L.copy),
|
|
554
|
+
h("div", null, L.codeOnce),
|
|
555
|
+
h("div", { style: { marginTop: "0.5rem" } }, `${L.codeCommand}:`),
|
|
556
|
+
h("pre", { style: { whiteSpace: "pre-wrap", wordBreak: "break-all" }, "data-testid": "agents-code-command" }, cmd),
|
|
557
|
+
h("button", { type: "button", className: "scalio-btn is-ghost", "data-testid": "agents-code-command-copy", onClick: () => copy(cmd) },
|
|
558
|
+
h(Icons.Copy, { className: "scalio-icon" }), L.copy),
|
|
559
|
+
h("button", { type: "button", className: "scalio-btn", "data-testid": "agents-code-close", onClick: closeAdd }, L.close)))) : null)));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// self-update rule (U2): one line
|
|
536
563
|
if (upd && policy) {
|
|
537
564
|
const win = policy.window || { days: [], start: "22:00", end: "04:00" };
|
|
538
565
|
const setWin = (k, v) => setPolicy(Object.assign({}, policy, { window: Object.assign({}, win, { [k]: v }) }));
|
|
539
566
|
const days = win.days || [];
|
|
540
|
-
rows.push(h(
|
|
541
|
-
h("
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
h("
|
|
567
|
+
rows.push(h("div", { key: "update", className: "scalio-agents-strip", "data-testid": "agents-update" },
|
|
568
|
+
h("span", { style: { fontWeight: 600 } }, L.updShort),
|
|
569
|
+
h("span", { className: "scalio-settings-text", "data-testid": "agents-update-available" },
|
|
570
|
+
upd.available ? fill(L.updAvailable, { version: upd.available.build || upd.available.version }) : L.updNone),
|
|
571
|
+
upd.minimum_version ? h("span", { className: "scalio-settings-text", "data-testid": "agents-update-minimum" }, fill(L.updMinimum, { version: upd.minimum_version })) : null,
|
|
572
|
+
h("span", { style: { display: "flex", gap: "0.5rem", flexWrap: "wrap", alignItems: "center", marginLeft: "auto" } },
|
|
545
573
|
h("select", { className: "scalio-input", value: policy.mode, "aria-label": L.updMode, disabled: busy, "data-testid": "agents-update-mode",
|
|
546
|
-
onChange: (e) => setPolicy(Object.assign({}, policy, { mode: e.target.value })) },
|
|
574
|
+
style: { width: "auto" }, onChange: (e) => setPolicy(Object.assign({}, policy, { mode: e.target.value })) },
|
|
547
575
|
["auto", "window", "manual"].map((m) => h("option", { key: m, value: m }, L.updModes[m]))),
|
|
548
576
|
policy.mode === "window" ? [
|
|
549
577
|
h("span", { key: "d", style: { display: "flex", gap: "0.5rem", flexWrap: "wrap" } }, `${L.updDays}:`,
|
|
@@ -552,9 +580,9 @@ function AgentsPanel(props) {
|
|
|
552
580
|
onChange: () => setWin("days", days.includes(i) ? days.filter((x) => x !== i) : days.concat([i]).sort()) }),
|
|
553
581
|
h("span", null, d)))),
|
|
554
582
|
h("label", { key: "s" }, L.updFrom, " ", h("input", { type: "time", className: "scalio-input", value: win.start, disabled: busy,
|
|
555
|
-
"data-testid": "agents-update-start", onChange: (e) => setWin("start", e.target.value) })),
|
|
583
|
+
style: { width: "auto" }, "data-testid": "agents-update-start", onChange: (e) => setWin("start", e.target.value) })),
|
|
556
584
|
h("label", { key: "e" }, L.updTo, " ", h("input", { type: "time", className: "scalio-input", value: win.end, disabled: busy,
|
|
557
|
-
"data-testid": "agents-update-end", onChange: (e) => setWin("end", e.target.value) })),
|
|
585
|
+
style: { width: "auto" }, "data-testid": "agents-update-end", onChange: (e) => setWin("end", e.target.value) })),
|
|
558
586
|
] : null,
|
|
559
587
|
h("button", { type: "button", className: "scalio-btn", disabled: busy, "data-testid": "agents-update-save",
|
|
560
588
|
onClick: async () => { const res = await run(() => props.client.setPolicy(policy), L.saved); if (res) setPolicy(res); } }, L.updSave))));
|
|
@@ -602,31 +630,35 @@ function AgentsPanel(props) {
|
|
|
602
630
|
h("td", null, h("div", { className: "font-medium" }, a.name || a.hostname),
|
|
603
631
|
host ? h("div", { className: "scalio-settings-text" }, host) : null,
|
|
604
632
|
a.os ? h("div", { className: "scalio-settings-text" }, a.os) : null),
|
|
605
|
-
h("td", null, h("span", { title: a.version || "", "data-testid": `agent-version-${a.id}` }, shortVersion(a.version) || "–"), updateCell(a)),
|
|
606
633
|
h("td", null, h(StatusBadge, { tone: st === "online" ? "ok" : st === "blocked" ? "error" : "warn", testId: `agent-status-${a.id}` }, L[st]),
|
|
607
634
|
h("div", { className: "scalio-settings-text" }, a.last_seen ? when(a.last_seen, props.lang) : L.never)),
|
|
608
|
-
h("td", null, h("
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
635
|
+
h("td", null, h("span", { title: a.version || "", "data-testid": `agent-version-${a.id}` }, shortVersion(a.version) || "–"), updateCell(a)),
|
|
636
|
+
// roles and workers in one column (layout A): one line per role the app offers, the worker state next to it
|
|
637
|
+
h("td", null, h("div", { className: "scalio-agent-roles" }, offered.concat((a.roles || []).filter((n) => !offered.some((r) => r.name === n)).map((n) => ({ name: n })))
|
|
638
|
+
.map((r) => {
|
|
639
|
+
const on = (a.roles || []).includes(r.name);
|
|
640
|
+
const w = on ? (states[r.name] || { name: r.name, state: can.has(r.name) ? "starting" : "unavailable" }) : null;
|
|
641
|
+
const stopped = w && (w.state === "stopped" || w.state === "disabled");
|
|
642
|
+
return h("div", { key: r.name, className: "scalio-agent-worker", "data-testid": on ? `agent-worker-${a.id}-${r.name}` : undefined },
|
|
643
|
+
h("label", { className: "scalio-settings-check", title: can.has(r.name) ? "" : L.notOnHost },
|
|
644
|
+
h("input", { type: "checkbox", checked: on, disabled: busy || a.blocked, "data-testid": `agent-role-${a.id}-${r.name}`,
|
|
645
|
+
onChange: () => setRoles(a, on ? a.roles.filter((x) => x !== r.name) : (a.roles || []).concat([r.name])) }),
|
|
646
|
+
h("span", null, r.label || roleLabel(r.name), can.has(r.name) ? "" : " ⚠")),
|
|
647
|
+
w ? [
|
|
648
|
+
h(StatusBadge, { key: "st", tone: STATE_TONE[w.state] || "neutral", testId: `agent-worker-state-${a.id}-${r.name}` }, (L.states || {})[w.state] || w.state),
|
|
649
|
+
w.restarts ? h("span", { key: "n", className: "scalio-settings-text" }, fill(L.restarts, { n: w.restarts })) : null,
|
|
650
|
+
w.last_error ? h("span", { key: "e", className: "scalio-settings-text", title: w.last_error }, h(Icons.Alert, { className: "scalio-icon" })) : null,
|
|
651
|
+
a.online && can.has(r.name) ? [
|
|
652
|
+
iconBtn(Icons.RotateCcw, L.restart, { key: "r", disabled: busy, "data-testid": `agent-worker-restart-${a.id}-${r.name}`,
|
|
653
|
+
onClick: () => run(() => props.client.control(a.id, r.name, "restart"), L.sent) }),
|
|
654
|
+
stopped
|
|
655
|
+
? iconBtn(Icons.Play, L.start, { key: "s", disabled: busy, "data-testid": `agent-worker-start-${a.id}-${r.name}`,
|
|
656
|
+
onClick: () => run(() => props.client.control(a.id, r.name, "start"), L.sent) })
|
|
657
|
+
: iconBtn(Icons.Square, L.stop, { key: "s", disabled: busy, "data-testid": `agent-worker-stop-${a.id}-${r.name}`,
|
|
658
|
+
onClick: () => confirmThen(fill(L.stopConfirm, { worker: roleLabel(r.name), name: a.name }), L.stop, () => props.client.control(a.id, r.name, "stop"), L.sent) }),
|
|
659
|
+
] : null,
|
|
660
|
+
] : null);
|
|
661
|
+
}))),
|
|
630
662
|
h("td", null, h("div", { className: "scalio-agent-actions" },
|
|
631
663
|
iconBtn(Icons.Settings, L.settings, { "aria-expanded": open === a.id, "data-testid": `agent-settings-open-${a.id}`,
|
|
632
664
|
onClick: () => setOpen(open === a.id ? null : a.id) }),
|
|
@@ -637,34 +669,44 @@ function AgentsPanel(props) {
|
|
|
637
669
|
iconBtn(Icons.Trash, L.remove, { disabled: busy, "data-testid": `agent-remove-${a.id}`,
|
|
638
670
|
onClick: () => confirmThen(fill(L.removeConfirm, { name: a.name }), L.remove, () => props.client.remove(a.id), L.saved) }))));
|
|
639
671
|
};
|
|
640
|
-
rows.push(h(
|
|
672
|
+
rows.push(h("div", { key: "agents", className: "scalio-agents-block" },
|
|
673
|
+
label(agents.length ? `${L.agents} (${agents.length})` : L.agents),
|
|
641
674
|
!data ? null : agents.length === 0
|
|
642
675
|
? h("p", { className: "scalio-settings-text", "data-testid": "agents-none" }, L.none)
|
|
643
|
-
: h("div", {
|
|
676
|
+
: h("div", { className: "scalio-agents-scroll" },
|
|
644
677
|
h("table", { className: "scalio-users-table scalio-agents-table", "data-testid": "agents-table" },
|
|
645
|
-
h("thead", null, h("tr", null, [L.name, L.
|
|
678
|
+
h("thead", null, h("tr", null, [L.name, L.status, L.version, L.rolesWorkers, ""].map((t, i) => h("th", { key: i }, t)))),
|
|
646
679
|
h("tbody", null, agents.map((a) => agentRow(a)))))));
|
|
647
680
|
const openAgent = agents.find((a) => a.id === open);
|
|
648
|
-
if (openAgent) rows.push(h(
|
|
681
|
+
if (openAgent) rows.push(h(PanelDialog, { key: "settings-dialog", L, onClose: () => setOpen(null),
|
|
682
|
+
title: fill(L.setTitle, { name: openAgent.name || openAgent.hostname || openAgent.id }),
|
|
683
|
+
testId: `agent-settings-dialog-${openAgent.id}`, closeTestId: `agent-settings-close-${openAgent.id}` },
|
|
649
684
|
h(AgentSettings, { agent: openAgent, L, lang: props.lang, busy, client: props.client, run, notify: props.notify,
|
|
650
685
|
suggest: props.suggest, roleLabel })));
|
|
651
686
|
|
|
652
|
-
// tasks
|
|
687
|
+
// tasks, newest first, with the filter «nur Fehler»
|
|
653
688
|
const nameOf = (id) => (agents.find((a) => a.id === id) || {}).name || "";
|
|
654
|
-
|
|
689
|
+
const shownTasks = onlyErrors ? tasks.filter((t) => t.status === "error") : tasks;
|
|
690
|
+
rows.push(h("div", { key: "tasks", className: "scalio-agents-block" },
|
|
691
|
+
h("div", { style: { display: "flex", gap: "1rem", alignItems: "center", flexWrap: "wrap" } },
|
|
692
|
+
label(L.tasks),
|
|
693
|
+
tasks.length ? h("label", { className: "scalio-settings-check" },
|
|
694
|
+
h("input", { type: "checkbox", checked: onlyErrors, "data-testid": "agents-tasks-errors", onChange: () => setOnlyErrors(!onlyErrors) }),
|
|
695
|
+
h("span", null, L.onlyErrors)) : null),
|
|
655
696
|
tasks.length === 0 ? h("p", { className: "scalio-settings-text", "data-testid": "agents-no-tasks" }, L.noTasks)
|
|
656
|
-
: h("
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
h("
|
|
697
|
+
: shownTasks.length === 0 ? h("p", { className: "scalio-settings-text", "data-testid": "agents-no-errors" }, L.noErrors)
|
|
698
|
+
: h("div", { className: "scalio-agents-scroll" },
|
|
699
|
+
h("table", { className: "scalio-users-table scalio-agents-table", "data-testid": "agents-tasks" },
|
|
700
|
+
h("thead", null, h("tr", null, [L.created, L.task, L.agent, L.status, L.message].map((t, i) => h("th", { key: i }, t)))),
|
|
701
|
+
h("tbody", null, shownTasks.map((t) => h("tr", { key: t.id, "data-testid": `agents-task-${t.id}` },
|
|
702
|
+
h("td", { style: { whiteSpace: "nowrap" } }, when(t.created_at, props.lang)),
|
|
660
703
|
h("td", null, `${t.worker ? `${t.worker} · ` : ""}${t.action || ""}`),
|
|
661
704
|
h("td", null, nameOf(t.agent_id)),
|
|
662
705
|
h("td", null, h(StatusBadge, { tone: TASK_TONE[t.status] || "neutral" }, (L.taskStates || {})[t.status] || t.status || "")),
|
|
663
|
-
h("td", null, when(t.created_at, props.lang)),
|
|
664
706
|
h("td", null, t.message || ""))))))));
|
|
665
707
|
|
|
666
708
|
if (error) rows.push(h("div", { key: "err", className: "scalio-notice is-error", role: "alert", "data-testid": "agents-error" }, error));
|
|
667
|
-
return h(
|
|
709
|
+
return h("section", { className: "scalio-agents", id: "settings-agent", "data-testid": "agents-panel" }, rows);
|
|
668
710
|
}
|
|
669
711
|
|
|
670
712
|
module.exports = { AgentsPanel, agentsApi, agentInstallCommand: installCommand, AGENT_LABELS: LABELS };
|