pve-manager/www/manager6/form/PCISelector.js
Dominik Csapak 7becf34fdd ui: improve permission handling for hardware
qemu/HardwareView:

with the new Hardware privileges, we want to adapt a few places where
we now allow to show the add/edit window with those permissions.

form/{PCI,USB}Selector:

increase the minHeight property of the PCI/USBSelector, so that
the user can see the error message if he has not enough permissions.

data/PermPathStore:

add '/hardware' to the list of acl paths

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-06-19 08:30:53 +02:00

93 lines
1.6 KiB
JavaScript

Ext.define('PVE.form.PCISelector', {
extend: 'Proxmox.form.ComboGrid',
xtype: 'pvePCISelector',
store: {
fields: ['id', 'vendor_name', 'device_name', 'vendor', 'device', 'iommugroup', 'mdev'],
filterOnLoad: true,
sorters: [
{
property: 'id',
direction: 'ASC',
},
],
},
autoSelect: false,
valueField: 'id',
displayField: 'id',
// can contain a load callback for the store
// useful to determine the state of the IOMMU
onLoadCallBack: undefined,
listConfig: {
minHeight: 80,
width: 800,
columns: [
{
header: 'ID',
dataIndex: 'id',
width: 100,
},
{
header: gettext('IOMMU Group'),
dataIndex: 'iommugroup',
renderer: v => v === -1 ? '-' : v,
width: 75,
},
{
header: gettext('Vendor'),
dataIndex: 'vendor_name',
flex: 2,
},
{
header: gettext('Device'),
dataIndex: 'device_name',
flex: 6,
},
{
header: gettext('Mediated Devices'),
dataIndex: 'mdev',
flex: 1,
renderer: function(val) {
return Proxmox.Utils.format_boolean(!!val);
},
},
],
},
setNodename: function(nodename) {
var me = this;
if (!nodename || me.nodename === nodename) {
return;
}
me.nodename = nodename;
me.store.setProxy({
type: 'proxmox',
url: '/api2/json/nodes/' + me.nodename + '/hardware/pci',
});
me.store.load();
},
initComponent: function() {
var me = this;
var nodename = me.nodename;
me.nodename = undefined;
me.callParent();
if (me.onLoadCallBack !== undefined) {
me.mon(me.getStore(), 'load', me.onLoadCallBack);
}
me.setNodename(nodename);
},
});