Commit 84d36cf3 authored by Leonardo Menezes's avatar Leonardo Menezes
Browse files

commons indices api

parent cdebe86a
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
package controllers

import models.ElasticServer
import models.commons.Indices
import scala.concurrent.ExecutionContext.Implicits.global

class CommonsController extends BaseController {

  def indices = process { (request, client) =>
    client.getIndices(ElasticServer(request.host, request.authentication)).map { response =>
      Status(response.status)(Indices(response.body))
    }
  }

}
+1 −1
Original line number Diff line number Diff line
package models.createindex
package models.commons

import play.api.libs.json.{JsArray, JsString, JsValue}

+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ POST /analysis/analyze/analyzer @controllers.AnalysisController.ana
POST       /analysis/analyze/field           @controllers.AnalysisController.analyzeByField
# Create index module
POST       /create_index/create              @controllers.CreateIndexController.execute
POST       /create_index/indices             @controllers.CreateIndexController.indices
# Commons
POST       /commons/indices                  @controllers.CommonsController.indices

GET        /apis/hosts                       @controllers.HostsController.index

+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@
          <span class="info-text">assigned to index </span>
          <div class="form-group">
            <select class="form-control" ng-model="new_alias.index"
                    ng-options="i.name as i.name for i in indices | orderBy:'name'">
                    ng-options="i for i in indices | orderBy:'i'">
              <option value="">select index</option>
            </select>
          </div>
+4 −3
Original line number Diff line number Diff line
@@ -1440,13 +1440,14 @@ angular.module('cerebro').factory('DataService', ['$rootScope', '$timeout',
      request('/overview', {}, success, error);
    };
    // Create index
    this.getIndices = function(success, error) {
      request('/create_index/indices', {}, success, error);
    };
    this.createIndex = function(index, metadata, success, error) {
      var data = {index: index, metadata: metadata};
      request('/create_index/create', data, success, error);
    };
    // Commons
    this.getIndices = function(success, error) {
      request('/commons/indices', {}, success, error);
    };

    this.closeIndex = function(index, success, error) {
      request('/apis/close_indices', {indices: index}, success, error);
Loading