Repository navigation
fix(webui): colour a container's CPU and MEM the way curses already does - #3724
Merged
nicolargo merged 1 commit intoSep 10, 2026
Merged
Conversation
The containers plugin decorates each container's cpu and mem against that container's own threshold from the config file, falling back to the global one. The curses view reads both. plugin-containers.vue did not: it rendered the two cells as plain text in both its narrow and wide tables, so a container over its limit was red in the terminal and black in the browser. The component already exposes the views it needs -- it uses them for show_engine_name and show_pod_name -- so this only adds the reader and the two class bindings, defensive the same way plugin-diskio.vue is for a container present in stats but not yet in views. The added test pins the server half of the pair: without it, removing the decoration upstream would take the colour out of both front ends silently, since get_views() answers DEFAULT for a key it cannot find.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
The containers plugin decorates each container's CPU and MEM in
update_views(), against that container's own threshold from the config file ([containers] cpu_careful=…), falling back to the global one:The curses view reads both back.
plugin-containers.vuedid not — it rendered the two cells as plain text, in both its narrow (d-md-none) and wide (d-none d-md-block) tables.So a container above its limit is red in the terminal and black in the browser. It is silent from either side:
get_views()answers'DEFAULT'for a key it cannot find, so a missing binding looks exactly like a deliberately undecorated column.The change
.vueonly, plus a test. The component already exposes the views it needs — it uses them forshow_engine_nameandshow_pod_name— so this adds agetDecoration()reader and four class bindings (two cells × two tables).The reader is defensive the same way
plugin-diskio.vueis: a container present instatsbut not yet inviewsreturns undefined rather than throwing.The limit column next to memory usage stays undecorated on purpose: the server classifies usage against that limit, so the limit itself carries no alert.
Evidence
There is no JS test harness here, so the added test pins the server half of the pair — the half the new binding depends on. Without it, removing the decoration upstream would take the colour out of both front ends with nothing failing.
Two-way mutation, run locally:
test_plugin_containers.py, 18 / 18['cpu']['decoration'] = alertOne note on the test itself: my first version configured
containers_cpu_careful=…and the alert came backDEFAULT, which looked like a second bug. It was my config — inside[containers]the key is section-relative (cpu_careful). The test now says so in a comment, since it is an easy trap for the next person writing one.