[pve-devel] [PATCH manager 08/15] gui: ceph: remove mon specific code from StatusDetail

Dominik Csapak d.csapak at proxmox.com
Mon May 27 14:13:59 CEST 2019


will be handled in ceph/Services.js

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/ceph/StatusDetail.js | 144 +-------------------------------------
 1 file changed, 2 insertions(+), 142 deletions(-)

diff --git a/www/manager6/ceph/StatusDetail.js b/www/manager6/ceph/StatusDetail.js
index 7625b366..97fa426e 100644
--- a/www/manager6/ceph/StatusDetail.js
+++ b/www/manager6/ceph/StatusDetail.js
@@ -17,17 +17,6 @@ Ext.define('PVE.ceph.StatusDetail', {
 
     items: [{
 	flex: 1,
-	itemId: 'monitors',
-	xtype: 'container',
-	items: [
-	    {
-		xtype: 'box',
-		width: '100%',
-		html: '<h3>' + gettext('Monitors') + '</h3>'
-	    }
-	]
-    },{
-	flex: 1,
 	itemId: 'osds',
 	data: {
 	    total: 0,
@@ -97,9 +86,7 @@ Ext.define('PVE.ceph.StatusDetail', {
 	me.getComponent('pgs').update({states: pgs_by_state});
 
 	var downinregex = /(\d+) osds down/;
-	var monnameregex = /^mon.(\S+) /;
 	var downin_osds = 0;
-	var monmsgs = {};
 
 	// we collect monitor/osd information from the checks
 	Ext.Object.each(health.checks, function(key, value, obj) {
@@ -110,23 +97,6 @@ Ext.define('PVE.ceph.StatusDetail', {
 		    downin_osds = parseInt(found[1],10);
 		}
 	    }
-	    else if (Ext.String.startsWith(key, 'MON_')) {
-		if (!value.detail) {
-		    return;
-		}
-		found = value.detail[0].message.match(monnameregex);
-		if (found !== null) {
-		    if (!monmsgs[found[1]]) {
-			monmsgs[found[1]] = [];
-		    }
-		    monmsgs[found[1]].push({
-			text: Ext.Array.reduce(value.detail, function(first, second) {
-			    return first + '\n' + second.message;
-			}, ''),
-			severity: value.severity
-		    });
-		}
-	    }
 	});
 
 	// update osds counts
@@ -147,121 +117,11 @@ Ext.define('PVE.ceph.StatusDetail', {
 	    downin: downin_osds,
 	    downout: downout_osds
 	};
-	me.getComponent('osds').update(osds);
-
-	// update the monitors
-	var mons = monmap.mons.sort(function(a,b) {
-	    return (a.name < b.name)?-1:(a.name > b.name)?1:0;
-	});
+	var osdcomponent = me.getComponent('osds');
+	osdcomponent.update(Ext.apply(osdcomponent.data, osds));
 
-	var monContainer = me.getComponent('monitors');
-
-	var i;
-	for (i = 0; i < mons.length; i++) {
-	    var monitor = monContainer.getComponent('mon.' + mons[i].name);
-	    if (!monitor) {
-		// since mons are already sorted, and
-		// we always have a sorted list
-		// we can add it at the mons+1 position (because of the title)
-		monitor = monContainer.insert(i+1, {
-		    xtype: 'pveCephMonitorWidget',
-		    itemId: 'mon.' + mons[i].name
-		});
-	    }
-	    monitor.updateMonitor(mons[i], monmsgs, quorum_names);
-	}
 	me.suspendLayout = false;
 	me.updateLayout();
     }
 });
 
-Ext.define('PVE.ceph.MonitorWidget', {
-    extend: 'Ext.Component',
-    alias: 'widget.pveCephMonitorWidget',
-
-    userCls: 'monitor inline-block',
-    data: {
-	name: '0',
-	health: 'HEALTH_ERR',
-	text: '',
-	iconCls: PVE.Utils.get_health_icon(),
-	addr: ''
-    },
-
-    tpl: [
-	'{name}: ',
-	'<i class="fa fa-fw {iconCls}"></i>'
-    ],
-
-    // expects 3 variables which are
-    // timestate: the status from timechecks.mons
-    // data: the monmap.mons data
-    // quorum_names: the quorum_names array
-    updateMonitor: function(data, monmsgs, quorum_names) {
-	var me = this;
-	var state = 'HEALTH_ERR';
-	var text = '';
-	var healthstates = {
-	    'HEALTH_OK': 3,
-	    'HEALTH_WARN': 2,
-	    'HEALTH_ERR': 1
-	};
-
-	if (quorum_names &&
-	    quorum_names.indexOf(data.name) !== -1) {
-	    state = 'HEALTH_OK';
-	}
-
-	if (monmsgs[data.name]) {
-	    Ext.Array.forEach(monmsgs[data.name], function(msg) {
-		if (healthstates[msg.severity] < healthstates[state]) {
-		    state = msg.severity;
-		}
-
-		text += msg.text + "\n";
-	    });
-	}
-
-	me.update(Ext.apply(me.data, {
-	    health: state,
-	    text: text,
-	    addr: data.addr,
-	    name: data.name,
-	    iconCls: PVE.Utils.get_health_icon(PVE.Utils.map_ceph_health[state])
-	}));
-    },
-
-    listeners: {
-	mouseenter: {
-	    element: 'el',
-	    fn: function(events, element) {
-		var me = this.component;
-		if (!me) {
-		    return;
-		}
-		if (!me.tooltip) {
-		    me.tooltip = Ext.create('Ext.tip.ToolTip', {
-			target: me.el,
-			trackMouse: true,
-			renderTo: Ext.getBody(),
-			html: gettext('Monitor') + ': ' + me.data.name + '<br />' +
-			      gettext('Address') + ': ' + me.data.addr + '<br />' +
-			      gettext('Health')  + ': ' + me.data.health + '<br />' + 
-			      me.data.text
-		    });
-		}
-		me.tooltip.show();
-	    }
-	},
-	mouseleave: {
-	    element: 'el',
-	    fn: function(events, element) {
-		var me = this.component;
-		if (me.tooltip) {
-		    me.tooltip.destroy();
-		    delete me.tooltip;
-		}
-	    }
-	}
-    }
-});
-- 
2.11.0





More information about the pve-devel mailing list