Pool View

LnxBil

Distinguished Member
Feb 21, 2015
10,208
2,298
303
Saarland, Germany
Hi all,

Is it possible to set the initial view to 'pool view' on a per user basis? Or at least change the default to pool view. For most 'ordinary' users would it be best in my opinion to start there - only seeing pools with vm members.

Best regards
Andreas
 
Hi

I found a way to limit the "view" access.
In /usr/share/pve-manager/ext4/pvemanagerlib.js change the following lines.
Only root will see Server View, Folder View, Storage View and Pool View.

I'm sure there is a more elegant way, but I'm not a JavaScript expert ;)
(if you log out root und login some other user, you have to hit the reload button on your browser to make the views disappear - and vice versa)



from

var default_views = {

server: {
text: gettext('Server View'),
groups: ['node']
},
folder: {
text: gettext('Folder View'),
groups: ['type']
},
storage: {
text: gettext('Storage View'),
groups: ['node'],
filterfn: function(node) {
return node.data.type === 'storage' || node.data.type === 'node';
}
},
pool: {
text: gettext('Pool View'),
groups: ['pool'],
// Pool View only lists VMs and Containers
filterfn: function(node) {
return node.data.type === 'qemu' || node.data.type === 'lxc' || node.data.type === 'openvz' ||
node.data.type === 'pool';
}
}
};

to

if (PVE.UserName === 'root@pam'){
var default_views = {

server: {
text: gettext('Server View'),
groups: ['node']
},
folder: {
text: gettext('Folder View'),
groups: ['type']
},
storage: {
text: gettext('Storage View'),
groups: ['node'],
filterfn: function(node) {
return node.data.type === 'storage' || node.data.type === 'node';
}
},
pool: {
text: gettext('Pool View'),
groups: ['pool'],
// Pool View only lists VMs and Containers
filterfn: function(node) {
return node.data.type === 'qemu' || node.data.type === 'lxc' || node.data.type === 'openvz' ||
node.data.type === 'pool';
}
}
};
}

else {
var default_views = {

pool: {
text: gettext('Pool View'),
groups: ['pool'],
// Pool View only lists VMs and Containers
filterfn: function(node) {
return node.data.type === 'qemu' || node.data.type === 'lxc' || node.data.type === 'openvz' ||
node.data.type === 'pool';
}
}
};
}
 
To do this in Proxmox VE 8.x is even simpler:

nano /usr/share/pve-manager/js/pvemanagerlib.js

After that, you should use Control + W to search for the "Pool View" code block and comment it out as you can see below:

let default_views = {
/* server: {
text: gettext('Server View'),
groups: ['node'],
},
folder: {
text: gettext('Folder View'),
groups: ['type'],
},
*/ pool: {
text: gettext('Pool View'),
groups: ['pool'],
// Pool View only lists VMs and Containers
filterfn: ({ data }) => data.type === 'qemu' || data.type === 'lxc' || data.type === 'pool',
},
};

After that, just use Control + O to save, Control + X to exit and finally, in the browser use Control + F5 to refresh the page and check if it worked.