Repository navigation
fix(webui): match the AMP alert to the plugin's get_alert - #3696
Merged
Merged
Conversation
`plugin-amps.vue` disagreed with `AmpsPlugin.get_alert()`, which is the authority — the TUI calls it directly at `amps/__init__.py:114`. Two divergences: 1. An out-of-range process count rendered "careful"; the plugin returns WARNING. Those are different levels with different colours in style.scss (`.careful` #295183, `.warning` #5D4062), so an AMP outside its configured bounds was under-reported in the WebUI relative to the TUI. 2. With a count of 0 the WebUI returned "critical" for any non-null `countmin`, including `countmin=0`. The plugin defaults an unset bound to the observed count and then returns OK when `int(countmin) == 0`, so a configured minimum of zero means zero processes is fine. The plugin supports that value explicitly; the WebUI flagged it red. The range check itself already matched and is unchanged in behaviour — it is only rewritten to default the bounds the way the plugin does, rather than short-circuiting on null, so the two read alike. Not mirrored: the plugin's `nbprocess is None -> OK` guard. `count` is initialised to 0 in `amps/amp.py` and only ever assigned a real count, so that branch is unreachable from the API and adding it would be dead code. Evidence, since the WebUI has no JS test runner: in the rebuilt bundle the `careful` occurrences drop 18 -> 17. `npx eslint` on the component reports 0 errors (the two warnings, `vue/require-default-prop` and `vue/no-v-html`, are on untouched code and predate this change).
ntdatt812
force-pushed
the
fix/webui-amps-alert
branch
from
August 29, 2026 08:12
3f5c096 to
4ddfb11
Compare
Contributor
Author
|
Reworked per your note on #3699: rebased onto current |
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.
plugin-amps.vuecomputes its own decoration instead of reading the server's. It disagrees withAmpsPlugin.get_alert(), which is the authority — the TUI calls it directly atamps/__init__.py:114with the same three fields the component reads (count,countmin,countmax).1. Out-of-range count is WARNING, not CAREFUL
These are different levels with different colours in
style.scss:.careful#295183(blue).warning#5D4062(purple)So an AMP outside its configured bounds is under-reported in the WebUI relative to the TUI — the same monitor shows one severity in
glancesand a milder one in the browser.2.
countmin=0with a count of 0 rendered criticalThe plugin defaults an unset bound to the observed count and then:
So a configured minimum of 0 means zero processes is fine. That is a value the plugin supports deliberately — the
int(countmin) == 0branch exists for it — andconf/glances.confdocumentscountminas optional. The WebUI flagged it red instead.What did not change
The range check already matched. It is rewritten to default the bounds the way the plugin does rather than short-circuiting on
null, so the two now read alike, but the behaviour forcount > 0with either bound unset is identical.Deliberately not mirrored: the plugin's
if nbprocess is None: return 'OK'guard.countis initialised to0inglances/amps/amp.pyand only ever assigned a real count, so that branch is unreachable from the API — porting it would be dead code. Say the word if you would rather have it for symmetry.Evidence
The WebUI has no JS test runner, so the proof is the rebuilt bundle:
carefuloccurrences drop 18 → 17, andglances.jsgoes 686883 → 686922 bytes with only the component and the bundle changed.npx eslinton the component: 0 errors. The two warnings (vue/require-default-prop,vue/no-v-html) are on untouched code and predate this change.