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>
|
||||||
<td>
|
<td>
|
||||||
<button ng-if="item.Status === 'available'" type="button" class="btn btn-sm btn-primary btn-datatable"
|
<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">
|
ng-click="$ctrl.addAction(item, $index)" button-spinner="$ctrl.additionInProgress[$index]" 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-hide="$ctrl.additionInProgress[$index]"><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>
|
<span ng-show="$ctrl.additionInProgress[$index]">Addition in progress...</span>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -11,6 +11,7 @@ angular.module('extension.storidge').component('storidgeDrivesDatatable', {
|
||||||
removeAction: '<',
|
removeAction: '<',
|
||||||
addAction: '<',
|
addAction: '<',
|
||||||
rescanAction: '<',
|
rescanAction: '<',
|
||||||
actionInProgress: '<'
|
actionInProgress: '<',
|
||||||
|
additionInProgress: '<'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
rescan-action="rescanAction"
|
rescan-action="rescanAction"
|
||||||
add-action="addAction"
|
add-action="addAction"
|
||||||
action-in-progress="state.actionInProgress"
|
action-in-progress="state.actionInProgress"
|
||||||
|
addition-in-progress="state.additionInProgress"
|
||||||
></storidge-drives-datatable>
|
></storidge-drives-datatable>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,10 +3,12 @@ angular.module('extension.storidge')
|
||||||
function ($scope, $state, Notifications, StoridgeDriveService) {
|
function ($scope, $state, Notifications, StoridgeDriveService) {
|
||||||
|
|
||||||
$scope.state = {
|
$scope.state = {
|
||||||
|
additionInProgress: [],
|
||||||
actionInProgress: false
|
actionInProgress: false
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addAction = function (drive) {
|
$scope.addAction = function (drive, idx) {
|
||||||
|
$scope.state.additionInProgress[idx] = true;
|
||||||
$scope.state.actionInProgress = true;
|
$scope.state.actionInProgress = true;
|
||||||
StoridgeDriveService.add(drive.Device, drive.Node)
|
StoridgeDriveService.add(drive.Device, drive.Node)
|
||||||
.then(function success() {
|
.then(function success() {
|
||||||
|
@ -17,6 +19,7 @@ function ($scope, $state, Notifications, StoridgeDriveService) {
|
||||||
Notifications.error('Failure', err, 'Unable to add drive');
|
Notifications.error('Failure', err, 'Unable to add drive');
|
||||||
})
|
})
|
||||||
.finally(function final() {
|
.finally(function final() {
|
||||||
|
$scope.state.additionInProgress[idx] = false;
|
||||||
$scope.state.actionInProgress = false;
|
$scope.state.actionInProgress = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue