Skip to content

fix(webui): match the VM status colour to the plugin's vm_alert - #3697

Merged
nicolargo merged 1 commit into
nicolargo:developfrom
ntdatt812:fix/webui-vms-status
Aug 29, 2026
Merged

nicolargo merged 1 commit into
nicolargo:developfrom
ntdatt812:fix/webui-vms-status

Conversation

@ntdatt812

Copy link
Copy Markdown
Contributor

plugin-vms.vue decided the status colour inline:

<td :class="vm.status == 'stopped' ? 'careful' : 'ok'">

VmsPlugin.vm_alert() — which the TUI calls directly at vms/__init__.py:271 — knows three states the WebUI had never heard of:

status plugin WebUI (before)
running OK ok ✅
starting WARNING ok ❌
restarting WARNING ok ❌
delayed shutdown WARNING ok ❌
stopped INFO careful ❌
anything else INFO ok ❌

The only status the WebUI recognised was stopped, so every other non-running state fell through to green. A VM stuck restarting looked healthy in the browser while the TUI flagged it WARNING. stopped went the other way and was over-reported as CAREFUL.

The fix

getStatusClass mirrors vm_alert, and follows the shape plugin-containers.vue already uses for its equivalent (container_alert) — including returning info for the fallback, which is that component's existing convention.

I checked plugin-containers.vue against container_alert while I was here, since it is the closest sibling: it matches exactly, so nothing to do there.

Evidence

The WebUI has no JS test runner, so the proof is the rebuilt bundle: the string delayed shutdown goes 0 → 1 occurrences. It was absent entirely before — which is the finding, not just the diff: that state had no representation in the WebUI at all.

glances.js 686883 → 686996 bytes, only the component and the bundle changed.

npx eslint on the component: 0 errors. Its 5 warnings sit at lines 9/15/19/24 (header attributes) and 69 (the props block); this change touches line 35 and appends a methods block, so none of them are new.

`plugin-vms.vue` decided the status colour inline:

    :class="vm.status == 'stopped' ? 'careful' : 'ok'"

`VmsPlugin.vm_alert()` — which the TUI calls directly at
`vms/__init__.py:271` — classifies three states the WebUI had never heard of:

    running                                   -> OK
    starting, restarting, delayed shutdown    -> WARNING
    everything else                           -> INFO

So the only status the WebUI recognised was `stopped`, and **every other
non-running state fell through to "ok"**. A VM that is starting, restarting,
or in delayed shutdown rendered green in the browser while the TUI showed
WARNING — a VM stuck restarting looked healthy. `stopped` was also
over-reported as CAREFUL where the plugin says INFO.

`getStatusClass` now mirrors `vm_alert`, and follows the shape
`plugin-containers.vue` already uses for its equivalent (`container_alert`),
including returning `info` for the fallback.

Evidence, since the WebUI has no JS test runner: the string
`delayed shutdown` goes 0 -> 1 occurrences in the rebuilt bundle. It was
absent entirely before, which is the point — that state had no representation
in the WebUI at all.

`npx eslint` on the component: 0 errors. Its 5 warnings sit at lines 9/15/19/24
(header attributes) and 69 (the props block); this change touches line 35 and
adds a methods block, so none of them are new.
@ntdatt812

Copy link
Copy Markdown
Contributor Author

Reworked per your note on #3699: rebased onto current develop and dropped glances/outputs/static/public/glances.js, so this is now the single .vue source file and nothing generated. The source diff is byte-identical to the one you already saw, and the bundle was the only thing these branches conflicted on.

@nicolargo nicolargo added this to the Glances 4.5.7 milestone Aug 29, 2026
@nicolargo
nicolargo merged commit 9859704 into nicolargo:develop Aug 29, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants