From 3003b258c9ef5802b4bace5e5376c8ec39b2b7ba Mon Sep 17 00:00:00 2001 From: felixApplatix Date: Fri, 25 Aug 2017 18:10:18 -0700 Subject: [PATCH] Issue #40: Added fallback values for form in multiple-service-launch-panel --- .../multiple-service-launch-panel.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 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 ae3885ee902d..da81d801f17e 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 @@ -355,9 +355,9 @@ export class MultipleServiceLaunchPanelComponent { private setParamValue(parameterValue: string) { let vTemp = parameterValue; this.session = { - commit: this.commit.revision, - repo: this.commit.repo, - branch: this.commit.branch + commit: this.commit.revision || this.getFallbackTemplateValue('commit'), + repo: this.commit.repo || this.getFallbackTemplateValue('repo'), + branch: this.commit.branch || this.getFallbackTemplateValue('branch') }; // this is required to GUI-1367 launch a workflow using the workflow instance's exported artifact @@ -376,6 +376,13 @@ 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]; + } + return; + } + private resubmitTask(task, runPartial = false): any { if (runPartial) { task.parameters = this.listParameters(this.allForms.controls[0]['controls']);