-
Notifications
You must be signed in to change notification settings - Fork 884
fix(frontend): add list instance emails endpoint and Select in AddUser #7903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
claude
wants to merge
25
commits into
main
Choose a base branch
from
claude/issue-7902-20260211-1113
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
077eb91
feat: add list instance emails endpoint and use Select in AddUser
github-actions[bot] fb0f003
fix: filter out existing workspace members from instance emails select
Guilhem-lm 793bb7b
fix: restrict list_instance_emails to workspace admins
Guilhem-lm b54bea7
feat: add email validation and use TextInput in AddUser
Guilhem-lm bfb65fc
fix: allow editing custom email in Select component
Guilhem-lm 4aa1f01
refactor: replace Select placeholder hack with autocomplete model
Guilhem-lm 90139c7
Merge remote-tracking branch 'origin/main' into glm/select-users
Guilhem-lm 19f30ee
Merge remote-tracking branch 'origin/main' into glm/select-users
Guilhem-lm 1dd2b0a
refactor: extract AutocompleteSelect from Select component
Guilhem-lm 360b43c
nit
Guilhem-lm 9347a04
style: format test_dev select page
Guilhem-lm 47c0277
chore: remove test_dev select page
Guilhem-lm d89d367
chore: update ee-repo-ref to c927593b0b49867284fc64d50c59daba6c70da84
windmill-internal-app[bot] 13ff7f4
Merge branch 'main' into claude/issue-7902-20260211-1113
Guilhem-lm 732aff1
Merge branch 'main' into claude/issue-7902-20260211-1113
Guilhem-lm 2ff72e3
Merge remote-tracking branch 'origin/main' into glm/select-users
Guilhem-lm e11a333
fix: address PR review comments
Guilhem-lm f03bd04
fix: use AutocompleteSelect loading prop instead of separate branch
Guilhem-lm da460fa
nit
Guilhem-lm fa22ec6
fix: only show email validation error after dropdown closes
Guilhem-lm 6df1e13
nit
Guilhem-lm 945188d
Merge branch 'main' into claude/issue-7902-20260211-1113
Guilhem-lm 09d280c
nit
Guilhem-lm 958b8ed
fix check
Guilhem-lm 6c226c6
chore: update ee-repo-ref to 592848d59ca2304926fb2bd85d000668a7f46a77
windmill-internal-app[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
backend/.sqlx/query-21e9a9fc33dcdb66a2c8e95b1359ca1b3e04b4ecf155757abf5798834ebfd0ce.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
178 changes: 178 additions & 0 deletions
178
frontend/src/lib/components/select/AutocompleteSelect.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| <script lang="ts"> | ||
| import { clickOutside } from '$lib/utils' | ||
| import { twMerge } from 'tailwind-merge' | ||
| import CloseButton from '../common/CloseButton.svelte' | ||
| import { Loader2 } from 'lucide-svelte' | ||
| import { untrack } from 'svelte' | ||
| import { getLabel, processItems, type ProcessedItem } from './utils.svelte' | ||
| import SelectDropdown from './SelectDropdown.svelte' | ||
| import { | ||
| inputBaseClass, | ||
| inputBorderClass, | ||
| inputSizeClasses | ||
| } from '../text_input/TextInput.svelte' | ||
| import { ButtonType } from '../common/button/model' | ||
|
|
||
| type Item = { label?: string; value: string; subtitle?: string; disabled?: boolean } | ||
|
|
||
| let { | ||
| items, | ||
| placeholder = 'Please select', | ||
| value = $bindable(), | ||
| class: className = '', | ||
| clearable = false, | ||
| disabled: _disabled = false, | ||
| containerStyle = '', | ||
| inputClass = '', | ||
| disablePortal = false, | ||
| loading = false, | ||
| error = false, | ||
| autofocus, | ||
| noItemsMsg, | ||
| id, | ||
| size = 'md', | ||
| transformInputSelectedText, | ||
| onFocus, | ||
| onBlur, | ||
| onClear | ||
| }: { | ||
| items?: Item[] | ||
| value: string | undefined | ||
| placeholder?: string | ||
| class?: string | ||
| clearable?: boolean | ||
| disabled?: boolean | ||
| containerStyle?: string | ||
| inputClass?: string | ||
| disablePortal?: boolean | ||
| loading?: boolean | ||
| error?: boolean | ||
| autofocus?: boolean | ||
| noItemsMsg?: string | ||
| id?: string | ||
| size?: 'sm' | 'md' | 'lg' | ||
| transformInputSelectedText?: (text: string) => string | ||
| onFocus?: () => void | ||
| onBlur?: () => void | ||
| onClear?: () => void | ||
| } = $props() | ||
|
|
||
| let disabled = $derived(_disabled || (loading && !value)) | ||
| let iconSize = $derived(ButtonType.UnifiedIconSizes[size]) | ||
|
|
||
| let inputEl: HTMLInputElement | undefined = $state() | ||
| let open = $state(false) | ||
| let filterText = $state('') | ||
|
|
||
| let processedItems: ProcessedItem<string>[] = $derived.by(() => { | ||
| let args = { items, filterText } | ||
| return untrack(() => processItems(args)) | ||
| }) | ||
|
|
||
| let rawLabel = $derived.by(() => { | ||
| let entry = value ? processedItems?.find((item) => item.value === value) : undefined | ||
| return entry?.label ?? getLabel({ value }) ?? '' | ||
| }) | ||
|
|
||
| let displayText = $derived(transformInputSelectedText?.(rawLabel) ?? rawLabel) | ||
|
|
||
| let inputValue = $derived(open ? filterText : displayText) | ||
|
|
||
| let hasFilteredItems = $derived( | ||
| !filterText || | ||
| processedItems?.some((item) => item.label?.toLowerCase().includes(filterText.toLowerCase())) | ||
| ) | ||
|
|
||
| let dropdownVisible = $derived(open && hasFilteredItems) | ||
|
|
||
| $effect(() => { | ||
Guilhem-lm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (filterText) open = true | ||
| }) | ||
|
|
||
| $effect(() => { | ||
| if (!open) { | ||
| filterText = '' | ||
| } else { | ||
| untrack(() => { | ||
| if (rawLabel) { | ||
| filterText = rawLabel | ||
| } | ||
| }) | ||
| } | ||
| }) | ||
|
|
||
| function setValue(item: ProcessedItem<string>) { | ||
| value = item.value | ||
| filterText = '' | ||
| open = false | ||
| } | ||
|
|
||
| function clearValue() { | ||
| filterText = '' | ||
| if (onClear) onClear() | ||
| else value = undefined | ||
| } | ||
| </script> | ||
|
|
||
| <div | ||
| class={`relative ${className}`} | ||
| use:clickOutside={{ onClickOutside: () => (open = false) }} | ||
| onpointerdown={() => onFocus?.()} | ||
| onfocus={() => onFocus?.()} | ||
| onblur={() => onBlur?.()} | ||
| > | ||
| {#if loading} | ||
| <div class="absolute z-10 right-2 h-full flex items-center"> | ||
| <Loader2 size={iconSize} class="animate-spin" /> | ||
| </div> | ||
| {:else if clearable && !disabled && value} | ||
| <div class="absolute z-10 right-2 h-full flex items-center"> | ||
| <CloseButton | ||
| class="bg-transparent text-secondary hover:text-primary" | ||
| noBg | ||
| small | ||
| onClick={clearValue} | ||
| /> | ||
| </div> | ||
| {/if} | ||
| <!-- svelte-ignore a11y_autofocus --> | ||
| <input | ||
| {autofocus} | ||
| {disabled} | ||
| type="text" | ||
| value={inputValue} | ||
| placeholder={loading && !value ? 'Loading...' : placeholder} | ||
| style={containerStyle} | ||
| class={twMerge( | ||
| inputBaseClass, | ||
| inputSizeClasses[size], | ||
| ButtonType.UnifiedHeightClasses[size], | ||
| inputBorderClass({ error, forceFocus: open }), | ||
| 'w-full', | ||
| open ? '' : 'cursor-pointer', | ||
| 'placeholder-hint', | ||
| clearable && !disabled && value ? 'pr-8' : '', | ||
| inputClass ?? '' | ||
| )} | ||
| autocomplete="off" | ||
| oninput={(e) => { | ||
| if (!open) open = true | ||
| filterText = e.currentTarget.value | ||
| value = filterText || undefined | ||
Guilhem-lm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }} | ||
| onpointerdown={() => (open = true)} | ||
| bind:this={inputEl} | ||
| {id} | ||
| /> | ||
| <SelectDropdown | ||
| {disablePortal} | ||
| onSelectValue={setValue} | ||
| open={dropdownVisible} | ||
| {processedItems} | ||
| {value} | ||
| {disabled} | ||
| {filterText} | ||
| getInputRect={inputEl && (() => inputEl!.getBoundingClientRect())} | ||
| {noItemsMsg} | ||
| /> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.