Merge branch 'master' into git

This commit is contained in:
Jimmy Zelinskie 2015-04-16 17:38:35 -04:00
commit ba2cb08904
268 changed files with 7008 additions and 1535 deletions

View file

@ -14,6 +14,7 @@
$scope.setEnabled = function(value) {
$scope.isEnabled = value;
CookieService.putPermanent('quay.exp-new-layout', value.toString());
document.location.reload();
};
}
}());

View file

@ -3,7 +3,14 @@
* Page to view the details of a single image.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('image-view', 'image-view.html', ImageViewCtrl);
pages.create('image-view', 'image-view.html', ImageViewCtrl, {
'newLayout': true,
'title': '{{ image.id }}',
'description': 'Image {{ image.id }}'
}, ['layout'])
pages.create('image-view', 'old-image-view.html', OldImageViewCtrl, {
}, ['old-layout']);
}]);
function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, ImageMetadataService) {
@ -11,6 +18,75 @@
var name = $routeParams.name;
var imageid = $routeParams.image;
var loadImage = function() {
var params = {
'repository': namespace + '/' + name,
'image_id': imageid
};
$scope.imageResource = ApiService.getImageAsResource(params).get(function(image) {
$scope.image = image;
$scope.reversedHistory = image.history.reverse();
});
};
var loadRepository = function() {
var params = {
'repository': namespace + '/' + name
};
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
$scope.repository = repo;
});
};
loadImage();
loadRepository();
$scope.downloadChanges = function() {
if ($scope.changesResource) { return; }
var params = {
'repository': namespace + '/' + name,
'image_id': imageid
};
$scope.changesResource = ApiService.getImageChangesAsResource(params).get(function(changes) {
var combinedChanges = [];
var addCombinedChanges = function(c, kind) {
for (var i = 0; i < c.length; ++i) {
combinedChanges.push({
'kind': kind,
'file': c[i]
});
}
};
addCombinedChanges(changes.added, 'added');
addCombinedChanges(changes.removed, 'removed');
addCombinedChanges(changes.changed, 'changed');
$scope.combinedChanges = combinedChanges;
$scope.imageChanges = changes;
$scope.initializeTree();
});
};
$scope.initializeTree = function() {
if ($scope.tree || !$scope.combinedChanges.length) { return; }
$scope.tree = new ImageFileChangeTree($scope.image, $scope.combinedChanges);
$timeout(function() {
$scope.tree.draw('changes-tree-container');
}, 100);
};
}
function OldImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, ImageMetadataService) {
var namespace = $routeParams.namespace;
var name = $routeParams.name;
var imageid = $routeParams.image;
$scope.getFormattedCommand = ImageMetadataService.getFormattedCommand;
$scope.parseDate = function(dateString) {

View file

@ -1,6 +1,7 @@
(function() {
/**
* Landing page.
* DEPRECATED: Remove the code for viewing when logged in.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('landing', 'landing.html', LandingCtrl, {
@ -8,7 +9,7 @@
});
}]);
function LandingCtrl($scope, UserService, ApiService, Features, Config) {
function LandingCtrl($scope, $location, UserService, ApiService, Features, Config) {
$scope.namespace = null;
$scope.currentScreenshot = 'repo-view';
@ -16,7 +17,12 @@
loadMyRepos(namespace);
});
UserService.updateUserIn($scope, function() {
UserService.updateUserIn($scope, function(user) {
if (!user.anonymous && Config.isNewLayout()) {
$location.path('/repository');
return;
}
loadMyRepos($scope.namespace);
});

View file

@ -4,9 +4,15 @@
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('new-organization', 'new-organization.html', NewOrgCtrl, {
'newLayout': true,
'title': 'New Organization',
'description': 'Create a new organization to manage teams and permissions'
});
}, ['layout']);
pages.create('new-organization', 'old-new-organization.html', NewOrgCtrl, {
'title': 'New Organization',
'description': 'Create a new organization to manage teams and permissions'
}, ['old-layout']);
}]);
function NewOrgCtrl($scope, $routeParams, $timeout, $location, UserService, PlanService, ApiService, CookieService, Features) {

View file

@ -3,10 +3,16 @@
* Page to create a new repository.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('new-repo', 'new-repo.html', NewRepoCtrl, {
pages.create('new-repo', 'new-repo.html', NewRepoCtrl, {
'newLayout': true,
'title': 'New Repository',
'description': 'Create a new Docker repository'
});
}, ['layout'])
pages.create('new-repo', 'old-new-repo.html', NewRepoCtrl, {
'title': 'New Repository',
'description': 'Create a new Docker repository'
}, ['old-layout']);
}]);
function NewRepoCtrl($scope, $location, $http, $timeout, UserService, ApiService, PlanService, TriggerService, Features) {

View file

@ -1,6 +1,6 @@
(function() {
/**
* Organization admin/settings page.
* DEPRECATED: Organization admin/settings page.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('org-admin', 'org-admin.html', OrgAdminCtrl);

View file

@ -3,10 +3,95 @@
* Page that displays details about an organization, such as its teams.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('org-view', 'org-view.html', OrgViewCtrl);
pages.create('org-view', 'org-view.html', OrgViewCtrl, {
'newLayout': true,
'title': 'Organization {{ organization.name }}',
'description': 'Organization {{ organization.name }}'
}, ['layout'])
pages.create('org-view', 'old-org-view.html', OldOrgViewCtrl, {
}, ['old-layout']);
}]);
function OrgViewCtrl($rootScope, $scope, ApiService, $routeParams, CreateService) {
function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService, AvatarService) {
var orgname = $routeParams.orgname;
$scope.showLogsCounter = 0;
$scope.showApplicationsCounter = 0;
$scope.showInvoicesCounter = 0;
$scope.orgScope = {
'changingOrganization': false,
'organizationEmail': ''
};
$scope.$watch('orgScope.organizationEmail', function(e) {
UIService.hidePopover('#changeEmailForm input');
});
var loadRepositories = function() {
var options = {
'namespace_only': true,
'namespace': orgname,
};
$scope.repositoriesResource = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
return resp.repositories;
});
};
var loadOrganization = function() {
$scope.orgResource = ApiService.getOrganizationAsResource({'orgname': orgname}).get(function(org) {
$scope.organization = org;
$scope.orgScope.organizationEmail = org.email;
$scope.isAdmin = org.is_admin;
$scope.isMember = org.is_member;
// Load the repositories.
$timeout(function() {
loadRepositories();
}, 10);
});
};
// Load the organization.
loadOrganization();
$scope.showInvoices = function() {
$scope.showInvoicesCounter++;
};
$scope.showApplications = function() {
$scope.showApplicationsCounter++;
};
$scope.showLogs = function() {
$scope.showLogsCounter++;
};
$scope.changeEmail = function() {
UIService.hidePopover('#changeEmailForm input');
$scope.orgScope.changingOrganization = true;
var params = {
'orgname': orgname
};
var data = {
'email': $scope.orgScope.organizationEmail
};
ApiService.changeOrganizationDetails(data, params).then(function(org) {
$scope.orgScope.changingOrganization = false;
$scope.organization = org;
}, function(result) {
$scope.orgScope.changingOrganization = false;
UIService.showFormError('#changeEmailForm input', result, 'right');
});
};
}
function OldOrgViewCtrl($rootScope, $scope, ApiService, $routeParams, CreateService) {
var orgname = $routeParams.orgname;
$scope.TEAM_PATTERN = TEAM_PATTERN;

View file

@ -1,6 +1,6 @@
(function() {
/**
* Page which displays the list of organizations of which the user is a member.
* DEPRECATED: Page which displays the list of organizations of which the user is a member.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('organizations', 'organizations.html', OrgsCtrl, {

View file

@ -13,7 +13,7 @@
}, ['old-layout']);
}]);
function RepoViewCtrl($scope, $routeParams, $location, ApiService, UserService, AngularPollChannel) {
function RepoViewCtrl($scope, $routeParams, $location, $timeout, ApiService, UserService, AngularPollChannel) {
$scope.namespace = $routeParams.namespace;
$scope.name = $routeParams.name;
@ -63,12 +63,21 @@
};
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
$scope.repository = repo;
$scope.viewScope.repository = repo;
$scope.setTags($routeParams.tag);
// Track builds.
buildPollChannel = AngularPollChannel.create($scope, loadRepositoryBuilds, 5000 /* 5s */);
buildPollChannel.start();
// Load the remainder of the data async, so we don't block the initial view from
// showing.
$timeout(function() {
$scope.setTags($routeParams.tag);
// Load the images.
loadImages();
// Track builds.
buildPollChannel = AngularPollChannel.create($scope, loadRepositoryBuilds, 5000 /* 5s */);
buildPollChannel.start();
}, 10);
});
};
@ -98,9 +107,8 @@
}, errorHandler);
};
// Load the repository and images.
// Load the repository.
loadRepository();
loadImages();
$scope.setTags = function(tagNames) {
if (!tagNames) {
@ -638,6 +646,10 @@
$scope.setImage($routeParams.image);
}
$timeout(function() {
$scope.tree.notifyResized();
}, 100);
return resp.images;
});
};

View file

@ -140,7 +140,7 @@
$scope.showSuperuserPanel = function() {
$('#setupModal').modal('hide');
var prefix = $scope.hasSSL ? 'https' : 'http';
var hostname = $scope.hostname;
var hostname = $scope.hostname || document.location.hostname;
window.location = prefix + '://' + hostname + '/superuser';
};

View file

@ -3,7 +3,14 @@
* Page to view the members of a team and add/remove them.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('team-view', 'team-view.html', TeamViewCtrl);
pages.create('team-view', 'team-view.html', TeamViewCtrl, {
'newLayout': true,
'title': 'Team {{ teamname }}',
'description': 'Team {{ teamname }}'
}, ['layout'])
pages.create('team-view', 'old-team-view.html', TeamViewCtrl, {
}, ['old-layout']);
}]);
function TeamViewCtrl($rootScope, $scope, $timeout, Features, Restangular, ApiService, $routeParams) {

View file

@ -4,9 +4,13 @@
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('tutorial', 'tutorial.html', TutorialCtrl, {
'newLayout': true,
'title': 'Tutorial',
'description': 'Basic tutorial on using Docker with Quay.io'
});
'description': 'Basic tutorial on using Quay.io'
}, ['layout'])
pages.create('tutorial', 'old-tutorial.html', TutorialCtrl, {
}, ['old-layout']);
}]);
function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService, Config) {
@ -59,7 +63,7 @@
'templateUrl': '/static/tutorial/push-image.html',
'signal': AngularTourSignals.serverEvent('/realtime/user/subscribe?events=docker-cli',
function(message, tourScope) {
var pushing = message['data']['action'] == 'push_repo';
var pushing = message['data']['action'] == 'push_start';
if (pushing) {
tourScope.repoName = message['data']['repository'];
}
@ -73,7 +77,7 @@
'templateUrl': '/static/tutorial/pushing.html',
'signal': AngularTourSignals.serverEvent('/realtime/user/subscribe?events=docker-cli',
function(message, tourScope) {
return message['data']['action'] == 'pushed_repo';
return message['data']['action'] == 'push_repo';
}),
'waitMessage': "Waiting for repository push to complete"
},

View file

@ -1,6 +1,6 @@
(function() {
/**
* User admin/settings page.
* DEPRECATED: User admin/settings page.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('user-admin', 'user-admin.html', UserAdminCtrl, {
@ -160,11 +160,7 @@
$scope.updatingUser = false;
$scope.changeEmailSent = true;
$scope.sentEmail = $scope.cuser.email;
// Reset the form.
delete $scope.cuser['email'];
$scope.changeEmailForm.$setPristine();
}, function(result) {
$scope.updatingUser = false;
UIService.showFormError('#changeEmailForm', result);
@ -196,6 +192,21 @@
});
};
$scope.generateClientToken = function() {
var generateToken = function(password) {
var data = {
'password': password
};
ApiService.generateUserClientKey(data).then(function(resp) {
$scope.generatedClientToken = resp['key'];
$('#clientTokenModal').modal({});
}, ApiService.errorDisplay('Could not generate token'));
};
UIService.showPasswordDialog('Enter your password to generated an encrypted version:', generateToken);
};
$scope.detachExternalLogin = function(kind) {
var params = {
'servicename': kind

View file

@ -0,0 +1,112 @@
(function() {
/**
* Page that displays details about an user.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('user-view', 'user-view.html', UserViewCtrl, {
'newLayout': true,
'title': 'User {{ user.username }}',
'description': 'User {{ user.username }}'
}, ['layout'])
}]);
function UserViewCtrl($scope, $routeParams, $timeout, ApiService, UserService, UIService, AvatarService) {
var username = $routeParams.username;
$scope.showInvoicesCounter = 0;
$scope.showAppsCounter = 0;
$scope.changeEmailInfo = {};
$scope.changePasswordInfo = {};
UserService.updateUserIn($scope);
var loadRepositories = function() {
var options = {
'sort': true,
'namespace_only': true,
'namespace': username,
};
$scope.repositoriesResource = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
return resp.repositories;
});
};
var loadUser = function() {
$scope.userResource = ApiService.getUserInformationAsResource({'username': username}).get(function(user) {
$scope.viewuser = user;
// Load the repositories.
$timeout(function() {
loadRepositories();
}, 10);
});
};
// Load the user.
loadUser();
$scope.showInvoices = function() {
$scope.showInvoicesCounter++;
};
$scope.showApplications = function() {
$scope.showAppsCounter++;
};
$scope.changePassword = function() {
UIService.hidePopover('#changePasswordForm');
$scope.changePasswordInfo.state = 'changing';
var data = {
'password': $scope.changePasswordInfo.password
};
ApiService.changeUserDetails(data).then(function(resp) {
$scope.changePasswordInfo.state = 'changed';
// Reset the form
delete $scope.changePasswordInfo['password']
delete $scope.changePasswordInfo['repeatPassword']
// Reload the user.
UserService.load();
}, function(result) {
$scope.changePasswordInfo.state = 'change-error';
UIService.showFormError('#changePasswordForm', result);
});
};
$scope.generateClientToken = function() {
var generateToken = function(password) {
var data = {
'password': password
};
ApiService.generateUserClientKey(data).then(function(resp) {
$scope.generatedClientToken = resp['key'];
$('#clientTokenModal').modal({});
}, ApiService.errorDisplay('Could not generate token'));
};
UIService.showPasswordDialog('Enter your password to generated an encrypted version:', generateToken);
};
$scope.changeEmail = function() {
UIService.hidePopover('#changeEmailForm');
var details = {
'email': $scope.changeEmailInfo.email
};
$scope.changeEmailInfo.state = 'sending';
ApiService.changeUserDetails(details).then(function() {
$scope.changeEmailInfo.state = 'sent';
delete $scope.changeEmailInfo['email'];
}, function(result) {
$scope.changeEmailInfo.state = 'send-error';
UIService.showFormError('#changeEmailForm', result);
});
};
}
})();