Skip to content

fix(webui): colour each DISK I/O column by the direction it prints - #3717

Merged
nicolargo merged 1 commit into
nicolargo:developfrom
ntdatt812:fix/webui-diskio-swapped-alerts
Sep 10, 2026
Merged

nicolargo merged 1 commit into
nicolargo:developfrom
ntdatt812:fix/webui-diskio-swapped-alerts

Conversation

@ntdatt812

Copy link
Copy Markdown
Contributor

In the WebUI's DISK I/O table the read and write columns wear each other's alert.

disks() builds each row's values like this (plugin-diskio.vue:79-86):

bitrate: {
  txps: bytes(diskioData["read_bytes_rate_per_sec"]),
  rxps: bytes(diskioData["write_bytes_rate_per_sec"]),
},

txps holds the read rate and rxps the write rate — the keys read the other way round, which is the whole trap. The cells then did:

column prints decoration it asked for
Rps bitrate.txps (read) write_bytes_rate_per_sec
Wps bitrate.rxps (write) read_bytes_rate_per_sec
ms/opR latency.txps (read) write_latency
ms/opW latency.rxps (write) read_latency

update_views() computes the two directions separately — get_alert(..., header='rx') and header='tx' for the bitrates, rx_latency/tx_latency for the latencies — so these are four distinct values, not one shared style. A disk saturated by reads therefore left the read column plain and lit up the write column instead.

The curses UI is not affected: msg_curse pairs each printed value with its own field (read_bytes with the read rate, write_bytes with the write rate), so the two interfaces disagreed.

The change swaps the four getDecoration field names so each cell asks for the field it prints, and names the txps/rxps trap in the one place those keys are assigned, since that naming is what makes the mistake easy to repeat.

Verification

npx eslint js/components/plugin-diskio.vue reports the same 5 warnings before and after the change (4 × vue/first-attribute-linebreak, 1 × vue/require-default-prop, all pre-existing) and 0 errors. There is no test runner under glances/outputs/static — only lint — so there is nothing to add a unit test to; the argument is the field mapping above, which is checkable by reading disks() next to the four cells.

The Rps cell prints `disk.bitrate.txps` and took the decoration of
`write_bytes_rate_per_sec`; the Wps cell prints `rxps` and took
`read_bytes_rate_per_sec`. `disks()` fills txps from read_bytes_rate_per_sec
and rxps from write_bytes_rate_per_sec, so the two columns wore each other's
alert. The latency pair is crossed the same way.

update_views() gives the two directions separate alerts (`rx`/`tx` headers,
and `rx_latency`/`tx_latency`), so a disk saturated by reads lit up the write
column and left the read one plain. The curses UI already pairs each value
with its own field.

Also names the txps/rxps trap in the one place it is introduced.
@nicolargo
nicolargo merged commit 78f064a into nicolargo:develop Sep 10, 2026
18 of 19 checks passed
@nicolargo nicolargo added this to the Glances 4.5.7 milestone Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants