diff --git a/client/src/components/Landing/WorkflowLanding.vue b/client/src/components/Landing/WorkflowLanding.vue index 9230d72829a0..4e8cd948ba21 100644 --- a/client/src/components/Landing/WorkflowLanding.vue +++ b/client/src/components/Landing/WorkflowLanding.vue @@ -14,10 +14,12 @@ import WorkflowRun from "@/components/Workflow/Run/WorkflowRun.vue"; interface Props { uuid: string; secret?: string; + public?: boolean; } const props = withDefaults(defineProps(), { secret: undefined, + public: false, }); const workflowId = ref(null); @@ -34,19 +36,38 @@ watch( currentUser, async () => { if (isAnonymous.value) { - router.push(`/login/start?redirect=/workflow_landings/${props.uuid}`); + router.push( + `/login/start?redirect=/workflow_landings/${props.uuid}?public=${props.public}&client_secret=${props.secret}` + ); } else if (currentUser.value) { - const { data, error } = await GalaxyApi().GET("/api/workflow_landings/{uuid}", { - params: { - path: { uuid: props.uuid }, - }, - }); - if (data) { - workflowId.value = data.workflow_id; - instance.value = data.workflow_target_type === "workflow"; - requestState.value = data.request_state; + let claim; + let claimError; + if (props.public) { + const { data, error } = await GalaxyApi().GET("/api/workflow_landings/{uuid}", { + params: { + path: { uuid: props.uuid }, + }, + }); + claim = data; + claimError = error; } else { - errorMessage.value = errorMessageAsString(error); + const { data, error } = await GalaxyApi().POST("/api/workflow_landings/{uuid}/claim", { + params: { + path: { uuid: props.uuid }, + }, + body: { + client_secret: props.secret, + }, + }); + claim = data; + claimError = error; + } + if (claim) { + workflowId.value = claim.workflow_id; + instance.value = claim.workflow_target_type === "workflow"; + requestState.value = claim.request_state; + } else { + errorMessage.value = errorMessageAsString(claimError); } } }, diff --git a/client/src/entry/analysis/router.js b/client/src/entry/analysis/router.js index 18024224e9d3..5c8cb8177e18 100644 --- a/client/src/entry/analysis/router.js +++ b/client/src/entry/analysis/router.js @@ -504,7 +504,11 @@ export function getRouter(Galaxy) { { path: "workflow_landings/:uuid", component: WorkflowLanding, - props: true, + props: (route) => ({ + uuid: route.params.uuid, + public: !!route.query.public, + secret: route.query.client_secret, + }), }, { path: "user",