Change from manual URL construction to using a lib
Makes the code cleaner to read and more resilient to changes Fixes https://jira.coreos.com/browse/QUAY-940
This commit is contained in:
parent
e33760fcd2
commit
648590c356
13 changed files with 85 additions and 56 deletions
|
@ -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;
|
||||
},
|
||||
|
|
Reference in a new issue