diff --git a/app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/hooks/UseLaunchGalaxy/useLaunchGalaxy.ts b/app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/hooks/UseLaunchGalaxy/useLaunchGalaxy.ts index f9bd1984a..7f6f67e07 100644 --- a/app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/hooks/UseLaunchGalaxy/useLaunchGalaxy.ts +++ b/app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/hooks/UseLaunchGalaxy/useLaunchGalaxy.ts @@ -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, @@ -14,11 +15,13 @@ export const useLaunchGalaxy = ({ workflow, }: Props): UseLaunchGalaxy => { const { error, isLoading: loading, run } = useAsync(); + const { config } = useConfig(); const configuredValue = getConfiguredValues(configuredInput, workflow); const disabled = !configuredValue; const onLaunchGalaxy = useCallback(async (): Promise => { if (!configuredValue) return; + const origin = config.browserURL || window.location.origin; const landingUrl = workflow.trsId === CUSTOM_WORKFLOW.trsId @@ -28,7 +31,8 @@ export const useLaunchGalaxy = ({ configuredValue.geneModelUrl, configuredValue.readRunsSingle, configuredValue.readRunsPaired, - configuredValue.tracks + configuredValue.tracks, + origin ) ) : await run( @@ -38,7 +42,8 @@ export const useLaunchGalaxy = ({ configuredValue.geneModelUrl, configuredValue.readRunsSingle, configuredValue.readRunsPaired, - workflow.parameters + workflow.parameters, + origin ) ); @@ -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) { diff --git a/app/utils/galaxy-api/entities.ts b/app/utils/galaxy-api/entities.ts index d63669287..e72cc8822 100644 --- a/app/utils/galaxy-api/entities.ts +++ b/app/utils/galaxy-api/entities.ts @@ -16,6 +16,7 @@ export interface EnaFileInfo { //// Workflow landing types export interface WorkflowLandingsBody { + origin: string; public: true; request_state: WorkflowLandingsBodyRequestState; workflow_id: string; @@ -62,6 +63,7 @@ interface WorkflowCollectionUrlData { //// Data landing types export interface DataLandingsBody { + origin: string; public: true; request_state: DataLandingsBodyRequestState; } diff --git a/app/utils/galaxy-api/galaxy-api.ts b/app/utils/galaxy-api/galaxy-api.ts index 5bc3f5c07..ef2b2e303 100644 --- a/app/utils/galaxy-api/galaxy-api.ts +++ b/app/utils/galaxy-api/galaxy-api.ts @@ -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( @@ -55,9 +56,11 @@ export async function getWorkflowLandingUrl( geneModelUrl: string | null, readRunsSingle: EnaSequencingReads[] | null, readRunsPaired: EnaSequencingReads[] | null, - parameters: WorkflowParameter[] + parameters: WorkflowParameter[], + origin: string ): Promise { const body: WorkflowLandingsBody = { + origin, public: true, request_state: getWorkflowLandingsRequestState( referenceGenome, @@ -79,6 +82,7 @@ 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( @@ -86,9 +90,11 @@ export async function getDataLandingUrl( geneModelUrl: string | null, readRunsSingle: EnaSequencingReads[] | null, readRunsPaired: EnaSequencingReads[] | null, - tracks: UcscTrack[] | null + tracks: UcscTrack[] | null, + origin: string ): Promise { const body: DataLandingsBody = { + origin, public: true, request_state: getDataLandingsRequestState( referenceGenome,