Pool View

LnxBil

Distinguished Member
Feb 21, 2015
9,531
1,727
273
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.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!