fix(custom git trigger): fixed init
correctly added in default parameters for config [TESTING -> locally with docker] Issue: https://www.pivotaltracker.com/story/show/145071887 - [ ] It works! - [ ] Comments provide sufficient explanations for the next contributor - [ ] Tests cover changes and corner cases - [ ] Follows Quay syntax patterns and format
This commit is contained in:
parent
6023e15274
commit
faa6b0c3a6
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