[pve-devel] [PATCH novnc] don't require confirmation for starting a stopped vm from button

Dominik Csapak d.csapak at proxmox.com
Wed Mar 9 09:26:53 CET 2022


when the vm is stopped and the user clicks on the 'start now' button,
there really is no need for confirmation again

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 ...ow-start-button-on-not-running-vm-ct.patch | 26 ++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/debian/patches/0018-show-start-button-on-not-running-vm-ct.patch b/debian/patches/0018-show-start-button-on-not-running-vm-ct.patch
index 1e9e73d..162acc4 100644
--- a/debian/patches/0018-show-start-button-on-not-running-vm-ct.patch
+++ b/debian/patches/0018-show-start-button-on-not-running-vm-ct.patch
@@ -13,22 +13,40 @@ colors were adapted
 
 Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
 ---
- app/pve.js         | 34 +++++++++++++++++++++++++--
+ app/pve.js         | 38 ++++++++++++++++++++++++++----
  app/styles/pve.css | 58 ++++++++++++++++++++++++++++++++++++++++++++++
  vnc.html           |  9 +++++++
- 3 files changed, 99 insertions(+), 2 deletions(-)
+ 3 files changed, 101 insertions(+), 4 deletions(-)
 
 diff --git a/app/pve.js b/app/pve.js
-index 583a406..8144fdb 100644
+index 583a406..3eeaa47 100644
 --- a/app/pve.js
 +++ b/app/pve.js
+@@ -231,7 +231,7 @@ PVEUI.prototype = {
+ 
+     },
+ 
+-    pve_vm_command: function(cmd, params, reload) {
++    pve_vm_command: function(cmd, params, reload, mustConfirm = true) {
+ 	var me = this;
+ 	var baseUrl;
+ 	var confirmMsg = "";
+@@ -255,7 +255,7 @@ PVEUI.prototype = {
+ 
+ 	confirmMsg = confirmMsg.replace('{0}', me.vmid);
+ 
+-	if (confirmMsg !== "" && confirm(confirmMsg) !== true) {
++	if (confirmMsg !== "" && mustConfirm && confirm(confirmMsg) !== true) {
+ 	    return;
+ 	}
+ 
 @@ -320,6 +320,11 @@ PVEUI.prototype = {
  		.classList.add('pve_hidden');
  	}
  
 +        document.getElementById("pve_start_button")
 +            .addEventListener('click', function() {
-+		me.pve_vm_command('start');
++		me.pve_vm_command('start', {}, undefined, false);
 +	    });
 +
  	// add command logic
-- 
2.30.2






More information about the pve-devel mailing list