[pve-devel] [PATCH manager 2/3] add defaultButton and focus to snapshot window

Dominik Csapak d.csapak at proxmox.com
Fri Jun 2 10:55:17 CEST 2017


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/Snapshot.js  | 7 +++++++
 www/manager6/qemu/Snapshot.js | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/www/manager6/lxc/Snapshot.js b/www/manager6/lxc/Snapshot.js
index 0014b224..f09630c1 100644
--- a/www/manager6/lxc/Snapshot.js
+++ b/www/manager6/lxc/Snapshot.js
@@ -3,6 +3,12 @@ Ext.define('PVE.window.LxcSnapshot', {
 
     resizable: false,
 
+    // needed for finding the reference to submitbutton
+    // because we do not have a controller
+    referenceHolder: true,
+    defaultButton: 'submitbutton',
+    defaultFocus: 'field',
+
     take_snapshot: function(snapname, descr, vmstate) {
 	var me = this;
 	var params = { snapname: snapname };
@@ -133,6 +139,7 @@ Ext.define('PVE.window.LxcSnapshot', {
 	    me.title ="VM " + me.vmid + ': ' + gettext('Take Snapshot');
 	    submitBtn = Ext.create('Ext.Button', {
 		text: gettext('Take Snapshot'),
+		reference: 'submitbutton',
 		handler: function() {
 		    if (form.isValid()) {
 			var values = form.getValues();
diff --git a/www/manager6/qemu/Snapshot.js b/www/manager6/qemu/Snapshot.js
index 3c12888f..bee26eb2 100644
--- a/www/manager6/qemu/Snapshot.js
+++ b/www/manager6/qemu/Snapshot.js
@@ -3,6 +3,12 @@ Ext.define('PVE.window.Snapshot', {
 
     resizable: false,
 
+    // needed for finding the reference to submitbutton
+    // because we do not have a controller
+    referenceHolder: true,
+    defaultButton: 'submitbutton',
+    defaultFocus: 'field',
+
     take_snapshot: function(snapname, descr, vmstate) {
 	var me = this;
 	var params = { snapname: snapname, vmstate: vmstate ? 1 : 0 };
@@ -143,6 +149,7 @@ Ext.define('PVE.window.Snapshot', {
 	    me.title ="VM " + me.vmid + ': ' + gettext('Take Snapshot');
 	    submitBtn = Ext.create('Ext.Button', {
 		text: gettext('Take Snapshot'),
+		reference: 'submitbutton',
 		handler: function() {
 		    if (form.isValid()) {
 			var values = form.getValues();
-- 
2.11.0





More information about the pve-devel mailing list