Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useAsync } from "@databiosphere/findable-ui/lib/hooks/useAsync";
import { useConfig } from "@databiosphere/findable-ui/lib/hooks/useConfig";
import { useCallback } from "react";
import {
getDataLandingUrl,
Expand All @@ -14,11 +15,13 @@ export const useLaunchGalaxy = ({
workflow,
}: Props): UseLaunchGalaxy => {
const { error, isLoading: loading, run } = useAsync<string>();
const { config } = useConfig();
const configuredValue = getConfiguredValues(configuredInput, workflow);
const disabled = !configuredValue;

const onLaunchGalaxy = useCallback(async (): Promise<void> => {
if (!configuredValue) return;
const origin = config.browserURL || window.location.origin;

const landingUrl =
workflow.trsId === CUSTOM_WORKFLOW.trsId
Expand All @@ -28,7 +31,8 @@ export const useLaunchGalaxy = ({
configuredValue.geneModelUrl,
configuredValue.readRunsSingle,
configuredValue.readRunsPaired,
configuredValue.tracks
configuredValue.tracks,
origin
)
)
: await run(
Expand All @@ -38,7 +42,8 @@ export const useLaunchGalaxy = ({
configuredValue.geneModelUrl,
configuredValue.readRunsSingle,
configuredValue.readRunsPaired,
workflow.parameters
workflow.parameters,
origin
)
);

Expand All @@ -48,7 +53,7 @@ export const useLaunchGalaxy = ({

// Launch the Galaxy workflow.
launchGalaxy(landingUrl);
}, [configuredValue, run, workflow]);
}, [config, configuredValue, run, workflow]);

let errorMessage: string | null = null;
if (error) {
Expand Down
2 changes: 2 additions & 0 deletions app/utils/galaxy-api/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface EnaFileInfo {
//// Workflow landing types

export interface WorkflowLandingsBody {
origin: string;
public: true;
request_state: WorkflowLandingsBodyRequestState;
workflow_id: string;
Expand Down Expand Up @@ -62,6 +63,7 @@ interface WorkflowCollectionUrlData {
//// Data landing types

export interface DataLandingsBody {
origin: string;
public: true;
request_state: DataLandingsBodyRequestState;
}
Expand Down
10 changes: 8 additions & 2 deletions app/utils/galaxy-api/galaxy-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const dataLandingUrl = `${galaxyInstanceUrl}/tool_landings`;
* @param readRunsSingle - Single read runs parameter sent to the API.
* @param readRunsPaired - Paired read runs parameter sent to the API.
* @param parameters - Parameters for this workflow.
* @param origin - Origin URL of the site making the request.
* @returns workflow landing URL.
*/
export async function getWorkflowLandingUrl(
Expand All @@ -55,9 +56,11 @@ export async function getWorkflowLandingUrl(
geneModelUrl: string | null,
readRunsSingle: EnaSequencingReads[] | null,
readRunsPaired: EnaSequencingReads[] | null,
parameters: WorkflowParameter[]
parameters: WorkflowParameter[],
origin: string
): Promise<string> {
const body: WorkflowLandingsBody = {
origin,
public: true,
request_state: getWorkflowLandingsRequestState(
referenceGenome,
Expand All @@ -79,16 +82,19 @@ export async function getWorkflowLandingUrl(
* @param readRunsSingle - Single read runs parameter sent to the API.
* @param readRunsPaired - Paired read runs parameter sent to the API.
* @param tracks - UCSC tracks sent to the API. Should all have defined `bigDataUrl` values.
* @param origin - Origin URL of the site making the request.
* @returns data landing URL.
*/
export async function getDataLandingUrl(
referenceGenome: string,
geneModelUrl: string | null,
readRunsSingle: EnaSequencingReads[] | null,
readRunsPaired: EnaSequencingReads[] | null,
tracks: UcscTrack[] | null
tracks: UcscTrack[] | null,
origin: string
): Promise<string> {
const body: DataLandingsBody = {
origin,
public: true,
request_state: getDataLandingsRequestState(
referenceGenome,
Expand Down
Loading