Skip to content

fix(containers): give a container without stats a default decoration - #3768

Merged
RazCrimson merged 3 commits into
nicolargo:developfrom
Juice-de-Orange:fix/containers-view-decoration-without-stats
Oct 2, 2026
Merged

RazCrimson merged 3 commits into
nicolargo:developfrom
Juice-de-Orange:fix/containers-view-decoration-without-stats

Conversation

@Juice-de-Orange

Copy link
Copy Markdown
Contributor

Description

Since #3724 (4.5.7) the WebUI reads the container cpu/mem decorations. A restarting container comes back from Docker with empty cpu and memory dicts, so update_views() left its views as {'cpu': {}, 'mem': {}} and getDecoration() throws on decoration.toLowerCase(). The whole CONTAINERS section disappears as long as any container is restarting.

The views now start with DEFAULT, same as the base update_views() and what get_views() already gives curses for a missing decoration. New test in tests/test_plugin_containers_views.py, it fails with KeyError: 'decoration' without the change. I also updated the module docstring there, it said a missing decoration is silent in both front ends.

Checked in the browser on the 4.5.7 image with a --restart always container that keeps exiting: without the change the section was gone in 30 of 30 samples (TypeError: Cannot read properties of undefined (reading 'toLowerCase')), with it the section stayed in 30 of 30, no console errors.

ruff check / ruff format --check clean. pytest tests (without the selenium/TUI ones): same 15 failures as develop, all in test_actions_sanitize.py (missing chevron extra here), plus the new test passing.

If you'd rather also guard getDecoration() in the Vue component, happy to add that.

Resume

  • Bug fix: yes
  • New feature: no
  • Fixed tickets: none, no issue open for it

A restarting container comes back with empty cpu and memory stats, so its
views stayed {'cpu': {}, 'mem': {}}. The WebUI calls toLowerCase() on the
decoration and threw, which removed the whole container table from the page.
Comment thread glances/plugins/containers/__init__.py
A container view without a decoration made getDecoration() throw on
toLowerCase(), which removed the whole container table. Fall back to
DEFAULT like curses does instead.
Comment thread tests/test_plugin_containers_views.py Outdated
Comment on lines +13 to +16
option='decoration'), and plugin-containers.vue reads the same two entries. In
curses a missing decoration is silent: get_views() answers 'DEFAULT' for a key it
cannot find. The WebUI calls toLowerCase() on it, so an entry without one breaks
the whole container table.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we have fixed this now with the extra checks you added, so the webui behaviour aligns with the earlier comment.

Wouldn't the comment change be misleading now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, with the fallback the original docstring is true again. Restored it in 5e5189e.

With the WebUI fallback from 7e70dd1 a missing decoration is silent in
both front ends again, so the original docstring is right.
@RazCrimson
RazCrimson merged commit 59a092c into nicolargo:develop Oct 2, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants