mirror of https://github.com/portainer/portainer
feat(storidge): add rescan drives button
parent
a30171c141
commit
62f6ac926c
|
@ -15,6 +15,9 @@
|
|||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.addAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" ng-click="$ctrl.rescanAction()">
|
||||
<i class="fa fa-sync space-right" aria-hidden="true"></i>Rescan drives
|
||||
</button>
|
||||
</div>
|
||||
<div class="searchBar">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
|
|
|
@ -9,6 +9,7 @@ angular.module('extension.storidge').component('storidgeDrivesDatatable', {
|
|||
orderBy: '@',
|
||||
reverseOrder: '<',
|
||||
removeAction: '<',
|
||||
addAction: '<'
|
||||
addAction: '<',
|
||||
rescanAction: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -28,6 +28,7 @@ angular.module('extension.storidge')
|
|||
getDrive: { method: 'GET', params: { resource: 'drives', id: '@id' } },
|
||||
addDrive: { method: 'POST', params: { resource: 'drives' } },
|
||||
removeDrive: { method: 'DELETE', params: { resource: 'drives', id: '@id' } },
|
||||
rescanDrives: { method: 'POST', params: { resource: 'drives', action: 'rescan' } },
|
||||
|
||||
queryVolumes: { method: 'GET', params: { resource: 'volumes' } },
|
||||
createVolume: { method: 'POST', params: { resource: 'volumes' } },
|
||||
|
|
|
@ -69,5 +69,9 @@ angular.module('extension.storidge')
|
|||
return deferred.promise;
|
||||
};
|
||||
|
||||
service.rescan = function () {
|
||||
return Storidge.rescanDrives().$promise;
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
order-by="Id"
|
||||
remove-action="removeAction"
|
||||
add-action="addAction"
|
||||
rescan-action="rescanAction"
|
||||
></storidge-drives-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -59,6 +59,16 @@ function ($q, $scope, $state, Notifications, ModalService, StoridgeDriveService)
|
|||
});
|
||||
};
|
||||
|
||||
$scope.rescanAction = function () {
|
||||
StoridgeDriveService.rescan()
|
||||
.then(function sucess() {
|
||||
$state.reload();
|
||||
})
|
||||
.catch(function error() {
|
||||
Notifications.error('Failure', err, 'Unable to scan drives');
|
||||
});
|
||||
};
|
||||
|
||||
function initView() {
|
||||
StoridgeDriveService.drives()
|
||||
.then(function success(data) {
|
||||
|
|
Loading…
Reference in New Issue