201 lines
No EOL
5.3 KiB
TypeScript
201 lines
No EOL
5.3 KiB
TypeScript
import * as Raven from 'raven-js';
|
|
import { RouteBuilder } from './route-builder/route-builder.service';
|
|
|
|
|
|
quayConfig.$inject = [
|
|
'$provide',
|
|
'cfpLoadingBarProvider',
|
|
'$tooltipProvider',
|
|
'$compileProvider',
|
|
'$routeProvider',
|
|
'$locationProvider',
|
|
'pages',
|
|
'RouteBuilderProvider',
|
|
'RestangularProvider',
|
|
'$analyticsProvider',
|
|
];
|
|
|
|
export function quayConfig(
|
|
$provide,
|
|
cfpLoadingBarProvider,
|
|
$tooltipProvider,
|
|
$compileProvider,
|
|
$routeProvider,
|
|
$locationProvider,
|
|
pages,
|
|
RouteBuilderProvider,
|
|
RestangularProvider,
|
|
$analyticsProvider) {
|
|
cfpLoadingBarProvider.includeSpinner = false;
|
|
|
|
// decorate the tooltip getter
|
|
var tooltipFactory = $tooltipProvider.$get[$tooltipProvider.$get.length - 1];
|
|
$tooltipProvider.$get[$tooltipProvider.$get.length - 1] = function($window) {
|
|
if ('ontouchstart' in $window) {
|
|
var existing = tooltipFactory.apply(this, arguments);
|
|
return function(element) {
|
|
// Note: We only disable bs-tooltip's themselves. $tooltip is used for other things
|
|
// (such as the datepicker), so we need to be specific when canceling it.
|
|
if (element.attr('bs-tooltip') == null) {
|
|
return existing.apply(this, arguments);
|
|
} else {
|
|
return null;
|
|
}
|
|
};
|
|
}
|
|
|
|
return tooltipFactory.apply(this, arguments);
|
|
};
|
|
|
|
if (!(<any>window).__config['DEBUG']) {
|
|
$compileProvider.debugInfoEnabled(false);
|
|
}
|
|
|
|
$locationProvider.html5Mode(true);
|
|
|
|
// WARNING WARNING WARNING
|
|
// 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
|
|
|
|
var layoutProfile: string = 'layout';
|
|
|
|
var routeBuilder: RouteBuilder = new RouteBuilderProvider.$get()($routeProvider, pages, [
|
|
// Start with the old pages (if we asked for it).
|
|
{id: 'old-layout', templatePath: '/static/partials/'},
|
|
|
|
// Fallback back combined new/existing pages.
|
|
{id: 'layout', templatePath: '/static/partials/'}
|
|
], layoutProfile);
|
|
|
|
if ((<any>window).__features.SUPER_USERS) {
|
|
// QE Management
|
|
routeBuilder.route('/superuser/', 'superuser')
|
|
|
|
// QE Setup
|
|
.route('/setup/', 'setup');
|
|
}
|
|
|
|
routeBuilder
|
|
// Repository View
|
|
.route('/repository/:namespace/:name', 'repo-view')
|
|
.route('/repository/:namespace/:name/tag/:tag', 'repo-view')
|
|
|
|
// Image View
|
|
.route('/repository/:namespace/:name/image/:image', 'image-view')
|
|
|
|
// Repo Build View
|
|
.route('/repository/:namespace/:name/build/:buildid', 'build-view')
|
|
|
|
// Create repository notification
|
|
.route('/repository/:namespace/:name/create-notification', 'create-repository-notification')
|
|
|
|
// Repo List
|
|
.route('/repository/', 'repo-list')
|
|
|
|
// Organizations
|
|
.route('/organizations/', 'organizations')
|
|
|
|
// New Organization
|
|
.route('/organizations/new/', 'new-organization')
|
|
|
|
// View Organization
|
|
.route('/organization/:orgname', 'org-view')
|
|
|
|
// View Organization Team
|
|
.route('/organization/:orgname/teams/:teamname', 'team-view')
|
|
|
|
// Organization View Application
|
|
.route('/organization/:orgname/application/:clientid', 'manage-application')
|
|
|
|
// View Organization Billing
|
|
.route('/organization/:orgname/billing', 'billing')
|
|
|
|
// View Organization Billing Invoices
|
|
.route('/organization/:orgname/billing/invoices', 'invoices')
|
|
|
|
// View User
|
|
.route('/user/:username', 'user-view')
|
|
|
|
// View User Billing
|
|
.route('/user/:username/billing', 'billing')
|
|
|
|
// View User Billing Invoices
|
|
.route('/user/:username/billing/invoices', 'invoices')
|
|
|
|
// Sign In
|
|
.route('/signin/', 'signin')
|
|
|
|
// New Repository
|
|
.route('/new/', 'new-repo')
|
|
|
|
// Plans
|
|
.route('/plans/', 'plans')
|
|
|
|
// Tutorial
|
|
.route('/tutorial/', 'tutorial')
|
|
|
|
// Contact
|
|
.route('/contact/', 'contact')
|
|
|
|
// About
|
|
.route('/about/', 'about')
|
|
|
|
// Security
|
|
.route('/security/', 'security')
|
|
|
|
// TOS
|
|
.route('/tos', 'tos')
|
|
|
|
// Privacy
|
|
.route('/privacy', 'privacy')
|
|
|
|
// Change username
|
|
.route('/updateuser', 'update-user')
|
|
|
|
// 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')
|
|
|
|
// Enterprise marketing page
|
|
.route('/enterprise', 'enterprise')
|
|
|
|
// Public Repo Experiments
|
|
.route('/__exp/publicRepo', 'public-repo-exp')
|
|
|
|
// 404/403
|
|
.route('/:catchall', 'error-view')
|
|
.route('/:catch/:all', 'error-view')
|
|
.route('/:catch/:all/:things', 'error-view')
|
|
.route('/:catch/:all/:things/:here', 'error-view');
|
|
|
|
// Configure compile provider to add additional URL prefixes to the sanitization list. We use
|
|
// these on the Contact page.
|
|
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|irc):/);
|
|
|
|
// Configure the API provider.
|
|
RestangularProvider.setBaseUrl('/api/v1/');
|
|
|
|
// Configure analytics.
|
|
if ((<any>window).__config && (<any>window).__config.MIXPANEL_KEY) {
|
|
$analyticsProvider.virtualPageviews(true);
|
|
}
|
|
|
|
// Configure sentry.
|
|
if ((<any>window).__config && (<any>window).__config.SENTRY_PUBLIC_DSN) {
|
|
$provide.decorator("$exceptionHandler", function($delegate) {
|
|
return function(ex, cause) {
|
|
$delegate(ex, cause);
|
|
Raven.captureException(ex, {extra: {cause: cause}});
|
|
};
|
|
});
|
|
}
|
|
} |