Skip to content

Commit

Permalink
Issue argoproj#40: Added the template index for fallback val and chan…
Browse files Browse the repository at this point in the history
…ged the prop name to 'revision'
  • Loading branch information
felixApplatix committed Aug 28, 2017
1 parent 6c2f510 commit d52b33c
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export class MultipleServiceLaunchPanelComponent {
if (resubmitFailedParameters) { // resubmit failed
val = resubmitFailedParameters[property];
} else if (templateInputParams[property] && templateInputParams[property].hasOwnProperty('default')) {
val = this.setParamValue(templateInputParams[property]['default']);
val = this.setParamValue(templateInputParams[property]['default'], index);
required = false;
}
newForm.addControl(property, new FormControl(val, required ? Validators.required : null));
Expand All @@ -352,12 +352,12 @@ export class MultipleServiceLaunchPanelComponent {
}

// if default value for parameter starts and ends with %%, replace the value with corresponding commits parameter
private setParamValue(parameterValue: string) {
private setParamValue(parameterValue: string, index = 0) {
let vTemp = parameterValue;
this.session = {
commit: this.commit.revision || this.getFallbackTemplateValue('commit'),
repo: this.commit.repo || this.getFallbackTemplateValue('repo'),
branch: this.commit.branch || this.getFallbackTemplateValue('branch')
commit: this.commit.revision || this.getFallbackTemplateValue('revision', index),
repo: this.commit.repo || this.getFallbackTemplateValue('repo', index),
branch: this.commit.branch || this.getFallbackTemplateValue('branch', index)
};

// this is required to GUI-1367 launch a workflow using the workflow instance's exported artifact
Expand All @@ -376,9 +376,9 @@ export class MultipleServiceLaunchPanelComponent {
return this.session[parameterValue.substring(parameterValue.indexOf('.') + 1).toString()] || vTemp;
}

private getFallbackTemplateValue(prop: string) {
if (this.templatesToSubmit.length === 1 && this.templatesToSubmit[0][prop]) {
return this.templatesToSubmit[0][prop];
private getFallbackTemplateValue(prop: string, index = 0) {
if (this.templatesToSubmit.length === 1 && this.templatesToSubmit[index][prop]) {
return this.templatesToSubmit[index][prop];
}
return;
}
Expand Down

0 comments on commit d52b33c

Please sign in to comment.