mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-30 08:16:49 +00:00
fix: HubPicker pick from trigger scripts when relevant
This commit is contained in:
@@ -1470,11 +1470,14 @@ paths:
|
||||
type: string
|
||||
approved:
|
||||
type: boolean
|
||||
is_trigger:
|
||||
type: boolean
|
||||
required:
|
||||
- id
|
||||
- summary
|
||||
- app
|
||||
- approved
|
||||
- is_trigger
|
||||
|
||||
/scripts/hub/get/{path}:
|
||||
get:
|
||||
|
||||
@@ -256,6 +256,7 @@ struct ScriptSearch {
|
||||
summary: String,
|
||||
app: String,
|
||||
approved: bool,
|
||||
is_trigger: bool,
|
||||
}
|
||||
|
||||
async fn list_hub_scripts(
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
$hubScripts = scripts.map((x) => ({
|
||||
path: `hub/${x.id}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`,
|
||||
summary: `${x.summary} (${x.app})`,
|
||||
approved: x.approved
|
||||
approved: x.approved,
|
||||
is_trigger: x.is_trigger
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
import { FlowModuleValue } from '$lib/gen/models/FlowModuleValue'
|
||||
|
||||
import { faCode } from '@fortawesome/free-solid-svg-icons'
|
||||
import type { integer } from 'monaco-languageclient'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import type { FlowMode } from './flowStore'
|
||||
import FlowScriptPicker from './pickers/FlowScriptPicker.svelte'
|
||||
import PickHubScript from './pickers/PickHubScript.svelte'
|
||||
import PickScript from './pickers/PickScript.svelte'
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
|
||||
type Item = { summary: String; path: String; version?: String }
|
||||
|
||||
const items: Item[] = $hubScripts ?? []
|
||||
let items: Item[]
|
||||
$: items = $hubScripts?.filter((x) => x.is_trigger == isTrigger) ?? []
|
||||
let itemPicker: ItemPicker
|
||||
|
||||
$: console.log('X', $hubScripts)
|
||||
$: console.log(items)
|
||||
const dispatch = createEventDispatcher()
|
||||
</script>
|
||||
|
||||
@@ -29,7 +32,7 @@
|
||||
/>
|
||||
|
||||
<FlowScriptPicker
|
||||
label={'Pick a script from the Hub'}
|
||||
label={`Pick a ${isTrigger ? 'trigger ' : ''} script from the Hub`}
|
||||
icon={faUserGroup}
|
||||
iconColor="text-blue-500"
|
||||
on:click={() => itemPicker.openModal()}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/>
|
||||
|
||||
<FlowScriptPicker
|
||||
label={'Pick a script from your workspace'}
|
||||
label={`Pick a ${isTrigger ? 'trigger ' : ''}script from your workspace`}
|
||||
icon={faUserGroup}
|
||||
iconColor="text-blue-500"
|
||||
on:click={() => itemPicker.openModal()}
|
||||
|
||||
@@ -27,6 +27,7 @@ export const hubScripts = writable<
|
||||
path: string
|
||||
summary: string
|
||||
approved: boolean
|
||||
is_trigger: boolean
|
||||
}>
|
||||
| undefined
|
||||
>(undefined)
|
||||
|
||||
Reference in New Issue
Block a user