Handle hostname changes in the config panel

Fixes #436
This commit is contained in:
Joseph Schorr 2015-09-02 17:21:38 -04:00
parent 0a91a1d9d8
commit f6cca81178
6 changed files with 31 additions and 22 deletions

View file

@ -47,7 +47,7 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService'
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.
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;
};
@ -216,8 +211,8 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService'
var urlPath = path['x-path'];
// Add the operation itself.
apiService[operationName] = function(opt_options, opt_parameters, opt_background, opt_forcessl) {
var one = Restangular.one(buildUrl(urlPath, opt_parameters, opt_forcessl));
apiService[operationName] = function(opt_options, opt_parameters, opt_background) {
var one = Restangular.one(buildUrl(urlPath, opt_parameters));
if (opt_background) {
one.withHttpConfig({
'ignoreLoadingBar': true