fix workspace settings script picker

This commit is contained in:
Ruben Fiszel
2022-12-03 00:18:06 +01:00
parent a4e4e7188f
commit 4245255fda
3 changed files with 16 additions and 8 deletions

View File

@@ -353,7 +353,7 @@
<div class="flex flex-col w-full">
<div class="flex flex-row w-full items- justify-between">
{#if password}
<Password bind:password={value} />
<Password {disabled} bind:password={value} />
{:else}
<textarea
{autofocus}

View File

@@ -3,6 +3,7 @@
import { onMount } from 'svelte'
export let password: string
export let placeholder = '******'
export let disabled = false
onMount(() => {
const passwordToggle = document.querySelector('.js-password-toggle')
@@ -42,5 +43,6 @@
bind:value={password}
autocomplete="off"
{placeholder}
{disabled}
/>
</div>

View File

@@ -31,37 +31,43 @@
if (itemKind == 'flow') {
items = (await FlowService.listFlows({ workspace: $workspaceStore! })).map((flow) => ({
value: flow.path,
label: `${flow.path}${flow.summary ? `| ${flow.summary}` : ''}`
label: `${flow.path}${flow.summary ? ` | ${flow.summary}` : ''}`
}))
} else if (itemKind == 'script') {
items = (await ScriptService.listScripts({ workspace: $workspaceStore!, kind })).map(
(script) => ({
value: script.path,
label: `${script.path}${script.summary ? `| ${script.summary}` : ''}`
label: `${script.path}${script.summary ? ` | ${script.summary}` : ''}`
})
)
} else {
items =
$hubScripts?.map((x) => ({
value: x.path,
label: `${x.path}${x.summary ? `| ${x.summary}` : ''}`
label: `${x.path}${x.summary ? ` | ${x.summary}` : ''}`
})) ?? []
}
}
$: $workspaceStore && itemKind && loadItems()
$: dispatch('select', { path: scriptPath })
</script>
<div class="flex flex-row items-center gap-4 w-full">
{#if options.length > 1}
<div class="w-80">
<div class="w-80 mt-1">
<RadioButton bind:value={itemKind} {options} />
</div>
{/if}
<Select class="grow" bind:justValue={scriptPath} {items} placeholder="Pick a {itemKind}" />
<Select
class="grow"
on:change={() => {
dispatch('select', { path: scriptPath })
}}
bind:justValue={scriptPath}
{items}
placeholder="Pick a {itemKind}"
/>
{#if scriptPath !== undefined && scriptPath !== ''}
<Button
color="light"