Commit a1ab3fd1 authored by Leonardo Menezes's avatar Leonardo Menezes
Browse files

update node types definitions

parent c8f105eb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import play.api.libs.json.{JsArray, JsString, JsValue}

case class NodeRoles(master: Boolean, data: Boolean, ingest: Boolean) {

  def client: Boolean = !master && !data && !ingest
  def coordinating: Boolean = !master && !data && !ingest

}

+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ object Node {
    val roles = NodeRoles(info)
    Json.obj(
      "master" -> JsBoolean(roles.master),
      "client" -> JsBoolean(roles.client),
      "coordinating" -> JsBoolean(roles.coordinating),
      "ingest" -> JsBoolean(roles.ingest),
      "data" -> JsBoolean(roles.data)
    )
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ object Node {
      "cpu_percent" -> cpuPercent(stats),
      "master" -> JsBoolean(nodeRoles.master),
      "data" -> JsBoolean(nodeRoles.data),
      "client" -> JsBoolean(nodeRoles.client),
      "coordinating" -> JsBoolean(nodeRoles.coordinating),
      "ingest" -> JsBoolean(nodeRoles.ingest),
      "heap" -> Json.obj(
        "used" -> (stats \ "jvm" \ "mem" \ "heap_used_in_bytes").as[JsNumber],
+14 −8
Original line number Diff line number Diff line
@@ -693,7 +693,7 @@ angular.module('cerebro').controller('NodesController', ['$scope',
    $scope.sortBy = 'name';
    $scope.reverse = false;

    $scope.filter = new NodeFilter('', true, true, true, 0);
    $scope.filter = new NodeFilter('', true, true, true, true, 0);

    $scope.$watch(
      function() {
@@ -777,7 +777,7 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
    $scope.shardAllocation = true;

    $scope.indices_filter = new IndexFilter('', true, false, true, true, 0);
    $scope.nodes_filter = new NodeFilter('', true, false, false, 0);
    $scope.nodes_filter = new NodeFilter('', true, false, false, false, 0);

    $scope.getPageSize = function() {
      return Math.max(Math.round($window.innerWidth / 280), 1);
@@ -1974,15 +1974,18 @@ function IndexFilter(name, closed, special, healthy, asc, timestamp) {

}

function NodeFilter(name, data, master, client, timestamp) {
function NodeFilter(name, data, master, ingest, coordinating, timestamp) {
  this.name = name;
  this.data = data;
  this.master = master;
  this.client = client;
  this.ingest = ingest;
  this.coordinating = coordinating;
  this.timestamp = timestamp;

  this.clone = function() {
    return new NodeFilter(this.name, this.data, this.master, this.client);
    return new NodeFilter(
      this.name, this.data, this.master, this.ingest, this.coordinating
    );
  };

  this.getSorting = function() {
@@ -1995,13 +1998,15 @@ function NodeFilter(name, data, master, client, timestamp) {
      this.name == other.name &&
      this.data == other.data &&
      this.master == other.master &&
      this.client == other.client &&
      this.ingest == other.ingest &&
      this.coordinating == other.coordinating &&
      this.timestamp == other.timestamp
    );
  };

  this.isBlank = function() {
    return !this.name && (this.data && this.master && this.client);
    return !this.name &&
      (this.data && this.master && this.ingest && this.coordinating);
  };

  this.matches = function(node) {
@@ -2016,7 +2021,8 @@ function NodeFilter(name, data, master, client, timestamp) {
    return (
      node.data && this.data ||
      node.master && this.master ||
      node.client && this.client
      node.ingest && this.ingest ||
      node.coordinating && this.coordinating
    );
  };

+8 −4
Original line number Diff line number Diff line
@@ -15,8 +15,12 @@
        <i class="fa fa-hdd-o"></i> data
      </label>
      <label class="checkbox-inline">
        <input type="checkbox" ng-model="filter.client">
        <i class="fa fa-search"></i> client
        <input type="checkbox" ng-model="filter.ingest">
        <i class="fa fa-crop"></i> ingest
      </label>
      <label class="checkbox-inline">
        <input type="checkbox" ng-model="filter.coordinating">
        <i class="fa fa-crosshairs"></i> coordinating
      </label>
    </div>
  </div>
@@ -58,8 +62,8 @@
            <div ng-show="node.data">
              <i class="fa fa-fw fa-hdd-o" title="data node"></i>
            </div>
            <div ng-show="node.client">
              <i class="fa fa-fw fa-search" title="client node"></i>
            <div ng-show="node.coordinating">
              <i class="fa fa-fw fa-search" title="coordinating node"></i>
            </div>
            <div ng-show="node.ingest">
              <i class="fa fa-fw fa-crop" title="ingest node"></i>
Loading