Commit Graph

4 Commits

Author SHA1 Message Date
nicolargo
a7b9992ae8 feat(v5): mem renderer pulls short_name from schema + drop label-column floors
User feedback: column widths shouldn't reserve space for label variants
the renderer never uses. Add v4-style short_name to mem and let the
auto-size adapt:

  mem.available.short_name = 'avail'    (9 -> 5 chars)
  mem.inactive.short_name  = 'inactiv'  (8 -> 7 chars)
  mem.buffers.short_name   = 'buffer'   (7 -> 6 chars)

The mem render_curses_v5 now resolves every label via
field_label(..., prefer_short=True), so adding/changing a short_name
in the schema is enough — no renderer edit needed.

The label-column floors in cpu and mem renderers
(_CPU_LABEL_MIN_WIDTHS / _MEM_LABEL_MIN_WIDTHS) are gone too: labels
are constant strings so the content-driven auto-size is naturally
stable. Only value columns still need a fixed floor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:15:24 +02:00
nicolargo
ec74e9f570 tweak(v5): raise title-color threshold — only warning/critical escalate
Previously a prominent careful level promoted the plugin title to
CAREFUL color. Per user feedback, careful is too noisy for a title
escalation: a freshly booted machine often sits in careful for one or
two cycles. Now the title stays white (HEADER) until any prominent
field reaches warning or critical.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 15:43:20 +02:00
nicolargo
42538a0098 feat(v5): dynamic plugin title color reflects worst prominent alert level
Plugin titles (MEM/CPU/LOAD) now adapt their color to the worst
prominent alert level in the payload:
- No prominent escalation → bold white (HEADER role, v4 TITLE parity).
- Worst prominent level is careful/warning/critical → bold + that color.

Non-prominent escalations do not promote the title color (only watched +
prominent fields count).

Implementation:
- ColorRole.HEADER curses color: cyan → white (matches v4 TITLE).
- Cell gains a 'bold' flag, decoupling the bold attribute from the
  HEADER role so alert-colored titles can still render bold.
- New helpers in curses_renderer_v5: _max_prominent_level(payload),
  title_role(payload). Handle scalar and nested (collection) _levels
  shapes.
- cpu/mem/load renderers compute the title cell color via title_role()
  and set bold=True explicitly.
- All alignment helpers (generic + cpu + mem) preserve the bold flag
  when rebuilding cells.

Tests cover: title_role priority ordering, prominent-only filtering,
collection level shape, painter A_BOLD applies on explicit bold flag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 15:41:53 +02:00
nicolargo
b016ae0b2e feat(v5): mem plugin — per-plugin TUI renderer mirroring v4 msg_curse
2-col x 4-row grid layout:
  MEM    53.2%      active   5.8G
  total  15.3G    inactive   4.4G
  avail   7.2G     buffers   185M
  free    2.6G      cached   4.2G

Variants:
- Line 3 col 1: 'avail' (when payload has 'available' — Linux/macOS) or
  'used' (BSD/other) as v4 does.

Fixed column widths (value=6 chars, label cols floored at v4 sizes) so
the block doesn't jiggle cycle-to-cycle.

The percent value cell carries the watched/prominent flag from the
schema, so the painter applies A_REVERSE under any non-DEFAULT alert
level.

Reference: glances/plugins/mem/__init__.py::msg_curse.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 15:22:44 +02:00