mirror of https://github.com/portainer/portainer
feat(storidge): update 9 - disable add drive button when action is in progress
parent
c6f083cd6f
commit
15e384b585
|
@ -87,9 +87,11 @@
|
|||
<span class="label label-{{ item.Status|drivestatusbadge }}">{{ item.Status|capitalize }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<button ng-if="item.Status === 'available'" type="button" class="btn btn-sm btn-primary btn-datatable" ng-click="$ctrl.addAction(item)">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool
|
||||
</button>
|
||||
<button ng-if="item.Status === 'available'" type="button" class="btn btn-sm btn-primary btn-datatable"
|
||||
ng-click="$ctrl.addAction(item)" button-spinner="$ctrl.actionInProgress" ng-disabled="$ctrl.actionInProgress">
|
||||
<span ng-hide="$ctrl.actionInProgress"><i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool</span>
|
||||
<span ng-show="$ctrl.actionInProgress">Addition in progress...</span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr ng-if="!$ctrl.dataset">
|
||||
|
|
|
@ -10,6 +10,7 @@ angular.module('extension.storidge').component('storidgeDrivesDatatable', {
|
|||
reverseOrder: '<',
|
||||
removeAction: '<',
|
||||
addAction: '<',
|
||||
rescanAction: '<'
|
||||
rescanAction: '<',
|
||||
actionInProgress: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
order-by="Id"
|
||||
rescan-action="rescanAction"
|
||||
add-action="addAction"
|
||||
action-in-progress="state.actionInProgress"
|
||||
></storidge-drives-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,12 @@ angular.module('extension.storidge')
|
|||
.controller('StoridgeDrivesController', ['$scope', '$state', 'Notifications', 'StoridgeDriveService',
|
||||
function ($scope, $state, Notifications, StoridgeDriveService) {
|
||||
|
||||
$scope.state = {
|
||||
actionInProgress: false
|
||||
};
|
||||
|
||||
$scope.addAction = function (drive) {
|
||||
$scope.state.actionInProgress = true;
|
||||
StoridgeDriveService.add(drive.Device, drive.Node)
|
||||
.then(function success() {
|
||||
Notifications.success('Drive ' + drive.Device + ' successfully added on node ' + drive.Node);
|
||||
|
@ -10,6 +15,9 @@ function ($scope, $state, Notifications, StoridgeDriveService) {
|
|||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to add drive');
|
||||
})
|
||||
.finally(function final() {
|
||||
$scope.state.actionInProgress = false;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue