fixes based on requested changes
This commit is contained in:
parent
43f95c52a0
commit
537c07ad4d
11 changed files with 60 additions and 48 deletions
|
@ -33,9 +33,7 @@ module.exports = function(config) {
|
|||
// Tests utils
|
||||
'static/test/**/*.js',
|
||||
],
|
||||
exclude: [
|
||||
'static/js/build/bundle.js',
|
||||
],
|
||||
exclude: [],
|
||||
preprocessors: {
|
||||
'static/lib/ngReact/react.ngReact.min.js': ['webpack'],
|
||||
'static/lib/angular-moment.min.js': ['webpack'],
|
||||
|
|
|
@ -3,24 +3,23 @@
|
|||
* TODO: Convert to class/Angular service
|
||||
*/
|
||||
export default {
|
||||
'_pages': {},
|
||||
_pages: {},
|
||||
|
||||
/**
|
||||
* Create a page.
|
||||
* @param pageName The name of the page.
|
||||
* @param templateName The file name of the template.
|
||||
* @param opt_controller Controller for the page.
|
||||
* @param opt_flags Additional flags passed to route provider.
|
||||
* @param opt_profiles Available profiles.
|
||||
* @param controller Controller for the page.
|
||||
* @param flags Additional flags passed to route provider.
|
||||
* @param profiles Available profiles.
|
||||
*/
|
||||
'create': function (pageName, templateName, opt_controller, opt_flags, opt_profiles) {
|
||||
var profiles = opt_profiles || ['old-layout', 'layout'];
|
||||
create: function(pageName: string, templateName: string, controller?: Object, flags = {}, profiles = ['old-layout', 'layout']) {
|
||||
for (var i = 0; i < profiles.length; ++i) {
|
||||
this._pages[profiles[i] + ':' + pageName] = {
|
||||
'name': pageName,
|
||||
'controller': opt_controller,
|
||||
'controller': controller,
|
||||
'templateName': templateName,
|
||||
'flags': opt_flags || {}
|
||||
'flags': flags
|
||||
};
|
||||
}
|
||||
},
|
||||
|
@ -30,7 +29,7 @@ export default {
|
|||
* @param pageName The name of the page.
|
||||
* @param profiles Available profiles to search.
|
||||
*/
|
||||
'get': function (pageName, profiles) {
|
||||
get: function(pageName: string, profiles: any[]) {
|
||||
for (var i = 0; i < profiles.length; ++i) {
|
||||
var current = profiles[i];
|
||||
var key = current.id + ':' + pageName;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
export function Inject(value: string) {
|
||||
return (target: any, propertyKey: string | symbol, parameterIndex: number): void => {
|
||||
target.$inject = target.$inject || [];
|
||||
target.$inject = target.$inject = [];
|
||||
target.$inject[parameterIndex] = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,8 @@ export function quayConfig(
|
|||
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) {
|
||||
if (element !== undefined && element.attr('bs-tooltip') == null) {
|
||||
return existing.apply(this, arguments);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -28,7 +28,9 @@ var quayDependencies: string[] = [
|
|||
'react'
|
||||
];
|
||||
|
||||
if (INJECTED_CONFIG && (INJECTED_CONFIG.MIXPANEL_KEY || INJECTED_CONFIG.MUNCHKIN_KEY || INJECTED_CONFIG.GOOGLE_ANALYTICS_KEY)) {
|
||||
if (INJECTED_CONFIG && (INJECTED_CONFIG.MIXPANEL_KEY ||
|
||||
INJECTED_CONFIG.MUNCHKIN_KEY ||
|
||||
INJECTED_CONFIG.GOOGLE_ANALYTICS_KEY)) {
|
||||
quayDependencies.push('angulartics');
|
||||
}
|
||||
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { RouteBuilderImpl } from './services/route-builder/route-builder.service.impl';
|
||||
import { RouteBuilder } from './services/route-builder/route-builder.service';
|
||||
import pages from './constants/pages.constant';
|
||||
import * as ng from '@types/angular';
|
||||
|
||||
|
||||
routeConfig.$inject = [
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as $ from 'jquery';
|
||||
import * as ng from '@types/angular';
|
||||
|
||||
|
||||
quayRun.$inject = [
|
||||
|
@ -18,42 +19,45 @@ quayRun.$inject = [
|
|||
];
|
||||
|
||||
export default function quayRun(
|
||||
$location,
|
||||
$rootScope,
|
||||
Restangular,
|
||||
UserService,
|
||||
PlanService,
|
||||
$http,
|
||||
$timeout,
|
||||
CookieService,
|
||||
Features,
|
||||
$anchorScroll,
|
||||
UtilService,
|
||||
MetaService,
|
||||
INJECTED_CONFIG) {
|
||||
$location: ng.ILocationService,
|
||||
$rootScope: QuayRunScope,
|
||||
Restangular: any,
|
||||
UserService: any,
|
||||
PlanService: any,
|
||||
$http: ng.IHttpService,
|
||||
$timeout: ng.ITimeoutService,
|
||||
CookieService: any,
|
||||
Features: any,
|
||||
$anchorScroll: ng.IAnchorScrollService,
|
||||
UtilService: any,
|
||||
MetaService: any,
|
||||
INJECTED_CONFIG: any) {
|
||||
var defaultTitle = INJECTED_CONFIG['REGISTRY_TITLE'] || 'Quay Container Registry';
|
||||
|
||||
// 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 || ''});
|
||||
|
||||
// Handle session expiration.
|
||||
Restangular.setErrorInterceptor(function(response) {
|
||||
if (response.status == 503) {
|
||||
if (response !== undefined && response.status == 503) {
|
||||
(<any>$('#cannotContactService')).modal({});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (response.status == 500) {
|
||||
if (response !== undefined && response.status == 500) {
|
||||
window.location.href = '/500';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!response.data) {
|
||||
if (response !== undefined && !response.data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var invalid_token = response.data['title'] == 'invalid_token' || response.data['error_type'] == 'invalid_token';
|
||||
if (response.status == 401 && invalid_token && response.data['session_required'] !== false) {
|
||||
if (response !== undefined && response.status == 401 &&
|
||||
invalid_token &&
|
||||
response.data['session_required'] !== false) {
|
||||
(<any>$('#sessionexpiredModal')).modal({});
|
||||
return false;
|
||||
}
|
||||
|
@ -73,9 +77,10 @@ export default function quayRun(
|
|||
return;
|
||||
}
|
||||
|
||||
$rootScope.$watch('description', function(description) {
|
||||
$rootScope.$watch('description', function(description: string) {
|
||||
if (!description) {
|
||||
description = 'Hosted private docker repositories. Includes full user management and history. Free for public repositories.';
|
||||
description = `Hosted private docker repositories. Includes full user management and history.
|
||||
Free for public repositories.`;
|
||||
}
|
||||
|
||||
// Note: We set the content of the description tag manually here rather than using Angular binding
|
||||
|
@ -87,9 +92,7 @@ export default function quayRun(
|
|||
// Listen for scope changes and update the title and description accordingly.
|
||||
$rootScope.$watch(function() {
|
||||
var title = MetaService.getTitle($rootScope.currentPage) || defaultTitle;
|
||||
if ($rootScope.title != title) {
|
||||
$rootScope.title = title;
|
||||
}
|
||||
|
||||
var description = MetaService.getDescription($rootScope.currentPage) || '';
|
||||
if ($rootScope.description != description) {
|
||||
|
@ -127,3 +130,14 @@ export default function quayRun(
|
|||
return $http.pendingRequests.length > 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
interface QuayRunScope extends ng.IRootScopeService {
|
||||
currentPage: any;
|
||||
current: any;
|
||||
title: any;
|
||||
description: string,
|
||||
pageClass: any;
|
||||
newLayout: any;
|
||||
fixFooter: any;
|
||||
}
|
Reference in a new issue