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'],
|
||||
|
|
|
@ -13,4 +13,4 @@ export const INJECTED_ENDPOINTS: any = (<any>window).__endpoints;
|
|||
/**
|
||||
* Features information.
|
||||
*/
|
||||
export const INJECTED_FEATURES: any = (<any>window).__features;
|
||||
export const INJECTED_FEATURES: any = (<any>window).__features;
|
||||
|
|
|
@ -5,4 +5,4 @@ export default {
|
|||
TEAM_PATTERN: '^[a-z][a-z0-9]+$',
|
||||
ROBOT_PATTERN: '^[a-z][a-z0-9_]{1,254}$',
|
||||
USERNAME_PATTERN: '^(?=.{2,255}$)([a-z0-9]+(?:[._-][a-z0-9]+)*)$',
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
@ -42,4 +41,4 @@ export default {
|
|||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -14,4 +14,4 @@ describe("Decorator: Inject", () => {
|
|||
|
||||
class ValidService {
|
||||
constructor(@Inject('$scope') private $scope: any) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,4 +9,4 @@ export default angular
|
|||
.directive('rpHeader', rpHeaderDirective)
|
||||
.directive('rpSidebar', rpSidebarDirective)
|
||||
.directive('rpBody', rpBodyDirective)
|
||||
.name;
|
||||
.name;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -66,4 +64,4 @@ export function quayConfig(
|
|||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
@ -54,4 +56,4 @@ export default angular
|
|||
.constant('INJECTED_ENDPOINTS', INJECTED_ENDPOINTS)
|
||||
.service('ViewArray', ViewArrayImpl)
|
||||
.run(quayRun)
|
||||
.name;
|
||||
.name;
|
||||
|
|
|
@ -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 = [
|
||||
|
@ -131,4 +132,4 @@ export function routeConfig(
|
|||
.route('/:catch/:all', 'error-view')
|
||||
.route('/:catch/:all/:things', 'error-view')
|
||||
.route('/:catch/:all/:things/:here', 'error-view');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
$rootScope.title = title;
|
||||
|
||||
var description = MetaService.getDescription($rootScope.currentPage) || '';
|
||||
if ($rootScope.description != description) {
|
||||
|
@ -126,4 +129,15 @@ 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