[pve-devel] [PATCH widget-toolkit 1/4] window/edit: add option to disable reset button

Aaron Lauterer a.lauterer at proxmox.com
Tue Aug 25 17:14:23 CEST 2020


Sometimes the reset button does not make sense and the isCreate option
does not fit as well because with it, the submit button will be enabled
right away instead of waiting for the form to be valid.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

This helps to reuse the PVE.window.Edit component in a modern viewModel
and controller way instead of building it all by hand the old way with a
large initComponent method.

A possible candidate for refactoring after this would be the
qemu/HDMove.js component.

 src/window/Edit.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/window/Edit.js b/src/window/Edit.js
index 2dfab19..9ca314d 100644
--- a/src/window/Edit.js
+++ b/src/window/Edit.js
@@ -22,6 +22,9 @@ Ext.define('Proxmox.window.Edit', {
     // set to true if you want an Remove button (instead of Create)
     isRemove: false,
 
+    // set to false, if you don't want the reset button present
+    showReset: true,
+
     // custom submitText
     submitText: undefined,
 
@@ -326,7 +329,7 @@ Ext.define('Proxmox.window.Edit', {
 	    me.title = Proxmox.Utils.dialog_title(me.subject, me.isCreate, me.isAdd);
 	}
 
-	if (me.isCreate) {
+	if (me.isCreate || !me.showReset) {
 		me.buttons = [submitBtn];
 	} else {
 		me.buttons = [submitBtn, resetBtn];
-- 
2.20.1





More information about the pve-devel mailing list