mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed some playlist issues, error when adding duplicates
This commit is contained in:
parent
1d86d4b94f
commit
6263ec1d38
@ -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 @@
|
|||||||
<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 @@
|
|||||||
</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>
|
||||||
|
Loading…
Reference in New Issue
Block a user