Watch the cluster and edit every setting from the console
The console gains live views of nodes, GPUs, models, replicas, usage and agent logs, and a settings tree over every key of server.yaml (agent.yaml on a node), generated from the configuration structs: values with their defaults and doc comments, edited in dialogs, saved only once the service's own loader accepts them, comments kept. The generator now tells blocks apart by package, which brings the TLS, engine and supervisor settings back into the reference. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
aa3efcebbe
commit
9ab93a0aa6
13 files changed
+2702
-472
No files matched your search
@@ -24,6 +24,8 @@ type navItem struct {
|
||||
Current bool
|
||||
// Dim greys an entry that cannot be chosen now.
|
||||
Dim bool
|
||||
// Heading is a title between groups of entries, not an entry.
|
||||
Heading bool
|
||||
}
|
||||
|
||||
type frame struct {
|
||||
@@ -70,6 +72,10 @@ func (f frame) render() string {
|
||||
for _, it := range f.Nav {
|
||||
mark := " "
|
||||
label := it.Label
|
||||
if it.Heading {
|
||||
nav.WriteString(sDim.Render(label) + "\n")
|
||||
continue
|
||||
}
|
||||
switch {
|
||||
case it.State == "done":
|
||||
mark = sOK.Render("✓ ")
|
||||
@@ -182,3 +188,50 @@ func truncateWidth(s string, w int) string {
|
||||
}
|
||||
return ansi.Truncate(s, max(w-1, 0), "…")
|
||||
}
|
||||
|
||||
// table draws rows under a header in columns as wide as they need, cut to
|
||||
// width; the selected row is shown reversed when the panel has the focus.
|
||||
func table(headers []string, rows [][]string, selected int, width int, focused bool) string {
|
||||
widths := make([]int, len(headers))
|
||||
for i, h := range headers {
|
||||
widths[i] = ansi.StringWidth(h)
|
||||
}
|
||||
for _, r := range rows {
|
||||
for i := range headers {
|
||||
if i < len(r) {
|
||||
widths[i] = min(max(widths[i], ansi.StringWidth(r[i])), 44)
|
||||
}
|
||||
}
|
||||
}
|
||||
line := func(cells []string) string {
|
||||
var b strings.Builder
|
||||
for i := range headers {
|
||||
c := ""
|
||||
if i < len(cells) {
|
||||
c = truncateWidth(cells[i], widths[i])
|
||||
}
|
||||
b.WriteString(c)
|
||||
if i < len(headers)-1 {
|
||||
b.WriteString(strings.Repeat(" ", widths[i]-ansi.StringWidth(c)+2))
|
||||
}
|
||||
}
|
||||
return truncateWidth(b.String(), width)
|
||||
}
|
||||
var b strings.Builder
|
||||
b.WriteString(" " + lipgloss.NewStyle().Bold(true).Foreground(tuiDim).Render(line(headers)) + "\n")
|
||||
for i, r := range rows {
|
||||
l := line(r)
|
||||
switch {
|
||||
case i == selected && focused:
|
||||
pad := max(0, width-ansi.StringWidth(ansi.Strip(l)))
|
||||
l = fBar.Render(ansi.Strip(l) + strings.Repeat(" ", pad))
|
||||
case i == selected:
|
||||
l = lipgloss.NewStyle().Bold(true).Render(l)
|
||||
}
|
||||
b.WriteString(" " + l + "\n")
|
||||
}
|
||||
if len(rows) == 0 {
|
||||
b.WriteString(" " + sDim.Render("nothing yet") + "\n")
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
Reference in new issue
Block a user