diff --git a/static/js/app.js b/static/js/app.js index 3440468d4..2ffde83b5 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1,7 +1,7 @@ var TEAM_PATTERN = '^[a-zA-Z][a-zA-Z0-9]+$'; var ROBOT_PATTERN = '^[a-zA-Z][a-zA-Z0-9]{3,29}$'; -$.fn.clipboardCopy = function() { +$.fn.clipboardCopy = function() { if (zeroClipboardSupported) { (new ZeroClipboard($(this))); return true; @@ -17,7 +17,7 @@ ZeroClipboard.config({ }); ZeroClipboard.on("error", function(e) { - zeroClipboardSupported = false; + zeroClipboardSupported = false; }); ZeroClipboard.on('aftercopy', function(e) { @@ -67,7 +67,7 @@ function clickElement(el){ function getFirstTextLine(commentString) { if (!commentString) { return ''; } - + var lines = commentString.split('\n'); var MARKDOWN_CHARS = { '#': true, @@ -113,7 +113,7 @@ function createOrganizationTeam(ApiService, orgname, teamname, callback) { 'orgname': orgname, 'teamname': teamname }; - + ApiService.updateOrganizationTeam(data, params) .then(callback, ApiService.errorDisplay('Cannot create team')); } @@ -206,7 +206,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading that.showAdditionalEntries_(); }, 10); }; - + _ViewArray.prototype.stopTimer_ = function() { if (this.timerRef_) { $interval.cancel(this.timerRef_); @@ -286,7 +286,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading that.call_(); }, this.sleeptime_) }; - + var service = { 'create': function(scope, requester, opt_sleeptime) { return new _PollChannel(scope, requester, opt_sleeptime); @@ -307,7 +307,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading dataFileService.tryAsZip_ = function(buf, success, failure) { var zip = null; var zipFiles = null; - try { + try { var zip = new JSZip(buf); zipFiles = zip.files; } catch (e) { @@ -391,7 +391,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading success(processed); break; } - }); + }); }; dataFileService.blobToString = function(blob, callback) { @@ -462,7 +462,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading $provide.factory('UIService', [function() { var uiService = {}; - + uiService.hidePopover = function(elem) { var popover = $(elem).data('bs.popover'); if (popover) { @@ -482,7 +482,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading popover.show(); }, 500); }; - + uiService.showFormError = function(elem, result) { var message = result.data['message'] || result.data['error_description'] || ''; if (message) { @@ -491,7 +491,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading uiService.hidePopover(elem); } }; - + return uiService; }]); @@ -510,14 +510,14 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading .replace(/>/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); - + return adjusted; }; - + utilService.textToSafeHtml = function(text) { return $sanitize(utilService.escapeHtmlString(text)); }; - + return utilService; }]); @@ -578,7 +578,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading }, 1000); } }; - + var pingUrlInternal = function($scope, url, callback) { var path = url + '?cb=' + (Math.random() * 100); var start = new Date(); @@ -605,7 +605,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading pingService.pingUrl = function($scope, url, callback) { if (pingCache[url]) { - invokeCallback($scope, pingCache[url]['pings'], callback); + invokeCallback($scope, pingCache[url]['pings'], callback); return; } @@ -615,12 +615,12 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading pingUrlInternal($scope, url, callback); }, 1000); }; - + return pingService; }]); - $provide.factory('TriggerService', ['UtilService', '$sanitize', 'KeyService', + $provide.factory('TriggerService', ['UtilService', '$sanitize', 'KeyService', function(UtilService, $sanitize, KeyService) { var triggerService = {}; @@ -643,13 +643,13 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading ], 'get_redirect_url': function(namespace, repository) { - var redirect_uri = KeyService['githubRedirectUri'] + '/trigger/' + + var redirect_uri = KeyService['githubRedirectUri'] + '/trigger/' + namespace + '/' + repository; var authorize_url = KeyService['githubTriggerAuthorizeUrl']; var client_id = KeyService['githubTriggerClientId']; - return authorize_url + 'client_id=' + client_id + + return authorize_url + 'client_id=' + client_id + '&scope=repo,user:email&redirect_uri=' + redirect_uri; } } @@ -758,7 +758,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading if (typeof description != 'string') { description = description(metadata); } - + for (var key in metadata) { if (metadata.hasOwnProperty(key)) { var value = metadata[key] != null ? metadata[key] : '(Unknown)'; @@ -807,7 +807,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading if (command.length > 2 && command[0] == '/bin/sh' && command[1] == '-c') { return command[2]; } - + return command.join(' '); }; @@ -838,7 +838,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading features.hasFeature = function(name) { return !!features.getFeature(name); }; - + features.matchesFeatures = function(list) { for (var i = 0; i < list.length; ++i) { var value = features.getFeature(list[i]); @@ -982,7 +982,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading if (userRelatedResource) { var operations = userRelatedResource['operations']; for (var i = 0; i < operations.length; ++i) { - var operation = operations[i]; + var operation = operations[i]; if (operation['method'].toLowerCase() == method) { return operation['nickname']; } @@ -996,7 +996,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading var name = endpointResource['name']; var operations = endpointResource['operations']; for (var i = 0; i < operations.length; ++i) { - var operation = operations[i]; + var operation = operations[i]; buildMethodsForOperation(operation, endpointResource, resourceMap); } }; @@ -1004,7 +1004,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading var freshLoginFailCheck = function(opName, opArgs) { return function(resp) { var deferred = $q.defer(); - + // If the error is a fresh login required, show the dialog. if (resp.status == 401 && resp.data['error_type'] == 'fresh_login_required') { var verifyNow = function() { @@ -1028,12 +1028,12 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading deferred.reject({'data': {'message': 'Invalid verification credentials'}}); }); }; - + var box = bootbox.dialog({ "message": 'It has been more than a few minutes since you last logged in, ' + - 'so please verify your password to perform this sensitive operation:' + + 'so please verify your password to perform this sensitive operation:' + '
', "title": 'Please Verify', "buttons": { @@ -1056,7 +1056,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading box.find("input").focus(); box.find("form").submit(function() { if (!$('#freshPassword').val()) { return; } - + box.modal('hide'); verifyNow(); }); @@ -1085,7 +1085,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading 'ignoreLoadingBar': true }); } - + var opObj = one['custom' + method.toUpperCase()](opt_options); // If the operation requires_fresh_login, then add a specialized error handler that @@ -1176,7 +1176,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading return apiService; }]); - + $provide.factory('CookieService', ['$cookies', '$cookieStore', function($cookies, $cookieStore) { var cookieService = {}; cookieService.putPermanent = function(name, value) { @@ -1219,7 +1219,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading scope.$watch(function () { return userService.currentUser(); }, function (currentUser) { scope.user = currentUser; if (opt_callback) { - opt_callback(currentUser); + opt_callback(currentUser); } }, true); }; @@ -1273,7 +1273,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading ApiService.getLoggedInUser().then(function(loadedUser) { handleUserResponse(loadedUser); }, function() { - handleUserResponse({'anonymous': true}); + handleUserResponse({'anonymous': true}); }); }; @@ -1310,7 +1310,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading var org = userService.getOrganization(namespace); return !!org; }; - + userService.currentUser = function() { return userResponse; }; @@ -1337,22 +1337,22 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading if (Features.BUILD_SUPPORT) { var buildEvents = [ - { + { 'id': 'build_queued', 'title': 'Dockerfile Build Queued', 'icon': 'fa-tasks' }, - { + { 'id': 'build_start', 'title': 'Dockerfile Build Started', 'icon': 'fa-circle-o-notch' }, - { + { 'id': 'build_success', 'title': 'Dockerfile Build Successfully Completed', 'icon': 'fa-check-circle-o' }, - { + { 'id': 'build_failure', 'title': 'Dockerfile Build Failed', 'icon': 'fa-times-circle-o' @@ -1376,7 +1376,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading } ] }, - { + { 'id': 'email', 'title': 'E-mail', 'icon': 'fa-envelope', @@ -1612,7 +1612,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading var params = { 'uuid': notification.id }; - + ApiService.updateUserNotification(notification, params, function() { notificationService.update(); }, ApiService.errorDisplay('Could not update notification')); @@ -1762,7 +1762,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading return keyService; }]); - + $provide.factory('PlanService', ['KeyService', 'UserService', 'CookieService', 'ApiService', 'Features', 'Config', function(KeyService, UserService, CookieService, ApiService, Features, Config) { var plans = null; @@ -1842,7 +1842,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading CookieService.clear('quay.notedplan'); return planId; }; - + planService.handleCardError = function(resp) { if (!planService.isCardError(resp)) { return; } @@ -1902,14 +1902,14 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading planService.getPlanIncludingDeprecated = function(planId, callback) { planService.verifyLoaded(function() { - if (planDict[planId]) { + if (planDict[planId]) { callback(planDict[planId]); } }); }; planService.getMinimumPlan = function(privateCount, isBusiness, callback) { - planService.getPlans(function(plans) { + planService.getPlans(function(plans) { for (var i = 0; i < plans.length; i++) { var plan = plans[i]; if (plan.privateRepos >= privateCount) { @@ -1975,7 +1975,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading planService.showSubscribeDialog($scope, orgname, planId, callbacks, title, /* async */true); return; } - + previousSubscribeFailure = false; planService.setSubscription(orgname, planId, callbacks['success'], function(resp) { @@ -1998,11 +1998,11 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading var submitToken = function(token) { if (submitted) { return; } submitted = true; - $scope.$apply(function() { + $scope.$apply(function() { if (callbacks['started']) { callbacks['started'](); } - + var cardInfo = { 'token': token.id }; @@ -2069,7 +2069,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading "className": "btn-default" } } - }); + }); return; } @@ -2120,7 +2120,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading return { require: 'ngModel', link: function(scope, elem, attrs, ctrl) { - scope.$watch(function() { + scope.$watch(function() { return $parse(attrs.match)(scope) === ctrl.$modelValue; }, function(currentValue) { ctrl.$setValidity('mismatch', currentValue); @@ -2215,7 +2215,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading if (window.__config && window.__config.MIXPANEL_KEY) { quayApp.config(['$analyticsProvider', function($analyticsProvider) { - $analyticsProvider.virtualPageviews(true); + $analyticsProvider.virtualPageviews(true); }]); } @@ -2331,7 +2331,7 @@ quayApp.directive('quayClasses', function(Features, Config) { priority: 580, restrict: 'A', link: function($scope, $element, $attr, ctrl, $transclude) { - + // Borrowed from ngClass. function flattenClasses(classVal) { if(angular.isArray(classVal)) { @@ -2345,10 +2345,10 @@ quayApp.directive('quayClasses', function(Features, Config) { }); return classes.join(' '); } - + return classVal; } - + function removeClass(classVal) { $attr.$removeClass(flattenClasses(classVal)); } @@ -2416,7 +2416,7 @@ quayApp.directive('quayInclude', function($compile, $templateCache, $http, Featu if (!templatePath) { return; } - + var promise = getTemplate(templatePath).success(function(html) { $element.html(html); }).then(function (response) { @@ -2495,7 +2495,7 @@ quayApp.directive('applicationInfo', function () { 'application': '=application' }, controller: function($scope, $element, ApiService) { - + } }; return directiveDefinitionObject; @@ -2572,7 +2572,7 @@ quayApp.directive('repoBreadcrumb', function () { 'subsection': '=subsection', 'subsectionIcon': '=subsectionIcon' }, - controller: function($scope, $element) { + controller: function($scope, $element) { } }; return directiveDefinitionObject; @@ -2586,7 +2586,7 @@ quayApp.directive('focusablePopoverContent', ['$timeout', '$popover', function ( var hide = function() { $body.off('click'); - if (!scope) { return; } + if (!scope) { return; } scope.$apply(function() { if (!scope) { return; } scope.$hide(); @@ -2594,7 +2594,7 @@ quayApp.directive('focusablePopoverContent', ['$timeout', '$popover', function ( }; scope.$on('$destroy', function() { - $body.off('click'); + $body.off('click'); }); $timeout(function() { @@ -2646,7 +2646,7 @@ quayApp.directive('copyBox', function () { var number = $rootScope.__copyBoxIdCounter || 0; $rootScope.__copyBoxIdCounter = number + 1; $scope.inputId = "copy-box-input-" + number; - + var button = $($element).find('.copy-icon'); var input = $($element).find('input'); @@ -2727,7 +2727,7 @@ quayApp.directive('externalLoginButton', function () { $scope.signInStarted({'service': service}); var url = KeyService.getExternalLoginUrl(service, $scope.action || 'login'); - + // Save the redirect URL in a cookie so that we can redirect back after the service returns to us. var redirectURL = $scope.redirectUrl || window.location.toString(); CookieService.putPermanent('quay.redirectAfterLoad', redirectURL); @@ -2825,7 +2825,7 @@ quayApp.directive('signinForm', function () { $scope.cancelInterval(); $scope.tryAgainSoon = result.headers('Retry-After'); - $scope.tryAgainInterval = $interval(function() { + $scope.tryAgainInterval = $interval(function() { $scope.tryAgainSoon--; if ($scope.tryAgainSoon <= 0) { $scope.cancelInterval(); @@ -2855,10 +2855,10 @@ quayApp.directive('signupForm', function () { 'userRegistered': '&userRegistered' }, - controller: function($scope, $location, $timeout, ApiService, KeyService, UserService, Config, UIService) { + controller: function($scope, $location, $timeout, ApiService, KeyService, UserService, Config, UIService) { $('.form-signup').popover(); - $scope.awaitingConfirmation = false; + $scope.awaitingConfirmation = false; $scope.registering = false; $scope.register = function() { @@ -2872,7 +2872,7 @@ quayApp.directive('signupForm', function () { ApiService.createNewUser($scope.newUser).then(function(resp) { $scope.registering = false; $scope.awaitingConfirmation = !!resp['awaiting_verification']; - + if (Config.MIXPANEL_KEY) { mixpanel.alias($scope.newUser.username); } @@ -3016,7 +3016,7 @@ quayApp.directive('dockerAuthDialog', function (Config) { $('#dockerauthmodal').modal('hide'); return; } - + $('#copyClipboard').clipboardCopy(); $('#dockerauthmodal').modal({}); }; @@ -3047,7 +3047,7 @@ quayApp.filter('regex', function() { if (m && m[0].length == input[i].length) { out.push(input[i]); } - } + } return out; }; }); @@ -3076,7 +3076,7 @@ quayApp.filter('visibleLogFilter', function () { if (!allowed) { return logs; } - + var filtered = []; angular.forEach(logs, function (log) { if (allowed[log.kind]) { @@ -3117,7 +3117,7 @@ quayApp.directive('billingInvoices', function () { if (!$scope.makevisible || !isValid) { return; } - + $scope.loading = true; ApiService.listInvoices($scope.organization).then(function(resp) { @@ -3158,7 +3158,7 @@ quayApp.directive('logsView', function () { $scope.kindsAllowed = null; $scope.chartVisible = true; $scope.logsPath = ''; - + var datetime = new Date(); $scope.logStartDate = new Date(datetime.getUTCFullYear(), datetime.getUTCMonth(), datetime.getUTCDate() - 7); $scope.logEndDate = new Date(datetime.getUTCFullYear(), datetime.getUTCMonth(), datetime.getUTCDate()); @@ -3269,7 +3269,7 @@ quayApp.directive('logsView', function () { return 'Create default permission: {role} for {delegate_team}' + defaultPermSuffix(metadata); } }, - 'modify_prototype_permission': function(metadata) { + 'modify_prototype_permission': function(metadata) { if (metadata.delegate_user) { return 'Modify default permission: {role} (from {original_role}) for {delegate_user}' + defaultPermSuffix(metadata); } else if (metadata.delegate_team) { @@ -3442,7 +3442,7 @@ quayApp.directive('logsView', function () { return $scope.chart.getColor(kind); }; - $scope.getDescription = function(log) { + $scope.getDescription = function(log) { log.metadata['_ip'] = log.ip ? log.ip : null; return StringBuilderService.buildString(logDescriptions[log.kind] || log.kind, log.metadata); }; @@ -3472,10 +3472,10 @@ quayApp.directive('applicationManager', function () { 'organization': '=organization', 'makevisible': '=makevisible' }, - controller: function($scope, $element, ApiService) { + controller: function($scope, $element, ApiService) { $scope.loading = false; $scope.applications = []; - + $scope.createApplication = function(appName) { if (!appName) { return; } @@ -3552,7 +3552,7 @@ quayApp.directive('robotsManager', function () { $scope.shownRobot = info; $scope.showRobotCounter++; }; - + $scope.findRobotIndexByName = function(name) { for (var i = 0; i < $scope.robots.length; ++i) { if ($scope.robots[i].name == name) { @@ -3942,13 +3942,13 @@ quayApp.directive('repoSearch', function () { $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 = url.replace('%QUERY', uriEncodedQuery); url += '&cb=' + searchToken; return url; }, @@ -3965,8 +3965,8 @@ quayApp.directive('repoSearch', function () { return datums; } }, - datumTokenizer: function(d) { - return Bloodhound.tokenizers.whitespace(d.val); + datumTokenizer: function(d) { + return Bloodhound.tokenizers.whitespace(d.val); }, queryTokenizer: Bloodhound.tokenizers.whitespace }); @@ -3974,7 +3974,7 @@ quayApp.directive('repoSearch', function () { var element = $($element[0].childNodes[0]); element.typeahead({ 'highlight': true }, { - source: repoHound.ttAdapter(), + source: repoHound.ttAdapter(), templates: { 'suggestion': function (datum) { template = '