renamed properties placed on the window object to INJECTED_<property>
This commit is contained in:
parent
64a4b68216
commit
6b2222a3ec
6 changed files with 37 additions and 27 deletions
16
static/js/constants/injected-values.constant.ts
Normal file
16
static/js/constants/injected-values.constant.ts
Normal 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;
|
|
@ -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;
|
|
|
@ -3,7 +3,7 @@ import * as Raven from 'raven-js';
|
||||||
|
|
||||||
quayConfig.$inject = [
|
quayConfig.$inject = [
|
||||||
'$provide',
|
'$provide',
|
||||||
'CONFIG',
|
'INJECTED_CONFIG',
|
||||||
'cfpLoadingBarProvider',
|
'cfpLoadingBarProvider',
|
||||||
'$tooltipProvider',
|
'$tooltipProvider',
|
||||||
'$compileProvider',
|
'$compileProvider',
|
||||||
|
@ -13,7 +13,7 @@ quayConfig.$inject = [
|
||||||
|
|
||||||
export function quayConfig(
|
export function quayConfig(
|
||||||
$provide,
|
$provide,
|
||||||
CONFIG,
|
INJECTED_CONFIG,
|
||||||
cfpLoadingBarProvider,
|
cfpLoadingBarProvider,
|
||||||
$tooltipProvider,
|
$tooltipProvider,
|
||||||
$compileProvider,
|
$compileProvider,
|
||||||
|
@ -40,7 +40,7 @@ export function quayConfig(
|
||||||
return tooltipFactory.apply(this, arguments);
|
return tooltipFactory.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!CONFIG['DEBUG']) {
|
if (!INJECTED_CONFIG['DEBUG']) {
|
||||||
$compileProvider.debugInfoEnabled(false);
|
$compileProvider.debugInfoEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,12 +52,12 @@ export function quayConfig(
|
||||||
RestangularProvider.setBaseUrl('/api/v1/');
|
RestangularProvider.setBaseUrl('/api/v1/');
|
||||||
|
|
||||||
// Configure analytics.
|
// Configure analytics.
|
||||||
if (CONFIG && CONFIG.MIXPANEL_KEY) {
|
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
|
||||||
$analyticsProvider.virtualPageviews(true);
|
$analyticsProvider.virtualPageviews(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure sentry.
|
// Configure sentry.
|
||||||
if (CONFIG && CONFIG.SENTRY_PUBLIC_DSN) {
|
if (INJECTED_CONFIG && INJECTED_CONFIG.SENTRY_PUBLIC_DSN) {
|
||||||
$provide.decorator("$exceptionHandler", function($delegate) {
|
$provide.decorator("$exceptionHandler", function($delegate) {
|
||||||
return function(ex, cause) {
|
return function(ex, cause) {
|
||||||
$delegate(ex, cause);
|
$delegate(ex, cause);
|
||||||
|
|
|
@ -5,7 +5,7 @@ import quayRun from './quay.run';
|
||||||
import { ViewArrayImpl } from './services/view-array/view-array.impl';
|
import { ViewArrayImpl } from './services/view-array/view-array.impl';
|
||||||
import NAME_PATTERNS from './constants/name-patterns.constant';
|
import NAME_PATTERNS from './constants/name-patterns.constant';
|
||||||
import { routeConfig } from './quay.routes';
|
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[] = [
|
var quayDependencies: string[] = [
|
||||||
|
@ -28,19 +28,19 @@ var quayDependencies: string[] = [
|
||||||
'react'
|
'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');
|
quayDependencies.push('angulartics');
|
||||||
}
|
}
|
||||||
if (CONFIG && CONFIG.MIXPANEL_KEY) {
|
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
|
||||||
quayDependencies.push('angulartics.mixpanel');
|
quayDependencies.push('angulartics.mixpanel');
|
||||||
}
|
}
|
||||||
if (CONFIG && CONFIG.MUNCHKIN_KEY) {
|
if (INJECTED_CONFIG && INJECTED_CONFIG.MUNCHKIN_KEY) {
|
||||||
quayDependencies.push('angulartics.marketo');
|
quayDependencies.push('angulartics.marketo');
|
||||||
}
|
}
|
||||||
if (CONFIG && CONFIG.GOOGLE_ANALYTICS_KEY) {
|
if (INJECTED_CONFIG && INJECTED_CONFIG.GOOGLE_ANALYTICS_KEY) {
|
||||||
quayDependencies.push('angulartics.google.analytics');
|
quayDependencies.push('angulartics.google.analytics');
|
||||||
}
|
}
|
||||||
if (CONFIG && CONFIG.RECAPTCHA_SITE_KEY) {
|
if (INJECTED_CONFIG && INJECTED_CONFIG.RECAPTCHA_SITE_KEY) {
|
||||||
quayDependencies.push('vcRecaptcha');
|
quayDependencies.push('vcRecaptcha');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,9 @@ export default angular
|
||||||
.config(quayConfig)
|
.config(quayConfig)
|
||||||
.config(routeConfig)
|
.config(routeConfig)
|
||||||
.constant('NAME_PATTERNS', NAME_PATTERNS)
|
.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)
|
.service('ViewArray', ViewArrayImpl)
|
||||||
.run(quayRun)
|
.run(quayRun)
|
||||||
.name;
|
.name;
|
|
@ -7,12 +7,14 @@ routeConfig.$inject = [
|
||||||
'pages',
|
'pages',
|
||||||
'$routeProvider',
|
'$routeProvider',
|
||||||
'$locationProvider',
|
'$locationProvider',
|
||||||
|
'INJECTED_FEATURES',
|
||||||
];
|
];
|
||||||
|
|
||||||
export function routeConfig(
|
export function routeConfig(
|
||||||
pages: any,
|
pages: any,
|
||||||
$routeProvider: ng.route.IRouteProvider,
|
$routeProvider: ng.route.IRouteProvider,
|
||||||
$locationProvider: ng.ILocationProvider) {
|
$locationProvider: ng.ILocationProvider,
|
||||||
|
INJECTED_FEATURES) {
|
||||||
$locationProvider.html5Mode(true);
|
$locationProvider.html5Mode(true);
|
||||||
|
|
||||||
// WARNING WARNING WARNING
|
// WARNING WARNING WARNING
|
||||||
|
@ -22,7 +24,7 @@ export function routeConfig(
|
||||||
|
|
||||||
var routeBuilder: RouteBuilder = new RouteBuilderImpl($routeProvider, pages);
|
var routeBuilder: RouteBuilder = new RouteBuilderImpl($routeProvider, pages);
|
||||||
|
|
||||||
if ((<any>window).__features.SUPER_USERS) {
|
if (INJECTED_FEATURES.SUPER_USERS) {
|
||||||
// QE Management
|
// QE Management
|
||||||
routeBuilder.route('/superuser/', 'superuser')
|
routeBuilder.route('/superuser/', 'superuser')
|
||||||
// QE Setup
|
// QE Setup
|
||||||
|
|
|
@ -14,7 +14,7 @@ quayRun.$inject = [
|
||||||
'$anchorScroll',
|
'$anchorScroll',
|
||||||
'UtilService',
|
'UtilService',
|
||||||
'MetaService',
|
'MetaService',
|
||||||
'CONFIG',
|
'INJECTED_CONFIG',
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function quayRun(
|
export default function quayRun(
|
||||||
|
@ -30,8 +30,8 @@ export default function quayRun(
|
||||||
$anchorScroll,
|
$anchorScroll,
|
||||||
UtilService,
|
UtilService,
|
||||||
MetaService,
|
MetaService,
|
||||||
CONFIG) {
|
INJECTED_CONFIG) {
|
||||||
var defaultTitle = CONFIG['REGISTRY_TITLE'] || 'Quay Container Registry';
|
var defaultTitle = INJECTED_CONFIG['REGISTRY_TITLE'] || 'Quay Container Registry';
|
||||||
|
|
||||||
// Handle session security.
|
// Handle session security.
|
||||||
Restangular.setDefaultRequestParams(['post', 'put', 'remove', 'delete'], {'_csrf_token': (<any>window).__token || ''});
|
Restangular.setDefaultRequestParams(['post', 'put', 'remove', 'delete'], {'_csrf_token': (<any>window).__token || ''});
|
||||||
|
|
Reference in a new issue