mirror of https://github.com/portainer/portainer
extension(storidge): support cluster shutdown (#1589)
parent
173ea372c2
commit
0d0072a50e
|
@ -40,5 +40,13 @@ angular.module('extension.storidge')
|
|||
});
|
||||
};
|
||||
|
||||
service.shutdown = function() {
|
||||
return $http({
|
||||
method: 'POST',
|
||||
url: StoridgeManager.StoridgeAPIURL() + '/cluster/shutdown',
|
||||
skipAuthorization: true
|
||||
});
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
||||
|
|
|
@ -7,6 +7,10 @@ angular.module('extension.storidge')
|
|||
return StoridgeCluster.reboot();
|
||||
};
|
||||
|
||||
service.shutdown = function() {
|
||||
return StoridgeCluster.shutdown();
|
||||
};
|
||||
|
||||
service.info = function() {
|
||||
var deferred = $q.defer();
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<button type="button" class="btn btn-danger btn-sm" ng-click="shutdownCluster()" ng-disabled="state.shutdownInProgress" button-spinner="state.shutdownInProgress">
|
||||
<span ng-hide="state.updateInProgress"><i class="fa fa-power-off space-right" aria-hidden="true"></i> Shutdown the cluster</span>
|
||||
<span ng-show="state.updateInProgress">Shutting down cluster...</span>
|
||||
<span ng-hide="state.shutdownInProgress"><i class="fa fa-power-off space-right" aria-hidden="true"></i> Shutdown the cluster</span>
|
||||
<span ng-show="state.shutdownInProgress">Shutting down cluster...</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" ng-click="rebootCluster()" ng-disabled="state.rebootInProgress" button-spinner="state.shutdownInProgress">
|
||||
<span ng-hide="state.deleteInProgress"><i class="fa fa-refresh space-right" aria-hidden="true"></i> Reboot the cluster</span>
|
||||
<span ng-show="state.deleteInProgress">Rebooting cluster...</span>
|
||||
<span ng-hide="state.rebootInProgress"><i class="fa fa-refresh space-right" aria-hidden="true"></i> Reboot the cluster</span>
|
||||
<span ng-show="state.rebootInProgress">Rebooting cluster...</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -42,8 +42,18 @@ function ($q, $scope, $state, Notifications, StoridgeClusterService, StoridgeNod
|
|||
};
|
||||
|
||||
function shutdownCluster() {
|
||||
Notifications.error('Not implemented', {}, 'Not implemented yet');
|
||||
$state.reload();
|
||||
$scope.state.shutdownInProgress = true;
|
||||
StoridgeClusterService.shutdown()
|
||||
.then(function success(data) {
|
||||
Notifications.success('Cluster successfully shutdown');
|
||||
$state.go('dashboard');
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to shutdown cluster');
|
||||
})
|
||||
.finally(function final() {
|
||||
$scope.state.shutdownInProgress = false;
|
||||
});
|
||||
}
|
||||
|
||||
function rebootCluster() {
|
||||
|
|
Loading…
Reference in New Issue