Merge branch 'master' into git
This commit is contained in:
commit
ba2cb08904
268 changed files with 7008 additions and 1535 deletions
4
static/js/services/angular-view-array.js
vendored
4
static/js/services/angular-view-array.js
vendored
|
@ -29,7 +29,7 @@ angular.module('quay').factory('AngularViewArray', ['$interval', function($inter
|
|||
this.hasEntries = true;
|
||||
|
||||
if (this.isVisible) {
|
||||
this.setVisible(true);
|
||||
this.startTimer_();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -64,6 +64,8 @@ angular.module('quay').factory('AngularViewArray', ['$interval', function($inter
|
|||
};
|
||||
|
||||
_ViewArray.prototype.startTimer_ = function() {
|
||||
if (this.timerRef_) { return; }
|
||||
|
||||
var that = this;
|
||||
this.timerRef_ = $interval(function() {
|
||||
that.showAdditionalEntries_();
|
||||
|
|
|
@ -14,7 +14,9 @@ angular.module('quay').factory('AvatarService', ['Config', '$sanitize', 'md5',
|
|||
break;
|
||||
|
||||
case 'gravatar':
|
||||
return '//www.gravatar.com/avatar/' + hash + '?d=identicon&size=' + size;
|
||||
// TODO(jschorr): Remove once the new layout is in place everywhere.
|
||||
var default_kind = Config.isNewLayout() ? '404' : 'identicon';
|
||||
return '//www.gravatar.com/avatar/' + hash + '?d=' + default_kind + '&size=' + size;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Service which exposes various methods for creating entities on the backend.
|
||||
*/
|
||||
angular.module('quay').factory('CreateService', ['ApiService', function(ApiService) {
|
||||
angular.module('quay').factory('CreateService', ['ApiService', 'UserService', function(ApiService, UserService) {
|
||||
var createService = {};
|
||||
|
||||
createService.createRobotAccount = function(ApiService, is_org, orgname, name, callback) {
|
||||
|
@ -24,5 +24,38 @@ angular.module('quay').factory('CreateService', ['ApiService', function(ApiServi
|
|||
.then(callback, ApiService.errorDisplay('Cannot create team'));
|
||||
};
|
||||
|
||||
createService.askCreateRobot = function(namespace, callback) {
|
||||
if (!namespace || !UserService.isNamespaceAdmin(namespace)) { return; }
|
||||
|
||||
var isorg = UserService.isOrganization(namespace);
|
||||
bootbox.prompt('Enter the name of the new robot account', function(robotname) {
|
||||
if (!robotname) { return; }
|
||||
|
||||
var regex = new RegExp(ROBOT_PATTERN);
|
||||
if (!regex.test(robotname)) {
|
||||
bootbox.alert('Invalid robot account name');
|
||||
return;
|
||||
}
|
||||
|
||||
createService.createRobotAccount(ApiService, isorg, namespace, robotname, callback);
|
||||
});
|
||||
};
|
||||
|
||||
createService.askCreateTeam = function(namespace, callback) {
|
||||
if (!namespace || !UserService.isNamespaceAdmin(namespace)) { return; }
|
||||
|
||||
bootbox.prompt('Enter the name of the new team', function(teamname) {
|
||||
if (!teamname) { return; }
|
||||
|
||||
var regex = new RegExp(TEAM_PATTERN);
|
||||
if (!regex.test(teamname)) {
|
||||
bootbox.alert('Invalid team name');
|
||||
return;
|
||||
}
|
||||
|
||||
CreateService.createOrganizationTeam(ApiService, namespace, teamname, callback);
|
||||
});
|
||||
};
|
||||
|
||||
return createService;
|
||||
}]);
|
||||
|
|
|
@ -54,6 +54,10 @@ angular.module('quay').factory('Config', [function() {
|
|||
return config['PREFERRED_URL_SCHEME'] + '://' + auth + config['SERVER_HOSTNAME'];
|
||||
};
|
||||
|
||||
config.getHttp = function() {
|
||||
return config['PREFERRED_URL_SCHEME'];
|
||||
};
|
||||
|
||||
config.getUrl = function(opt_path) {
|
||||
var path = opt_path || '';
|
||||
return config['PREFERRED_URL_SCHEME'] + '://' + config['SERVER_HOSTNAME'] + path;
|
||||
|
@ -67,5 +71,10 @@ angular.module('quay').factory('Config', [function() {
|
|||
return value;
|
||||
};
|
||||
|
||||
config.isNewLayout = function() {
|
||||
// TODO(jschorr): Remove once new layout is in place for everyone.
|
||||
return document.cookie.toString().indexOf('quay.exp-new-layout=true') >= 0;
|
||||
};
|
||||
|
||||
return config;
|
||||
}]);
|
|
@ -24,6 +24,10 @@ angular.module('quay').factory('KeyService', ['$location', 'Config', function($l
|
|||
keyService['githubTriggerAuthorizeUrl'] = oauth['GITHUB_TRIGGER_CONFIG']['AUTHORIZE_ENDPOINT'];
|
||||
|
||||
keyService['githubLoginScope'] = 'user:email';
|
||||
if (oauth['GITHUB_LOGIN_CONFIG']['ORG_RESTRICT']) {
|
||||
keyService['githubLoginScope'] += ',read:org';
|
||||
}
|
||||
|
||||
keyService['googleLoginScope'] = 'openid email';
|
||||
|
||||
keyService.isEnterprise = function(service) {
|
||||
|
|
|
@ -66,10 +66,10 @@ angular.module('quay').factory('UIService', [function() {
|
|||
}
|
||||
};
|
||||
|
||||
uiService.showPopover = function(elem, content) {
|
||||
uiService.showPopover = function(elem, content, opt_placement) {
|
||||
var popover = $(elem).data('bs.popover');
|
||||
if (!popover) {
|
||||
$(elem).popover({'content': '-', 'placement': 'left'});
|
||||
$(elem).popover({'content': '-', 'placement': opt_placement || 'left'});
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
|
@ -79,10 +79,10 @@ angular.module('quay').factory('UIService', [function() {
|
|||
}, 500);
|
||||
};
|
||||
|
||||
uiService.showFormError = function(elem, result) {
|
||||
uiService.showFormError = function(elem, result, opt_placement) {
|
||||
var message = result.data['message'] || result.data['error_description'] || '';
|
||||
if (message) {
|
||||
uiService.showPopover(elem, message);
|
||||
uiService.showPopover(elem, message, opt_placement);
|
||||
} else {
|
||||
uiService.hidePopover(elem);
|
||||
}
|
||||
|
@ -92,5 +92,47 @@ angular.module('quay').factory('UIService', [function() {
|
|||
return new CheckStateController(items, opt_checked);
|
||||
};
|
||||
|
||||
uiService.showPasswordDialog = function(message, callback, opt_canceledCallback) {
|
||||
var success = function() {
|
||||
var password = $('#passDialogBox').val();
|
||||
$('#passDialogBox').val('');
|
||||
callback(password);
|
||||
};
|
||||
|
||||
var canceled = function() {
|
||||
$('#passDialogBox').val('');
|
||||
opt_canceledCallback && opt_canceledCallback();
|
||||
};
|
||||
|
||||
var box = bootbox.dialog({
|
||||
"message": message +
|
||||
'<form style="margin-top: 10px" action="javascript:void(0)">' +
|
||||
'<input id="passDialogBox" class="form-control" type="password" placeholder="Current Password">' +
|
||||
'</form>',
|
||||
"title": 'Please Verify',
|
||||
"buttons": {
|
||||
"verify": {
|
||||
"label": "Verify",
|
||||
"className": "btn-success",
|
||||
"callback": success
|
||||
},
|
||||
"close": {
|
||||
"label": "Cancel",
|
||||
"className": "btn-default",
|
||||
"callback": canceled
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
box.bind('shown.bs.modal', function(){
|
||||
box.find("input").focus();
|
||||
box.find("form").submit(function() {
|
||||
if (!$('#passDialogBox').val()) { return; }
|
||||
box.modal('hide');
|
||||
success();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return uiService;
|
||||
}]);
|
||||
|
|
|
@ -12,7 +12,8 @@ function(ApiService, CookieService, $rootScope, Config) {
|
|||
username: null,
|
||||
email: null,
|
||||
organizations: [],
|
||||
logins: []
|
||||
logins: [],
|
||||
beforeload: true
|
||||
}
|
||||
|
||||
var userService = {}
|
||||
|
@ -83,6 +84,10 @@ function(ApiService, CookieService, $rootScope, Config) {
|
|||
});
|
||||
};
|
||||
|
||||
userService.isOrganization = function(name) {
|
||||
return !!userService.getOrganization(name);
|
||||
};
|
||||
|
||||
userService.getOrganization = function(name) {
|
||||
if (!userResponse || !userResponse.organizations) { return null; }
|
||||
for (var i = 0; i < userResponse.organizations.length; ++i) {
|
||||
|
|
Reference in a new issue