added TSLint for TypeScript code style checking, fixed associated errors
This commit is contained in:
parent
6a7722cadb
commit
41e7e559a6
43 changed files with 253 additions and 730 deletions
|
@ -9,7 +9,8 @@
|
|||
"test:node": "JASMINE_CONFIG_PATH=static/test/jasmine.json ./node_modules/.bin/jasmine-ts './static/js/**/*.spec.ts'",
|
||||
"e2e": "./node_modules/.bin/ts-node ./node_modules/.bin/protractor static/test/protractor.conf.ts",
|
||||
"build": "NODE_ENV=production ./node_modules/.bin/webpack --progress",
|
||||
"watch": "./node_modules/.bin/webpack --watch"
|
||||
"watch": "./node_modules/.bin/webpack --watch",
|
||||
"lint": "./node_modules/.bin/tslint --type-check -p tsconfig.json -e **/*.spec.ts"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -54,7 +55,6 @@
|
|||
"@types/react-dom": "0.14.17",
|
||||
"@types/showdown": "^1.4.32",
|
||||
"angular-mocks": "1.6.2",
|
||||
"angular-ts-decorators": "0.0.19",
|
||||
"css-loader": "0.25.0",
|
||||
"html-loader": "^0.4.5",
|
||||
"jasmine-core": "^2.5.2",
|
||||
|
@ -73,8 +73,8 @@
|
|||
"ts-loader": "^0.9.5",
|
||||
"ts-mocks": "^0.2.2",
|
||||
"ts-node": "^3.0.6",
|
||||
"tslint": "^5.4.3",
|
||||
"typescript": "^2.2.1",
|
||||
"typings": "1.4.0",
|
||||
"webpack": "^2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ export function Inject(value: string) {
|
|||
return (target: any, propertyKey: string | symbol, parameterIndex: number): void => {
|
||||
target.$inject = target.$inject = [];
|
||||
target.$inject[parameterIndex] = value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ import { Input, Component, Inject } from 'ng-metadata/core';
|
|||
templateUrl: '/static/js/directives/ui/app-public-view/app-public-view.component.html'
|
||||
})
|
||||
export class AppPublicViewComponent {
|
||||
|
||||
@Input('<') public repository: any;
|
||||
|
||||
private settingsShown: number = 0;
|
||||
private logsShown: number = 0;
|
||||
|
||||
|
@ -17,11 +19,6 @@ export class AppPublicViewComponent {
|
|||
this.updateDescription = this.updateDescription.bind(this);
|
||||
}
|
||||
|
||||
private updateDescription(content: string) {
|
||||
this.repository.description = content;
|
||||
this.repository.put();
|
||||
}
|
||||
|
||||
public showSettings(): void {
|
||||
this.settingsShown++;
|
||||
}
|
||||
|
@ -29,4 +26,9 @@ export class AppPublicViewComponent {
|
|||
public showLogs(): void {
|
||||
this.logsShown++;
|
||||
}
|
||||
|
||||
private updateDescription(content: string) {
|
||||
this.repository.description = content;
|
||||
this.repository.put();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { NgModule } from 'ng-metadata/core'
|
||||
import { NgModule } from 'ng-metadata/core';
|
||||
import { CorTabsComponent } from './cor-tabs.component';
|
||||
import { CorTabComponent } from './cor-tab/cor-tab.component';
|
||||
import { CorNavTabsDirective } from './cor-nav-tabs/cor-nav-tabs.directive';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Input, Output, Component, Inject } from 'ng-metadata/core';
|
||||
import { Input, Component, Inject } from 'ng-metadata/core';
|
||||
import * as moment from "moment";
|
||||
|
||||
|
||||
/**
|
||||
* A component that allows for selecting a time duration.
|
||||
*/
|
||||
|
@ -9,6 +10,7 @@ import * as moment from "moment";
|
|||
templateUrl: '/static/js/directives/ui/duration-input/duration-input.component.html'
|
||||
})
|
||||
export class DurationInputComponent implements ng.IComponentController {
|
||||
|
||||
@Input('<') public min: string;
|
||||
@Input('<') public max: string;
|
||||
@Input('=?') public value: string;
|
||||
|
@ -33,7 +35,7 @@ export class DurationInputComponent implements ng.IComponentController {
|
|||
}
|
||||
|
||||
private updateValue(): void {
|
||||
this.value = this.seconds + 's';
|
||||
this.value = `${this.seconds}s`;
|
||||
}
|
||||
|
||||
private refresh(): void {
|
||||
|
@ -41,8 +43,8 @@ export class DurationInputComponent implements ng.IComponentController {
|
|||
this.max_s = this.toSeconds(this.max || '1h');
|
||||
|
||||
if (this.value) {
|
||||
this.seconds = this.toSeconds(this.value || '0s')
|
||||
};
|
||||
this.seconds = this.toSeconds(this.value || '0s');
|
||||
}
|
||||
}
|
||||
|
||||
private durationExplanation(durationSeconds: string): string {
|
||||
|
|
|
@ -75,4 +75,4 @@ export class LinearWorkflowComponent {
|
|||
export type SectionInfo = {
|
||||
index: number;
|
||||
component: LinearWorkflowSectionComponent;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,7 +17,9 @@ export class ManageTriggerComponent implements OnChanges {
|
|||
@Input('<') public githost: string = 'custom-git';
|
||||
@Input('<') public repository: Repository;
|
||||
@Input('<') public trigger: Trigger;
|
||||
|
||||
@Output() public activateTrigger: EventEmitter<{config: TriggerConfig, pull_robot?: any}> = new EventEmitter();
|
||||
|
||||
public config: TriggerConfig;
|
||||
public local: Local = {
|
||||
selectedRepository: {name: ''},
|
||||
|
@ -28,6 +30,7 @@ export class ManageTriggerComponent implements OnChanges {
|
|||
repositoryOptions: {filter: '', predicate: 'score', reverse: false, page: 0, hideStale: true},
|
||||
robotOptions: {filter: '', predicate: 'score', reverse: false, page: 0},
|
||||
};
|
||||
|
||||
private namespacesPerPage: number = 10;
|
||||
private repositoriesPerPage: number = 10;
|
||||
private robotsPerPage: number = 10;
|
||||
|
@ -288,7 +291,7 @@ export class ManageTriggerComponent implements OnChanges {
|
|||
const kind = ref.kind == 'branch' ? 'heads' : 'tags';
|
||||
const icon = ref.kind == 'branch' ? 'fa-code-fork' : 'fa-tag';
|
||||
return {
|
||||
'value': kind + '/' + ref.name,
|
||||
'value': `${kind}/${ref.name}`,
|
||||
'icon': icon,
|
||||
'title': ref.name
|
||||
};
|
||||
|
|
|
@ -16,10 +16,13 @@ export class ManageTriggerViewObject {
|
|||
|
||||
private customGitRepoInput: ElementFinder = element(by.model('$ctrl.buildSource'));
|
||||
private dockerfileLocationInput: ElementFinder = this.sections['dockerfilelocation'].$('input');
|
||||
private dockerfileLocationDropdownButton: ElementFinder = this.sections['dockerfilelocation'].$('button[data-toggle=dropdown');
|
||||
private dockerfileLocationDropdownButton: ElementFinder = this.sections['dockerfilelocation']
|
||||
.$('button[data-toggle=dropdown');
|
||||
private dockerContextInput: ElementFinder = this.sections['contextlocation'].$('input');
|
||||
private dockerContextDropdownButton: ElementFinder = this.sections['contextlocation'].$('button[data-toggle=dropdown');
|
||||
private robotAccountOptions: ElementFinder = this.sections['robot'].element(by.repeater('$ctrl.orderedData.visibleEntries'));
|
||||
private dockerContextDropdownButton: ElementFinder = this.sections['contextlocation']
|
||||
.$('button[data-toggle=dropdown');
|
||||
private robotAccountOptions: ElementFinder = this.sections['robot']
|
||||
.element(by.repeater('$ctrl.orderedData.visibleEntries'));
|
||||
|
||||
public continue(): Promise<void> {
|
||||
return Promise.resolve(element(by.buttonText('Continue')).click());
|
||||
|
|
|
@ -16,8 +16,10 @@ export class MarkdownEditorComponent {
|
|||
@Input('<') public content: string;
|
||||
@Output() public save: EventEmitter<{editedContent: string}> = new EventEmitter();
|
||||
@Output() public discard: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
// Textarea is public for testability, should not be directly accessed
|
||||
@ViewChild('#markdown-textarea') public textarea: ng.IAugmentedJQuery;
|
||||
|
||||
private editMode: EditMode = "write";
|
||||
|
||||
constructor(@Inject('$document') private $document: ng.IDocumentService,
|
||||
|
@ -115,9 +117,9 @@ export class MarkdownEditorComponent {
|
|||
private insertText(text: string, startPos: number, endPos: number): void {
|
||||
if (this.browserPlatform === 'firefox') {
|
||||
// FIXME: Ctrl-Z highlights previous text
|
||||
this.textarea.val(this.textarea.val().substr(0, startPos) +
|
||||
this.textarea.val(<string>this.textarea.val().substr(0, startPos) +
|
||||
text +
|
||||
this.textarea.val().substr(endPos, this.textarea.val().length));
|
||||
<string>this.textarea.val().substr(endPos, this.textarea.val().length));
|
||||
}
|
||||
else {
|
||||
// TODO: Test other platforms (IE...)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Input, Component, Inject } from 'ng-metadata/core';
|
||||
import { Repository } from '../../../types/common.types';
|
||||
|
||||
|
||||
/**
|
||||
* A component that displays the configuration and options for repository signing.
|
||||
*/
|
||||
|
@ -9,6 +10,7 @@ import { Repository } from '../../../types/common.types';
|
|||
templateUrl: '/static/js/directives/ui/repository-signing-config/repository-signing-config.component.html',
|
||||
})
|
||||
export class RepositorySigningConfigComponent {
|
||||
|
||||
@Input('<') public repository: Repository;
|
||||
|
||||
private enableTrustInfo: {[key: string]: string} = null;
|
||||
|
|
|
@ -43,7 +43,7 @@ export class SearchBoxComponent {
|
|||
private onSelected($event): void {
|
||||
this.autocompleteSelected = true;
|
||||
this.$timeout(() => {
|
||||
this.$location.url($event['result']['href'])
|
||||
this.$location.url($event['result']['href']);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Input, Component, Inject } from 'ng-metadata/core';
|
|||
import { ApostilleDelegationsSet, ApostilleSignatureDocument, ApostilleTagDocument } from '../../../types/common.types';
|
||||
import * as moment from "moment";
|
||||
|
||||
|
||||
type TagSigningInfo = {
|
||||
delegations: DelegationInfo[];
|
||||
delegationsByName: {[delegationName: string]: DelegationInfo};
|
||||
|
@ -9,7 +10,8 @@ type TagSigningInfo = {
|
|||
hasExpiringSoon: boolean;
|
||||
hasExpired: boolean;
|
||||
hasInvalid: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
type DelegationInfo = {
|
||||
delegationName: string;
|
||||
|
@ -20,7 +22,9 @@ type DelegationInfo = {
|
|||
isExpiringSoon: boolean
|
||||
};
|
||||
|
||||
var RELEASES = ['targets/releases', 'targets'];
|
||||
|
||||
const RELEASES = ['targets/releases', 'targets'];
|
||||
|
||||
|
||||
/**
|
||||
* A component that displays the signing status of a tag in the repository view.
|
||||
|
@ -30,13 +34,16 @@ var RELEASES = ['targets/releases', 'targets'];
|
|||
templateUrl: '/static/js/directives/ui/tag-signing-display/tag-signing-display.component.html',
|
||||
})
|
||||
export class TagSigningDisplayComponent {
|
||||
|
||||
@Input('<') public compact: boolean;
|
||||
@Input('<') public tag: any;
|
||||
@Input('<') public delegations: ApostilleDelegationsSet;
|
||||
|
||||
private cachedSigningInfo: TagSigningInfo | null = null;
|
||||
|
||||
constructor(@Inject("$sanitize") private $sanitize: ng.sanitize.ISanitizeService) {}
|
||||
constructor(@Inject("$sanitize") private $sanitize: ng.sanitize.ISanitizeService) {
|
||||
|
||||
}
|
||||
|
||||
private base64ToHex(base64String: string): string {
|
||||
// Based on: http://stackoverflow.com/questions/39460182/decode-base64-to-hexadecimal-string-with-javascript
|
||||
|
@ -49,13 +56,15 @@ export class TagSigningDisplayComponent {
|
|||
var hexString = '';
|
||||
for (var i = 0; i < raw.length; ++i) {
|
||||
var char = raw.charCodeAt(i);
|
||||
var hex = char.toString(16)
|
||||
var hex = char.toString(16);
|
||||
hexString += (hex.length == 2 ? hex : '0' + hex);
|
||||
}
|
||||
return hexString;
|
||||
}
|
||||
|
||||
private buildDelegationInfo(tag: any, delegationName: string, delegation: ApostilleSignatureDocument): DelegationInfo {
|
||||
private buildDelegationInfo(tag: any,
|
||||
delegationName: string,
|
||||
delegation: ApostilleSignatureDocument): DelegationInfo {
|
||||
var digest_without_prefix = tag.manifest_digest.substr('sha256:'.length);
|
||||
var hex_signature = this.base64ToHex(delegation.targets[tag.name].hashes['sha256']);
|
||||
|
||||
|
@ -70,7 +79,7 @@ export class TagSigningDisplayComponent {
|
|||
'delegationHash': hex_signature,
|
||||
'isExpired': expires.isSameOrBefore(now),
|
||||
'isExpiringSoon': !expires.isSameOrBefore(now) && expires.isSameOrBefore(withOneWeek),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private buildTagSigningInfo(tag: any, delegationSet: ApostilleDelegationsSet): TagSigningInfo {
|
||||
|
@ -80,13 +89,13 @@ export class TagSigningDisplayComponent {
|
|||
'hasExpired': false,
|
||||
'hasExpiringSoon': false,
|
||||
'hasInvalid': false,
|
||||
}
|
||||
};
|
||||
|
||||
// Find all delegations containing the tag as a target.
|
||||
Object.keys(delegationSet.delegations).forEach((delegationName) => {
|
||||
var delegation = delegationSet.delegations[delegationName];
|
||||
if (delegation.targets[tag.name]) {
|
||||
var DelegationInfo = this.buildDelegationInfo(tag, delegationName, delegation)
|
||||
var DelegationInfo = this.buildDelegationInfo(tag, delegationName, delegation);
|
||||
info.delegations.push(DelegationInfo);
|
||||
info.delegationsByName[delegationName] = DelegationInfo;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Input, Component, Inject } from 'ng-metadata/core';
|
||||
import * as moment from "moment";
|
||||
|
||||
|
||||
/**
|
||||
* A component that displays settings for a namespace for time machine.
|
||||
*/
|
||||
|
@ -9,6 +10,7 @@ import * as moment from "moment";
|
|||
templateUrl: '/static/js/directives/ui/time-machine-settings/time-machine-settings.component.html'
|
||||
})
|
||||
export class TimeMachineSettingsComponent implements ng.IComponentController {
|
||||
|
||||
@Input('<') public user: any;
|
||||
@Input('<') public organization: any;
|
||||
|
||||
|
@ -51,7 +53,7 @@ export class TimeMachineSettingsComponent implements ng.IComponentController {
|
|||
this.updating = true;
|
||||
var errorDisplay = this.ApiService.errorDisplay('Could not update time machine setting', () => {
|
||||
this.updating = false;
|
||||
})
|
||||
});
|
||||
|
||||
var method = (this.user ? this.ApiService.changeUserDetails :
|
||||
this.ApiService.changeOrganizationDetails);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Input, Output, Directive, Inject, AfterContentInit, EventEmitter, HostListener } from 'ng-metadata/core';
|
||||
import * as $ from 'jquery';
|
||||
|
||||
|
||||
/**
|
||||
* Directive which decorates an <input> with a typeahead autocomplete.
|
||||
*/
|
||||
|
@ -8,15 +9,15 @@ import * as $ from 'jquery';
|
|||
selector: '[typeahead]',
|
||||
})
|
||||
export class TypeaheadDirective implements AfterContentInit {
|
||||
@Output('typeahead') typeahead = new EventEmitter<any>();
|
||||
|
||||
@Input('taDisplayKey') displayKey: string = '';
|
||||
@Input('taSuggestionTmpl') suggestionTemplate: string = '';
|
||||
@Input('taClearOnSelect') clearOnSelect: boolean = false;
|
||||
@Input('taDebounce') debounce: number = 250;
|
||||
@Input('taDisplayKey') public displayKey: string = '';
|
||||
@Input('taSuggestionTmpl') public suggestionTemplate: string = '';
|
||||
@Input('taClearOnSelect') public clearOnSelect: boolean = false;
|
||||
@Input('taDebounce') public debounce: number = 250;
|
||||
|
||||
@Output('taSelected') selected = new EventEmitter<any>();
|
||||
@Output('taEntered') entered = new EventEmitter<any>();
|
||||
@Output('typeahead') public typeahead = new EventEmitter<any>();
|
||||
@Output('taSelected') public selected = new EventEmitter<any>();
|
||||
@Output('taEntered') public entered = new EventEmitter<any>();
|
||||
|
||||
private itemSelected: boolean = false;
|
||||
private existingTimer: ng.IPromise<void> = null;
|
||||
|
@ -28,10 +29,25 @@ export class TypeaheadDirective implements AfterContentInit {
|
|||
@Inject('$timeout') private $timeout: ng.ITimeoutService) {
|
||||
}
|
||||
|
||||
@HostListener('keyup', ['$event'])
|
||||
public onKeyup(event: JQueryKeyEventObject): void {
|
||||
if (!this.itemSelected && event.keyCode == 13) {
|
||||
this.entered.emit({
|
||||
'value': $(this.$element).typeahead('val'),
|
||||
'callback': (reset: boolean) => {
|
||||
if (reset) {
|
||||
this.itemSelected = false;
|
||||
$(this.$element).typeahead('val', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public ngAfterContentInit(): void {
|
||||
var templates = null;
|
||||
if (this.suggestionTemplate) {
|
||||
templates = {}
|
||||
templates = {};
|
||||
|
||||
if (this.suggestionTemplate) {
|
||||
templates['suggestion'] = this.buildTemplateHandler(this.suggestionTemplate);
|
||||
|
@ -42,7 +58,7 @@ export class TypeaheadDirective implements AfterContentInit {
|
|||
if (this.clearOnSelect) {
|
||||
$(this.$element).typeahead('val', '');
|
||||
}
|
||||
this.selected.emit({'result': suggestion})
|
||||
this.selected.emit({'result': suggestion});
|
||||
this.itemSelected = true;
|
||||
});
|
||||
|
||||
|
@ -72,21 +88,6 @@ export class TypeaheadDirective implements AfterContentInit {
|
|||
}, this.debounce);
|
||||
}
|
||||
|
||||
@HostListener('keyup', ['$event'])
|
||||
public onKeyup(event: JQueryKeyEventObject): void {
|
||||
if (!this.itemSelected && event.keyCode == 13) {
|
||||
this.entered.emit({
|
||||
'value': $(this.$element).typeahead('val'),
|
||||
'callback': (reset: boolean) => {
|
||||
if (reset) {
|
||||
this.itemSelected = false;
|
||||
$(this.$element).typeahead('val', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private buildTemplateHandler(templateUrl: string): Function {
|
||||
return (value) => {
|
||||
var resultDiv = document.createElement('div');
|
||||
|
|
|
@ -10,9 +10,6 @@ import { Input, Component } from 'ng-metadata/core';
|
|||
templateUrl: '/static/js/directives/ui/visibility-indicator/visibility-indicator.component.html'
|
||||
})
|
||||
export class VisibilityIndicatorComponent {
|
||||
|
||||
@Input('<') public repository: any;
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,8 @@ function provideConfig($provide: ng.auto.IProvideService,
|
|||
var tooltipFactory: any = $tooltipProvider.$get[$tooltipProvider.$get.length - 1];
|
||||
$tooltipProvider.$get[$tooltipProvider.$get.length - 1] = function($window: ng.IWindowService) {
|
||||
if ('ontouchstart' in $window) {
|
||||
var existing: any = tooltipFactory.apply(this, arguments);
|
||||
const existing: any = tooltipFactory.apply(this, arguments);
|
||||
|
||||
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.
|
||||
|
|
|
@ -45,7 +45,8 @@ export function provideRun($rootScope: QuayRunScope,
|
|||
return true;
|
||||
}
|
||||
|
||||
const invalid_token: boolean = response.data['title'] == 'invalid_token' || response.data['error_type'] == 'invalid_token';
|
||||
const invalid_token: boolean = response.data['title'] == 'invalid_token' ||
|
||||
response.data['error_type'] == 'invalid_token';
|
||||
if (response !== undefined &&
|
||||
response.status == 401 &&
|
||||
invalid_token &&
|
||||
|
@ -126,7 +127,7 @@ interface QuayRunScope extends ng.IRootScopeService {
|
|||
currentPage: any;
|
||||
current: any;
|
||||
title: any;
|
||||
description: string,
|
||||
description: string;
|
||||
pageClass: any;
|
||||
newLayout: any;
|
||||
fixFooter: any;
|
||||
|
|
|
@ -13,7 +13,9 @@ import { CorTableComponent } from './directives/ui/cor-table/cor-table.component
|
|||
import { CorTableColumn } from './directives/ui/cor-table/cor-table-col.component';
|
||||
import { ChannelIconComponent } from './directives/ui/channel-icon/channel-icon.component';
|
||||
import { TagSigningDisplayComponent } from './directives/ui/tag-signing-display/tag-signing-display.component';
|
||||
import { RepositorySigningConfigComponent } from './directives/ui/repository-signing-config/repository-signing-config.component';
|
||||
import {
|
||||
RepositorySigningConfigComponent
|
||||
} from './directives/ui/repository-signing-config/repository-signing-config.component';
|
||||
import { TimeMachineSettingsComponent } from './directives/ui/time-machine-settings/time-machine-settings.component';
|
||||
import { DurationInputComponent } from './directives/ui/duration-input/duration-input.component';
|
||||
import { SearchBoxComponent } from './directives/ui/search-box/search-box.component';
|
||||
|
@ -22,7 +24,6 @@ import { BuildServiceImpl } from './services/build/build.service.impl';
|
|||
import { AvatarServiceImpl } from './services/avatar/avatar.service.impl';
|
||||
import { DockerfileServiceImpl } from './services/dockerfile/dockerfile.service.impl';
|
||||
import { DataFileServiceImpl } from './services/datafile/datafile.service.impl';
|
||||
import { UtilServiceImpl } from './services/util/util.service.impl';
|
||||
import { QuayRequireDirective } from './directives/structural/quay-require/quay-require.directive';
|
||||
import { MarkdownInputComponent } from './directives/ui/markdown/markdown-input.component';
|
||||
import { MarkdownViewComponent } from './directives/ui/markdown/markdown-view.component';
|
||||
|
|
|
@ -73,7 +73,8 @@ export class BuildServiceImpl implements BuildService {
|
|||
break;
|
||||
|
||||
case 'internalerror':
|
||||
message = 'An internal system error occurred while building; the build will be retried in the next few minutes.';
|
||||
message = 'An internal system error occurred while building; ' +
|
||||
'the build will be retried in the next few minutes.';
|
||||
break;
|
||||
|
||||
case 'cancelled':
|
||||
|
|
|
@ -86,7 +86,7 @@ export class DataFileServiceImpl implements DataFileService {
|
|||
var zip = null;
|
||||
var zipFiles = null;
|
||||
try {
|
||||
var zip = new JSZip(buf);
|
||||
zip = new JSZip(buf);
|
||||
zipFiles = zip.files;
|
||||
} catch (e) {
|
||||
failure();
|
||||
|
@ -164,9 +164,9 @@ export class DataFileServiceImpl implements DataFileService {
|
|||
'name': this.getName(path),
|
||||
'path': path,
|
||||
'canRead': true,
|
||||
'toBlob': (function(currentFile) {
|
||||
'toBlob': (function(file) {
|
||||
return function() {
|
||||
return new Blob([currentFile.buffer], {type: 'application/octet-binary'});
|
||||
return new Blob([file.buffer], {type: 'application/octet-binary'});
|
||||
};
|
||||
}(currentFile))
|
||||
});
|
||||
|
|
|
@ -104,11 +104,11 @@ export class DockerfileInfoImpl implements DockerfileInfo {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (baseImage.indexOf(this.config.getDomain() + '/') != 0) {
|
||||
if (baseImage.indexOf(`${this.config.getDomain()}/`) != 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return baseImage.substring(this.config.getDomain().length + 1);
|
||||
return baseImage.substring(<number>this.config.getDomain().length + 1);
|
||||
}
|
||||
|
||||
public getBaseImage(): string | null {
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { RouteBuilder } from './route-builder.service';
|
||||
import { Injectable, Inject } from 'ng-metadata/core';
|
||||
import { PageService } from '../page/page.service';
|
||||
import { PageService, QuayPage, QuayPageProfile } from '../page/page.service';
|
||||
|
||||
|
||||
@Injectable(RouteBuilder.name)
|
||||
export class RouteBuilderImpl implements RouteBuilder {
|
||||
|
||||
public currentProfile: string = 'layout';
|
||||
public profiles: any[] = [
|
||||
public profiles: QuayPageProfile[] = [
|
||||
// Start with the old pages (if we asked for it).
|
||||
{id: 'old-layout', templatePath: '/static/partials/'},
|
||||
// Fallback back combined new/existing pages.
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
import { UtilServiceImpl } from './util.service.impl';
|
||||
|
||||
|
||||
describe("UtilServiceImpl", () => {
|
||||
var utilServiceImpl: UtilServiceImpl;
|
||||
var $sanitizeMock: ng.sanitize.ISanitizeService;
|
||||
|
||||
beforeEach(() => {
|
||||
$sanitizeMock = jasmine.createSpy('$sanitizeSpy').and.returnValue("");
|
||||
utilServiceImpl = new UtilServiceImpl($sanitizeMock);
|
||||
});
|
||||
|
||||
describe("isAdBlockEnabled", () => {
|
||||
// TODO
|
||||
});
|
||||
|
||||
describe("isEmailAddress", () => {
|
||||
// TODO
|
||||
});
|
||||
|
||||
describe("getMarkedDown", () => {
|
||||
// TODO
|
||||
});
|
||||
|
||||
describe("getFirstMarkdownLineAsText", () => {
|
||||
// TODO
|
||||
});
|
||||
|
||||
describe("escapeHtmlString", () => {
|
||||
// TODO
|
||||
});
|
||||
|
||||
describe("getRestUrl", () => {
|
||||
// TODO
|
||||
});
|
||||
|
||||
describe("textToSafeHtml", () => {
|
||||
// TODO
|
||||
});
|
||||
});
|
|
@ -1,39 +0,0 @@
|
|||
import { Injectable, Inject } from 'ng-metadata/core';
|
||||
import { UtilService } from './util.service';
|
||||
|
||||
|
||||
@Injectable(UtilService.name)
|
||||
export class UtilServiceImpl implements UtilService {
|
||||
|
||||
constructor(@Inject('$sanitize') private $sanitize: ng.sanitize.ISanitizeService) {
|
||||
|
||||
}
|
||||
|
||||
public isAdBlockEnabled(callback: (isEnabled: boolean) => void): void {
|
||||
|
||||
}
|
||||
|
||||
public isEmailAddress(str: string): boolean {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getMarkedDown(str: string): string {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getFirstMarkdownLineAsText(commentString: string, placeholderNeeded: boolean): string {
|
||||
return null;
|
||||
}
|
||||
|
||||
public escapeHtmlString(text: string): string {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getRestUrl(args: any[]): string {
|
||||
return null;
|
||||
}
|
||||
|
||||
public textToSafeHtml(text: string): string {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* Service which exposes various utility methods.
|
||||
*/
|
||||
export abstract class UtilService {
|
||||
|
||||
public abstract isAdBlockEnabled(callback: (isEnabled: boolean) => void): void;
|
||||
|
||||
public abstract isEmailAddress(str: string): boolean;
|
||||
|
||||
public abstract getMarkedDown(str: string): string;
|
||||
|
||||
public abstract getFirstMarkdownLineAsText(commentString: string, placeholderNeeded: boolean): string;
|
||||
|
||||
public abstract escapeHtmlString(text: string): string;
|
||||
|
||||
public abstract getRestUrl(args: any[]): string;
|
||||
|
||||
public abstract textToSafeHtml(text: string): string;
|
||||
}
|
|
@ -1,22 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"jsx": "react",
|
||||
"module": "commonjs",
|
||||
"outDir": "./build/",
|
||||
"target": "es5",
|
||||
"lib": ["es2017", "dom"],
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"paths": {
|
||||
"sass/*": ["./static/css/directives/components/pages/*"]
|
||||
}
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"include": [
|
||||
"./static/js/**/*.tsx",
|
||||
"./static/js/**/*.ts"
|
||||
]
|
||||
}
|
||||
|
|
26
tslint.json
26
tslint.json
|
@ -1,5 +1,29 @@
|
|||
{
|
||||
"rules": {
|
||||
"no-default-export": true
|
||||
"no-default-export": true,
|
||||
"member-access": true,
|
||||
"member-ordering": [true, {"order": "fields-first"}],
|
||||
"no-empty-interface": true,
|
||||
"no-namespace": true,
|
||||
"no-reference": true,
|
||||
"curly": true,
|
||||
"no-conditional-assignment": true,
|
||||
"no-duplicate-super": true,
|
||||
"no-empty": true,
|
||||
"no-invalid-template-strings": true,
|
||||
"no-misused-new": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-unbound-method": true,
|
||||
"restrict-plus-operands": true,
|
||||
"eofline": true,
|
||||
"indent": [true, "spaces", 2],
|
||||
"max-line-length": [true, 120],
|
||||
"class-name": true,
|
||||
"import-spacing": true,
|
||||
"align": true,
|
||||
"new-parens": true,
|
||||
"semicolon": true,
|
||||
"space-before-function-paren": [true, "never"],
|
||||
"whitespace": [true, "check-decl", "check-operator", "check-module", "check-separator", "check-type", "check-preblock"]
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"globalDependencies": {
|
||||
"react": "registry:dt/react#0.14.0+20160927082313",
|
||||
"react-dom": "registry:dt/react-dom#0.14.0+20160412154040"
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ var config = {
|
|||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
test: /\.ts?$/,
|
||||
use: ["ts-loader"],
|
||||
exclude: /node_modules/
|
||||
},
|
||||
|
|
Reference in a new issue