mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 16:02:19 +00:00
Fix resource picker auto select if single choice (#6143)
* Fix resource picker auto select if single choice * clear value on resourceType change
This commit is contained in:
@@ -85,11 +85,7 @@
|
||||
}
|
||||
|
||||
let loading = $state(true)
|
||||
async function loadResources(
|
||||
resourceType: string | undefined,
|
||||
initialValue: string | undefined,
|
||||
value: string | undefined
|
||||
) {
|
||||
async function loadResources(resourceType: string | undefined) {
|
||||
loading = true
|
||||
try {
|
||||
const resourceTypesToQuery =
|
||||
@@ -130,12 +126,9 @@
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
$workspaceStore &&
|
||||
loadResources(
|
||||
resourceType,
|
||||
untrack(() => initialValue),
|
||||
untrack(() => value)
|
||||
)
|
||||
$workspaceStore && resourceType
|
||||
value = undefined
|
||||
untrack(() => loadResources(resourceType))
|
||||
})
|
||||
|
||||
let appConnect: AppConnect | undefined = $state()
|
||||
@@ -144,7 +137,7 @@
|
||||
|
||||
<AppConnect
|
||||
on:refresh={async (e) => {
|
||||
await loadResources(resourceType, initialValue, value)
|
||||
await loadResources(resourceType)
|
||||
value = e.detail
|
||||
valueType = collection.find((x) => x?.value == value)?.type
|
||||
}}
|
||||
@@ -154,7 +147,7 @@
|
||||
<ResourceEditorDrawer
|
||||
bind:this={resourceEditor}
|
||||
on:refresh={async (e) => {
|
||||
await loadResources(resourceType, initialValue, value)
|
||||
await loadResources(resourceType)
|
||||
if (e.detail) {
|
||||
value = e.detail
|
||||
valueType = collection.find((x) => x?.value == value)?.type
|
||||
@@ -240,7 +233,7 @@
|
||||
btnClasses="w-8 px-0.5 py-1.5"
|
||||
size="sm"
|
||||
on:click={() => {
|
||||
loadResources(resourceType, initialValue, value)
|
||||
loadResources(resourceType)
|
||||
}}
|
||||
startIcon={{ icon: RotateCw }}
|
||||
iconOnly
|
||||
|
||||
Reference in New Issue
Block a user