fix(admin-init): do not redirect to endpoint-init if at least one endpoint is defined
parent
56604a5445
commit
be4f3ec81d
|
@ -1,6 +1,6 @@
|
|||
angular.module('initAdmin', [])
|
||||
.controller('InitAdminController', ['$scope', '$state', '$sanitize', 'Notifications', 'Authentication', 'StateManager', 'UserService',
|
||||
function ($scope, $state, $sanitize, Notifications, Authentication, StateManager, UserService) {
|
||||
.controller('InitAdminController', ['$scope', '$state', '$sanitize', 'Notifications', 'Authentication', 'StateManager', 'UserService', 'EndpointService', 'EndpointProvider',
|
||||
function ($scope, $state, $sanitize, Notifications, Authentication, StateManager, UserService, EndpointService, EndpointProvider) {
|
||||
|
||||
$scope.logo = StateManager.getState().application.logo;
|
||||
|
||||
|
@ -20,7 +20,23 @@ function ($scope, $state, $sanitize, Notifications, Authentication, StateManager
|
|||
return Authentication.login(username, password);
|
||||
})
|
||||
.then(function success() {
|
||||
$state.go('init.endpoint');
|
||||
return EndpointService.endpoints();
|
||||
})
|
||||
.then(function success(data) {
|
||||
var endpoints = data;
|
||||
if (endpoints.length > 0) {
|
||||
var endpoint = endpoints[0];
|
||||
EndpointProvider.setEndpointID(endpoint.Id);
|
||||
StateManager.updateEndpointState(true)
|
||||
.then(function success(data) {
|
||||
$state.go('dashboard');
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to connect to the Docker endpoint');
|
||||
});
|
||||
} else {
|
||||
$state.go('init.endpoint');
|
||||
}
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to create administrator user');
|
||||
|
|
Loading…
Reference in New Issue