mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-28 13:25:22 +00:00
ui: qemu/HardwareView: fix CDRom permission checkss
There are several types of drives that use the same config keys. Most notably CDRom and regular VM disks (EFI and cloudinit exist as well). Since there is a dedicated permission for CDRom drives we need to check permissions in more detail, depending on what type of drive it actually is for things like the edit, remove and Add -> CDRom buttons. The permission check in the row definition itself which only checked for 'VM.Config.Disk' permissions (never_delete) had to be removed and finer grained checks added for the individual buttons. This also meant a bit of reshuffling in the checks what kind of disk the current one is. Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
96da47ba51
commit
a1e25c47f3
@ -225,7 +225,6 @@ Ext.define('PVE.qemu.HardwareView', {
|
||||
group: 10,
|
||||
iconCls: 'hdd-o',
|
||||
editor: 'PVE.qemu.HDEdit',
|
||||
never_delete: !caps.vms['VM.Config.Disk'],
|
||||
isOnStorageBus: true,
|
||||
header: gettext('Hard Disk') + ' (' + confid +')',
|
||||
cdheader: gettext('CD/DVD Drive') + ' (' + confid +')',
|
||||
@ -596,12 +595,21 @@ Ext.define('PVE.qemu.HardwareView', {
|
||||
const isEfi = key === 'efidisk0';
|
||||
|
||||
remove_btn.setDisabled(
|
||||
rec.data.delete || rowdef.never_delete === true || (isUnusedDisk && !diskCap),
|
||||
deleted ||
|
||||
row.never_delete ||
|
||||
(isCDRom && !cdromCap) ||
|
||||
(isDisk && !diskCap),
|
||||
);
|
||||
remove_btn.setText(isUsedDisk && !isCloudInit ? remove_btn.altText : remove_btn.defaultText);
|
||||
remove_btn.RESTMethod = isUnusedDisk ? 'POST':'PUT';
|
||||
|
||||
edit_btn.setDisabled(rec.data.delete || !rowdef.editor || isCloudInit || (!isCDRom && !diskCap));
|
||||
edit_btn.setDisabled(
|
||||
deleted ||
|
||||
!row.editor ||
|
||||
isCloudInit ||
|
||||
(isCDRom && !cdromCap) ||
|
||||
(isDisk && !diskCap),
|
||||
);
|
||||
|
||||
resize_btn.setDisabled(pending || !isUsedDisk || !diskCap);
|
||||
|
||||
@ -637,7 +645,7 @@ Ext.define('PVE.qemu.HardwareView', {
|
||||
{
|
||||
text: gettext('CD/DVD Drive'),
|
||||
iconCls: 'pve-itype-icon-cdrom',
|
||||
disabled: !caps.vms['VM.Config.Disk'],
|
||||
disabled: !caps.vms['VM.Config.CDROM'],
|
||||
handler: function() {
|
||||
let win = Ext.create('PVE.qemu.CDEdit', {
|
||||
url: '/api2/extjs/' + baseurl,
|
||||
|
Loading…
Reference in New Issue
Block a user