Commit 6263ec1d by Torkel Ödegaard

Fixed some playlist issues, error when adding duplicates

parent 1d86d4b9
...@@ -27,15 +27,24 @@ function (angular, _, config) { ...@@ -27,15 +27,24 @@ function (angular, _, config) {
$scope.db.searchDashboards(query).then(function(results) { $scope.db.searchDashboards(query).then(function(results) {
$scope.searchHits = results.dashboards; $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.addDashboard = function(dashboard) {
$scope.playlist.push(dashboard); $scope.playlist.push(dashboard);
$scope.filterHits();
}; };
$scope.removeDashboard = function(dashboard) { $scope.removeDashboard = function(dashboard) {
$scope.playlist = _.without($scope.playlist, dashboard); $scope.playlist = _.without($scope.playlist, dashboard);
$scope.filterHits();
}; };
$scope.start = function() { $scope.start = function() {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<div class="row"> <div class="row">
<div class="span6"> <div class="span6">
<table class="grafana-options-table"> <table class="grafana-options-table">
<tr ng-repeat="dashboard in searchHits"> <tr ng-repeat="dashboard in filteredHits">
<td style="white-space: nowrap;"> <td style="white-space: nowrap;">
{{dashboard.title}} {{dashboard.title}}
</td> </td>
...@@ -65,11 +65,6 @@ ...@@ -65,11 +65,6 @@
</button> </button>
</td> </td>
</tr> </tr>
<tr ng-hide="searchHits.length">
<td colspan="3">
<i class="fa fa-warning"></i> No dashboards found
</td>
</tr>
</table> </table>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment