From 6263ec1d3892312ae126277c9d301d36b6c46777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 13 Feb 2015 14:36:16 +0100 Subject: [PATCH] Fixed some playlist issues, error when adding duplicates --- src/app/features/dashboard/playlistCtrl.js | 9 +++++++++ src/app/partials/playlist.html | 7 +------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/features/dashboard/playlistCtrl.js b/src/app/features/dashboard/playlistCtrl.js index 357663b722d..50440c5912b 100644 --- a/src/app/features/dashboard/playlistCtrl.js +++ b/src/app/features/dashboard/playlistCtrl.js @@ -27,15 +27,24 @@ function (angular, _, config) { $scope.db.searchDashboards(query).then(function(results) { $scope.searchHits = results.dashboards; + $scope.filterHits(); + }); + }; + + $scope.filterHits = function() { + $scope.filteredHits = _.reject($scope.searchHits, function(dash) { + return _.findWhere($scope.playlist, {slug: dash.slug}); }); }; $scope.addDashboard = function(dashboard) { $scope.playlist.push(dashboard); + $scope.filterHits(); }; $scope.removeDashboard = function(dashboard) { $scope.playlist = _.without($scope.playlist, dashboard); + $scope.filterHits(); }; $scope.start = function() { diff --git a/src/app/partials/playlist.html b/src/app/partials/playlist.html index 05d0422771b..38fd552d43b 100644 --- a/src/app/partials/playlist.html +++ b/src/app/partials/playlist.html @@ -36,7 +36,7 @@
- + @@ -65,11 +65,6 @@ - - -
{{dashboard.title}}
- No dashboards found -