-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide Launch with FireCloud if No Content
dockstore/dockstore#1372 Created a launch-third-party component to both more easily unit test and to add new upcoming third party integrations. Turned on Launch with FireCloud by default, as unit test was failing with flag set to false. Since the flag has been turned on in production, make it the default.
- Loading branch information
Showing
12 changed files
with
217 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/app/workflow/launch-third-party/launch-third-party.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div *ngIf="dnastackURL || fireCloudURL" class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h3>Launch with</h3> | ||
</div> | ||
<div class="panel-body"> | ||
<div class="container-source-repos"> | ||
<div class="container-launch-with"> | ||
<div class="button-wrap"> | ||
<div *ngIf="dnastackURL" class="button"> | ||
<p><a href="{{dnastackURL}}"><img src="../../assets/images/thirdparty/dnastack.png"> DNAstack »</a> | ||
</p> | ||
</div> | ||
<div *ngIf="fireCloudURL" class="button"> | ||
<p><a href="{{fireCloudURL}}"><img src="../../assets/images/thirdparty/FireCloud-white-icon.svg"> FireCloud | ||
»</a></p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
11 changes: 11 additions & 0 deletions
11
src/app/workflow/launch-third-party/launch-third-party.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.button-wrap { | ||
display: inline-block; | ||
} | ||
|
||
.button-wrap > .button { | ||
display: block; | ||
} | ||
|
||
.button-wrap > .button:not(:last-child) { | ||
margin-bottom: 10px; | ||
} |
82 changes: 82 additions & 0 deletions
82
src/app/workflow/launch-third-party/launch-third-party.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { LaunchThirdPartyComponent } from './launch-third-party.component'; | ||
import { WorkflowsService } from '../../shared/swagger/api/workflows.service'; | ||
import { WorkflowsStubService, WorkflowStubService, WorkflowVersionStubService } from '../../test/service-stubs'; | ||
import { Workflow, WorkflowVersion } from '../../shared/swagger'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { wdlSourceFile } from '../../test/mocked-objects'; | ||
|
||
describe('LaunchThirdPartyComponent', () => { | ||
let component: LaunchThirdPartyComponent; | ||
let fixture: ComponentFixture<LaunchThirdPartyComponent>; | ||
let workflowVersion: WorkflowVersion; | ||
let workflow: Workflow; | ||
let workflowsService: WorkflowsService; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ LaunchThirdPartyComponent ], | ||
providers: [ | ||
{ provide: WorkflowsService, useClass: WorkflowsStubService}, | ||
{ provide: WorkflowVersion, useClass: WorkflowVersionStubService}, | ||
{ provide: Workflow, useClass: WorkflowStubService} | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LaunchThirdPartyComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
workflowVersion = TestBed.get(WorkflowVersion); | ||
workflow = TestBed.get(Workflow); | ||
workflowsService = TestBed.get(WorkflowsService); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should not set urls if CWL', () => { | ||
spyOnProperty(workflowVersion, 'name', 'get').and.returnValue('master'); | ||
component.selectedVersion = workflowVersion; | ||
spyOnProperty(workflow, 'full_workflow_path', 'get').and | ||
.returnValue('github.com/DataBiosphere/topmed-workflows/Functional_Equivalence'); | ||
spyOnProperty(workflow, 'descriptorType', 'get').and.returnValue('cwl'); | ||
expect(component.dnastackURL).toBeFalsy(); | ||
expect(component.fireCloudURL).toBeFalsy(); | ||
}); | ||
|
||
it('should set urls if WDL with no secondary files', () => { | ||
spyOnProperty(workflowVersion, 'name', 'get').and.returnValue('master'); | ||
component.selectedVersion = workflowVersion; | ||
spyOnProperty(workflow, 'full_workflow_path', 'get').and | ||
.returnValue('github.com/DataBiosphere/topmed-workflows/Functional_Equivalence'); | ||
spyOnProperty(workflow, 'descriptorType', 'get').and.returnValue('wdl'); | ||
spyOn(workflowsService, 'wdl').and.returnValue(Observable.of(wdlSourceFile)); | ||
component.workflow = workflow; | ||
expect(component.dnastackURL) | ||
// tslint:disable-next-line:max-line-length | ||
.toEqual('https://app.dnastack.com/#/app/workflow/import/dockstore?path=github.com/DataBiosphere/topmed-workflows/Functional_Equivalence&descriptorType=wdl'); | ||
expect(component.fireCloudURL) | ||
// tslint:disable-next-line:max-line-length | ||
.toEqual('https://portal.firecloud.org/#import/dockstore/github.com/DataBiosphere/topmed-workflows/Functional_Equivalence:master'); | ||
}); | ||
|
||
it('should set dnastack but not Firecloud if WDL with secondary files', () => { | ||
spyOnProperty(workflowVersion, 'name', 'get').and.returnValue('master'); | ||
component.selectedVersion = workflowVersion; | ||
spyOnProperty(workflow, 'full_workflow_path', 'get').and | ||
.returnValue('github.com/DataBiosphere/topmed-workflows/Functional_Equivalence'); | ||
spyOnProperty(workflow, 'descriptorType', 'get').and.returnValue('wdl'); | ||
spyOn(workflowsService, 'wdl').and.returnValue(Observable.of(wdlSourceFile)); | ||
spyOn(workflowsService, 'secondaryWdl').and.returnValue(Observable.of([wdlSourceFile])); | ||
component.workflow = workflow; | ||
expect(component.dnastackURL) | ||
// tslint:disable-next-line:max-line-length | ||
.toEqual('https://app.dnastack.com/#/app/workflow/import/dockstore?path=github.com/DataBiosphere/topmed-workflows/Functional_Equivalence&descriptorType=wdl'); | ||
expect(component.fireCloudURL).toBeFalsy(); | ||
}); | ||
}); |
78 changes: 78 additions & 0 deletions
78
src/app/workflow/launch-third-party/launch-third-party.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { Workflow, WorkflowVersion } from '../../shared/swagger'; | ||
import { Dockstore } from '../../shared/dockstore.model'; | ||
import { ExtendedWorkflow } from '../../shared/models/ExtendedWorkflow'; | ||
import { SourceFile } from '../../shared/swagger/model/sourceFile'; | ||
import { WorkflowsService } from '../../shared/swagger/api/workflows.service'; | ||
import { URLSearchParams } from '@angular/http'; | ||
|
||
@Component({ | ||
selector: 'app-launch-third-party', | ||
templateUrl: './launch-third-party.component.html', | ||
styleUrls: ['./launch-third-party.component.scss'] | ||
}) | ||
export class LaunchThirdPartyComponent { | ||
|
||
private _workflow: Workflow; | ||
private _selectedVersion: WorkflowVersion; | ||
|
||
@Input() set workflow(value: Workflow) { | ||
this._workflow = value; | ||
this.onChange(); | ||
} | ||
|
||
get workflow(): Workflow { | ||
return this._workflow; | ||
} | ||
|
||
@Input() set selectedVersion(value: WorkflowVersion) { | ||
this._selectedVersion = value; | ||
this.onChange(); | ||
} | ||
|
||
get selectedVersion() { | ||
return this._selectedVersion; | ||
} | ||
|
||
dnastackURL: string; | ||
fireCloudURL: string; | ||
|
||
constructor(private workflowsService: WorkflowsService) { } | ||
|
||
private onChange() { | ||
this.setupFireCloudUrl(this.workflow); | ||
this.setupDnaStackUrl(this.workflow); | ||
} | ||
|
||
private isWdl(workflowRef: ExtendedWorkflow) { | ||
return workflowRef && workflowRef.full_workflow_path && workflowRef.descriptorType === 'wdl'; | ||
} | ||
|
||
|
||
private setupFireCloudUrl(workflowRef: ExtendedWorkflow) { | ||
if (Dockstore.FEATURES.enableLaunchWithFireCloud) { | ||
this.fireCloudURL = null; | ||
const version: WorkflowVersion = this.selectedVersion; | ||
if (version && this.isWdl(workflowRef)) { | ||
this.workflowsService.wdl(workflowRef.id, version.name).subscribe((sourceFile: SourceFile) => { | ||
if (sourceFile && sourceFile.content && sourceFile.content.length) { | ||
this.workflowsService.secondaryWdl(workflowRef.id, version.name).subscribe((sourceFiles: Array<SourceFile>) => { | ||
if (!sourceFiles || sourceFiles.length === 0) { | ||
this.fireCloudURL = `${Dockstore.FIRECLOUD_IMPORT_URL}/${workflowRef.full_workflow_path}:${version.name}`; | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
|
||
private setupDnaStackUrl(workflow: ExtendedWorkflow) { | ||
if (this.isWdl(workflow)) { | ||
const myParams = new URLSearchParams(); | ||
myParams.set('path', workflow.full_workflow_path); | ||
myParams.set('descriptorType', workflow.descriptorType); | ||
this.dnastackURL = Dockstore.DNASTACK_IMPORT_URL + '?' + myParams; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters