From 1ccd4956e72836b69d76fa0a485f8ea970371b56 Mon Sep 17 00:00:00 2001 From: felixApplatix Date: Mon, 28 Aug 2017 12:36:31 -0700 Subject: [PATCH] Issue #40: Passed in the template itself to provide the fallback val --- .../multiple-service-launch-panel.component.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/saas/axops/src/ui/src/app/common/multiple-service-launch-panel/multiple-service-launch-panel.component.ts b/saas/axops/src/ui/src/app/common/multiple-service-launch-panel/multiple-service-launch-panel.component.ts index ce78443ef430..ced08b96cc3e 100644 --- a/saas/axops/src/ui/src/app/common/multiple-service-launch-panel/multiple-service-launch-panel.component.ts +++ b/saas/axops/src/ui/src/app/common/multiple-service-launch-panel/multiple-service-launch-panel.component.ts @@ -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'], index); + val = this.setParamValue(templateInputParams[property]['default'], template); required = false; } newForm.addControl(property, new FormControl(val, required ? Validators.required : null)); @@ -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, index = 0) { + private setParamValue(parameterValue: string, template: Template) { let vTemp = parameterValue; this.session = { - commit: this.commit.revision || this.getFallbackTemplateValue('revision', index), - repo: this.commit.repo || this.getFallbackTemplateValue('repo', index), - branch: this.commit.branch || this.getFallbackTemplateValue('branch', index) + commit: this.commit.revision || template.revision, + repo: this.commit.repo || template.repo, + branch: this.commit.branch || template.branch }; // this is required to GUI-1367 launch a workflow using the workflow instance's exported artifact @@ -376,13 +376,6 @@ export class MultipleServiceLaunchPanelComponent { return this.session[parameterValue.substring(parameterValue.indexOf('.') + 1).toString()] || vTemp; } - private getFallbackTemplateValue(prop: string, index = 0) { - if (this.templatesToSubmit.length === 1 && this.templatesToSubmit[index][prop]) { - return this.templatesToSubmit[index][prop]; - } - return; - } - private resubmitTask(task, runPartial = false): any { if (runPartial) { task.parameters = this.listParameters(this.allForms.controls[0]['controls']);