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
|
@ -38,4 +38,4 @@ export class QuayRequireDirective implements AfterContentInit {
|
|||
this.$transclude
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,4 +44,4 @@ export class ChannelIconComponent {
|
|||
var num: number = parseInt(hash.substr(0, 4));
|
||||
return this.colors[num % this.colors.length];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,4 +60,4 @@ export class ClipboardCopyDirective implements AfterContentInit, OnDestroy {
|
|||
this.clipboard.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -17,7 +19,7 @@ export class DurationInputComponent implements ng.IComponentController {
|
|||
private min_s: number;
|
||||
private max_s: number;
|
||||
|
||||
constructor (@Inject('$scope') private $scope: ng.IScope) {
|
||||
constructor(@Inject('$scope') private $scope: ng.IScope) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -174,7 +177,7 @@ export class ManageTriggerComponent implements OnChanges {
|
|||
}
|
||||
|
||||
private setPossibleContexts(path: string) {
|
||||
if (this.local.dockerfileLocations.contextMap){
|
||||
if (this.local.dockerfileLocations.contextMap) {
|
||||
this.local.contexts = this.local.dockerfileLocations.contextMap[path] || [];
|
||||
} else {
|
||||
this.local.contexts = [path.split('/').slice(0, -1).join('/').concat('/')];
|
||||
|
@ -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,12 +10,13 @@ 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;
|
||||
private disableTrustInfo: {[key: string]: string} = null;
|
||||
|
||||
constructor (@Inject("ApiService") private ApiService: any) {
|
||||
constructor(@Inject("ApiService") private ApiService: any) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -41,4 +43,4 @@ export class RepositorySigningConfigComponent {
|
|||
callback(true);
|
||||
}, errorDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -54,4 +54,4 @@ export class SearchBoxComponent {
|
|||
this.$location.search('q', $event['value']);
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -173,4 +182,4 @@ export class TagSigningDisplayComponent {
|
|||
|
||||
return 'invalid-signed';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -16,7 +18,7 @@ export class TimeMachineSettingsComponent implements ng.IComponentController {
|
|||
private current_s: number;
|
||||
private updating: boolean;
|
||||
|
||||
constructor (@Inject('Config') private Config: any, @Inject('ApiService') private ApiService: any,
|
||||
constructor(@Inject('Config') private Config: any, @Inject('ApiService') private ApiService: any,
|
||||
@Inject('Features') private Features: any) {
|
||||
this.current_s = 0;
|
||||
this.initial_s = 0;
|
||||
|
@ -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');
|
||||
|
@ -101,4 +102,4 @@ export class TypeaheadDirective implements AfterContentInit {
|
|||
return resultDiv;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue