[pve-devel] [PATCH manager v2 1/3] Add Storage Controller class

Emmanuel Kasper e.kasper at proxmox.com
Tue Oct 31 15:52:09 CET 2017


This controller will display the 'Max Backups' field only if the storage can
hold backups.

Signed-off-by: Emmanuel Kasper <e.kasper at proxmox.com>
---
 www/manager6/Makefile                  |  1 +
 www/manager6/controller/StorageEdit.js | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 www/manager6/controller/StorageEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index d2089618..d39bb49c 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -10,6 +10,7 @@ JSSRC= 				                 	\
 	button/ConsoleButton.js				\
 	button/Split.js					\
 	button/HelpButton.js				\
+	controller/StorageEdit.js			\
 	qemu/SendKeyMenu.js				\
 	qemu/CmdMenu.js					\
 	qemu/TemplateMenu.js				\
diff --git a/www/manager6/controller/StorageEdit.js b/www/manager6/controller/StorageEdit.js
new file mode 100644
index 00000000..fc090046
--- /dev/null
+++ b/www/manager6/controller/StorageEdit.js
@@ -0,0 +1,18 @@
+Ext.define('PVE.controller.StorageEdit', {
+    extend: 'Ext.app.ViewController',
+    alias: 'controller.storageEdit',
+    control: {
+	'field[name=content]': {
+	    change: function(field, value) {
+		var hasBackups = Ext.Array.contains(value, 'backup');
+		var maxfiles = this.lookupReference('maxfiles');
+
+		if (!hasBackups) {
+		// clear values which will never be submitted
+		    maxfiles.reset();
+		}
+		maxfiles.setDisabled(!hasBackups);
+	    }
+	}
+    }
+});
-- 
2.11.0




More information about the pve-devel mailing list