From cc8bedd0c79995c7fb3059b2997273092824d47d Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 9 Mar 2023 22:54:19 +0100 Subject: [PATCH] make frontend configurable through consts.ts --- frontend/src/lib/consts.ts | 1 + .../(logged)/scripts/get/[...hash]/+page.svelte | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 frontend/src/lib/consts.ts diff --git a/frontend/src/lib/consts.ts b/frontend/src/lib/consts.ts new file mode 100644 index 0000000000..9cb292f1e9 --- /dev/null +++ b/frontend/src/lib/consts.ts @@ -0,0 +1 @@ +export const DEFAULT_WEBHOOK_TYPE: 'async' | 'sync' = 'async' \ No newline at end of file diff --git a/frontend/src/routes/(root)/(logged)/scripts/get/[...hash]/+page.svelte b/frontend/src/routes/(root)/(logged)/scripts/get/[...hash]/+page.svelte index 48108377f9..8e0a1995aa 100644 --- a/frontend/src/routes/(root)/(logged)/scripts/get/[...hash]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/scripts/get/[...hash]/+page.svelte @@ -55,6 +55,7 @@ import { Loader2 } from 'lucide-svelte' import { slide } from 'svelte/transition' import MoveDrawer from '$lib/components/MoveDrawer.svelte' + import { DEFAULT_WEBHOOK_TYPE } from '$lib/consts' let userSettings: UserSettings let script: Script | undefined @@ -75,11 +76,11 @@ loadScript($page.params.hash) } $: webhooks = { - uuid: { + async: { hash: `${$page.url.hostname}/api/w/${$workspaceStore}/jobs/run/h/${script?.hash}`, path: `${$page.url.hostname}/api/w/${$workspaceStore}/jobs/run/p/${script?.path}` }, - result: { + sync: { hash: `${$page.url.hostname}/api/w/${$workspaceStore}/jobs/run_wait_result/h/${script?.hash}`, path: `${$page.url.hostname}/api/w/${$workspaceStore}/jobs/run_wait_result/p/${script?.path}` } @@ -456,9 +457,9 @@ - - UUID/Async - Result/Sync + + UUID/Async + Result/Sync {#each Object.keys(webhooks) as key}