[pve-devel] [PATCH manager 3/4] merge ha resources into the ha status panel

Dominik Csapak d.csapak at proxmox.com
Tue Nov 22 12:07:30 CET 2016


this changes the ha status view and ha resources view, so that they take
an rstore and use that instead of a new one

we do this, so that we can display the status and the resources grid
with one api call

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/dc/Config.js     |  9 +--------
 www/manager6/ha/Resources.js  | 25 +++++++++++++------------
 www/manager6/ha/StatusView.js | 20 +++++++++-----------
 3 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index f7097e0..73f4e00 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -99,19 +99,12 @@ Ext.define('PVE.dc.Config', {
 		itemId: 'domains'
 	    },
 	    {
-		xtype: 'pveHAStatusView',
+		xtype: 'pveHAStatus',
 		title: 'HA',
 		iconCls: 'fa fa-heartbeat',
 		itemId: 'ha'
 	    },
 	    {
-		title: gettext('Resources'),
-		groups: ['ha'],
-		iconCls: 'fa fa-th',
-		xtype: 'pveHAResourcesView',
-		itemId: 'resources'
-	    },
-	    {
 		title: gettext('Groups'),
 		groups: ['ha'],
 		xtype: 'pveHAGroupsView',
diff --git a/www/manager6/ha/Resources.js b/www/manager6/ha/Resources.js
index 872d925..8dfb4d9 100644
--- a/www/manager6/ha/Resources.js
+++ b/www/manager6/ha/Resources.js
@@ -12,20 +12,22 @@ Ext.define('PVE.ha.ResourcesView', {
 
 	var caps = Ext.state.Manager.get('GuiCap');
 
-	var store = new Ext.data.Store({
-	    model: 'pve-ha-resources',
-	    proxy: {
-                type: 'pve',
-		url: "/api2/json/cluster/ha/resources"
-	    },
-	    sorters: { 
-		property: 'sid', 
-		order: 'DESC' 
+	if (!me.rstore) {
+	    throw "no store given";
+	}
+
+	PVE.Utils.monStoreErrors(me, me.rstore);
+
+	var store = Ext.create('PVE.data.DiffStore', {
+	    rstore: me.rstore,
+	    filters: {
+		property: 'type',
+		value: 'service'
 	    }
 	});
-	
+
 	var reload = function() {
-	    store.load();
+	    me.rstore.load();
 	};
 
 	var render_error = function(dataIndex, value, metaData, record) {
@@ -162,7 +164,6 @@ Ext.define('PVE.ha.ResourcesView', {
 		}
 	    ],
 	    listeners: {
-		activate: reload,
 		beforeselect: function(grid, record, index, eOpts) {
 		    if (!caps.nodes['Sys.Console']) {
 			return false;
diff --git a/www/manager6/ha/StatusView.js b/www/manager6/ha/StatusView.js
index 5a9dd59..212207b 100644
--- a/www/manager6/ha/StatusView.js
+++ b/www/manager6/ha/StatusView.js
@@ -14,16 +14,9 @@ Ext.define('PVE.ha.StatusView', {
     initComponent : function() {
 	var me = this;
 
-	me.rstore = Ext.create('PVE.data.ObjectStore', {
-	    interval: me.interval,
-	    model: 'pve-ha-status',
-	    storeid: 'pve-store-' + (++Ext.idSeed),
-	    groupField: 'type',
-	    proxy: {
-                type: 'pve',
-		url: '/api2/json/cluster/ha/status/current'
-	    }
-	});
+	if (!me.rstore) {
+	    throw "no rstore given";
+	}
 
 	PVE.Utils.monStoreErrors(me, me.rstore);
 
@@ -36,7 +29,12 @@ Ext.define('PVE.ha.StatusView', {
 		    var p2 = me.sortPriority[rec2.data.type];
 		    return (p1 !== p2) ? ((p1 > p2) ? 1 : -1) : 0;
 		}
-	    }]
+	    }],
+	    filters: {
+		property: 'type',
+		value: 'service',
+		operator: '!='
+	    }
 	});
 
 	Ext.apply(me, {
-- 
2.1.4





More information about the pve-devel mailing list