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