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