mirror of https://github.com/portainer/portainer
fix(storidge): update 9 - add drive button will now change only for the concerned drive
parent
15e384b585
commit
2c576f83b3
|
@ -88,9 +88,9 @@
|
|||
</td>
|
||||
<td>
|
||||
<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>
|
||||
ng-click="$ctrl.addAction(item, $index)" button-spinner="$ctrl.additionInProgress[$index]" ng-disabled="$ctrl.actionInProgress">
|
||||
<span ng-hide="$ctrl.additionInProgress[$index]"><i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool</span>
|
||||
<span ng-show="$ctrl.additionInProgress[$index]">Addition in progress...</span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -11,6 +11,7 @@ angular.module('extension.storidge').component('storidgeDrivesDatatable', {
|
|||
removeAction: '<',
|
||||
addAction: '<',
|
||||
rescanAction: '<',
|
||||
actionInProgress: '<'
|
||||
actionInProgress: '<',
|
||||
additionInProgress: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
rescan-action="rescanAction"
|
||||
add-action="addAction"
|
||||
action-in-progress="state.actionInProgress"
|
||||
addition-in-progress="state.additionInProgress"
|
||||
></storidge-drives-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,10 +3,12 @@ angular.module('extension.storidge')
|
|||
function ($scope, $state, Notifications, StoridgeDriveService) {
|
||||
|
||||
$scope.state = {
|
||||
additionInProgress: [],
|
||||
actionInProgress: false
|
||||
};
|
||||
|
||||
$scope.addAction = function (drive) {
|
||||
$scope.addAction = function (drive, idx) {
|
||||
$scope.state.additionInProgress[idx] = true;
|
||||
$scope.state.actionInProgress = true;
|
||||
StoridgeDriveService.add(drive.Device, drive.Node)
|
||||
.then(function success() {
|
||||
|
@ -17,6 +19,7 @@ function ($scope, $state, Notifications, StoridgeDriveService) {
|
|||
Notifications.error('Failure', err, 'Unable to add drive');
|
||||
})
|
||||
.finally(function final() {
|
||||
$scope.state.additionInProgress[idx] = false;
|
||||
$scope.state.actionInProgress = false;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue