[pve-devel] [RFC manager 05/28] use RRDTypeSelector from widget toolkit

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 11 16:25:54 CET 2017


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/Makefile                |  1 -
 www/manager6/data/RRDStore.js        |  2 +-
 www/manager6/form/RRDTypeSelector.js | 49 ------------------------------------
 www/manager6/lxc/Summary.js          |  2 +-
 www/manager6/node/Summary.js         |  2 +-
 www/manager6/panel/RRDView.js        |  2 +-
 www/manager6/qemu/Summary.js         |  2 +-
 www/manager6/storage/Summary.js      |  2 +-
 8 files changed, 6 insertions(+), 56 deletions(-)
 delete mode 100644 www/manager6/form/RRDTypeSelector.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index a5ebf1af..df7329e0 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -29,7 +29,6 @@ JSSRC= 				                 	\
 	form/VLanField.js				\
 	form/TextField.js				\
 	form/IntegerField.js				\
-	form/RRDTypeSelector.js				\
 	form/ComboGrid.js				\
 	form/KVComboBox.js				\
 	form/Boolean.js					\
diff --git a/www/manager6/data/RRDStore.js b/www/manager6/data/RRDStore.js
index f9f80685..3caf0f4d 100644
--- a/www/manager6/data/RRDStore.js
+++ b/www/manager6/data/RRDStore.js
@@ -89,7 +89,7 @@ Ext.define('PVE.data.RRDStore', {
 	    throw "no rrdurl specified";
 	}
 
-	var stateid = 'pveRRDTypeSelection';
+	var stateid = 'proxmoxRRDTypeSelection';
 	var sp = Ext.state.Manager.getProvider();
 	var stateinit = sp.get(stateid);
 
diff --git a/www/manager6/form/RRDTypeSelector.js b/www/manager6/form/RRDTypeSelector.js
deleted file mode 100644
index a912c710..00000000
--- a/www/manager6/form/RRDTypeSelector.js
+++ /dev/null
@@ -1,49 +0,0 @@
-Ext.define('PVE.form.RRDTypeSelector', {
-    extend: 'Ext.form.field.ComboBox',
-    alias: ['widget.pveRRDTypeSelector'],
-
-    displayField: 'text',
-    valueField: 'id',
-    editable: false,
-    queryMode: 'local',
-    value: 'hour',
-    stateEvents: [ 'select' ],
-    stateful: true,
-    stateId: 'pveRRDTypeSelection',
-    store: {
-	type: 'array',
-	fields: [ 'id', 'timeframe', 'cf', 'text' ],
-	data : [
-		[ 'hour', 'hour', 'AVERAGE', "Hour (average)" ],
-		[ 'hourmax', 'hour', 'MAX', "Hour (max)" ],
-		[ 'day', 'day', 'AVERAGE', "Day (average)" ],
-		[ 'daymax', 'day', 'MAX', "Day (max)" ],
-		[ 'week', 'week', 'AVERAGE', "Week (average)" ],
-		[ 'weekmax', 'week', 'MAX', "Week (max)" ],
-		[ 'month', 'month', 'AVERAGE', "Month (average)" ],
-		[ 'monthmax', 'month', 'MAX', "Month (max)" ],
-		[ 'year', 'year', 'AVERAGE', "Year (average)" ],
-		[ 'yearmax', 'year', 'MAX', "Year (max)" ]
-	    ]
-	},
-// save current selection in the state Provider so RRDView can read it
-    getState: function() {
-	var ind = this.getStore().findExact('id', this.getValue());
-	var rec = this.getStore().getAt(ind);
-	if (!rec) {
-	    return;
-	}
-	return {
-	    id: rec.data.id,
-	    timeframe: rec.data.timeframe,
-	    cf: rec.data.cf
-	};
-    },
-// set selection based on last saved state
-    applyState : function(state) {
-	if (state && state.id) {
-	    this.setValue(state.id);
-	}
-    }
-});
-
diff --git a/www/manager6/lxc/Summary.js b/www/manager6/lxc/Summary.js
index e9292b2b..509ef576 100644
--- a/www/manager6/lxc/Summary.js
+++ b/www/manager6/lxc/Summary.js
@@ -73,7 +73,7 @@ Ext.define('PVE.lxc.Summary', {
 	    });
 
 	    Ext.apply(me, {
-		tbar: [ '->' , { xtype: 'pveRRDTypeSelector' } ],
+		tbar: [ '->' , { xtype: 'proxmoxRRDTypeSelector' } ],
 		plugins: {
 		    ptype: 'lazyitems',
 		    items: [
diff --git a/www/manager6/node/Summary.js b/www/manager6/node/Summary.js
index 6e67b74a..0d2d77cd 100644
--- a/www/manager6/node/Summary.js
+++ b/www/manager6/node/Summary.js
@@ -92,7 +92,7 @@ Ext.define('PVE.node.Summary', {
 	});
 
 	Ext.apply(me, {
-	    tbar: [version_btn, '->', { xtype: 'pveRRDTypeSelector' } ],
+	    tbar: [version_btn, '->', { xtype: 'proxmoxRRDTypeSelector' } ],
 	    plugins: {
 		ptype: 'lazyitems',
 		items: [
diff --git a/www/manager6/panel/RRDView.js b/www/manager6/panel/RRDView.js
index 9fd3c47a..fb4f2f4f 100644
--- a/www/manager6/panel/RRDView.js
+++ b/www/manager6/panel/RRDView.js
@@ -13,7 +13,7 @@ Ext.define('PVE.panel.RRDView', {
 	    throw "no rrdurl specified";
 	}
 
-	var stateid = 'pveRRDTypeSelection';
+	var stateid = 'proxmoxRRDTypeSelection';
 	var sp = Ext.state.Manager.getProvider();
 	var stateinit = sp.get(stateid);
 
diff --git a/www/manager6/qemu/Summary.js b/www/manager6/qemu/Summary.js
index e0838b62..dfb14951 100644
--- a/www/manager6/qemu/Summary.js
+++ b/www/manager6/qemu/Summary.js
@@ -80,7 +80,7 @@ Ext.define('PVE.qemu.Summary', {
 	    });
 
 	    Ext.apply(me, {
-		tbar: [ '->', { xtype: 'pveRRDTypeSelector' } ],
+		tbar: [ '->', { xtype: 'proxmoxRRDTypeSelector' } ],
 		plugins: {
 		    ptype: 'lazyitems',
 		    items: [
diff --git a/www/manager6/storage/Summary.js b/www/manager6/storage/Summary.js
index 2101549c..4b26f234 100644
--- a/www/manager6/storage/Summary.js
+++ b/www/manager6/storage/Summary.js
@@ -10,7 +10,7 @@ Ext.define('PVE.storage.Summary', {
     tbar: [
 	'->',
 	{
-	    xtype: 'pveRRDTypeSelector'
+	    xtype: 'proxmoxRRDTypeSelector'
 	}
     ],
     initComponent: function() {
-- 
2.11.0





More information about the pve-devel mailing list