initialize path and context component members to avoid null exception

This commit is contained in:
alecmerdler 2017-04-06 15:25:52 -07:00
parent a8ec7865a7
commit 49c04eb7af
4 changed files with 41 additions and 42 deletions

View file

@ -11,7 +11,7 @@ import { Input, Component, OnChanges, SimpleChanges } from 'ng-metadata/core';
export class ContextPathSelectComponent implements OnChanges {
// FIXME: Use one-way data binding
@Input('=') public currentContext: string;
@Input('=') public currentContext: string = '';
@Input('=') public isValidContext: boolean;
@Input('=') public contexts: string[];
private isUnknownContext: boolean = true;

View file

@ -1,5 +1,6 @@
<div class="dockerfile-path-select-element">
<div class="dropdown-select" placeholder="'Enter path containing a Dockerfile'"
<div class="dropdown-select"
placeholder="'Enter path containing a Dockerfile'"
selected-item="$ctrl.selectedPath"
lookahead-items="$ctrl.paths"
handle-input="$ctrl.setPath(input)"

View file

@ -11,7 +11,7 @@ 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 currentPath: string = '';
@Input('=') public isValidPath: boolean;
@Input('=') public paths: string[];
@Input('=') public supportsFullListing: boolean;

View file

@ -1,6 +1,5 @@
<div class="manage-trigger-githost-element manage-trigger-control">
<linear-workflow
done-title="Create Trigger"
<linear-workflow done-title="Create Trigger"
(on-workflow-complete)="$ctrl.createTrigger($event)">
<!-- Section: Namespace -->
@ -202,7 +201,10 @@
</div>
<div class="radio">
<label>
<input type="radio" name="optionRadio" ng-model="$ctrl.local.triggerOptions.hasBranchTagFilter" ng-value="true">
<input type="radio"
name="optionRadio"
ng-model="$ctrl.local.triggerOptions.hasBranchTagFilter"
ng-value="true">
<div class="title">Trigger only on branches and tags matching a regular expression</div>
<div class="description">Only build container images for a subset of branches and/or tags.</div>
<div class="extended" ng-if="$ctrl.local.triggerOptions.hasBranchTagFilter">
@ -214,8 +216,7 @@
ng-model="$ctrl.local.triggerOptions.branchTagFilter"
required>
<div class="description">Examples: heads/master, tags/tagname, heads/.+</div>
<regex-match-view
items="$ctrl.local.repositoryFullRefs"
<regex-match-view items="$ctrl.local.repositoryFullRefs"
regex="$ctrl.local.triggerOptions.branchTagFilter"
ng-if="$ctrl.local.triggerOptions.branchTagFilter"></regex-match-view>
</td>
@ -255,12 +256,10 @@
Please select the location of the Dockerfile to build when this trigger is invoked
</strong>
<dockerfile-path-select
current-path="$ctrl.local.dockerfilePath"
<dockerfile-path-select current-path="$ctrl.local.dockerfilePath"
paths="$ctrl.local.dockerfileLocations.dockerfile_paths"
supports-full-listing="true"
is-valid-path="$ctrl.local.hasValidDockerfilePath">
</dockerfile-path-select>
is-valid-path="$ctrl.local.hasValidDockerfilePath"></dockerfile-path-select>
</div>
<div class="col-lg-8 col-md-8 col-sm-12 main-col"
@ -290,12 +289,10 @@
Please select the context for the docker build
</strong>
<context-path-select
current-context="$ctrl.local.dockerContext"
<context-path-select current-context="$ctrl.local.dockerContext"
current-path="$ctrl.local.dockerfilePath"
contexts="$ctrl.local.contexts"
is-valid-context="$ctrl.local.hasValidContextLocation">
</context-path-select>
is-valid-context="$ctrl.local.hasValidContextLocation"></context-path-select>
</div>
<div class="col-lg-8 col-md-8 col-sm-12 main-col"
@ -311,7 +308,8 @@
<linear-workflow-section class="row"
section-id="verification"
section-title="Robot Account"
section-valid="$ctrl.local.triggerAnalysis.status != 'error' && ($ctrl.local.triggerAnalysis.status != 'requiresrobot' || $ctrl.local.robotAccount != null)">
section-valid="$ctrl.local.triggerAnalysis.status != 'error' &&
($ctrl.local.triggerAnalysis.status != 'requiresrobot' || $ctrl.local.robotAccount != null)">
<!-- Error -->
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
ng-if="$ctrl.local.triggerAnalysis.status == 'error'">