diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index ebc9cdd9079..2626137657c 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -9,4 +9,5 @@ define([ './graphiteTarget', './graphiteImport', './influxTargetCtrl', + './playlistCtrl', ], function () {}); \ No newline at end of file diff --git a/src/app/controllers/dashLoader.js b/src/app/controllers/dashLoader.js index caa6a6e69a6..cf77a28dd09 100644 --- a/src/app/controllers/dashLoader.js +++ b/src/app/controllers/dashLoader.js @@ -8,7 +8,7 @@ function (angular, _, moment) { var module = angular.module('kibana.controllers'); - module.controller('dashLoader', function($scope, $rootScope, $http, dashboard, alertSrv, $location, filterSrv) { + module.controller('dashLoader', function($scope, $rootScope, $http, dashboard, alertSrv, $location, filterSrv, playlistSrv) { $scope.loader = dashboard.current.loader; $scope.init = function() { @@ -154,6 +154,24 @@ function (angular, _, moment) { }); }; + $scope.openSaveDropdown = function() { + $scope.isFavorite = playlistSrv.isCurrentFavorite(); + }; + + $scope.markAsFavorite = function() { + playlistSrv.markAsFavorite(); + $scope.isFavorite = true; + }; + + $scope.removeAsFavorite = function() { + playlistSrv.removeAsFavorite(dashboard.current); + $scope.isFavorite = false; + }; + + $scope.stopPlaylist = function() { + playlistSrv.stop(1); + }; + }); }); diff --git a/src/app/controllers/playlistCtrl.js b/src/app/controllers/playlistCtrl.js new file mode 100644 index 00000000000..4751703fb65 --- /dev/null +++ b/src/app/controllers/playlistCtrl.js @@ -0,0 +1,38 @@ +define([ + 'angular', + 'underscore' +], +function (angular, _) { + 'use strict'; + + var module = angular.module('kibana.controllers'); + + module.controller('PlaylistCtrl', function($scope, playlistSrv) { + + $scope.init = function() { + $scope.timespan = "15s"; + $scope.loadFavorites(); + $scope.$on('modal-opened', $scope.loadFavorites); + }; + + $scope.loadFavorites = function() { + $scope.favDashboards = playlistSrv.getFavorites().dashboards; + + _.each($scope.favDashboards, function(dashboard) { + dashboard.include = true; + }); + }; + + $scope.removeAsFavorite = function(dashboard) { + playlistSrv.removeAsFavorite(dashboard); + $scope.loadFavorites(); + }; + + $scope.start = function() { + var included = _.where($scope.favDashboards, { include: true }); + playlistSrv.start(included, $scope.timespan); + }; + + }); + +}); \ No newline at end of file diff --git a/src/app/controllers/search.js b/src/app/controllers/search.js index eebc9d74e46..ace80b3b755 100644 --- a/src/app/controllers/search.js +++ b/src/app/controllers/search.js @@ -69,7 +69,7 @@ function (angular, _, config, $) { .query($scope.ejs.QueryStringQuery(query)) .sort('_uid') .facet($scope.ejs.TermsFacet("tags").field("tags").order('term').size(50)) - .size(50).doSearch() + .size(20).doSearch() .then(function(results) { if(_.isUndefined(results.hits)) { diff --git a/src/app/directives/bodyClass.js b/src/app/directives/bodyClass.js index ffb84c8c099..6cd9bab1346 100644 --- a/src/app/directives/bodyClass.js +++ b/src/app/directives/bodyClass.js @@ -25,13 +25,17 @@ function (angular, app, _) { }, true); $scope.$watch('dashboard.current.hideControls', function() { - var hideControls = $scope.dashboard.current.hideControls; + var hideControls = $scope.dashboard.current.hideControls || $scope.playlist_active; if (lastHideControlsVal !== hideControls) { elem.toggleClass('hide-controls', hideControls); lastHideControlsVal = hideControls; } + }); + $scope.$watch('playlist_active', function() { + elem.toggleClass('hide-controls', $scope.playlist_active === true); + elem.toggleClass('playlist-active', $scope.playlist_active === true); }); } }; diff --git a/src/app/directives/configModal.js b/src/app/directives/configModal.js index 452b326d242..4528a0be620 100644 --- a/src/app/directives/configModal.js +++ b/src/app/directives/configModal.js @@ -18,6 +18,7 @@ function (angular, _, $) { elem.bind('click',function() { if ($(id).length) { elem.attr('data-target', id).attr('data-toggle', 'modal'); + scope.$apply(function() { scope.$broadcast('modal-opened'); }); return; } diff --git a/src/app/panels/timepicker/module.html b/src/app/panels/timepicker/module.html index 3b3019facd6..f0975d371ae 100644 --- a/src/app/panels/timepicker/module.html +++ b/src/app/panels/timepicker/module.html @@ -47,7 +47,7 @@ -
  • +
  • diff --git a/src/app/partials/dashLoader.html b/src/app/partials/dashLoader.html index 5bff28860c9..8fb77db3196 100644 --- a/src/app/partials/dashLoader.html +++ b/src/app/partials/dashLoader.html @@ -10,7 +10,7 @@ -
  • +
  • Zoom Out @@ -18,54 +18,60 @@
  • -