mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-02 21:00:22 +00:00
ui: tree/ResourceTree: show Tags in tree
and update the treenodes when the tags change. since we change the vm node text (which we pass through to the config panel), we have to change how we generate the text there slightly (otherwise that would include the rendered tags) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
d70be8cd73
commit
366558a79d
@ -293,6 +293,12 @@ Ext.define('PVE.data.ResourceStore', {
|
||||
sortable: true,
|
||||
width: 100,
|
||||
},
|
||||
tags: {
|
||||
header: gettext('Tags'),
|
||||
type: 'string',
|
||||
hidden: true,
|
||||
sortable: true,
|
||||
},
|
||||
};
|
||||
|
||||
let fields = [];
|
||||
|
@ -206,8 +206,10 @@ Ext.define('PVE.lxc.Config', {
|
||||
},
|
||||
});
|
||||
|
||||
let vm_text = `${vm.vmid} (${vm.name})`;
|
||||
|
||||
Ext.apply(me, {
|
||||
title: Ext.String.format(gettext("Container {0} on node '{1}'"), vm.text, nodename),
|
||||
title: Ext.String.format(gettext("Container {0} on node '{1}'"), vm_text, nodename),
|
||||
hstateid: 'lxctab',
|
||||
tbarSpacing: false,
|
||||
tbar: [statusTxt, tagsContainer, '->', startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn],
|
||||
|
@ -242,8 +242,10 @@ Ext.define('PVE.qemu.Config', {
|
||||
},
|
||||
});
|
||||
|
||||
let vm_text = `${vm.vmid} (${vm.name})`;
|
||||
|
||||
Ext.apply(me, {
|
||||
title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm.text, nodename),
|
||||
title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm_text, nodename),
|
||||
hstateid: 'kvmtab',
|
||||
tbarSpacing: false,
|
||||
tbar: [statusTxt, tagsContainer, '->', resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn],
|
||||
|
@ -5,6 +5,8 @@ Ext.define('PVE.tree.ResourceTree', {
|
||||
extend: 'Ext.tree.TreePanel',
|
||||
alias: ['widget.pveResourceTree'],
|
||||
|
||||
userCls: 'proxmox-tags-circle',
|
||||
|
||||
statics: {
|
||||
typeDefaults: {
|
||||
node: {
|
||||
@ -114,6 +116,8 @@ Ext.define('PVE.tree.ResourceTree', {
|
||||
}
|
||||
}
|
||||
|
||||
info.text += PVE.Utils.renderTags(info.tags, PVE.Utils.tagOverrides);
|
||||
|
||||
info.text = status + info.text;
|
||||
},
|
||||
|
||||
@ -226,6 +230,10 @@ Ext.define('PVE.tree.ResourceTree', {
|
||||
|
||||
let stateid = 'rid';
|
||||
|
||||
const changedFields = [
|
||||
'text', 'running', 'template', 'status', 'qmpstatus', 'hastate', 'lock', 'tags',
|
||||
];
|
||||
|
||||
let updateTree = function() {
|
||||
store.suspendEvents();
|
||||
|
||||
@ -261,7 +269,7 @@ Ext.define('PVE.tree.ResourceTree', {
|
||||
}
|
||||
|
||||
// tree item has been updated
|
||||
for (const field of ['text', 'running', 'template', 'status', 'qmpstatus', 'hastate', 'lock']) {
|
||||
for (const field of changedFields) {
|
||||
if (item.data[field] !== olditem.data[field]) {
|
||||
changed = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user