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
|
// Tests utils
|
||||||
'static/test/**/*.js',
|
'static/test/**/*.js',
|
||||||
],
|
],
|
||||||
exclude: [
|
exclude: [],
|
||||||
'static/js/build/bundle.js',
|
|
||||||
],
|
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'static/lib/ngReact/react.ngReact.min.js': ['webpack'],
|
'static/lib/ngReact/react.ngReact.min.js': ['webpack'],
|
||||||
'static/lib/angular-moment.min.js': ['webpack'],
|
'static/lib/angular-moment.min.js': ['webpack'],
|
||||||
|
|
|
@ -3,24 +3,23 @@
|
||||||
* TODO: Convert to class/Angular service
|
* TODO: Convert to class/Angular service
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
'_pages': {},
|
_pages: {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a page.
|
* Create a page.
|
||||||
* @param pageName The name of the page.
|
* @param pageName The name of the page.
|
||||||
* @param templateName The file name of the template.
|
* @param templateName The file name of the template.
|
||||||
* @param opt_controller Controller for the page.
|
* @param controller Controller for the page.
|
||||||
* @param opt_flags Additional flags passed to route provider.
|
* @param flags Additional flags passed to route provider.
|
||||||
* @param opt_profiles Available profiles.
|
* @param profiles Available profiles.
|
||||||
*/
|
*/
|
||||||
'create': function (pageName, templateName, opt_controller, opt_flags, opt_profiles) {
|
create: function(pageName: string, templateName: string, controller?: Object, flags = {}, profiles = ['old-layout', 'layout']) {
|
||||||
var profiles = opt_profiles || ['old-layout', 'layout'];
|
|
||||||
for (var i = 0; i < profiles.length; ++i) {
|
for (var i = 0; i < profiles.length; ++i) {
|
||||||
this._pages[profiles[i] + ':' + pageName] = {
|
this._pages[profiles[i] + ':' + pageName] = {
|
||||||
'name': pageName,
|
'name': pageName,
|
||||||
'controller': opt_controller,
|
'controller': controller,
|
||||||
'templateName': templateName,
|
'templateName': templateName,
|
||||||
'flags': opt_flags || {}
|
'flags': flags
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -30,7 +29,7 @@ export default {
|
||||||
* @param pageName The name of the page.
|
* @param pageName The name of the page.
|
||||||
* @param profiles Available profiles to search.
|
* @param profiles Available profiles to search.
|
||||||
*/
|
*/
|
||||||
'get': function (pageName, profiles) {
|
get: function(pageName: string, profiles: any[]) {
|
||||||
for (var i = 0; i < profiles.length; ++i) {
|
for (var i = 0; i < profiles.length; ++i) {
|
||||||
var current = profiles[i];
|
var current = profiles[i];
|
||||||
var key = current.id + ':' + pageName;
|
var key = current.id + ':' + pageName;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
export function Inject(value: string) {
|
export function Inject(value: string) {
|
||||||
return (target: any, propertyKey: string | symbol, parameterIndex: number): void => {
|
return (target: any, propertyKey: string | symbol, parameterIndex: number): void => {
|
||||||
target.$inject = target.$inject || [];
|
target.$inject = target.$inject = [];
|
||||||
target.$inject[parameterIndex] = value;
|
target.$inject[parameterIndex] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,8 @@ export function quayConfig(
|
||||||
return function(element) {
|
return function(element) {
|
||||||
// Note: We only disable bs-tooltip's themselves. $tooltip is used for other things
|
// 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.
|
// (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);
|
return existing.apply(this, arguments);
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,9 @@ var quayDependencies: string[] = [
|
||||||
'react'
|
'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');
|
quayDependencies.push('angulartics');
|
||||||
}
|
}
|
||||||
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
|
if (INJECTED_CONFIG && INJECTED_CONFIG.MIXPANEL_KEY) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { RouteBuilderImpl } from './services/route-builder/route-builder.service.impl';
|
import { RouteBuilderImpl } from './services/route-builder/route-builder.service.impl';
|
||||||
import { RouteBuilder } from './services/route-builder/route-builder.service';
|
import { RouteBuilder } from './services/route-builder/route-builder.service';
|
||||||
import pages from './constants/pages.constant';
|
import pages from './constants/pages.constant';
|
||||||
|
import * as ng from '@types/angular';
|
||||||
|
|
||||||
|
|
||||||
routeConfig.$inject = [
|
routeConfig.$inject = [
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import * as $ from 'jquery';
|
import * as $ from 'jquery';
|
||||||
|
import * as ng from '@types/angular';
|
||||||
|
|
||||||
|
|
||||||
quayRun.$inject = [
|
quayRun.$inject = [
|
||||||
|
@ -18,42 +19,45 @@ quayRun.$inject = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function quayRun(
|
export default function quayRun(
|
||||||
$location,
|
$location: ng.ILocationService,
|
||||||
$rootScope,
|
$rootScope: QuayRunScope,
|
||||||
Restangular,
|
Restangular: any,
|
||||||
UserService,
|
UserService: any,
|
||||||
PlanService,
|
PlanService: any,
|
||||||
$http,
|
$http: ng.IHttpService,
|
||||||
$timeout,
|
$timeout: ng.ITimeoutService,
|
||||||
CookieService,
|
CookieService: any,
|
||||||
Features,
|
Features: any,
|
||||||
$anchorScroll,
|
$anchorScroll: ng.IAnchorScrollService,
|
||||||
UtilService,
|
UtilService: any,
|
||||||
MetaService,
|
MetaService: any,
|
||||||
INJECTED_CONFIG) {
|
INJECTED_CONFIG: any) {
|
||||||
var defaultTitle = INJECTED_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 || ''});
|
||||||
|
|
||||||
// Handle session expiration.
|
// Handle session expiration.
|
||||||
Restangular.setErrorInterceptor(function(response) {
|
Restangular.setErrorInterceptor(function(response) {
|
||||||
if (response.status == 503) {
|
if (response !== undefined && response.status == 503) {
|
||||||
(<any>$('#cannotContactService')).modal({});
|
(<any>$('#cannotContactService')).modal({});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.status == 500) {
|
if (response !== undefined && response.status == 500) {
|
||||||
window.location.href = '/500';
|
window.location.href = '/500';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response.data) {
|
if (response !== undefined && !response.data) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var invalid_token = response.data['title'] == 'invalid_token' || response.data['error_type'] == 'invalid_token';
|
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({});
|
(<any>$('#sessionexpiredModal')).modal({});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -73,9 +77,10 @@ export default function quayRun(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.$watch('description', function(description) {
|
$rootScope.$watch('description', function(description: string) {
|
||||||
if (!description) {
|
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
|
// 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.
|
// Listen for scope changes and update the title and description accordingly.
|
||||||
$rootScope.$watch(function() {
|
$rootScope.$watch(function() {
|
||||||
var title = MetaService.getTitle($rootScope.currentPage) || defaultTitle;
|
var title = MetaService.getTitle($rootScope.currentPage) || defaultTitle;
|
||||||
if ($rootScope.title != title) {
|
|
||||||
$rootScope.title = title;
|
$rootScope.title = title;
|
||||||
}
|
|
||||||
|
|
||||||
var description = MetaService.getDescription($rootScope.currentPage) || '';
|
var description = MetaService.getDescription($rootScope.currentPage) || '';
|
||||||
if ($rootScope.description != description) {
|
if ($rootScope.description != description) {
|
||||||
|
@ -127,3 +130,14 @@ export default function quayRun(
|
||||||
return $http.pendingRequests.length > 0;
|
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