From 8a3537b76124b67d0aa163f8dcc55f1db0f4f56d Mon Sep 17 00:00:00 2001 From: Guillaume Bouvignies Date: Fri, 13 Oct 2023 09:50:48 -0700 Subject: [PATCH] fix: Error handler script pickers lists both "regular" script and "error handler" scripts (#2449) * fix: Error handler script pickers lists both regular script and error handle scripts * filter on backend if only one kind --- .../components/ErrorOrRecoveryHandler.svelte | 2 +- .../src/lib/components/ScheduleEditor.svelte | 2 +- .../src/lib/components/ScriptPicker.svelte | 25 +++++++++++++------ .../(logged)/workspace_settings/+page.svelte | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte b/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte index 0076ba4f9d..a35966ac5c 100644 --- a/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte +++ b/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte @@ -169,7 +169,7 @@ ({ - value: script.path, - label: `${script.path}${script.summary ? ` | ${truncate(script.summary, 20)}` : ''}` - }) - ) + if (kinds.length === 1) { + items = (await ScriptService.listScripts({ workspace: $workspaceStore!, kind: kinds[0]})).map( + (script) => ({ + value: script.path, + label: `${script.path}${script.summary ? ` | ${truncate(script.summary, 20)}` : ''}` + }) + ) + } else { + items = (await ScriptService.listScripts({ workspace: $workspaceStore! })).filter( + (script) => kinds.includes(script.kind) + ).map( + (script) => ({ + value: script.path, + label: `${script.path}${script.summary ? ` | ${truncate(script.summary, 20)}` : ''}` + }) + ) + } } else { items = $hubScripts?.map((x) => ({ diff --git a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte index 71156629f9..dee2cb9644 100644 --- a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte @@ -326,7 +326,7 @@
{/if}