From: Jonas Theisen <j.theisen@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 1/5] ui: integrate new VM.Reboot permission
Date: Wed, 16 Sep 2026 11:06:55 +0200 [thread overview]
Message-ID: <20260916090715.72307-2-j.theisen@proxmox.com> (raw)
In-Reply-To: <20260916090715.72307-1-j.theisen@proxmox.com>
To allow users with this restriced VM PowerMgmt permission
to still intuitively use the interface this commit rearranges
and introduces a few new UI elements.
If the user only has the VM.Reboot permission:
* The default Shutdown Button is replaced by a Reboot button to
not hide the first available functino to the user behind
a dropdown menu.
* The Start button is hidden as long as the user does not have
the VM.PowerMgmt permission.
* The new Reboot button is updated similar to the Shutdown and
Start button if the guest state changes.
For regular users with VM.PowerMgmt permission this should not
change anything.
Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
www/manager6/qemu/Config.js | 51 +++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 8 deletions(-)
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 842d35de..b22b52fe 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -57,7 +57,7 @@ Ext.define('PVE.qemu.Config', {
var startBtn = Ext.create('Ext.Button', {
text: gettext('Start'),
disabled: !caps.vms['VM.PowerMgmt'] || running,
- hidden: template,
+ hidden: !caps.vms['VM.PowerMgmt'] || template,
handler: function () {
vm_command('start');
},
@@ -153,7 +153,7 @@ Ext.define('PVE.qemu.Config', {
var shutdownBtn = Ext.create('PVE.button.Split', {
text: gettext('Shutdown'),
disabled: !caps.vms['VM.PowerMgmt'] || !running,
- hidden: template,
+ hidden: !caps.vms['VM.PowerMgmt'] || template,
confirmMsg: PVE.Utils.formatGuestTaskConfirmation('qmshutdown', vmid, vm.name),
handler: function () {
vm_command('shutdown');
@@ -228,6 +228,35 @@ Ext.define('PVE.qemu.Config', {
iconCls: 'fa fa-power-off',
});
+ var rebootBtn = Ext.create('PVE.button.Split', {
+ text: gettext('Reboot'),
+ disabled: !running || !!caps.vms['VM.PowerMgmt'] || !caps.vms['VM.Reboot'],
+ hidden: !!caps.vms['VM.PowerMgmt'] || !caps.vms['VM.Reboot'],
+ tooltip: Ext.String.format(
+ gettext('Shutdown, apply pending changes and reboot {0}'),
+ 'VM',
+ ),
+ confirmMsg: PVE.Utils.formatGuestTaskConfirmation('qmreboot', vmid, vm.name),
+ handler: function () {
+ vm_command('reboot');
+ },
+ iconCls: 'fa fa-refresh',
+ menu: {
+ items: [
+ {
+ text: gettext('Reset'),
+ disabled: !(caps.vms['VM.PowerMgmt'] || caps.vms['VM.Reboot']),
+ tooltip: Ext.String.format(gettext('Reset {0} immediately'), 'VM'),
+ confirmMsg: PVE.Utils.formatGuestTaskConfirmation('qmreset', vmid, vm.name),
+ handler: function () {
+ vm_command('reset');
+ },
+ iconCls: 'fa fa-bolt',
+ },
+ ],
+ },
+ });
+
var consoleBtn = Ext.create('PVE.button.ConsoleButton', {
disabled: !caps.vms['VM.Console'],
hidden: template,
@@ -287,6 +316,7 @@ Ext.define('PVE.qemu.Config', {
resumeBtn,
startBtn,
shutdownBtn,
+ rebootBtn,
migrateBtn,
consoleBtn,
moreBtn,
@@ -486,12 +516,14 @@ Ext.define('PVE.qemu.Config', {
var resume = ['prelaunch', 'paused', 'suspended'].indexOf(qmpstatus) !== -1;
- if (resume || lock === 'suspended') {
- startBtn.setVisible(false);
- resumeBtn.setVisible(true);
- } else {
- startBtn.setVisible(true);
- resumeBtn.setVisible(false);
+ if (caps.vms['VM.PowerMgmt']) {
+ if (resume || lock === 'suspended') {
+ startBtn.setVisible(false);
+ resumeBtn.setVisible(true);
+ } else {
+ startBtn.setVisible(true);
+ resumeBtn.setVisible(false);
+ }
}
consoleBtn.setEnableSpice(spice);
@@ -504,6 +536,9 @@ Ext.define('PVE.qemu.Config', {
startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || template || guest_running);
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
+
+ rebootBtn.setDisabled(!caps.vms['VM.Reboot'] || status !== 'running');
+
me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
consoleBtn.setDisabled(template);
--
2.47.3
next prev parent reply other threads:[~2026-09-16 9:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 9:06 [PATCH access-control/docs/manager/qemu-server 0/5] Add new permission VM.Reboot Jonas Theisen
2026-09-16 9:06 ` Jonas Theisen [this message]
2026-09-16 9:06 ` [PATCH manager 2/5] ui: align VM context menu to permissions Jonas Theisen
2026-09-16 9:06 ` [PATCH access-control 3/5] acl: Add new privilege VM.Reboot Jonas Theisen
2026-09-16 9:06 ` [PATCH qemu-server 4/5] api: Integrate " Jonas Theisen
2026-09-16 9:06 ` [PATCH docs 5/5] pveum: VM permissions: add VM.Reboot Jonas Theisen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916090715.72307-2-j.theisen@proxmox.com \
--to=j.theisen@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.