Loading app/controllers/ClusterSettingsController.scala 0 → 100644 +21 −0 Original line number Diff line number Diff line package controllers import models.ElasticServer import scala.concurrent.ExecutionContext.Implicits.global class ClusterSettingsController extends BaseController { def getSettings = process { (request, client) => client.getClusterSettings(ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } def save = process { (request, client) => val settings = request.getObj("settings") client.saveClusterSettings(settings, ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } } app/elastic/ElasticClient.scala +10 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,16 @@ trait ElasticClient { execute(s"${target.host}$path", "GET", Some(body), target.authentication) } def getClusterSettings(target: ElasticServer) = { val path = s"/_cluster/settings?flat_settings=true" execute(s"${target.host}$path", "GET", None, target.authentication) } def saveClusterSettings(settings: JsValue, target: ElasticServer) = { val path = s"/_cluster/settings" execute(s"${target.host}$path", "PUT", Some(settings.toString), target.authentication) } def executeRequest(method: String, path: String, data: Option[JsValue], target: ElasticServer) = execute(s"${target.host}/$path", method, data.map(_.toString), target.authentication) Loading conf/routes +4 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ POST /templates @controllers.TemplatesCont POST /templates/delete @controllers.TemplatesController.delete POST /templates/create @controllers.TemplatesController.create # Cluster settings module POST /cluster_settings @controllers.ClusterSettingsController.getSettings POST /cluster_settings/save @controllers.ClusterSettingsController.save # Connect module GET /connect/hosts @controllers.ConnectController.index Loading public/cluster_settings/circuit_breaker.html 0 → 100644 +21 −0 Original line number Diff line number Diff line <div class="row form-group"> <div class="col-xs-12"> <h4>circuit breaker</h4> </div> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.total.limit'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.fielddata.limit'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.fielddata.overhead'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.request.limit'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.request.overhead'"/> </div> public/cluster_settings/cluster_setting.html 0 → 100644 +7 −0 Original line number Diff line number Diff line <div class="col-lg-3 col-md-4 col-sm-6"> <div class="form-group"> <label class="form-label">{{property}}</label> <input type="text" class="form-control" ng-model="settings[property]" ng-change="set({property: property})"/> </div> </div> Loading
app/controllers/ClusterSettingsController.scala 0 → 100644 +21 −0 Original line number Diff line number Diff line package controllers import models.ElasticServer import scala.concurrent.ExecutionContext.Implicits.global class ClusterSettingsController extends BaseController { def getSettings = process { (request, client) => client.getClusterSettings(ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } def save = process { (request, client) => val settings = request.getObj("settings") client.saveClusterSettings(settings, ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } }
app/elastic/ElasticClient.scala +10 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,16 @@ trait ElasticClient { execute(s"${target.host}$path", "GET", Some(body), target.authentication) } def getClusterSettings(target: ElasticServer) = { val path = s"/_cluster/settings?flat_settings=true" execute(s"${target.host}$path", "GET", None, target.authentication) } def saveClusterSettings(settings: JsValue, target: ElasticServer) = { val path = s"/_cluster/settings" execute(s"${target.host}$path", "PUT", Some(settings.toString), target.authentication) } def executeRequest(method: String, path: String, data: Option[JsValue], target: ElasticServer) = execute(s"${target.host}/$path", method, data.map(_.toString), target.authentication) Loading
conf/routes +4 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ POST /templates @controllers.TemplatesCont POST /templates/delete @controllers.TemplatesController.delete POST /templates/create @controllers.TemplatesController.create # Cluster settings module POST /cluster_settings @controllers.ClusterSettingsController.getSettings POST /cluster_settings/save @controllers.ClusterSettingsController.save # Connect module GET /connect/hosts @controllers.ConnectController.index Loading
public/cluster_settings/circuit_breaker.html 0 → 100644 +21 −0 Original line number Diff line number Diff line <div class="row form-group"> <div class="col-xs-12"> <h4>circuit breaker</h4> </div> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.total.limit'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.fielddata.limit'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.fielddata.overhead'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.request.limit'"/> <cluster-setting settings="settings" set="set(property)" property="'indices.breaker.request.overhead'"/> </div>
public/cluster_settings/cluster_setting.html 0 → 100644 +7 −0 Original line number Diff line number Diff line <div class="col-lg-3 col-md-4 col-sm-6"> <div class="form-group"> <label class="form-label">{{property}}</label> <input type="text" class="form-control" ng-model="settings[property]" ng-change="set({property: property})"/> </div> </div>