@scalio-cloud/ui 0.79.0 → 0.80.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 +8 -0
- package/package.json +1 -1
- package/react/agents.js +31 -22
- package/react/icons.js +5 -1
package/nav.css
CHANGED
|
@@ -463,6 +463,14 @@
|
|
|
463
463
|
.scalio-users-table td { padding: 0.75rem 1rem; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
|
|
464
464
|
.scalio-users-table tr:last-child td { border-bottom: 0; }
|
|
465
465
|
.scalio-users-table tbody tr:hover { background: hsl(var(--muted) / 0.4); }
|
|
466
|
+
/* AgentsPanel (0.80.0): compact rows, icon buttons with a tooltip, actions never cut off */
|
|
467
|
+
.scalio-agents-table td { padding: 0.5rem 0.75rem; vertical-align: top; }
|
|
468
|
+
.scalio-agents-table th { white-space: nowrap; }
|
|
469
|
+
.scalio-btn.is-icon { width: 1.75rem; height: 1.75rem; padding: 0; justify-content: center; }
|
|
470
|
+
.scalio-agent-actions { display: flex; gap: 0.125rem; justify-content: flex-end; white-space: nowrap; }
|
|
471
|
+
.scalio-agent-worker { display: flex; align-items: center; gap: 0.35rem; flex-wrap: nowrap; white-space: nowrap; }
|
|
472
|
+
.scalio-agent-worker + .scalio-agent-worker { margin-top: 0.25rem; }
|
|
473
|
+
.scalio-agent-roles { display: flex; flex-direction: column; gap: 0.125rem; white-space: nowrap; }
|
|
466
474
|
.scalio-users-table tr.is-pending { background: rgb(217 119 6 / 0.05); }
|
|
467
475
|
.scalio-users-table tr.is-locked .scalio-users-who { opacity: 0.6; }
|
|
468
476
|
.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.80.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
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
const React = require("react");
|
|
11
11
|
const h = React.createElement;
|
|
12
12
|
const Icons = require("./icons");
|
|
13
|
+
|
|
14
|
+
// «2.0.0-rc.2+cebfb4f…» or «2.0.0rc2.abcdef» shown as «2.0.0-rc.2»; the full version stays in the tooltip.
|
|
15
|
+
function shortVersion(v) {
|
|
16
|
+
return String(v || "").split("+")[0];
|
|
17
|
+
}
|
|
13
18
|
const { StatusBadge } = require("./blocks");
|
|
14
19
|
const { SettingsSection, SettingsField: Field } = require("./settings");
|
|
15
20
|
const { askConfirm } = require("./dialog");
|
|
@@ -584,56 +589,60 @@ function AgentsPanel(props) {
|
|
|
584
589
|
}
|
|
585
590
|
return out.length ? out : null;
|
|
586
591
|
};
|
|
592
|
+
// Icon button with the text as tooltip and accessible name (0.80.0: the table fits without scrolling).
|
|
593
|
+
const iconBtn = (Icon, label, props) => h("button", Object.assign({ type: "button", className: "scalio-btn is-ghost is-icon",
|
|
594
|
+
title: label, "aria-label": label }, props), h(Icon, { className: "scalio-icon" }));
|
|
587
595
|
const agentRow = (a) => {
|
|
588
596
|
const st = statusOf(a);
|
|
589
597
|
const can = new Set(((a.capabilities || {}).workers) || []);
|
|
590
598
|
const states = {};
|
|
591
599
|
(a.workers || []).forEach((w) => { states[w.name] = w; });
|
|
600
|
+
const host = [a.hostname && a.hostname !== a.name ? a.hostname : "", a.domain].filter(Boolean).join(" · ");
|
|
592
601
|
return h("tr", { key: a.id, "data-testid": `agent-${a.id}` },
|
|
593
|
-
h("td", null, h("div", { className: "font-medium" }, a.name || a.hostname),
|
|
594
|
-
|
|
595
|
-
|
|
602
|
+
h("td", null, h("div", { className: "font-medium" }, a.name || a.hostname),
|
|
603
|
+
host ? h("div", { className: "scalio-settings-text" }, host) : null,
|
|
604
|
+
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)),
|
|
596
606
|
h("td", null, h(StatusBadge, { tone: st === "online" ? "ok" : st === "blocked" ? "error" : "warn", testId: `agent-status-${a.id}` }, L[st]),
|
|
597
607
|
h("div", { className: "scalio-settings-text" }, a.last_seen ? when(a.last_seen, props.lang) : L.never)),
|
|
598
|
-
h("td", null, offered.map((r) => h("label", { key: r.name, className: "scalio-settings-check", title: can.has(r.name) ? "" : L.notOnHost },
|
|
608
|
+
h("td", null, h("div", { className: "scalio-agent-roles" }, offered.map((r) => h("label", { key: r.name, className: "scalio-settings-check", title: can.has(r.name) ? "" : L.notOnHost },
|
|
599
609
|
h("input", { type: "checkbox", checked: (a.roles || []).includes(r.name), disabled: busy || a.blocked, "data-testid": `agent-role-${a.id}-${r.name}`,
|
|
600
610
|
onChange: () => setRoles(a, (a.roles || []).includes(r.name) ? a.roles.filter((x) => x !== r.name) : (a.roles || []).concat([r.name])) }),
|
|
601
|
-
h("span", null, r.label || r.name, can.has(r.name) ? "" : " ⚠")))),
|
|
611
|
+
h("span", null, r.label || r.name, can.has(r.name) ? "" : " ⚠"))))),
|
|
602
612
|
h("td", null, (a.roles || []).map((name) => {
|
|
603
613
|
const w = states[name] || { name, state: can.has(name) ? "starting" : "unavailable" };
|
|
604
614
|
const stopped = w.state === "stopped" || w.state === "disabled";
|
|
605
|
-
return h("div", { key: name,
|
|
615
|
+
return h("div", { key: name, className: "scalio-agent-worker", "data-testid": `agent-worker-${a.id}-${name}` },
|
|
606
616
|
h("span", null, roleLabel(name)),
|
|
607
617
|
h(StatusBadge, { tone: STATE_TONE[w.state] || "neutral", testId: `agent-worker-state-${a.id}-${name}` }, (L.states || {})[w.state] || w.state),
|
|
608
618
|
w.restarts ? h("span", { className: "scalio-settings-text" }, fill(L.restarts, { n: w.restarts })) : null,
|
|
609
619
|
w.last_error ? h("span", { className: "scalio-settings-text", title: w.last_error }, h(Icons.Alert, { className: "scalio-icon" })) : null,
|
|
610
620
|
a.online && can.has(name) ? [
|
|
611
|
-
|
|
612
|
-
onClick: () => run(() => props.client.control(a.id, name, "restart"), L.sent) }
|
|
621
|
+
iconBtn(Icons.RotateCcw, L.restart, { key: "r", disabled: busy, "data-testid": `agent-worker-restart-${a.id}-${name}`,
|
|
622
|
+
onClick: () => run(() => props.client.control(a.id, name, "restart"), L.sent) }),
|
|
613
623
|
stopped
|
|
614
|
-
?
|
|
615
|
-
onClick: () => run(() => props.client.control(a.id, name, "start"), L.sent) }
|
|
616
|
-
:
|
|
617
|
-
onClick: () => confirmThen(fill(L.stopConfirm, { worker: roleLabel(name), name: a.name }), L.stop, () => props.client.control(a.id, name, "stop"), L.sent) }
|
|
624
|
+
? iconBtn(Icons.Play, L.start, { key: "s", disabled: busy, "data-testid": `agent-worker-start-${a.id}-${name}`,
|
|
625
|
+
onClick: () => run(() => props.client.control(a.id, name, "start"), L.sent) })
|
|
626
|
+
: iconBtn(Icons.Square, L.stop, { key: "s", disabled: busy, "data-testid": `agent-worker-stop-${a.id}-${name}`,
|
|
627
|
+
onClick: () => confirmThen(fill(L.stopConfirm, { worker: roleLabel(name), name: a.name }), L.stop, () => props.client.control(a.id, name, "stop"), L.sent) }),
|
|
618
628
|
] : null);
|
|
619
629
|
})),
|
|
620
|
-
h("td", null,
|
|
621
|
-
|
|
622
|
-
onClick: () => setOpen(open === a.id ? null : a.id) }
|
|
623
|
-
|
|
630
|
+
h("td", null, h("div", { className: "scalio-agent-actions" },
|
|
631
|
+
iconBtn(Icons.Settings, L.settings, { "aria-expanded": open === a.id, "data-testid": `agent-settings-open-${a.id}`,
|
|
632
|
+
onClick: () => setOpen(open === a.id ? null : a.id) }),
|
|
633
|
+
iconBtn(a.blocked ? Icons.Check : Icons.Ban, a.blocked ? L.unblock : L.block, { disabled: busy, "data-testid": `agent-block-${a.id}`,
|
|
624
634
|
onClick: () => a.blocked
|
|
625
635
|
? run(() => props.client.block(a.id, false), L.saved)
|
|
626
|
-
: confirmThen(fill(L.blockConfirm, { name: a.name }), L.block, () => props.client.block(a.id, true), L.saved) }
|
|
627
|
-
|
|
628
|
-
onClick: () => confirmThen(fill(L.removeConfirm, { name: a.name }), L.remove, () => props.client.remove(a.id), L.saved) }
|
|
629
|
-
h(Icons.Trash, { className: "scalio-icon" }), L.remove)));
|
|
636
|
+
: confirmThen(fill(L.blockConfirm, { name: a.name }), L.block, () => props.client.block(a.id, true), L.saved) }),
|
|
637
|
+
iconBtn(Icons.Trash, L.remove, { disabled: busy, "data-testid": `agent-remove-${a.id}`,
|
|
638
|
+
onClick: () => confirmThen(fill(L.removeConfirm, { name: a.name }), L.remove, () => props.client.remove(a.id), L.saved) }))));
|
|
630
639
|
};
|
|
631
640
|
rows.push(h(Field, { key: "agents", label: L.agents },
|
|
632
641
|
!data ? null : agents.length === 0
|
|
633
642
|
? h("p", { className: "scalio-settings-text", "data-testid": "agents-none" }, L.none)
|
|
634
643
|
: h("div", { style: { overflowX: "auto" } },
|
|
635
|
-
h("table", { className: "scalio-users-table", "data-testid": "agents-table" },
|
|
636
|
-
h("thead", null, h("tr", null, [L.name, L.
|
|
644
|
+
h("table", { className: "scalio-users-table scalio-agents-table", "data-testid": "agents-table" },
|
|
645
|
+
h("thead", null, h("tr", null, [L.name, L.version, L.status, L.roles, L.workers, ""].map((t, i) => h("th", { key: i }, t)))),
|
|
637
646
|
h("tbody", null, agents.map((a) => agentRow(a)))))));
|
|
638
647
|
const openAgent = agents.find((a) => a.id === open);
|
|
639
648
|
if (openAgent) rows.push(h(SettingsDialog, { key: "settings-dialog", agent: openAgent, L, onClose: () => setOpen(null) },
|
package/react/icons.js
CHANGED
|
@@ -141,6 +141,10 @@ const Sparkles = icon([
|
|
|
141
141
|
]);
|
|
142
142
|
const Download = icon([["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }], ["path", { d: "m7 10 5 5 5-5" }], ["path", { d: "M12 15V3" }]]);
|
|
143
143
|
|
|
144
|
+
const Play = icon([["polygon", { points: "6 3 20 12 6 21 6 3" }]]);
|
|
145
|
+
const Square = icon([["rect", { width: 14, height: 14, x: 5, y: 5, rx: 2 }]]);
|
|
146
|
+
const Ban = icon([["circle", { cx: 12, cy: 12, r: 10 }], ["path", { d: "m4.9 4.9 14.2 14.2" }]]);
|
|
147
|
+
|
|
144
148
|
module.exports = { Sun, Moon, Monitor, LifeBuoy, BookOpen, Library, LogOut, Menu, Check, X, Search, ChevronDown, Fingerprint, FileStack, ShieldCheck, Hammer, Activity,
|
|
145
149
|
Smartphone, KeyRound, Trash, Copy, Puzzle, Plus, Pencil, Link2, Alert, History, CornerDownLeft,
|
|
146
|
-
Users, Settings, ScrollText, Info, RadioTower, Globe, Clock, Download, Upload, RotateCcw, Sparkles };
|
|
150
|
+
Users, Settings, ScrollText, Info, RadioTower, Globe, Clock, Download, Upload, RotateCcw, Sparkles, Play, Square, Ban };
|