Merge pull request #441 from coreos-inc/ersetupimprove
ER setup improvements
This commit is contained in:
commit
0823ba5c46
8 changed files with 37 additions and 23 deletions
|
@ -20,7 +20,7 @@ CLIENT_WHITELIST = ['SERVER_HOSTNAME', 'PREFERRED_URL_SCHEME', 'MIXPANEL_KEY',
|
||||||
'STRIPE_PUBLISHABLE_KEY', 'ENTERPRISE_LOGO_URL', 'SENTRY_PUBLIC_DSN',
|
'STRIPE_PUBLISHABLE_KEY', 'ENTERPRISE_LOGO_URL', 'SENTRY_PUBLIC_DSN',
|
||||||
'AUTHENTICATION_TYPE', 'REGISTRY_TITLE', 'REGISTRY_TITLE_SHORT',
|
'AUTHENTICATION_TYPE', 'REGISTRY_TITLE', 'REGISTRY_TITLE_SHORT',
|
||||||
'CONTACT_INFO', 'AVATAR_KIND', 'LOCAL_OAUTH_HANDLER', 'DOCUMENTATION_LOCATION',
|
'CONTACT_INFO', 'AVATAR_KIND', 'LOCAL_OAUTH_HANDLER', 'DOCUMENTATION_LOCATION',
|
||||||
'DOCUMENTATION_METADATA']
|
'DOCUMENTATION_METADATA', 'SETUP_COMPLETE']
|
||||||
|
|
||||||
|
|
||||||
def frontend_visible_config(config_dict):
|
def frontend_visible_config(config_dict):
|
||||||
|
|
|
@ -228,9 +228,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
|
||||||
box.find("input").focus();
|
box.find("input").focus();
|
||||||
box.find("form").submit(function() {
|
box.find("form").submit(function() {
|
||||||
if (!$('#validatePassword').val()) { return; }
|
if (!$('#validatePassword').val()) { return; }
|
||||||
|
|
||||||
box.modal('hide');
|
box.modal('hide');
|
||||||
verifyNow();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
$scope.currentScreenshot = 'repo-view';
|
$scope.currentScreenshot = 'repo-view';
|
||||||
$scope.userRegistered = false;
|
$scope.userRegistered = false;
|
||||||
|
|
||||||
|
if (!Config['SETUP_COMPLETE'] && !Features.BILLING) {
|
||||||
|
$location.path('/setup');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UserService.updateUserIn($scope, function(user) {
|
UserService.updateUserIn($scope, function(user) {
|
||||||
if (!user.anonymous) {
|
if (!user.anonymous) {
|
||||||
$location.path('/repository');
|
$location.path('/repository');
|
||||||
|
|
|
@ -93,6 +93,8 @@
|
||||||
$scope.stepProgress = [];
|
$scope.stepProgress = [];
|
||||||
$scope.hasSSL = false;
|
$scope.hasSSL = false;
|
||||||
$scope.hostname = null;
|
$scope.hostname = null;
|
||||||
|
$scope.currentConfig = null;
|
||||||
|
|
||||||
$scope.currentState = {
|
$scope.currentState = {
|
||||||
'hasDatabaseSSLCert': false
|
'hasDatabaseSSLCert': false
|
||||||
};
|
};
|
||||||
|
@ -147,6 +149,8 @@
|
||||||
$scope.configurationSaved = function(config) {
|
$scope.configurationSaved = function(config) {
|
||||||
$scope.hasSSL = config['PREFERRED_URL_SCHEME'] == 'https';
|
$scope.hasSSL = config['PREFERRED_URL_SCHEME'] == 'https';
|
||||||
$scope.hostname = config['SERVER_HOSTNAME'];
|
$scope.hostname = config['SERVER_HOSTNAME'];
|
||||||
|
$scope.currentConfig = config;
|
||||||
|
|
||||||
$scope.currentStep = $scope.States.VALID_CONFIG;
|
$scope.currentStep = $scope.States.VALID_CONFIG;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -298,7 +302,7 @@
|
||||||
$scope.checkStatus = function() {
|
$scope.checkStatus = function() {
|
||||||
ContainerService.checkStatus(function(resp) {
|
ContainerService.checkStatus(function(resp) {
|
||||||
$scope.currentStep = resp['status'];
|
$scope.currentStep = resp['status'];
|
||||||
}, $scope.hasSSL);
|
}, $scope.currentConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load the initial status.
|
// Load the initial status.
|
||||||
|
|
|
@ -30,12 +30,14 @@
|
||||||
$scope.logsScrolled = false;
|
$scope.logsScrolled = false;
|
||||||
$scope.csrf_token = encodeURIComponent(window.__token);
|
$scope.csrf_token = encodeURIComponent(window.__token);
|
||||||
$scope.dashboardActive = false;
|
$scope.dashboardActive = false;
|
||||||
|
$scope.currentConfig = null;
|
||||||
|
|
||||||
$scope.setDashboardActive = function(active) {
|
$scope.setDashboardActive = function(active) {
|
||||||
$scope.dashboardActive = active;
|
$scope.dashboardActive = active;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.configurationSaved = function() {
|
$scope.configurationSaved = function(config) {
|
||||||
|
$scope.currentConfig = config;
|
||||||
$scope.requiresRestart = true;
|
$scope.requiresRestart = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -321,6 +323,7 @@
|
||||||
$scope.requiresRestart = resp['requires_restart'];
|
$scope.requiresRestart = resp['requires_restart'];
|
||||||
|
|
||||||
if ($scope.configStatus == 'ready') {
|
if ($scope.configStatus == 'ready') {
|
||||||
|
$scope.currentConfig = null;
|
||||||
$scope.loadUsers();
|
$scope.loadUsers();
|
||||||
} else {
|
} else {
|
||||||
var message = "Installation of this product has not yet been completed." +
|
var message = "Installation of this product has not yet been completed." +
|
||||||
|
@ -331,7 +334,7 @@
|
||||||
var title = "Installation Incomplete";
|
var title = "Installation Incomplete";
|
||||||
CoreDialog.fatal(title, message);
|
CoreDialog.fatal(title, message);
|
||||||
}
|
}
|
||||||
});
|
}, $scope.currentConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load the initial status.
|
// Load the initial status.
|
||||||
|
|
|
@ -47,7 +47,7 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService'
|
||||||
return resource;
|
return resource;
|
||||||
};
|
};
|
||||||
|
|
||||||
var buildUrl = function(path, parameters, opt_forcessl) {
|
var buildUrl = function(path, parameters) {
|
||||||
// We already have /api/v1/ on the URLs, so remove them from the paths.
|
// We already have /api/v1/ on the URLs, so remove them from the paths.
|
||||||
path = path.substr('/api/v1/'.length, path.length);
|
path = path.substr('/api/v1/'.length, path.length);
|
||||||
|
|
||||||
|
@ -87,11 +87,6 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are forcing SSL, return an absolutel URL with an SSL prefix.
|
|
||||||
if (opt_forcessl) {
|
|
||||||
path = 'https://' + window.location.host + '/api/v1/' + path;
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -216,8 +211,8 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService'
|
||||||
var urlPath = path['x-path'];
|
var urlPath = path['x-path'];
|
||||||
|
|
||||||
// Add the operation itself.
|
// Add the operation itself.
|
||||||
apiService[operationName] = function(opt_options, opt_parameters, opt_background, opt_forcessl) {
|
apiService[operationName] = function(opt_options, opt_parameters, opt_background) {
|
||||||
var one = Restangular.one(buildUrl(urlPath, opt_parameters, opt_forcessl));
|
var one = Restangular.one(buildUrl(urlPath, opt_parameters));
|
||||||
if (opt_background) {
|
if (opt_background) {
|
||||||
one.withHttpConfig({
|
one.withHttpConfig({
|
||||||
'ignoreLoadingBar': true
|
'ignoreLoadingBar': true
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* Helper service for working with the registry's container. Only works in enterprise.
|
* Helper service for working with the registry's container. Only works in enterprise.
|
||||||
*/
|
*/
|
||||||
angular.module('quay').factory('ContainerService', ['ApiService', '$timeout',
|
angular.module('quay').factory('ContainerService', ['ApiService', '$timeout', 'Restangular',
|
||||||
|
|
||||||
function(ApiService, $timeout) {
|
function(ApiService, $timeout, Restangular) {
|
||||||
var containerService = {};
|
var containerService = {};
|
||||||
containerService.restartContainer = function(callback) {
|
containerService.restartContainer = function(callback) {
|
||||||
ApiService.scShutdownContainer(null, null).then(function(resp) {
|
ApiService.scShutdownContainer(null, null).then(function(resp) {
|
||||||
|
@ -11,25 +11,34 @@ function(ApiService, $timeout) {
|
||||||
}, ApiService.errorDisplay('Cannot restart container. Please report this to support.'))
|
}, ApiService.errorDisplay('Cannot restart container. Please report this to support.'))
|
||||||
};
|
};
|
||||||
|
|
||||||
containerService.scheduleStatusCheck = function(callback) {
|
containerService.scheduleStatusCheck = function(callback, opt_config) {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
containerService.checkStatus(callback);
|
containerService.checkStatus(callback, opt_config);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
containerService.checkStatus = function(callback, force_ssl) {
|
containerService.checkStatus = function(callback, opt_config) {
|
||||||
var errorHandler = function(resp) {
|
var errorHandler = function(resp) {
|
||||||
if (resp.status == 404 || resp.status == 502) {
|
if (resp.status == 404 || resp.status == 502) {
|
||||||
// Container has not yet come back up, so we schedule another check.
|
// Container has not yet come back up, so we schedule another check.
|
||||||
containerService.scheduleStatusCheck(callback);
|
containerService.scheduleStatusCheck(callback, opt_config);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiService.errorDisplay('Cannot load status. Please report this to support')(resp);
|
return ApiService.errorDisplay('Cannot load status. Please report this to support')(resp);
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiService.scRegistryStatus(null, null)
|
// If config is specified, override the API base URL from this point onward.
|
||||||
.then(callback, errorHandler, /* background */true, /* force ssl*/force_ssl);
|
// TODO(jschorr): Find a better way than this. This is safe, since this will only be called
|
||||||
|
// for a restart, but it is still ugly.
|
||||||
|
if (opt_config && opt_config['SERVER_HOSTNAME']) {
|
||||||
|
var scheme = opt_config['PREFERRED_URL_SCHEME'] || 'http';
|
||||||
|
var baseUrl = scheme + '://' + opt_config['SERVER_HOSTNAME'] + '/api/v1/';
|
||||||
|
Restangular.setBaseUrl(baseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiService.scRegistryStatus(null, null, /* background */true)
|
||||||
|
.then(callback, errorHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
return containerService;
|
return containerService;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<!-- Setup tab -->
|
<!-- Setup tab -->
|
||||||
<div id="setup" class="tab-pane">
|
<div id="setup" class="tab-pane">
|
||||||
<div class="config-setup-tool" is-active="configStatus == 'ready'"
|
<div class="config-setup-tool" is-active="configStatus == 'ready'"
|
||||||
configuration-saved="configurationSaved()"></div>
|
configuration-saved="configurationSaved(config)"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Dashboard tab -->
|
<!-- Dashboard tab -->
|
||||||
|
|
Reference in a new issue