diff --git a/oauth/base.py b/oauth/base.py
index 1e3d451d6..12ca4dfef 100644
--- a/oauth/base.py
+++ b/oauth/base.py
@@ -25,14 +25,7 @@ class OAuthEndpoint(object):
params_copy = copy.copy(self.params)
params_copy.update(parameters)
return OAuthEndpoint(self.base_url, params_copy)
-
- def to_url_prefix(self):
- prefix = self.to_url()
- if self.params:
- return prefix + '&'
- else:
- return prefix + '?'
-
+
def to_url(self):
(scheme, netloc, path, _, fragment) = urlparse.urlsplit(self.base_url)
updated_query = urllib.urlencode(self.params)
diff --git a/oauth/services/github.py b/oauth/services/github.py
index 3923b6c95..6bc9350ff 100644
--- a/oauth/services/github.py
+++ b/oauth/services/github.py
@@ -113,7 +113,7 @@ class GithubOAuthService(OAuthLoginService):
def get_public_config(self):
return {
'CLIENT_ID': self.client_id(),
- 'AUTHORIZE_ENDPOINT': self.authorize_endpoint().to_url_prefix(),
+ 'AUTHORIZE_ENDPOINT': self.authorize_endpoint().to_url(),
'GITHUB_ENDPOINT': self._endpoint(),
'ORG_RESTRICT': self.config.get('ORG_RESTRICT', False)
}
diff --git a/oauth/services/gitlab.py b/oauth/services/gitlab.py
index 4ac0dda22..1ee2f90ed 100644
--- a/oauth/services/gitlab.py
+++ b/oauth/services/gitlab.py
@@ -55,6 +55,6 @@ class GitLabOAuthService(OAuthService):
def get_public_config(self):
return {
'CLIENT_ID': self.client_id(),
- 'AUTHORIZE_ENDPOINT': self.authorize_endpoint().to_url_prefix(),
+ 'AUTHORIZE_ENDPOINT': self.authorize_endpoint().to_url(),
'GITLAB_ENDPOINT': self._endpoint(),
}
diff --git a/oauth/services/google.py b/oauth/services/google.py
index ede5203dd..a22964bb6 100644
--- a/oauth/services/google.py
+++ b/oauth/services/google.py
@@ -61,7 +61,7 @@ class GoogleOAuthService(OAuthLoginService):
def get_public_config(self):
return {
'CLIENT_ID': self.client_id(),
- 'AUTHORIZE_ENDPOINT': self.authorize_endpoint().to_url_prefix()
+ 'AUTHORIZE_ENDPOINT': self.authorize_endpoint().to_url()
}
def get_login_service_id(self, user_info):
diff --git a/oauth/services/test/test_github.py b/oauth/services/test/test_github.py
index c19ec3f42..b14ac4952 100644
--- a/oauth/services/test/test_github.py
+++ b/oauth/services/test/test_github.py
@@ -29,7 +29,6 @@ def test_basic_enterprise_config(trigger_config, domain, api_endpoint, is_enterp
assert github_trigger.is_enterprise() == is_enterprise
assert github_trigger.authorize_endpoint().to_url() == '%s/login/oauth/authorize' % domain
- assert github_trigger.authorize_endpoint().to_url_prefix() == '%s/login/oauth/authorize?' % domain
assert github_trigger.token_endpoint().to_url() == '%s/login/oauth/access_token' % domain
diff --git a/package.json b/package.json
index 828195b23..5ed245cb3 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"showdown": "^1.6.4",
"underscore": "^1.5.2",
"urijs": "^1.18.10",
+ "url-parse": "^1.4.0",
"zeroclipboard": "^2.3.0"
},
"devDependencies": {
diff --git a/static/css/quay.css b/static/css/quay.css
index 575a8fa52..33256d4b0 100644
--- a/static/css/quay.css
+++ b/static/css/quay.css
@@ -13,16 +13,6 @@
}
}
-.repo-search {
- display: none;
-}
-
-@media (min-width: 1200px) {
- .repo-search {
- display: inline-block;
- }
-}
-
.announcement a {
color: lightblue;
}
diff --git a/static/directives/repo-search.html b/static/directives/repo-search.html
deleted file mode 100644
index 2f313db34..000000000
--- a/static/directives/repo-search.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/static/js/directives/ui/entity-search.js b/static/js/directives/ui/entity-search.js
index c95b7ca76..9a3f868b8 100644
--- a/static/js/directives/ui/entity-search.js
+++ b/static/js/directives/ui/entity-search.js
@@ -84,7 +84,7 @@ angular.module('quay').directive('entitySearch', function () {
$scope.checkLazyLoad = function() {
if (!$scope.namespace || !$scope.thisUser || !$scope.requiresLazyLoading ||
$scope.isLazyLoading || !$scope.userRequestedLazyLoading) {
- return;
+ return;
}
$scope.isLazyLoading = true;
@@ -229,15 +229,20 @@ angular.module('quay').directive('entitySearch', function () {
name: 'entities' + $rootScope.__entity_search_counter,
remote: {
url: '/api/v1/entities/%QUERY',
- replace: function (url, uriEncodedQuery) {
+ replace: function (query_url, uriEncodedQuery) {
+ $scope.lazyLoad();
+
var namespace = $scope.namespace || '';
- url = url.replace('%QUERY', uriEncodedQuery);
- url += '?namespace=' + encodeURIComponent(namespace);
+
+ var url = UtilService.getRestUrl(query_url.replace('%QUERY', uriEncodedQuery));
+ url.setQueryParameter('namespace', namespace);
+
if ($scope.isOrganization && isSupported('team')) {
- url += '&includeTeams=true'
+ url.setQueryParameter('includeTeams', true);
}
+
if (isSupported('org')) {
- url += '&includeOrgs=true'
+ url.setQueryParameter('includeOrgs', true);
}
return url;
},
diff --git a/static/js/directives/ui/location-view.js b/static/js/directives/ui/location-view.js
deleted file mode 100644
index 388a89b06..000000000
--- a/static/js/directives/ui/location-view.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * An element which displays a small flag representing the given location, as well as a ping
- * latency gauge for that location.
- */
-angular.module('quay').directive('locationView', function () {
- var directiveDefinitionObject = {
- priority: 0,
- templateUrl: '/static/directives/location-view.html',
- replace: false,
- transclude: true,
- restrict: 'C',
- scope: {
- 'location': '=location'
- },
- controller: function($rootScope, $scope, $element, $http, PingService) {
- var LOCATIONS = {
- 'local_us': { 'country': 'US', 'data': 'quay-registry.s3.amazonaws.com', 'title': 'United States' },
- 'local_eu': { 'country': 'EU', 'data': 'quay-registry-eu.s3-eu-west-1.amazonaws.com', 'title': 'Europe' },
-
- 's3_us_east_1': { 'country': 'US', 'data': 'quay-registry.s3.amazonaws.com', 'title': 'United States (East)' },
- 's3_us_west_1': { 'country': 'US', 'data': 'quay-registry-cali.s3.amazonaws.com', 'title': 'United States (West)' },
-
- 's3_eu_west_1': { 'country': 'EU', 'data': 'quay-registry-eu.s3-eu-west-1.amazonaws.com', 'title': 'Europe' },
-
- 's3_ap_southeast_1': { 'country': 'SG', 'data': 'quay-registry-singapore.s3-ap-southeast-1.amazonaws.com', 'title': 'Singapore' },
- 's3_ap_southeast_2': { 'country': 'AU', 'data': 'quay-registry-sydney.s3-ap-southeast-2.amazonaws.com', 'title': 'Australia' },
-
- // 's3_ap_northeast-1': { 'country': 'JP', 'data': 's3-ap-northeast-1.amazonaws.com', 'title': 'Japan' },
- // 's3_sa_east1': { 'country': 'BR', 'data': 's3-east-1.amazonaws.com', 'title': 'Sao Paulo' }
- };
-
- $scope.locationPing = null;
-
- $scope.getLocationTooltip = function(location, ping) {
- var tip = $scope.getLocationTitle(location) + '
';
- if (ping == null) {
- tip += '(Loading)';
- } else if (ping < 0) {
- tip += '
Note: Could not contact server';
- } else {
- tip += 'Estimated Ping: ' + (ping ? ping + 'ms' : '(Loading)');
- }
- return tip;
- };
-
- $scope.getLocationTitle = function(location) {
- if (!LOCATIONS[location]) {
- return '(Unknown)';
- }
- return 'Image data is located in ' + LOCATIONS[location]['title'];
- };
-
- $scope.getLocationImage = function(location) {
- if (!LOCATIONS[location]) {
- return 'unknown.png';
- }
- return LOCATIONS[location]['country'] + '.png';
- };
-
- $scope.getLocationPing = function(location) {
- var url = 'https://' + LOCATIONS[location]['data'] + '/okay.txt';
- PingService.pingUrl($scope, url, function(ping, success, count) {
- if (count == 3 || !success) {
- $scope.locationPing = success ? ping : -1;
- }
- });
- };
-
- $scope.$watch('location', function(location) {
- if (!location) { return; }
- $scope.getLocationPing(location);
- });
- }
- };
- return directiveDefinitionObject;
-});
diff --git a/static/js/directives/ui/logs-view.js b/static/js/directives/ui/logs-view.js
index 544263a1e..877863b78 100644
--- a/static/js/directives/ui/logs-view.js
+++ b/static/js/directives/ui/logs-view.js
@@ -1,5 +1,5 @@
import { LogUsageChart } from '../../graphing';
-
+import { parse } from 'path';
/**
* Element which displays usage logs for the given entity.
@@ -383,8 +383,8 @@ angular.module('quay').directive('logsView', function () {
url = UtilService.getRestUrl('superuser', suffix)
}
- url += '?starttime=' + encodeURIComponent(getDateString($scope.options.logStartDate));
- url += '&endtime=' + encodeURIComponent(getDateString($scope.options.logEndDate));
+ url.setQueryParameter('starttime', getDateString($scope.options.logStartDate));
+ url.setQueryParameter('endtime', getDateString($scope.options.logEndDate));
return url;
};
@@ -405,7 +405,7 @@ angular.module('quay').directive('logsView', function () {
$scope.chartLoading = true;
- var aggregateUrl = getUrl('aggregatelogs')
+ var aggregateUrl = getUrl('aggregatelogs').toString();
var loadAggregate = Restangular.one(aggregateUrl);
loadAggregate.customGET().then(function(resp) {
$scope.chart = new LogUsageChart(logKinds);
@@ -430,12 +430,10 @@ angular.module('quay').directive('logsView', function () {
$scope.loading = true;
- var logsUrl = getUrl('logs');
- if ($scope.nextPageToken) {
- logsUrl = logsUrl + '&next_page=' + encodeURIComponent($scope.nextPageToken);
- }
+ var url = getUrl('logs');
+ url.setQueryParameter('next_page', $scope.nextPageToken);
- var loadLogs = Restangular.one(logsUrl);
+ var loadLogs = Restangular.one(url.toString());
loadLogs.customGET().then(function(resp) {
resp.logs.forEach(function(log) {
$scope.logs.push(log);
diff --git a/static/js/directives/ui/repo-search.js b/static/js/directives/ui/repo-search.js
deleted file mode 100644
index d46764404..000000000
--- a/static/js/directives/ui/repo-search.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * An element which displays a repository search box.
- */
-angular.module('quay').directive('repoSearch', function () {
- var number = 0;
- var directiveDefinitionObject = {
- priority: 0,
- templateUrl: '/static/directives/repo-search.html',
- replace: false,
- transclude: false,
- restrict: 'C',
- scope: {
- },
- controller: function($scope, $element, $location, UserService, Restangular, UtilService) {
- var searchToken = 0;
- $scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
- ++searchToken;
- }, true);
-
- var repoHound = new Bloodhound({
- name: 'repositories',
- remote: {
- url: '/api/v1/find/repository?query=%QUERY',
- replace: function (url, uriEncodedQuery) {
- url = url.replace('%QUERY', uriEncodedQuery);
- url += '&cb=' + searchToken;
- return url;
- },
- filter: function(data) {
- var datums = [];
- for (var i = 0; i < data.repositories.length; ++i) {
- var repo = data.repositories[i];
- datums.push({
- 'value': repo.name,
- 'tokens': [repo.name, repo.namespace],
- 'repo': repo
- });
- }
- return datums;
- }
- },
- datumTokenizer: function(d) {
- return Bloodhound.tokenizers.whitespace(d.val);
- },
- queryTokenizer: Bloodhound.tokenizers.whitespace
- });
- repoHound.initialize();
-
- var element = $($element[0].childNodes[0]);
- element.typeahead({ 'highlight': true }, {
- source: repoHound.ttAdapter(),
- templates: {
- 'suggestion': function (datum) {
- template = '