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 { export class ContextPathSelectComponent implements OnChanges {
// FIXME: Use one-way data binding // FIXME: Use one-way data binding
@Input('=') public currentContext: string; @Input('=') public currentContext: string = '';
@Input('=') public isValidContext: boolean; @Input('=') public isValidContext: boolean;
@Input('=') public contexts: string[]; @Input('=') public contexts: string[];
private isUnknownContext: boolean = true; private isUnknownContext: boolean = true;

View file

@ -1,5 +1,6 @@
<div class="dockerfile-path-select-element"> <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" selected-item="$ctrl.selectedPath"
lookahead-items="$ctrl.paths" lookahead-items="$ctrl.paths"
handle-input="$ctrl.setPath(input)" 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 { export class DockerfilePathSelectComponent implements OnChanges {
// FIXME: Use one-way data binding // FIXME: Use one-way data binding
@Input('=') public currentPath: string; @Input('=') public currentPath: string = '';
@Input('=') public isValidPath: boolean; @Input('=') public isValidPath: boolean;
@Input('=') public paths: string[]; @Input('=') public paths: string[];
@Input('=') public supportsFullListing: boolean; @Input('=') public supportsFullListing: boolean;

View file

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