mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #3649 from nikita-graf/playlist-sort
Playlist dashboards sort
This commit is contained in:
commit
de20a8930e
@ -86,8 +86,14 @@
|
||||
<td style="white-space: nowrap;">
|
||||
{{dashboard.title}}
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<button class="btn btn-inverse btn-mini pull-right" ng-click="removeDashboard(dashboard)">
|
||||
<td style="text-align: right">
|
||||
<button class="btn btn-inverse btn-mini" ng-click="moveDashboardUp(dashboard)">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
</button>
|
||||
<button class="btn btn-inverse btn-mini" ng-click="moveDashboardDown(dashboard)">
|
||||
<i class="fa fa-arrow-down"></i>
|
||||
</button>
|
||||
<button class="btn btn-inverse btn-mini" ng-click="removeDashboard(dashboard)">
|
||||
<i class="fa fa-remove"></i>
|
||||
</button>
|
||||
</td>
|
||||
|
@ -107,6 +107,24 @@ function (angular, config, _) {
|
||||
return $scope.loading;
|
||||
};
|
||||
|
||||
$scope.moveDashboard = function(dashboard, offset) {
|
||||
var currentPosition = dashboards.indexOf(dashboard);
|
||||
var newPosition = currentPosition + offset;
|
||||
|
||||
if (newPosition >= 0 && newPosition < dashboards.length) {
|
||||
dashboards.splice(currentPosition, 1);
|
||||
dashboards.splice(newPosition, 0, dashboard);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.moveDashboardUp = function(dashboard) {
|
||||
$scope.moveDashboard(dashboard, -1);
|
||||
};
|
||||
|
||||
$scope.moveDashboardDown = function(dashboard) {
|
||||
$scope.moveDashboard(dashboard, 1);
|
||||
};
|
||||
|
||||
$scope.playlist = playlist;
|
||||
$scope.dashboards = dashboards;
|
||||
$scope.timespan = config.playlist_timespan;
|
||||
|
Loading…
Reference in New Issue
Block a user