3 var services = app.ns("services");
6 services.ClusterState = ux.Observable.extend({
12 this.cluster = this.config.cluster;
13 this.clusterState = null;
15 this.nodeStats = null;
16 this.clusterNodes = null;
19 var self = this, clusterState, status, nodeStats, clusterNodes, clusterHealth;
20 function updateModel() {
21 if( clusterState && status && nodeStats && clusterNodes && clusterHealth ) {
22 this.clusterState = clusterState;
24 this.nodeStats = nodeStats;
25 this.clusterNodes = clusterNodes;
26 this.clusterHealth = clusterHealth;
27 this.fire( "data", this );
30 this.cluster.get("_cluster/state", function( data ) {
32 updateModel.call( self );
34 this.cluster.get("_stats", function( data ) {
36 updateModel.call( self );
38 this.cluster.get("_nodes/stats", function( data ) {
40 updateModel.call( self );
42 this.cluster.get("_nodes", function( data ) {
44 updateModel.call( self );
46 this.cluster.get("_cluster/health", function( data ) {
48 updateModel.call( self );
51 _clusterState_handler: function(state) {
52 this.clusterState = state;
53 this.redraw("clusterState");
55 _status_handler: function(status) {
57 this.redraw("status");
59 _clusterNodeStats_handler: function(stats) {
60 this.nodeStats = stats;
61 this.redraw("nodeStats");
63 _clusterNodes_handler: function(nodes) {
64 this.clusterNodes = nodes;
65 this.redraw("clusterNodes");
67 _clusterHealth_handler: function(health) {
68 this.clusterHealth = health;
69 this.redraw("status");