Merge pull request #2641 from charltonaustin/adding_build_trigger_for_custom_git_repository_fails_145071887
fix(custom git trigger): fixed init
This commit is contained in:
commit
298eed11ad
2 changed files with 15 additions and 4 deletions
|
@ -31,7 +31,7 @@
|
||||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col">
|
<div class="col-lg-7 col-md-7 col-sm-12 main-col">
|
||||||
<h3>Select build context directory</h3>
|
<h3>Select build context directory</h3>
|
||||||
<strong>Please select the build context directory under the git repository:</strong>
|
<strong>Please select the build context directory under the git repository:</strong>
|
||||||
<input class="form-control" type="text" placeholder="/"
|
<input class="form-control" type="text"
|
||||||
ng-model="$ctrl.config.context"
|
ng-model="$ctrl.config.context"
|
||||||
ng-pattern="/^($|\/|\/.+)/">
|
ng-pattern="/^($|\/|\/.+)/">
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<div class="col-lg-7 col-md-7 col-sm-12 main-col">
|
<div class="col-lg-7 col-md-7 col-sm-12 main-col">
|
||||||
<h3>Select dockerfile path</h3>
|
<h3>Select dockerfile path</h3>
|
||||||
<strong>Please select the build context directory under the git repository:</strong>
|
<strong>Please select the build context directory under the git repository:</strong>
|
||||||
<input class="form-control" type="text" placeholder="{{ $ctrl.config.context }}"
|
<input class="form-control" type="text"
|
||||||
ng-model="$ctrl.config.dockerfile_path"
|
ng-model="$ctrl.config.dockerfile_path"
|
||||||
ng-pattern="/^($|\/|\/.+)/">
|
ng-pattern="/^($|\/|\/.+)/">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Input, Output, Component, EventEmitter, OnChanges, SimpleChanges } from 'ng-metadata/core';
|
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges} from "ng-metadata/core";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,12 +13,23 @@ export class ManageTriggerCustomGitComponent implements OnChanges {
|
||||||
// FIXME: Use one-way data binding
|
// FIXME: Use one-way data binding
|
||||||
@Input('=') public trigger: {config: any};
|
@Input('=') public trigger: {config: any};
|
||||||
@Output() public activateTrigger: EventEmitter<{config: any, pull_robot?: any}> = new EventEmitter();
|
@Output() public activateTrigger: EventEmitter<{config: any, pull_robot?: any}> = new EventEmitter();
|
||||||
private config: any = {};
|
private config: any = {"context": "/", "dockerfile_path": "/Dockerfile"};
|
||||||
private currentState: any | null;
|
private currentState: any | null;
|
||||||
|
|
||||||
public ngOnChanges(changes: SimpleChanges): void {
|
public ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (changes['trigger'] !== undefined) {
|
if (changes['trigger'] !== undefined) {
|
||||||
this.config = Object.assign({}, changes['trigger'].currentValue.config);
|
this.config = Object.assign({}, changes['trigger'].currentValue.config);
|
||||||
}
|
}
|
||||||
|
if (this.config.context === "") {
|
||||||
|
this.config.context = "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.config.dockerfile_path === "") {
|
||||||
|
if (this.config.context.endsWith("/")) {
|
||||||
|
this.config.dockerfile_path = this.config.context + "Dockerfile";
|
||||||
|
} else {
|
||||||
|
this.config.dockerfile_path = this.config.context + "/Dockerfile";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue