added TSLint for TypeScript code style checking, fixed associated errors

This commit is contained in:
alecmerdler 2017-06-19 23:17:42 -07:00
parent 6a7722cadb
commit 41e7e559a6
43 changed files with 253 additions and 730 deletions

View file

@ -1,15 +1,11 @@
import { Injectable } from 'ng-metadata/core';
import { PageService } from './page.service';
import { PageService, QuayPage, QuayPageProfile } from './page.service';
@Injectable(PageService.name)
export class PageServiceImpl implements ng.IServiceProvider {
private pages: any = {};
constructor() {
}
private pages: {[pageName: string]: QuayPage} = {};
public create(pageName: string,
templateName: string,
@ -26,8 +22,8 @@ export class PageServiceImpl implements ng.IServiceProvider {
}
}
public get(pageName: string, profiles: any[]): any[] | null {
for (var i = 0; i < profiles.length; ++i) {
public get(pageName: string, profiles: QuayPageProfile[]): [QuayPageProfile, QuayPage] | null {
for (let i = 0; i < profiles.length; ++i) {
var current = profiles[i];
var key = current.id + ':' + pageName;
var page = this.pages[key];

View file

@ -22,7 +22,7 @@ export abstract class PageService implements ng.IServiceProvider {
* @param pageName The name of the page.
* @param profiles Available profiles to search.
*/
public abstract get(pageName: string, profiles: any[]): any[] | null;
public abstract get(pageName: string, profiles: QuayPageProfile[]): [QuayPageProfile, QuayPage] | null;
/**
* Provide the service instance.
@ -30,3 +30,24 @@ export abstract class PageService implements ng.IServiceProvider {
*/
public abstract $get(): PageService;
}
/**
* A type representing a registered application page.
*/
export type QuayPage = {
name: string;
controller: ng.IController;
templateName: string,
flags: {[key: string]: any};
};
/**
* Represents a page profile type.
*/
export type QuayPageProfile = {
id: string;
templatePath: string;
};