Refactor Manage Trigger to Single Workflow (#2577)

* Refactor Manage Trigger to Single Workflow
This commit is contained in:
Alec Merdler 2017-05-22 13:59:12 -07:00 committed by GitHub
parent d122743129
commit 97256841bd
26 changed files with 1262 additions and 1077 deletions

View file

@ -1,4 +1,4 @@
import { Input, Component, OnChanges, SimpleChanges } from 'ng-metadata/core';
import { Input, Output, EventEmitter, Component, OnChanges, SimpleChanges } from 'ng-metadata/core';
/**
@ -10,11 +10,11 @@ import { Input, Component, OnChanges, SimpleChanges } from 'ng-metadata/core';
})
export class DockerfilePathSelectComponent implements OnChanges {
// FIXME: Use one-way data binding
@Input('=') public currentPath: string = '';
@Input('=') public isValidPath: boolean;
@Input('=') public paths: string[];
@Input('=') public supportsFullListing: boolean;
@Input('<') public currentPath: string = '';
@Input('<') public paths: string[];
@Input('<') public supportsFullListing: boolean;
@Output() public pathChanged: EventEmitter<PathChangeEvent> = new EventEmitter();
public isValidPath: boolean;
private isUnknownPath: boolean = true;
private selectedPath: string | null = null;
@ -26,12 +26,16 @@ export class DockerfilePathSelectComponent implements OnChanges {
this.currentPath = path;
this.selectedPath = null;
this.isValidPath = this.checkPath(path, this.paths, this.supportsFullListing);
this.pathChanged.emit({path: this.currentPath, isValid: this.isValidPath});
}
public setSelectedPath(path: string): void {
this.currentPath = path;
this.selectedPath = path;
this.isValidPath = this.checkPath(path, this.paths, this.supportsFullListing);
this.pathChanged.emit({path: this.currentPath, isValid: this.isValidPath});
}
private checkPath(path: string = '', paths: string[] = [], supportsFullListing: boolean): boolean {
@ -45,3 +49,12 @@ export class DockerfilePathSelectComponent implements OnChanges {
return isValidPath;
}
}
/**
* Dockerfile path changed event.
*/
export type PathChangeEvent = {
path: string;
isValid: boolean;
};