diff --git a/pkg/api/admin_settings.go b/pkg/api/admin_settings.go index c126c1108c6..21615219acd 100644 --- a/pkg/api/admin_settings.go +++ b/pkg/api/admin_settings.go @@ -20,6 +20,7 @@ func AdminGetSettings(c *middleware.Context) { if strings.Contains(keyName, "secret") || strings.Contains(keyName, "password") { value = "************" } + jsonSec[keyName] = value } } diff --git a/src/app/features/dashboard/playlistCtrl.js b/src/app/features/dashboard/playlistCtrl.js index 9e6a60013e2..357663b722d 100644 --- a/src/app/features/dashboard/playlistCtrl.js +++ b/src/app/features/dashboard/playlistCtrl.js @@ -8,29 +8,38 @@ function (angular, _, config) { var module = angular.module('grafana.controllers'); - module.controller('PlaylistCtrl', function($scope, playlistSrv) { + module.controller('PlaylistCtrl', function($scope, playlistSrv, datasourceSrv) { $scope.init = function() { + $scope.playlist = []; $scope.timespan = config.playlist_timespan; - $scope.loadFavorites(); + $scope.db = datasourceSrv.getGrafanaDB(); + $scope.search(); }; - $scope.loadFavorites = function() { - $scope.favDashboards = playlistSrv.getFavorites().dashboards; + $scope.search = function() { + var query = {starred: true, limit: 10}; - _.each($scope.favDashboards, function(dashboard) { - dashboard.include = true; + if ($scope.searchQuery) { + query.query = $scope.searchQuery; + query.starred = false; + } + + $scope.db.searchDashboards(query).then(function(results) { + $scope.searchHits = results.dashboards; }); }; - $scope.removeAsFavorite = function(dashboard) { - playlistSrv.removeAsFavorite(dashboard); - $scope.loadFavorites(); + $scope.addDashboard = function(dashboard) { + $scope.playlist.push(dashboard); + }; + + $scope.removeDashboard = function(dashboard) { + $scope.playlist = _.without($scope.playlist, dashboard); }; $scope.start = function() { - var included = _.where($scope.favDashboards, { include: true }); - playlistSrv.start(included, $scope.timespan); + playlistSrv.start($scope.playlist, $scope.timespan); }; }); diff --git a/src/app/features/dashboard/playlistSrv.js b/src/app/features/dashboard/playlistSrv.js index b486e5957fc..1af3360e85c 100644 --- a/src/app/features/dashboard/playlistSrv.js +++ b/src/app/features/dashboard/playlistSrv.js @@ -61,6 +61,8 @@ function (angular, _, kbn, store) { }; this.start = function(dashboards, timespan) { + this.stop(); + var interval = kbn.interval_to_ms(timespan); var index = 0; @@ -69,8 +71,10 @@ function (angular, _, kbn, store) { timerInstance = setInterval(function() { $rootScope.$apply(function() { angular.element(window).unbind('resize'); - $location.search({}); - $location.path(dashboards[index % dashboards.length].url); + var dash = dashboards[index % dashboards.length]; + var relativeUrl = dash.url.substring($location.absUrl().length - $location.url().length); + $location.url(relativeUrl); + index++; }); }, interval); diff --git a/src/app/partials/playlist.html b/src/app/partials/playlist.html index c0b9f0545fb..05d0422771b 100644 --- a/src/app/partials/playlist.html +++ b/src/app/partials/playlist.html @@ -12,56 +12,88 @@
- -
-
-
- - - - - - - - - - - - - - -
DashboardIncludeRemove as favorite
- {{dashboard.title}} - - - - - -
- No dashboards marked as favorites -
-
-
-
- - dashboards available in the playlist are only the ones marked as favorites (stored in local browser storage). - to mark a dashboard as favorite, use save icon in the menu and in the dropdown select mark as favorite -

-
+
+
+
+
+
    +
  • + Search +
  • +
  • + +
  • +
+
-
- - -
+
+
Playlist dashboards
+
+
+
+
+ + + + + + + + +
+ {{dashboard.title}} + + +
+ No dashboards found +
+
+
+ + + + + + + + +
+ {{dashboard.title}} + + +
+ No dashboards found +
+

-
+
+
+
    +
  • + Timespan between dashboard change +
  • +
  • + +
  • +
  • + +
  • +
+
+
+
+ +
+
diff --git a/src/app/services/userSrv.js b/src/app/services/userSrv.js deleted file mode 100644 index 14f373f7b1b..00000000000 --- a/src/app/services/userSrv.js +++ /dev/null @@ -1,24 +0,0 @@ -define([ - 'angular', - 'lodash', -], -function (angular, _) { - 'use strict'; - - var module = angular.module('grafana.services'); - - module.service('userSrv', function() { - - function User() { - if (window.grafanaBootData.user) { - _.extend(this, window.grafanaBootData.user); - } - } - - this.getSignedInUser = function() { - return new User(); - }; - - }); - -});