mirror of https://github.com/portainer/portainer
fix(storidge): update 10 - disable remove drive button when removal in progress
parent
2c576f83b3
commit
988bdb8280
|
@ -16,11 +16,9 @@
|
|||
<td>ID</td>
|
||||
<td>
|
||||
{{ drive.Id }}
|
||||
<button class="btn btn-xs btn-primary" ng-click="addDrive()" ng-if="drive.Status === 'available'">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool
|
||||
</button>
|
||||
<button class="btn btn-xs btn-danger" ng-click="removeDrive()" ng-if="drive.Status === 'faulty'">
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove from storage pool
|
||||
<button class="btn btn-xs btn-danger" ng-click="removeDrive()" ng-if="drive.Status === 'faulty'" button-spinner="actionInProgress" ng-disabled="actionInProgress">
|
||||
<span ng-hide="actionInProgress"><i class="fa fa-trash space-right" aria-hidden="true"></i>Remove from storage pool</span>
|
||||
<span ng-show="actionInProgress">Removal in progress...</span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -2,16 +2,7 @@ angular.module('extension.storidge')
|
|||
.controller('StoridgeDriveController', ['$scope', '$state', '$transition$', 'Notifications', 'ModalService', 'StoridgeDriveService',
|
||||
function ($scope, $state, $transition$, Notifications, ModalService, StoridgeDriveService) {
|
||||
|
||||
$scope.addDrive = function () {
|
||||
StoridgeDriveService.add($scope.drive.Device, $scope.drive.Node)
|
||||
.then(function () {
|
||||
Notifications.success('Success', 'Drive added to storage pool');
|
||||
$state.reload();
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to add drive to storage pool');
|
||||
});
|
||||
};
|
||||
$scope.actionInProgress = false;
|
||||
|
||||
$scope.removeDrive = function () {
|
||||
ModalService.confirm({
|
||||
|
@ -25,13 +16,17 @@ function ($scope, $state, $transition$, Notifications, ModalService, StoridgeDri
|
|||
},
|
||||
callback: function onConfirm(confirmed) {
|
||||
if(!confirmed) { return; }
|
||||
$scope.actionInProgress = true;
|
||||
StoridgeDriveService.remove($scope.drive.Id)
|
||||
.then(function () {
|
||||
Notifications.success('Success', 'Drive removed from storage pool');
|
||||
$state.reload();
|
||||
$state.go('storidge.drives', {}, { reload:true });
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to remove drive from storage pool');
|
||||
})
|
||||
.finally(function final() {
|
||||
$scope.actionInProgress = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue