[pve-devel] [PATCH manager 2/4] PVEResource store: respect defaulValue of elements

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 15 15:46:05 CET 2017


If we explicitly set a fields defaultValue we really want it in the
Model.

Also needed for a further patch

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/data/ResourceStore.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/www/manager6/data/ResourceStore.js b/www/manager6/data/ResourceStore.js
index a648ebd..910480c 100644
--- a/www/manager6/data/ResourceStore.js
+++ b/www/manager6/data/ResourceStore.js
@@ -247,7 +247,11 @@ Ext.define('PVE.data.ResourceStore', {
 	var fieldNames = [];
 	Ext.Object.each(field_defaults, function(key, value) {
 	    if (!Ext.isDefined(value.convert) && !Ext.isDefined(value.calculate)) {
-		fields.push({name: key, type: value.type});
+		var field = {name: key, type: value.type};
+		if (Ext.isDefined(value.defaultValue)) {
+		    field.defaultValue = value.defaultValue;
+		}
+		fields.push(field);
 		fieldNames.push(key);
 	    } else if (key === 'text' || key === 'running') {
 		fields.push({name: key, type: value.type, convert: value.convert});
-- 
2.1.4





More information about the pve-devel mailing list