mirror of https://github.com/portainer/portainer
fix(endpoints-creation): remove endpoint if an error is raised during creation (#1678)
parent
0c5152fb5f
commit
b8f8df5f48
|
@ -30,18 +30,21 @@ function ($scope, $state, $filter, EndpointService, Notifications, ExtensionMana
|
|||
var TLSCertFile = TLSSkipClientVerify ? null : securityData.TLSCert;
|
||||
var TLSKeyFile = TLSSkipClientVerify ? null : securityData.TLSKey;
|
||||
|
||||
var endpointId;
|
||||
$scope.state.actionInProgress = true;
|
||||
EndpointService.createRemoteEndpoint(name, URL, PublicURL, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile)
|
||||
.then(function success(data) {
|
||||
endpointId = data.Id;
|
||||
var currentEndpointId = EndpointProvider.endpointID();
|
||||
EndpointProvider.setEndpointID(data.Id);
|
||||
ExtensionManager.initEndpointExtensions(data.Id)
|
||||
EndpointProvider.setEndpointID(endpointId);
|
||||
ExtensionManager.initEndpointExtensions(endpointId)
|
||||
.then(function success(data) {
|
||||
Notifications.success('Endpoint created', name);
|
||||
$state.reload();
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to create endpoint');
|
||||
EndpointService.deleteEndpoint(endpointId);
|
||||
})
|
||||
.finally(function final() {
|
||||
$scope.state.actionInProgress = false;
|
||||
|
|
Loading…
Reference in New Issue