renamed properties placed on the window object to INJECTED_<property>

This commit is contained in:
alecmerdler 2017-01-23 12:34:22 -08:00
parent 64a4b68216
commit 6b2222a3ec
6 changed files with 37 additions and 27 deletions

View file

@ -0,0 +1,16 @@
/**
* Configuration data set.
*/
export const INJECTED_CONFIG: any = (<any>window).__config;
/**
* REST API route information.
*/
export const INJECTED_ENDPOINTS: any = (<any>window).__endpoints;
/**
* Features information.
*/
export const INJECTED_FEATURES: any = (<any>window).__features;

View file

@ -1,10 +0,0 @@
/**
* Configuration data set.
*/
export const CONFIG: any = (<any>window).__config;
/**
* REST API route information.
*/
export const ENDPOINTS: any = (<any>window).__endpoints;

View file

@ -3,7 +3,7 @@ import * as Raven from 'raven-js';
quayConfig.$inject = [
'$provide',
'CONFIG',
'INJECTED_CONFIG',
'cfpLoadingBarProvider',
'$tooltipProvider',
'$compileProvider',
@ -13,7 +13,7 @@ quayConfig.$inject = [
export function quayConfig(
$provide,
CONFIG,
INJECTED_CONFIG,
cfpLoadingBarProvider,
$tooltipProvider,
$compileProvider,
@ -40,7 +40,7 @@ export function quayConfig(
return tooltipFactory.apply(this, arguments);
};
if (!CONFIG['DEBUG']) {
if (!INJECTED_CONFIG['DEBUG']) {
$compileProvider.debugInfoEnabled(false);
}
@ -52,12 +52,12 @@ export function quayConfig(
RestangularProvider.setBaseUrl('/api/v1/');
// Configure analytics.
if (CONFIG && CONFIG.MIXPANEL_KEY) {
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
$analyticsProvider.virtualPageviews(true);
}
// Configure sentry.
if (CONFIG && CONFIG.SENTRY_PUBLIC_DSN) {
if (INJECTED_CONFIG && INJECTED_CONFIG.SENTRY_PUBLIC_DSN) {
$provide.decorator("$exceptionHandler", function($delegate) {
return function(ex, cause) {
$delegate(ex, cause);

View file

@ -5,7 +5,7 @@ import quayRun from './quay.run';
import { ViewArrayImpl } from './services/view-array/view-array.impl';
import NAME_PATTERNS from './constants/name-patterns.constant';
import { routeConfig } from './quay.routes';
import { CONFIG } from './constants/quay-config.constant';
import { INJECTED_CONFIG, INJECTED_FEATURES, INJECTED_ENDPOINTS } from './constants/injected-values.constant';
var quayDependencies: string[] = [
@ -28,19 +28,19 @@ var quayDependencies: string[] = [
'react'
];
if (CONFIG && (CONFIG.MIXPANEL_KEY || CONFIG.MUNCHKIN_KEY || CONFIG.GOOGLE_ANALYTICS_KEY)) {
if (INJECTED_CONFIG && (INJECTED_CONFIG.MIXPANEL_KEY || INJECTED_CONFIG.MUNCHKIN_KEY || INJECTED_CONFIG.GOOGLE_ANALYTICS_KEY)) {
quayDependencies.push('angulartics');
}
if (CONFIG && CONFIG.MIXPANEL_KEY) {
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
quayDependencies.push('angulartics.mixpanel');
}
if (CONFIG && CONFIG.MUNCHKIN_KEY) {
if (INJECTED_CONFIG && INJECTED_CONFIG.MUNCHKIN_KEY) {
quayDependencies.push('angulartics.marketo');
}
if (CONFIG && CONFIG.GOOGLE_ANALYTICS_KEY) {
if (INJECTED_CONFIG && INJECTED_CONFIG.GOOGLE_ANALYTICS_KEY) {
quayDependencies.push('angulartics.google.analytics');
}
if (CONFIG && CONFIG.RECAPTCHA_SITE_KEY) {
if (INJECTED_CONFIG && INJECTED_CONFIG.RECAPTCHA_SITE_KEY) {
quayDependencies.push('vcRecaptcha');
}
@ -49,7 +49,9 @@ export default angular
.config(quayConfig)
.config(routeConfig)
.constant('NAME_PATTERNS', NAME_PATTERNS)
.constant('CONFIG', CONFIG)
.constant('INJECTED_CONFIG', INJECTED_CONFIG)
.constant('INJECTED_FEATURES', INJECTED_FEATURES)
.constant('INJECTED_ENDPOINTS', INJECTED_ENDPOINTS)
.service('ViewArray', ViewArrayImpl)
.run(quayRun)
.name;

View file

@ -7,12 +7,14 @@ routeConfig.$inject = [
'pages',
'$routeProvider',
'$locationProvider',
'INJECTED_FEATURES',
];
export function routeConfig(
pages: any,
$routeProvider: ng.route.IRouteProvider,
$locationProvider: ng.ILocationProvider) {
$locationProvider: ng.ILocationProvider,
INJECTED_FEATURES) {
$locationProvider.html5Mode(true);
// WARNING WARNING WARNING
@ -22,7 +24,7 @@ export function routeConfig(
var routeBuilder: RouteBuilder = new RouteBuilderImpl($routeProvider, pages);
if ((<any>window).__features.SUPER_USERS) {
if (INJECTED_FEATURES.SUPER_USERS) {
// QE Management
routeBuilder.route('/superuser/', 'superuser')
// QE Setup

View file

@ -14,7 +14,7 @@ quayRun.$inject = [
'$anchorScroll',
'UtilService',
'MetaService',
'CONFIG',
'INJECTED_CONFIG',
];
export default function quayRun(
@ -30,8 +30,8 @@ export default function quayRun(
$anchorScroll,
UtilService,
MetaService,
CONFIG) {
var defaultTitle = CONFIG['REGISTRY_TITLE'] || 'Quay Container Registry';
INJECTED_CONFIG) {
var defaultTitle = INJECTED_CONFIG['REGISTRY_TITLE'] || 'Quay Container Registry';
// Handle session security.
Restangular.setDefaultRequestParams(['post', 'put', 'remove', 'delete'], {'_csrf_token': (<any>window).__token || ''});