mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(UX): replace tables with datatables (#1460)
This commit is contained in:
parent
7922ecc4a1
commit
bdb23a8dd2
121 changed files with 4123 additions and 2701 deletions
|
@ -1,67 +1,32 @@
|
|||
angular.module('volumes', [])
|
||||
.controller('VolumesController', ['$q', '$scope', 'VolumeService', 'Notifications', 'Pagination',
|
||||
function ($q, $scope, VolumeService, Notifications, Pagination) {
|
||||
$scope.state = {};
|
||||
$scope.state.pagination_count = Pagination.getPaginationCount('volumes');
|
||||
$scope.state.selectedItemCount = 0;
|
||||
$scope.sortType = 'Id';
|
||||
$scope.sortReverse = false;
|
||||
.controller('VolumesController', ['$q', '$scope', '$state', 'VolumeService', 'Notifications',
|
||||
function ($q, $scope, $state, VolumeService, Notifications) {
|
||||
|
||||
$scope.changePaginationCount = function() {
|
||||
Pagination.setPaginationCount('volumes', $scope.state.pagination_count);
|
||||
};
|
||||
|
||||
$scope.order = function(sortType) {
|
||||
$scope.sortReverse = ($scope.sortType === sortType) ? !$scope.sortReverse : false;
|
||||
$scope.sortType = sortType;
|
||||
};
|
||||
|
||||
$scope.selectItems = function (allSelected) {
|
||||
angular.forEach($scope.state.filteredVolumes, function (volume) {
|
||||
if (volume.Checked !== allSelected) {
|
||||
volume.Checked = allSelected;
|
||||
$scope.selectItem(volume);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.selectItem = function (item) {
|
||||
if (item.Checked) {
|
||||
$scope.state.selectedItemCount++;
|
||||
} else {
|
||||
$scope.state.selectedItemCount--;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.removeAction = function () {
|
||||
angular.forEach($scope.volumes, function (volume) {
|
||||
if (volume.Checked) {
|
||||
VolumeService.remove(volume)
|
||||
.then(function success() {
|
||||
Notifications.success('Volume deleted', volume.Id);
|
||||
var index = $scope.volumes.indexOf(volume);
|
||||
$scope.volumes.splice(index, 1);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to remove volume');
|
||||
});
|
||||
}
|
||||
$scope.removeAction = function (selectedItems) {
|
||||
var actionCount = selectedItems.length;
|
||||
angular.forEach(selectedItems, function (volume) {
|
||||
VolumeService.remove(volume)
|
||||
.then(function success() {
|
||||
Notifications.success('Volume successfully removed', volume.Id);
|
||||
var index = $scope.volumes.indexOf(volume);
|
||||
$scope.volumes.splice(index, 1);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to remove volume');
|
||||
})
|
||||
.finally(function final() {
|
||||
--actionCount;
|
||||
if (actionCount === 0) {
|
||||
$state.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function initView() {
|
||||
|
||||
$q.all({
|
||||
attached: VolumeService.volumes({
|
||||
filters: {
|
||||
'dangling': ['false']
|
||||
}
|
||||
}),
|
||||
dangling: VolumeService.volumes({
|
||||
filters: {
|
||||
'dangling': ['true']
|
||||
}
|
||||
})
|
||||
attached: VolumeService.volumes({ filters: { 'dangling': ['false'] } }),
|
||||
dangling: VolumeService.volumes({ filters: { 'dangling': ['true'] } })
|
||||
})
|
||||
.then(function success(data) {
|
||||
$scope.volumes = data.attached.map(function(volume) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue