mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-05 08:02:18 +00:00
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
This commit is contained in:
@@ -169,7 +169,7 @@
|
||||
<ScriptPicker
|
||||
disabled={!isEditable}
|
||||
initialPath={customInitialScriptPath}
|
||||
kind={Script.kind.SCRIPT}
|
||||
kinds={[Script.kind.SCRIPT, Script.kind.FAILURE]}
|
||||
allowFlow={true}
|
||||
bind:scriptPath={handlerPath}
|
||||
bind:itemKind={customHandlerKind}
|
||||
|
||||
@@ -297,7 +297,7 @@
|
||||
<ScriptPicker
|
||||
disabled={initialScriptPath != '' || !can_write}
|
||||
initialPath={initialScriptPath}
|
||||
kind={Script.kind.SCRIPT}
|
||||
kinds={[Script.kind.SCRIPT]}
|
||||
allowFlow={true}
|
||||
bind:itemKind
|
||||
bind:scriptPath={script_path}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
export let allowFlow = false
|
||||
export let allowHub = false
|
||||
export let itemKind: 'hub' | 'script' | 'flow' = allowHub ? 'hub' : 'script'
|
||||
export let kind: Script.kind | undefined = Script.kind.SCRIPT
|
||||
export let kinds: Script.kind[] = [Script.kind.SCRIPT]
|
||||
export let disabled = false
|
||||
export let allowRefresh = false
|
||||
|
||||
@@ -48,12 +48,23 @@
|
||||
label: `${flow.path}${flow.summary ? ` | ${truncate(flow.summary, 20)}` : ''}`
|
||||
}))
|
||||
} else if (itemKind == 'script') {
|
||||
items = (await ScriptService.listScripts({ workspace: $workspaceStore!, kind })).map(
|
||||
(script) => ({
|
||||
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) => ({
|
||||
|
||||
@@ -326,7 +326,7 @@
|
||||
<div class="absolute top-0 right-0 bottom-0 left-0 bg-surface-disabled/50 z-40" />
|
||||
{/if}
|
||||
<ScriptPicker
|
||||
kind={Script.kind.SCRIPT}
|
||||
kinds={[Script.kind.SCRIPT]}
|
||||
allowFlow
|
||||
bind:itemKind
|
||||
bind:scriptPath
|
||||
|
||||
Reference in New Issue
Block a user