[pve-devel] [PATCH manager 2/3] ui: resource tree: consistently apply the tooltip and 'setText' method
Dominik Csapak
d.csapak at proxmox.com
Thu Nov 23 09:25:41 CET 2023
'setText' is meant to augment the content of the tree node with
additional information and add markup so that the tooltips work
properly.
Previously this was overwritten for grouping types (e.g. nodes when in
the server view), but we want to put the elements through every time the
text gets set so the html markup is consistent. (E.g. without this, the
node text in the server view gets wrapped in a span, but only if a
relevant property of the node changes, for instance 'running').
To not mark all tree elements changed all the time, replace 'text' with
'name' in the 'changedFields' array, so they get only changed when the
name changes. The text changing from the backend can only happen for
guests anyway and the name field is the correct one for this.
Also change it so that the nodes get their tooltip also when they are
the grouping type in the server view.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/tree/ResourceTree.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 7b2934ae..8856bedf 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -135,7 +135,7 @@ Ext.define('PVE.tree.ResourceTree', {
},
getToolTip: function(info) {
- if (info.type === 'pool' || info.groupbyid !== undefined) {
+ if (info.type === 'pool' || (info.groupbyid !== undefined && info.type !== 'node')) {
return undefined;
}
@@ -167,10 +167,12 @@ Ext.define('PVE.tree.ResourceTree', {
if (info.groupbyid) {
info.text = info.groupbyid;
+ me.setText(info);
if (info.type === 'type') {
let defaults = PVE.tree.ResourceTree.typeDefaults[info.groupbyid];
if (defaults && defaults.text) {
info.text = defaults.text;
+ me.setText(info);
}
}
}
@@ -265,7 +267,7 @@ Ext.define('PVE.tree.ResourceTree', {
let stateid = 'rid';
const changedFields = [
- 'text', 'running', 'template', 'status', 'qmpstatus', 'hastate', 'lock', 'tags',
+ 'name', 'running', 'template', 'status', 'qmpstatus', 'hastate', 'lock', 'tags',
];
let updateTree = function() {
--
2.30.2
More information about the pve-devel
mailing list