mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-28 22:07:01 +00:00
gui: let users add PCI devices
this enables the gui part to enable the user to add a pci device via the gui we disable the button after 4 devices, since that is the maximum in the backend Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
c59fb4eef5
commit
25a1063ac7
@ -219,6 +219,7 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
order: i,
|
order: i,
|
||||||
tdCls: 'pve-itype-icon-pci',
|
tdCls: 'pve-itype-icon-pci',
|
||||||
never_delete: caps.nodes['Sys.Console'] ? false : true,
|
never_delete: caps.nodes['Sys.Console'] ? false : true,
|
||||||
|
editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.PCIEdit' : undefined,
|
||||||
header: gettext('PCI Device') + ' (' + confid + ')'
|
header: gettext('PCI Device') + ' (' + confid + ')'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -501,11 +502,14 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
// see that there is already one
|
// see that there is already one
|
||||||
efidisk_menuitem.setDisabled(me.rstore.getData().map.efidisk0 !== undefined);
|
efidisk_menuitem.setDisabled(me.rstore.getData().map.efidisk0 !== undefined);
|
||||||
// en/disable usb add button
|
// en/disable usb add button
|
||||||
var count = 0;
|
var usbcount = 0;
|
||||||
|
var pcicount = 0;
|
||||||
var hasCloudInit = false;
|
var hasCloudInit = false;
|
||||||
me.rstore.getData().items.forEach(function(item){
|
me.rstore.getData().items.forEach(function(item){
|
||||||
if (/^usb\d+/.test(item.id)) {
|
if (/^usb\d+/.test(item.id)) {
|
||||||
count++;
|
usbcount++;
|
||||||
|
} else if (/^hostpci\d+/.test(item.id)) {
|
||||||
|
pcicount++;
|
||||||
}
|
}
|
||||||
if (!hasCloudInit && /vm-.*-cloudinit/.test(item.data.value)) {
|
if (!hasCloudInit && /vm-.*-cloudinit/.test(item.data.value)) {
|
||||||
hasCloudInit = true;
|
hasCloudInit = true;
|
||||||
@ -515,7 +519,8 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
// heuristic only for disabling some stuff, the backend has the final word.
|
// heuristic only for disabling some stuff, the backend has the final word.
|
||||||
var noSysConsolePerm = !caps.nodes['Sys.Console'];
|
var noSysConsolePerm = !caps.nodes['Sys.Console'];
|
||||||
|
|
||||||
me.down('#addusb').setDisabled(noSysConsolePerm || (count >= 5));
|
me.down('#addusb').setDisabled(noSysConsolePerm || (usbcount >= 5));
|
||||||
|
me.down('#addpci').setDisabled(noSysConsolePerm || (pcicount >= 4));
|
||||||
me.down('#addci').setDisabled(noSysConsolePerm || hasCloudInit);
|
me.down('#addci').setDisabled(noSysConsolePerm || hasCloudInit);
|
||||||
|
|
||||||
if (!rec) {
|
if (!rec) {
|
||||||
@ -618,6 +623,20 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
win.show();
|
win.show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: gettext('PCI Device'),
|
||||||
|
itemId: 'addpci',
|
||||||
|
iconCls: 'pve-itype-icon-pci',
|
||||||
|
disabled: !caps.nodes['Sys.Console'],
|
||||||
|
handler: function() {
|
||||||
|
var win = Ext.create('PVE.qemu.PCIEdit', {
|
||||||
|
url: '/api2/extjs/' + baseurl,
|
||||||
|
pveSelNode: me.pveSelNode
|
||||||
|
});
|
||||||
|
win.on('destroy', reload);
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: gettext('Serial Port'),
|
text: gettext('Serial Port'),
|
||||||
itemId: 'addserial',
|
itemId: 'addserial',
|
||||||
|
Loading…
Reference in New Issue
Block a user