2017-01-19 08:53:38 +00:00
|
|
|
import * as Raven from 'raven-js';
|
|
|
|
|
|
|
|
|
|
|
|
quayConfig.$inject = [
|
|
|
|
'$provide',
|
2017-01-26 00:11:19 +00:00
|
|
|
'$injector',
|
2017-01-23 20:34:22 +00:00
|
|
|
'INJECTED_CONFIG',
|
2017-01-19 08:53:38 +00:00
|
|
|
'cfpLoadingBarProvider',
|
|
|
|
'$tooltipProvider',
|
|
|
|
'$compileProvider',
|
|
|
|
'RestangularProvider',
|
|
|
|
];
|
|
|
|
|
|
|
|
export function quayConfig(
|
2017-01-26 00:11:19 +00:00
|
|
|
$provide: ng.auto.IProvideService,
|
|
|
|
$injector: ng.auto.IInjectorService,
|
|
|
|
INJECTED_CONFIG: any,
|
|
|
|
cfpLoadingBarProvider: any,
|
|
|
|
$tooltipProvider: any,
|
|
|
|
$compileProvider: ng.ICompileProvider,
|
|
|
|
RestangularProvider: any) {
|
2017-01-19 08:53:38 +00:00
|
|
|
cfpLoadingBarProvider.includeSpinner = false;
|
|
|
|
|
|
|
|
// decorate the tooltip getter
|
2017-01-26 00:11:19 +00:00
|
|
|
var tooltipFactory: any = $tooltipProvider.$get[$tooltipProvider.$get.length - 1];
|
2017-01-21 00:24:55 +00:00
|
|
|
$tooltipProvider.$get[$tooltipProvider.$get.length - 1] = function($window: ng.IWindowService) {
|
2017-01-19 08:53:38 +00:00
|
|
|
if ('ontouchstart' in $window) {
|
2017-01-26 00:11:19 +00:00
|
|
|
var existing: any = tooltipFactory.apply(this, arguments);
|
2017-01-19 08:53:38 +00:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
2017-01-23 20:34:22 +00:00
|
|
|
if (!INJECTED_CONFIG['DEBUG']) {
|
2017-01-19 08:53:38 +00:00
|
|
|
$compileProvider.debugInfoEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
2017-01-23 20:34:22 +00:00
|
|
|
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
|
2017-01-26 00:11:19 +00:00
|
|
|
let $analyticsProvider: any = $injector.get('$analyticsProvider');
|
2017-01-19 08:53:38 +00:00
|
|
|
$analyticsProvider.virtualPageviews(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Configure sentry.
|
2017-01-23 20:34:22 +00:00
|
|
|
if (INJECTED_CONFIG && INJECTED_CONFIG.SENTRY_PUBLIC_DSN) {
|
2017-01-19 08:53:38 +00:00
|
|
|
$provide.decorator("$exceptionHandler", function($delegate) {
|
|
|
|
return function(ex, cause) {
|
|
|
|
$delegate(ex, cause);
|
|
|
|
Raven.captureException(ex, {extra: {cause: cause}});
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|