Loading app/controllers/CommonsController.scala +6 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,10 @@ class CommonsController @Inject()(val authentication: AuthenticationModule, } } def getIndexStats = process { request => client.indexStats(request.get("index"), request.target).map { response => CerebroResponse(response.status, response.body) } } } app/elastic/ElasticClient.scala +2 −1 Original line number Diff line number Diff line package elastic import com.google.inject.ImplementedBy import controllers.auth.AuthenticationModuleImpl import models.ElasticServer import play.api.libs.json._ Loading @@ -20,6 +19,8 @@ trait ElasticClient { def nodeStats(node: String, target: ElasticServer): Future[ElasticResponse] def indexStats(index: String, target: ElasticServer): Future[ElasticResponse] def clusterSettings(target: ElasticServer): Future[ElasticResponse] def aliases(target: ElasticServer): Future[ElasticResponse] Loading app/elastic/HTTPElasticClient.scala +5 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,11 @@ class HTTPElasticClient @Inject()(client: WSClient) extends ElasticClient { execute(s"${target.host}$path", "GET", None, target.authentication) } def indexStats(index: String, target: ElasticServer): Future[ElasticResponse] = { val path = s"/$index/_stats?human=true" execute(s"${target.host}$path", "GET", None, target.authentication) } def nodeStats(node: String, target: ElasticServer) = { val path = s"/_nodes/$node/stats?human" execute(s"${target.host}$path", "GET", None, target.authentication) Loading conf/routes +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ POST /commons/nodes controllers.CommonsControl POST /commons/get_index_settings controllers.CommonsController.getIndexSettings POST /commons/get_index_mapping controllers.CommonsController.getIndexMappings POST /commons/get_node_stats controllers.CommonsController.getNodeStats POST /commons/get_index_stats controllers.CommonsController.getIndexStats # Create index module POST /create_index/get_index_metadata controllers.CreateIndexController.getIndexMetadata Loading public/js/app.js +9 −0 Original line number Diff line number Diff line Loading @@ -1011,6 +1011,10 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http', OverviewDataService.nodeStats(node, displayInfo, error); }; $scope.indexStats = function(index) { OverviewDataService.indexStats(index, displayInfo, error); }; $scope.getIndexSettings = function(index) { OverviewDataService.getIndexSettings(index, displayInfo, error); }; Loading Loading @@ -1136,6 +1140,11 @@ angular.module('cerebro').factory('OverviewDataService', ['DataService', DataService.send('commons/get_node_stats', {node: node}, success, error); }; this.indexStats = function(index, success, error) { var data = {index: index}; DataService.send('commons/get_index_stats', data, success, error); }; this.getIndexMapping = function(index, success, error) { var data = {index: index}; DataService.send('commons/get_index_mapping', data, success, error); Loading Loading
app/controllers/CommonsController.scala +6 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,10 @@ class CommonsController @Inject()(val authentication: AuthenticationModule, } } def getIndexStats = process { request => client.indexStats(request.get("index"), request.target).map { response => CerebroResponse(response.status, response.body) } } }
app/elastic/ElasticClient.scala +2 −1 Original line number Diff line number Diff line package elastic import com.google.inject.ImplementedBy import controllers.auth.AuthenticationModuleImpl import models.ElasticServer import play.api.libs.json._ Loading @@ -20,6 +19,8 @@ trait ElasticClient { def nodeStats(node: String, target: ElasticServer): Future[ElasticResponse] def indexStats(index: String, target: ElasticServer): Future[ElasticResponse] def clusterSettings(target: ElasticServer): Future[ElasticResponse] def aliases(target: ElasticServer): Future[ElasticResponse] Loading
app/elastic/HTTPElasticClient.scala +5 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,11 @@ class HTTPElasticClient @Inject()(client: WSClient) extends ElasticClient { execute(s"${target.host}$path", "GET", None, target.authentication) } def indexStats(index: String, target: ElasticServer): Future[ElasticResponse] = { val path = s"/$index/_stats?human=true" execute(s"${target.host}$path", "GET", None, target.authentication) } def nodeStats(node: String, target: ElasticServer) = { val path = s"/_nodes/$node/stats?human" execute(s"${target.host}$path", "GET", None, target.authentication) Loading
conf/routes +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ POST /commons/nodes controllers.CommonsControl POST /commons/get_index_settings controllers.CommonsController.getIndexSettings POST /commons/get_index_mapping controllers.CommonsController.getIndexMappings POST /commons/get_node_stats controllers.CommonsController.getNodeStats POST /commons/get_index_stats controllers.CommonsController.getIndexStats # Create index module POST /create_index/get_index_metadata controllers.CreateIndexController.getIndexMetadata Loading
public/js/app.js +9 −0 Original line number Diff line number Diff line Loading @@ -1011,6 +1011,10 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http', OverviewDataService.nodeStats(node, displayInfo, error); }; $scope.indexStats = function(index) { OverviewDataService.indexStats(index, displayInfo, error); }; $scope.getIndexSettings = function(index) { OverviewDataService.getIndexSettings(index, displayInfo, error); }; Loading Loading @@ -1136,6 +1140,11 @@ angular.module('cerebro').factory('OverviewDataService', ['DataService', DataService.send('commons/get_node_stats', {node: node}, success, error); }; this.indexStats = function(index, success, error) { var data = {index: index}; DataService.send('commons/get_index_stats', data, success, error); }; this.getIndexMapping = function(index, success, error) { var data = {index: index}; DataService.send('commons/get_index_mapping', data, success, error); Loading