fix #6874: ui: node selectors: sort memory usage by percentage
The memory usage column of the node selector, used e.g. in the migration dialog, and of the HA node priority selector shows a percentage, but uses the raw 'mem' bytes as data index. Sorting by that column thus sorts by used bytes, which does not match the displayed values as soon as the nodes have a different amount of memory. Add a calculated 'memuse' field, like the resource store already has, and use it for the column. This also makes the percentage renderer receive a ratio here, like everywhere else, which allows dropping its bytes fallback in a follow-up. Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
1 parent
92f8784d03
commit
85bc6aeedb
2 files changed
+26
-4
No files matched your search
@@ -23,7 +23,17 @@ Ext.define('PVE.forms.NodePrioritySelector', {
|
||||
|
||||
store: {
|
||||
autoLoad: true,
|
||||
fields: ['node', 'cpu', 'mem', 'priority'],
|
||||
fields: [
|
||||
'node',
|
||||
'cpu',
|
||||
'mem',
|
||||
'priority',
|
||||
{
|
||||
name: 'memuse',
|
||||
type: 'number',
|
||||
calculate: PVE.Utils.calculate_mem_usage,
|
||||
},
|
||||
],
|
||||
proxy: {
|
||||
type: 'proxmox',
|
||||
url: '/api2/json/nodes',
|
||||
@@ -47,7 +57,7 @@ Ext.define('PVE.forms.NodePrioritySelector', {
|
||||
renderer: PVE.Utils.render_mem_usage_percent,
|
||||
sortable: true,
|
||||
width: 150,
|
||||
dataIndex: 'mem',
|
||||
dataIndex: 'memuse',
|
||||
},
|
||||
{
|
||||
header: gettext('CPU usage'),
|
||||
|
||||
Reference in new issue
Block a user