[pve-devel] [PATCH pve-manager 1/2] fix Timezones window

Emmanuel Kasper e.kasper at proxmox.com
Wed Mar 2 11:26:42 CET 2016


Ext.regModel() was removed from the framework
rewrite the store in declarative style with inline data
---
 www/manager6/data/TimezoneStore.js | 34 ++++++++--------------------------
 www/manager6/node/TimeEdit.js      |  2 +-
 2 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/www/manager6/data/TimezoneStore.js b/www/manager6/data/TimezoneStore.js
index f00cc2f..6de132e 100644
--- a/www/manager6/data/TimezoneStore.js
+++ b/www/manager6/data/TimezoneStore.js
@@ -1,8 +1,12 @@
+Ext.define('Timezone', {
+    extend: 'Ext.data.Model',
+    fields: ['zone']
+});
+
 Ext.define('PVE.data.TimezoneStore', {
     extend: 'Ext.data.Store',
-
-    statics: {
-	timezones: [
+    model: 'Timezone',
+    data: [
 	    ['Africa/Abidjan'],
 	    ['Africa/Accra'],
 	    ['Africa/Addis_Ababa'],
@@ -410,27 +414,5 @@ Ext.define('PVE.data.TimezoneStore', {
 	    ['Pacific/Tongatapu'],
 	    ['Pacific/Wake'],
 	    ['Pacific/Wallis']
-	]
-    },
-
-    constructor: function(config) {
-	var me = this;
-
-	config = config || {};
-
-	Ext.regModel('Timezone', {
-	    fields: ['zone'],
-	    proxy: {
-		type: 'memory',
-		reader: 'array'
-	    }
-	});
-
-	Ext.apply(config, {
-	    model: 'Timezone',
-	    data: PVE.data.TimezoneStore.timezones
-	});
-
-	me.callParent([config]);	
-    }
+	],
 });
\ No newline at end of file
diff --git a/www/manager6/node/TimeEdit.js b/www/manager6/node/TimeEdit.js
index 103ee40..62d3c21 100644
--- a/www/manager6/node/TimeEdit.js
+++ b/www/manager6/node/TimeEdit.js
@@ -22,7 +22,7 @@ Ext.define('PVE.node.TimeEdit', {
 		fieldLabel: gettext('Time zone'),
 		name: 'timezone',
 		queryMode: 'local',
-		store: new PVE.data.TimezoneStore(),
+		store: Ext.create('PVE.data.TimezoneStore'),
 		valueField: 'zone',
 		displayField: 'zone',
 		triggerAction: 'all',
-- 
2.1.4





More information about the pve-devel mailing list