diff --git a/frontend/src/routes/(root)/(logged)/flows/get/[...path]/+page.svelte b/frontend/src/routes/(root)/(logged)/flows/get/[...path]/+page.svelte index 1eda42f160..5ca070fea6 100644 --- a/frontend/src/routes/(root)/(logged)/flows/get/[...path]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/flows/get/[...path]/+page.svelte @@ -2,7 +2,7 @@ import { page } from '$app/stores' import { FlowService, JobService, ScheduleService, type Flow, type Schedule } from '$lib/gen' import { - canWrite, + canWrite, copyToClipboard, defaultIfEmptyString, displayDaysAgo, @@ -25,7 +25,7 @@ import { goto } from '$app/navigation' import CenteredPage from '$lib/components/CenteredPage.svelte' - import { Alert, Badge, Button, Skeleton } from '$lib/components/common' + import { Alert, Badge, Button, Skeleton, Tab, TabContent, Tabs } from '$lib/components/common' import CronInput from '$lib/components/CronInput.svelte' import FlowViewer from '$lib/components/FlowViewer.svelte' import JobArgs from '$lib/components/JobArgs.svelte' @@ -135,11 +135,14 @@ let viewWebhookCommand = false let args = undefined - $: curlCommand = `curl -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" -X POST -d '${JSON.stringify( - args - )}' ${$page.url.protocol}//${$page.url.hostname}/api/w/${$workspaceStore}/jobs/run/f/${ - flow?.path - }` + + function curlCommand(async: boolean) { + return `curl -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" -X POST -d '${JSON.stringify( + args + )}' ${$page.url.protocol}//${$page.url.hostname}/api/w/${$workspaceStore}/jobs/run${ + async ? '' : '_wait_result' + }/f/${flow?.path}` + } let webhook: HTMLHeadElement let moveDrawer: MoveDrawer @@ -358,31 +361,46 @@
+{curlCommand(true)} copyToClipboard(curlCommand(true))} + class="cursor-pointer ml-2"> {curlCommand(false)} copyToClipboard(curlCommand(false))} + class="cursor-pointer ml-2">
//^ returns an UUID. Fetch result until completed == true
curl -H "Authorization: Bearer $TOKEN" {$page.url.protocol}//{$page.url + .hostname}/api/w/{$workspaceStore}/jobs_u/completed/get_result_maybe/$UUID
{curlCommand} copyToClipboard(curlCommand)}
- class="cursor-pointer ml-2">
- {command} copyToClipboard(command)}
+ class="cursor-pointer ml-2"> {#if key == 'async'}
//^ returns an UUID. Fetch until completed == true
curl -H "Authorization: Bearer $TOKEN" {$page.url.protocol}//{$page.url
+ .hostname}/api/w/{$workspaceStore}/jobs_u/completed/get_result_maybe/$UUID{/if}
+ {curlCommand} copyToClipboard(curlCommand)}
- class="cursor-pointer ml-2">
-