Move all controllers into page definitions and add support for layout profiles
This commit is contained in:
parent
f650479266
commit
d6d11644d8
34 changed files with 3744 additions and 3428 deletions
179
static/js/app.js
179
static/js/app.js
|
@ -2,9 +2,42 @@ var TEAM_PATTERN = '^[a-zA-Z][a-zA-Z0-9]+$';
|
|||
var ROBOT_PATTERN = '^[a-zA-Z][a-zA-Z0-9]{3,29}$';
|
||||
var USER_PATTERN = '^[a-z0-9_]{4,30}$';
|
||||
|
||||
// Define the pages module.
|
||||
quayPages = angular.module('quayPages', [], function(){});
|
||||
|
||||
// Define a constant for creating pages.
|
||||
quayPages.constant('pages', {
|
||||
'_pages': {},
|
||||
|
||||
'create': function(pageName, templateName, opt_controller, opt_flags, opt_profiles) {
|
||||
var profiles = opt_profiles || ['old-layout', 'layout'];
|
||||
for (var i = 0; i < profiles.length; ++i) {
|
||||
this._pages[profiles[i] + ':' + pageName] = {
|
||||
'name': pageName,
|
||||
'controller': opt_controller,
|
||||
'templateName': templateName,
|
||||
'flags': opt_flags || {}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
'get': function(pageName, profiles) {
|
||||
for (var i = 0; i < profiles.length; ++i) {
|
||||
var current = profiles[i];
|
||||
var key = current.id + ':' + pageName;
|
||||
var page = this._pages[key];
|
||||
if (page) {
|
||||
return [current, page];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
quayDependencies = ['ngRoute', 'chieffancypants.loadingBar', 'angular-tour', 'restangular', 'angularMoment',
|
||||
'mgcrea.ngStrap', 'ngCookies', 'ngSanitize', 'angular-md5', 'pasvaz.bindonce', 'ansiToHtml',
|
||||
'ngAnimate', 'core-ui', 'core-config-setup'];
|
||||
'ngAnimate', 'core-ui', 'core-config-setup', 'quayPages'];
|
||||
|
||||
if (window.__config && window.__config.MIXPANEL_KEY) {
|
||||
quayDependencies.push('angulartics');
|
||||
|
@ -17,7 +50,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
});
|
||||
|
||||
// Configure the routes.
|
||||
quayApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
|
||||
quayApp.config(['$routeProvider', '$locationProvider', 'pages', function($routeProvider, $locationProvider, pages) {
|
||||
var title = window.__config['REGISTRY_TITLE'] || 'Quay.io';
|
||||
|
||||
$locationProvider.html5Mode(true);
|
||||
|
@ -26,61 +59,101 @@ quayApp.config(['$routeProvider', '$locationProvider', function($routeProvider,
|
|||
// If you add a route here, you must add a corresponding route in thr endpoints/web.py
|
||||
// index rule to make sure that deep links directly deep into the app continue to work.
|
||||
// WARNING WARNING WARNING
|
||||
$routeProvider.
|
||||
when('/repository/:namespace/:name', {templateUrl: '/static/partials/view-repo.html', controller: RepoCtrl,
|
||||
fixFooter: false, reloadOnSearch: false}).
|
||||
when('/repository/:namespace/:name/tag/:tag', {templateUrl: '/static/partials/view-repo.html', controller: RepoCtrl,
|
||||
fixFooter: false}).
|
||||
when('/repository/:namespace/:name/image/:image', {templateUrl: '/static/partials/image-view.html', controller: ImageViewCtrl, reloadOnSearch: false}).
|
||||
when('/repository/:namespace/:name/admin', {templateUrl: '/static/partials/repo-admin.html', controller:RepoAdminCtrl, reloadOnSearch: false}).
|
||||
when('/repository/:namespace/:name/build', {templateUrl: '/static/partials/repo-build.html', controller:RepoBuildCtrl, reloadOnSearch: false}).
|
||||
when('/repository/:namespace/:name/build/:buildid/buildpack', {templateUrl: '/static/partials/build-package.html', controller:BuildPackageCtrl, reloadOnSearch: false}).
|
||||
when('/repository/', {title: 'Repositories', description: 'Public and private docker repositories list',
|
||||
templateUrl: '/static/partials/repo-list.html', controller: RepoListCtrl, reloadOnSearch: false}).
|
||||
when('/user/', {title: 'Account Settings', description:'Account settings for ' + title, templateUrl: '/static/partials/user-admin.html',
|
||||
reloadOnSearch: false, controller: UserAdminCtrl}).
|
||||
when('/superuser/', {title: 'Enterprise Registry Management', description:'Admin panel for ' + title, templateUrl: '/static/partials/super-user.html',
|
||||
reloadOnSearch: false, controller: SuperUserAdminCtrl, newLayout: true}).
|
||||
when('/setup/', {title: 'Enterprise Registry Setup', description:'Setup for ' + title, templateUrl: '/static/partials/setup.html',
|
||||
reloadOnSearch: false, controller: SetupCtrl, newLayout: true}).
|
||||
when('/guide/', {title: 'Guide', description:'Guide to using private docker repositories on ' + title,
|
||||
templateUrl: '/static/partials/guide.html',
|
||||
controller: GuideCtrl}).
|
||||
when('/tutorial/', {title: 'Tutorial', description:'Interactive tutorial for using ' + title, templateUrl: '/static/partials/tutorial.html',
|
||||
controller: TutorialCtrl}).
|
||||
when('/contact/', {title: 'Contact Us', description:'Different ways for you to get a hold of us when you need us most.', templateUrl: '/static/partials/contact.html',
|
||||
controller: ContactCtrl}).
|
||||
when('/about/', {title: 'About Us', description:'Information about the Quay.io team and the company.', templateUrl: '/static/partials/about.html'}).
|
||||
when('/plans/', {title: 'Plans and Pricing', description: 'Plans and pricing for private docker repositories on Quay.io',
|
||||
templateUrl: '/static/partials/plans.html', controller: PlansCtrl}).
|
||||
when('/security/', {title: 'Security', description: 'Security features used when transmitting and storing data',
|
||||
templateUrl: '/static/partials/security.html'}).
|
||||
when('/signin/', {title: 'Sign In', description: 'Sign into ' + title, templateUrl: '/static/partials/signin.html', controller: SignInCtrl, reloadOnSearch: false}).
|
||||
when('/new/', {title: 'Create new repository', description: 'Create a new public or private docker repository, optionally constructing from a dockerfile',
|
||||
templateUrl: '/static/partials/new-repo.html', controller: NewRepoCtrl}).
|
||||
when('/organizations/', {title: 'Organizations', description: 'Private docker repository hosting for businesses and organizations',
|
||||
templateUrl: '/static/partials/organizations.html', controller: OrgsCtrl}).
|
||||
when('/organizations/new/', {title: 'New Organization', description: 'Create a new organization on ' + title,
|
||||
templateUrl: '/static/partials/new-organization.html', controller: NewOrgCtrl}).
|
||||
when('/organization/:orgname', {templateUrl: '/static/partials/org-view.html', controller: OrgViewCtrl}).
|
||||
when('/organization/:orgname/admin', {templateUrl: '/static/partials/org-admin.html', controller: OrgAdminCtrl, reloadOnSearch: false}).
|
||||
when('/organization/:orgname/teams/:teamname', {templateUrl: '/static/partials/team-view.html', controller: TeamViewCtrl}).
|
||||
when('/organization/:orgname/logs/:membername', {templateUrl: '/static/partials/org-member-logs.html', controller: OrgMemberLogsCtrl}).
|
||||
when('/organization/:orgname/application/:clientid', {templateUrl: '/static/partials/manage-application.html',
|
||||
controller: ManageApplicationCtrl, reloadOnSearch: false}).
|
||||
when('/v1/', {title: 'Activation information', templateUrl: '/static/partials/v1-page.html', controller: V1Ctrl}).
|
||||
|
||||
var layoutProfile = window.location.search.indexOf('old-ui=1') >= 0 ? 'old-layout' : 'layout';
|
||||
var routeBuilder = new AngularRouteBuilder($routeProvider, pages, [
|
||||
// Start with the old pages (if we asked for it).
|
||||
{id: 'old-layout', templatePath: '/static/partials/'},
|
||||
|
||||
when('/tour/', {title: title + ' Tour', templateUrl: '/static/partials/tour.html', controller: TourCtrl}).
|
||||
when('/tour/organizations', {title: 'Teams and Organizations Tour', templateUrl: '/static/partials/tour.html', controller: TourCtrl}).
|
||||
when('/tour/features', {title: title + ' Features', templateUrl: '/static/partials/tour.html', controller: TourCtrl}).
|
||||
when('/tour/enterprise', {title: 'Enterprise Edition', templateUrl: '/static/partials/tour.html', controller: TourCtrl}).
|
||||
// Fallback back combined new/existing pages.
|
||||
{id: 'layout', templatePath: '/static/partials/'}
|
||||
], layoutProfile);
|
||||
|
||||
when('/confirminvite', {title: 'Confirm Invite', templateUrl: '/static/partials/confirm-invite.html', controller: ConfirmInviteCtrl, reloadOnSearch: false}).
|
||||
routeBuilder
|
||||
// Repository View
|
||||
.route('/repository/:namespace/:name', 'repo-view')
|
||||
.route('/repository/:namespace/:name/tag/:tag', 'repo-view', 'RepoCtrl')
|
||||
|
||||
when('/', {title: 'Hosted Private Docker Registry', templateUrl: '/static/partials/landing.html', controller: LandingCtrl,
|
||||
pageClass: 'landing-page'}).
|
||||
otherwise({redirectTo: '/'});
|
||||
// Image View
|
||||
.route('/repository/:namespace/:name/image/:image', 'image-view')
|
||||
|
||||
// Repo Admin
|
||||
.route('/repository/:namespace/:name/admin', 'repo-admin')
|
||||
|
||||
// Repo Builds
|
||||
.route('/repository/:namespace/:name/build', 'repo-build')
|
||||
|
||||
// Repo Build Package
|
||||
.route('/repository/:namespace/:name/build/:buildid/buildpack', 'build-package')
|
||||
|
||||
// Repo List
|
||||
.route('/repository/', 'repo-list')
|
||||
|
||||
// Organizations
|
||||
.route('/organizations/', 'organizations')
|
||||
|
||||
// New Organization
|
||||
.route('/organizations/new/', 'new-organization')
|
||||
|
||||
// View Organization
|
||||
.route('/organization/:orgname', 'org-view')
|
||||
|
||||
// Organization Admin
|
||||
.route('/organization/:orgname/admin', 'org-admin')
|
||||
|
||||
// View Organization Team
|
||||
.route('/organization/:orgname/teams/:teamname', 'team-view')
|
||||
|
||||
// Organization Member Logs
|
||||
.route('/organization/:orgname/logs/:membername', 'org-member-logs')
|
||||
|
||||
// Organization View Application
|
||||
.route('/organization/:orgname/application/:clientid', 'manage-application')
|
||||
|
||||
// User Admin
|
||||
.route('/user/', 'user-admin')
|
||||
|
||||
// Sign In
|
||||
.route('/signin/', 'signin')
|
||||
|
||||
// New Repository
|
||||
.route('/new/', 'new-repo')
|
||||
|
||||
// ER Management
|
||||
.route('/superuser/', 'superuser')
|
||||
|
||||
// ER Setup
|
||||
.route('/setup/', 'setup')
|
||||
|
||||
// Plans
|
||||
.route('/plans/', 'plans')
|
||||
|
||||
// Tutorial
|
||||
.route('/tutorial/', 'tutorial')
|
||||
|
||||
// Contact
|
||||
.route('/contact/', 'contact')
|
||||
|
||||
// About
|
||||
//.route('/about/', 'about')
|
||||
|
||||
// Security
|
||||
//.route('/security/', 'security')
|
||||
|
||||
// Landing Page
|
||||
.route('/', 'landing')
|
||||
|
||||
// Tour
|
||||
.route('/tour/', 'tour')
|
||||
.route('/tour/features', 'tour')
|
||||
.route('/tour/organizations', 'tour')
|
||||
.route('/tour/enterprise', 'tour')
|
||||
|
||||
// Confirm Invite
|
||||
.route('/confirminvite', 'confirm-invite')
|
||||
|
||||
// Default: Redirect to the landing page
|
||||
.otherwise({redirectTo: '/'});
|
||||
}]);
|
||||
|
||||
// Configure compile provider to add additional URL prefixes to the sanitization list. We use
|
||||
|
|
Reference in a new issue