feat(node): add pagination to associated tasks

pull/551/head
Anthony Lapenna 8 years ago
parent e25c5a014c
commit fcc9203416

@ -12,7 +12,7 @@
<div class="row" ng-if="!node"> <div class="row" ng-if="!node">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div ng-if="loading"> <div ng-if="loading">
<i class="fa fa-cog fa-spin"></i> Loading.. <i class="fa fa-cog fa-spin"></i> Loading...
</div> </div>
<rd-widget ng-if="!loading"> <rd-widget ng-if="!loading">
@ -207,7 +207,18 @@
<div class="row" ng-if="node && tasks.length > 0"> <div class="row" ng-if="node && tasks.length > 0">
<div class="col-lg-12 col-md-12 col-xs-12"> <div class="col-lg-12 col-md-12 col-xs-12">
<rd-widget> <rd-widget>
<rd-widget-header icon="fa-tasks" title="Associated tasks"></rd-widget-header> <rd-widget-header icon="fa-tasks" title="Associated tasks">
<div class="pull-right">
Items per page:
<select ng-model="state.pagination_count" ng-change="changePaginationCount()">
<option value="0">All</option>
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
</rd-widget-header>
<rd-widget-body classes="no-padding"> <rd-widget-body classes="no-padding">
<table class="table"> <table class="table">
<thead> <thead>
@ -244,7 +255,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr dir-paginate="task in (filteredTasks = ( tasks | orderBy:sortType:sortReverse | itemsPerPage: pagination_count))"> <tr dir-paginate="task in (filteredTasks = ( tasks | orderBy:sortType:sortReverse | itemsPerPage: state.pagination_count))">
<td><a ui-sref="task({ id: task.Id })">{{ task.Id }}</a></td> <td><a ui-sref="task({ id: task.Id })">{{ task.Id }}</a></td>
<td><span class="label label-{{ task.Status|taskstatusbadge }}">{{ task.Status }}</span></td> <td><span class="label label-{{ task.Status|taskstatusbadge }}">{{ task.Status }}</span></td>
<td>{{ task.Slot }}</td> <td>{{ task.Slot }}</td>

@ -1,13 +1,14 @@
angular.module('node', []) angular.module('node', [])
.controller('NodeController', ['$scope', '$state', '$stateParams', 'LabelHelper', 'Node', 'NodeHelper', 'Task', 'Settings', 'Messages', .controller('NodeController', ['$scope', '$state', '$stateParams', 'LabelHelper', 'Node', 'NodeHelper', 'Task', 'Pagination', 'Messages',
function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Settings, Messages) { function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Pagination, Messages) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('node_tasks');
$scope.loading = true; $scope.loading = true;
$scope.tasks = []; $scope.tasks = [];
$scope.displayNode = false; $scope.displayNode = false;
$scope.sortType = 'Status'; $scope.sortType = 'Status';
$scope.sortReverse = false; $scope.sortReverse = false;
$scope.pagination_count = Settings.pagination_count;
var originalNode = {}; var originalNode = {};
var editedKeys = []; var editedKeys = [];
@ -17,6 +18,10 @@ function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Set
$scope.sortType = sortType; $scope.sortType = sortType;
}; };
$scope.changePaginationCount = function() {
Pagination.setPaginationCount('node_tasks', $scope.state.pagination_count);
};
$scope.updateNodeAttribute = function updateNodeAttribute(node, key) { $scope.updateNodeAttribute = function updateNodeAttribute(node, key) {
editedKeys.push(key); editedKeys.push(key);
}; };

Loading…
Cancel
Save