Loading app/controllers/SnapshotsController.scala +1 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ import javax.inject.Inject import controllers.auth.AuthenticationModule import elastic.{ElasticClient, Error, Success} import models.commons.Indices import models.snapshot.{Repositories, Snapshots} import models.snapshot.{Repositories, Snapshots, Indices} import models.{CerebroResponse, Hosts} import play.api.libs.json.Json Loading app/models/snapshot/Indices.scala 0 → 100644 +16 −0 Original line number Diff line number Diff line package models.snapshot import play.api.libs.json.{JsArray, JsString, JsValue, Json} object Indices { def apply(data: JsValue) = JsArray(data.as[JsArray].value.collect { case index => val name = (index \ "index").as[String] Json.obj( "name" -> JsString(name), "special" -> name.startsWith(".") ) }) } public/js/app.js +19 −1 Original line number Diff line number Diff line Loading @@ -1313,9 +1313,12 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', 'SnapshotsDataService', 'AlertService', 'ModalService', function($scope, SnapshotsDataService, AlertService, ModalService) { $scope._indices = []; $scope.indices = []; $scope.repositories = []; $scope.showSpecialIndices = false; $scope.repository = undefined; $scope.snapshots = []; $scope.form = { Loading @@ -1333,6 +1336,10 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', true ); $scope.$watch('showSpecialIndices', function(current, previous) { $scope.refreshIndices(); }); $scope.loadSnapshots = function(repository) { if (repository) { SnapshotsDataService.loadSnapshots( Loading Loading @@ -1403,10 +1410,21 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', ); }; $scope.refreshIndices = function() { if (!$scope.showSpecialIndices) { $scope.indices = $scope._indices.filter(function(i) { return !i.special; }); } else { $scope.indices = $scope._indices; } }; $scope.setup = function() { SnapshotsDataService.load( function(data) { $scope.indices = data.indices; $scope._indices = data.indices; $scope.refreshIndices(); $scope.repositories = data.repositories; }, function(error) { Loading public/snapshot/index.html +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ <input type="checkbox" ng-model="showSpecialIndices" ng-true-value="true"> show special indices </label> </label> <select multiple ng-model="form.indices" ng-options="index for index in indices | orderBy:'index'" <select multiple ng-model="form.indices" ng-options="index.name for index in indices | orderBy:'name'" class="form-control" size="13"> </select> </div> Loading src/app/components/snapshot/controller.js +19 −1 Original line number Diff line number Diff line Loading @@ -2,9 +2,12 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', 'SnapshotsDataService', 'AlertService', 'ModalService', function($scope, SnapshotsDataService, AlertService, ModalService) { $scope._indices = []; $scope.indices = []; $scope.repositories = []; $scope.showSpecialIndices = false; $scope.repository = undefined; $scope.snapshots = []; $scope.form = { Loading @@ -22,6 +25,10 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', true ); $scope.$watch('showSpecialIndices', function(current, previous) { $scope.refreshIndices(); }); $scope.loadSnapshots = function(repository) { if (repository) { SnapshotsDataService.loadSnapshots( Loading Loading @@ -92,10 +99,21 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', ); }; $scope.refreshIndices = function() { if (!$scope.showSpecialIndices) { $scope.indices = $scope._indices.filter(function(i) { return !i.special; }); } else { $scope.indices = $scope._indices; } }; $scope.setup = function() { SnapshotsDataService.load( function(data) { $scope.indices = data.indices; $scope._indices = data.indices; $scope.refreshIndices(); $scope.repositories = data.repositories; }, function(error) { Loading Loading
app/controllers/SnapshotsController.scala +1 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ import javax.inject.Inject import controllers.auth.AuthenticationModule import elastic.{ElasticClient, Error, Success} import models.commons.Indices import models.snapshot.{Repositories, Snapshots} import models.snapshot.{Repositories, Snapshots, Indices} import models.{CerebroResponse, Hosts} import play.api.libs.json.Json Loading
app/models/snapshot/Indices.scala 0 → 100644 +16 −0 Original line number Diff line number Diff line package models.snapshot import play.api.libs.json.{JsArray, JsString, JsValue, Json} object Indices { def apply(data: JsValue) = JsArray(data.as[JsArray].value.collect { case index => val name = (index \ "index").as[String] Json.obj( "name" -> JsString(name), "special" -> name.startsWith(".") ) }) }
public/js/app.js +19 −1 Original line number Diff line number Diff line Loading @@ -1313,9 +1313,12 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', 'SnapshotsDataService', 'AlertService', 'ModalService', function($scope, SnapshotsDataService, AlertService, ModalService) { $scope._indices = []; $scope.indices = []; $scope.repositories = []; $scope.showSpecialIndices = false; $scope.repository = undefined; $scope.snapshots = []; $scope.form = { Loading @@ -1333,6 +1336,10 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', true ); $scope.$watch('showSpecialIndices', function(current, previous) { $scope.refreshIndices(); }); $scope.loadSnapshots = function(repository) { if (repository) { SnapshotsDataService.loadSnapshots( Loading Loading @@ -1403,10 +1410,21 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', ); }; $scope.refreshIndices = function() { if (!$scope.showSpecialIndices) { $scope.indices = $scope._indices.filter(function(i) { return !i.special; }); } else { $scope.indices = $scope._indices; } }; $scope.setup = function() { SnapshotsDataService.load( function(data) { $scope.indices = data.indices; $scope._indices = data.indices; $scope.refreshIndices(); $scope.repositories = data.repositories; }, function(error) { Loading
public/snapshot/index.html +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ <input type="checkbox" ng-model="showSpecialIndices" ng-true-value="true"> show special indices </label> </label> <select multiple ng-model="form.indices" ng-options="index for index in indices | orderBy:'index'" <select multiple ng-model="form.indices" ng-options="index.name for index in indices | orderBy:'name'" class="form-control" size="13"> </select> </div> Loading
src/app/components/snapshot/controller.js +19 −1 Original line number Diff line number Diff line Loading @@ -2,9 +2,12 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', 'SnapshotsDataService', 'AlertService', 'ModalService', function($scope, SnapshotsDataService, AlertService, ModalService) { $scope._indices = []; $scope.indices = []; $scope.repositories = []; $scope.showSpecialIndices = false; $scope.repository = undefined; $scope.snapshots = []; $scope.form = { Loading @@ -22,6 +25,10 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', true ); $scope.$watch('showSpecialIndices', function(current, previous) { $scope.refreshIndices(); }); $scope.loadSnapshots = function(repository) { if (repository) { SnapshotsDataService.loadSnapshots( Loading Loading @@ -92,10 +99,21 @@ angular.module('cerebro').controller('SnapshotController', ['$scope', ); }; $scope.refreshIndices = function() { if (!$scope.showSpecialIndices) { $scope.indices = $scope._indices.filter(function(i) { return !i.special; }); } else { $scope.indices = $scope._indices; } }; $scope.setup = function() { SnapshotsDataService.load( function(data) { $scope.indices = data.indices; $scope._indices = data.indices; $scope.refreshIndices(); $scope.repositories = data.repositories; }, function(error) { Loading