Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Display visual indication for master node. Closes #6

  • Loading branch information...
commit 5d1ef3aa3880fce1978a890f07155652c9c4482a 1 parent ac80218
@lukas-vlcek authored
View
5 css/bigdesk.css
@@ -82,6 +82,11 @@ body * {
-webkit-border-radius: 3px;
}
+.node.masterNode {
+ padding-left: 20px;
+ background: url("../images/award_star_gold.png") no-repeat 1px 1px;
+}
+
.node {
border: 2px solid #E1EDB9;
background-color: white;
View
17 images/1license.txt
@@ -0,0 +1,17 @@
+The icons are free for personal use and also free for commercial use, but we require linking to our web site.
+
+http://creativecommons.org/licenses/by-sa/3.0/
+
+You are free:
+* to Share � to copy, distribute and transmit the work
+
+Under the following conditions:
+Attribution � You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
+
+Attribute this work:
+What does "Attribute this work" mean?
+The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. Doing so will also include metadata on your page so that others can find the original work as well.
+Share Alike � If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.
+
+led24.de
+31/05/2009
View
BIN  images/award_star_gold.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
55 js/bigdesk.js
@@ -1,5 +1,6 @@
/**
* BigDesk is a monitoring application with live charts and statistics info for ElasticSearch cluster.
+ * @github https://github.com/lukas-vlcek/bigdesk/
* @author Lukas Vlcek (twitter: @lukasvlcek)
*/
;
@@ -115,9 +116,7 @@
function connect () {
- var path = endpoint;
- path += "/_cluster/health";
-
+ var path = endpoint + "/_cluster/health";
$.ajax({
type: "GET",
url: path,
@@ -133,17 +132,27 @@
});
}
- function stats (data) {
+ /**
+ * @param stats /_cluster/nodes/stats
+ */
+ function stats (stats) {
- // console.log(data);
- updateClusterAndNodeNames(data);
+ var path = endpoint + "/_cluster/state";
+ $.ajax({
+ type: "GET",
+ url: path,
+ data: "filter_metadata=true&filter_routing_table=true&filter_blocks=true",
+ dataType: 'jsonp',
+ success : function( state ) {
+ updateClusterAndNodeNames( stats, state );
+ }
+ });
var selectedNode = undefined;
- for (var node in data.nodes) {
- if (!selectedNode && data.nodes[node].name == selectedNodeName) { selectedNode = data.nodes[node]; }
+ for (var node in stats.nodes) {
+ if (!selectedNode && stats.nodes[node].name == selectedNodeName) { selectedNode = stats.nodes[node]; }
}
if (selectedNode) {
- // console.log(selectedNode);
var indices = selectedNode.indices;
var jvm = selectedNode.jvm;
@@ -229,17 +238,27 @@
}
// Update cluster name and Nodes if there has been any change since the last run.
- function updateClusterAndNodeNames (data){
- if (data) {
- if(data.cluster_name && clusterName != data.cluster_name) {
- clusterName = data.cluster_name;
+ /**
+ * Update cluster name and Nodes if there has been any change since the last run.
+ * @param stats /_cluster/nodes/stats
+ * @param state /_cluster/state
+ */
+ function updateClusterAndNodeNames ( stats, state ){
+ if (stats) {
+ // get master node id if available
+ var masterNodeId = undefined;
+ if (state) {
+ masterNodeId = state.master_node;
+ }
+ if(stats.cluster_name && clusterName != stats.cluster_name) {
+ clusterName = stats.cluster_name;
clusterNameSpan.text(clusterName);
}
- if (data.nodes) {
+ if (stats.nodes) {
var nodesChanged = false;
for (var node in nodes) {
// node removed?
- if (!data.nodes[node]) {
+ if (!stats.nodes[node]) {
if (selectedNodeName && nodes[node] == selectedNodeName) {
selectedNodeName = undefined;
cleanCharts(charts);
@@ -249,10 +268,10 @@
nodesChanged = true;
}
}
- for (var node in data.nodes) {
+ for (var node in stats.nodes) {
// new node?
if (!nodes[node]) {
- nodes[node] = data.nodes[node].name;
+ nodes[node] = stats.nodes[node].name;
nodesChanged = true;
}
}
@@ -270,6 +289,7 @@
$.each(_nodes, function(index, value) {
var node = $(document.createElement("span")).attr("class","node").append(value);
if (value == selectedNodeName) { $(node).addClass("selectedNode"); }
+ if ( masterNodeId == getSelectedNodeId(value)) { $(node).addClass( "masterNode" ); }
$(node).click(
function(){
// new node selected by user
@@ -319,7 +339,6 @@
}
function updateStaticNodeData (data) {
-// console.log(data);
if (data) {
$("#networkStateTmpl").mustache(data).appendTo(networkStateContainer.empty());
if (data.os && data.os.cpu) {
Please sign in to comment.
Something went wrong with that request. Please try again.