mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
basic playlist dashboards sort support
This commit is contained in:
parent
5eea02b17a
commit
3fabd2ea1b
@ -86,8 +86,14 @@
|
|||||||
<td style="white-space: nowrap;">
|
<td style="white-space: nowrap;">
|
||||||
{{dashboard.title}}
|
{{dashboard.title}}
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: center">
|
<td style="text-align: right">
|
||||||
<button class="btn btn-inverse btn-mini pull-right" ng-click="removeDashboard(dashboard)">
|
<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>
|
<i class="fa fa-remove"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
@ -107,6 +107,24 @@ function (angular, config, _) {
|
|||||||
return $scope.loading;
|
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.playlist = playlist;
|
||||||
$scope.dashboards = dashboards;
|
$scope.dashboards = dashboards;
|
||||||
$scope.timespan = config.playlist_timespan;
|
$scope.timespan = config.playlist_timespan;
|
||||||
|
Loading…
Reference in New Issue
Block a user