From adb9d75494a7a1553792f6ac981baeab5c18a043 Mon Sep 17 00:00:00 2001 From: Charles Overbeck Date: Tue, 10 Jul 2018 08:50:14 -0700 Subject: [PATCH] Fix Launch With Disabling for Checker Workflows (#341) * Fix Launch With Disabling for Checker Workflows ga4gh/dockstore#1548 Fix case when disabling of launch with FireCloud/DNAstack buttons did not happen when it should have, when you select the checker workflow by clicking View Checker when on the parent. Events seem to fire in a different order when selecting a checker workflow that way. Add a call to checkWdlForImportsAndSetFirecloudUrl in setupPublicEntry(). To avoid too many calls to fetch secondary files, store the last time workflow and version that was queried, and make sure we don't query twice for the same workflow/version. Less than perfect, but will will redo in ga4gh/dockstore#1575. --- src/app/workflow/workflow.component.ts | 29 ++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/app/workflow/workflow.component.ts b/src/app/workflow/workflow.component.ts index 4c5b2371da..eb995e2be6 100644 --- a/src/app/workflow/workflow.component.ts +++ b/src/app/workflow/workflow.component.ts @@ -52,6 +52,8 @@ export class WorkflowComponent extends Entry { public wdlHasHttpImports: boolean; public wdlHasFileImports: boolean; public enableLaunchWithFireCloud = Dockstore.FEATURES.enableLaunchWithFireCloud; + private lastWorkflow: ExtendedWorkflow; + private lastVersion: WorkflowVersion; public workflow; public missingWarning: boolean; public title: string; @@ -144,18 +146,22 @@ export class WorkflowComponent extends Entry { if (this.isWdl(workflowRef)) { const version: WorkflowVersion = this.selectedVersion; if (version) { - this.workflowsService.secondaryWdl(workflowRef.id, version.name).subscribe((sourceFiles: Array) => { - if (!sourceFiles || sourceFiles.length === 0) { - this.workflowsService.wdl(workflowRef.id, version.name).subscribe((sourceFile) => { - this.wdlHasHttpImports = importHttpRegEx.test(sourceFile.content); - }); - if (this.enableLaunchWithFireCloud) { - this.fireCloudURL = `${Dockstore.FIRECLOUD_IMPORT_URL}/${workflowRef.full_workflow_path}:${version.name}`; + if (version !== this.lastVersion || this.lastWorkflow !== workflowRef) { + this.lastVersion = version; + this.lastWorkflow = workflowRef; + this.workflowsService.secondaryWdl(workflowRef.id, version.name).subscribe((sourceFiles: Array) => { + if (!sourceFiles || sourceFiles.length === 0) { + this.workflowsService.wdl(workflowRef.id, version.name).subscribe((sourceFile) => { + this.wdlHasHttpImports = importHttpRegEx.test(sourceFile.content); + }); + if (this.enableLaunchWithFireCloud) { + this.fireCloudURL = `${Dockstore.FIRECLOUD_IMPORT_URL}/${workflowRef.full_workflow_path}:${version.name}`; + } + } else { + this.wdlHasFileImports = true; } - } else { - this.wdlHasFileImports = true; - } - }); + }); + } } } } @@ -206,6 +212,7 @@ export class WorkflowComponent extends Entry { this.workflowService.setWorkflow(workflow); this.selectedVersion = this.selectVersion(this.workflow.workflowVersions, this.urlVersion, this.workflow.defaultVersion); + this.checkWdlForImportsAndSetFirecloudUrl(workflow); this.selectTab(this.validTabs.indexOf(this.currentTab)); if (this.workflow != null) {