feat(storidge): add rescan drives button

storidge-standalone
baron_l 2019-03-12 16:23:30 +01:00
parent a30171c141
commit 62f6ac926c
6 changed files with 21 additions and 1 deletions

View File

@ -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>

View File

@ -9,6 +9,7 @@ angular.module('extension.storidge').component('storidgeDrivesDatatable', {
orderBy: '@',
reverseOrder: '<',
removeAction: '<',
addAction: '<'
addAction: '<',
rescanAction: '<'
}
});

View File

@ -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' } },

View File

@ -69,5 +69,9 @@ angular.module('extension.storidge')
return deferred.promise;
};
service.rescan = function () {
return Storidge.rescanDrives().$promise;
};
return service;
}]);

View File

@ -17,6 +17,7 @@
order-by="Id"
remove-action="removeAction"
add-action="addAction"
rescan-action="rescanAction"
></storidge-drives-datatable>
</div>
</div>

View File

@ -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) {