1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 05:15:25 +02:00

fix(home): fix an issue when trying to connect to an Azure ACI endpoint (#2671)

This commit is contained in:
Anthony Lapenna 2019-02-04 09:04:52 +13:00 committed by GitHub
parent 2eec8b75d0
commit 899cd5f279
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,12 @@
angular.module('portainer.app') angular.module('portainer.app')
.controller('HomeController', ['$q', '$scope', '$state', 'Authentication', 'EndpointService', 'EndpointHelper', 'GroupService', 'Notifications', 'EndpointProvider', 'StateManager', 'LegacyExtensionManager', 'ModalService', 'MotdService', 'SystemService', .controller('HomeController', ['$q', '$scope', '$state', 'Authentication', 'EndpointService', 'EndpointHelper', 'GroupService', 'Notifications', 'EndpointProvider', 'StateManager', 'LegacyExtensionManager', 'ModalService', 'MotdService', 'SystemService',
function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, GroupService, Notifications, EndpointProvider, StateManager, LegacyExtensionManager, ModalService, MotdService, SystemService) { function($q, $scope, $state, Authentication, EndpointService, EndpointHelper, GroupService, Notifications, EndpointProvider, StateManager, LegacyExtensionManager, ModalService, MotdService, SystemService) {
$scope.goToEdit = function(id) { $scope.goToEdit = function(id) {
$state.go('portainer.endpoints.endpoint', { id: id }); $state.go('portainer.endpoints.endpoint', { id: id });
}; };
$scope.goToDashboard = function (endpoint) { $scope.goToDashboard = function(endpoint) {
if (endpoint.Type === 3) { if (endpoint.Type === 3) {
return switchToAzureEndpoint(endpoint); return switchToAzureEndpoint(endpoint);
} }
@ -19,16 +19,16 @@ function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, G
}); });
}; };
$scope.dismissImportantInformation = function (hash) { $scope.dismissImportantInformation = function(hash) {
StateManager.dismissImportantInformation(hash); StateManager.dismissImportantInformation(hash);
}; };
$scope.dismissInformationPanel = function (id) { $scope.dismissInformationPanel = function(id) {
StateManager.dismissInformationPanel(id); StateManager.dismissInformationPanel(id);
}; };
$scope.triggerSnapshot = function () { $scope.triggerSnapshot = function() {
ModalService.confirmEndpointSnapshot(function (result) { ModalService.confirmEndpointSnapshot(function(result) {
if (!result) { if (!result) {
return; return;
} }
@ -45,7 +45,7 @@ function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, G
status = 1; status = 1;
}).catch(function error() { }).catch(function error() {
status = 2; status = 2;
}).finally(function () { }).finally(function() {
if (endpoint.Status === status) { if (endpoint.Status === status) {
deferred.resolve(endpoint); deferred.resolve(endpoint);
return deferred.promise; return deferred.promise;
@ -55,7 +55,7 @@ function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, G
.then(function sucess() { .then(function sucess() {
deferred.resolve(endpoint); deferred.resolve(endpoint);
}).catch(function error(err) { }).catch(function error(err) {
deferred.reject({msg: 'Unable to update endpoint status', err: err}); deferred.reject({ msg: 'Unable to update endpoint status', err: err });
}); });
}); });
@ -66,7 +66,7 @@ function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, G
EndpointProvider.setEndpointID(endpoint.Id); EndpointProvider.setEndpointID(endpoint.Id);
EndpointProvider.setEndpointPublicURL(endpoint.PublicURL); EndpointProvider.setEndpointPublicURL(endpoint.PublicURL);
EndpointProvider.setOfflineModeFromStatus(endpoint.Status); EndpointProvider.setOfflineModeFromStatus(endpoint.Status);
StateManager.updateEndpointState(endpoint.Name, endpoint.Type, []) StateManager.updateEndpointState(endpoint, [])
.then(function success() { .then(function success() {
$state.go('azure.dashboard'); $state.go('azure.dashboard');
}) })
@ -136,4 +136,4 @@ function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, G
} }
initView(); initView();
}]); }]);