Skip to content

Comments

fix(frontend): add list instance emails endpoint and Select in AddUser#7903

Open
claude[bot] wants to merge 25 commits intomainfrom
claude/issue-7902-20260211-1113
Open

fix(frontend): add list instance emails endpoint and Select in AddUser#7903
claude[bot] wants to merge 25 commits intomainfrom
claude/issue-7902-20260211-1113

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Feb 11, 2026

Summary

  • Add a GET /w/{workspace}/users/list_instance_emails endpoint that returns all instance user emails (requires workspace admin, disabled on cloud)
  • Enhance the "Add user" popover in workspace settings with an AutocompleteSelect dropdown that suggests existing instance users not yet in the workspace
  • Users can select from the dropdown or type a custom email — value syncs live as they type
  • Falls back to a plain TextInput on cloud or if the endpoint fails
  • Add client-side email validation with InputError

Closes #7902

Changes

Backend

  • New list_instance_emails endpoint in windmill-api-users that queries emails from the password table (sorted alphabetically). Disabled on cloud-hosted instances. Requires workspace admin.
  • OpenAPI spec updated with the new endpoint definition.
  • SQLX offline query cache updated.

Frontend

  • New AutocompleteSelect.svelte: A dedicated component for the "type anything, value syncs live" use case. Reuses SelectDropdown and processItems from the existing select infrastructure. Keeps the widely-used Select component unchanged.
  • AddUser.svelte: On non-cloud instances, fetches instance emails and renders an AutocompleteSelect (with type-to-filter and custom email support). Falls back to TextInput on cloud or if the endpoint fails. Existing workspace members are filtered out. Email validation added.
  • WorkspaceUserSettings.svelte: Passes current workspace member emails to AddUser for filtering.
  • Select.svelte: Minor fix — on:close to onClick on CloseButton (Svelte 5 migration).
  • Regenerated OpenAPI TypeScript client.

Screenshot

add-user-autocomplete-select

Test plan

  • On a non-cloud instance, open Workspace Settings > Users, click "Add new user" and verify an autocomplete dropdown appears
  • Verify the dropdown only shows instance users that are not already workspace members
  • Verify typing filters the list and a custom email can be typed directly
  • Verify email validation shows an error for invalid emails
  • On a cloud instance, verify the plain email input still appears
  • Verify existing Select usages (e.g. DBManager schema select) are unaffected

Add a new GET /users/list_instance_emails endpoint that returns all
instance user emails (from the password table). This endpoint is only
available on non-cloud instances.

In the frontend AddUser component, when the instance emails are
available (non-cloud), replace the email text input with a Select
component that allows both selecting from existing instance users and
typing custom emails.

Closes #7902

Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
@claude claude bot mentioned this pull request Feb 11, 2026
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 11, 2026

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6c226c6
Status: ✅  Deploy successful!
Preview URL: https://fd67b868.windmill.pages.dev
Branch Preview URL: https://claude-issue-7902-20260211-1.windmill.pages.dev

View logs

Guilhem-lm and others added 12 commits February 16, 2026 10:25
Also fixes "Add new userss" typo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move the endpoint from global to workspace-scoped route
(/w/{workspace}/users/list_instance_emails) and add require_admin
check so only workspace admins can list instance emails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add client-side email format validation with error message display
and disable the Add button when email is invalid. Replace plain
<input> elements with TextInput component for consistent styling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a custom value (not in the items list) is selected, reopening
the dropdown now pre-fills the filter with the current value so users
can directly edit it. Also hide the "Use custom email" create option
when the filter matches the current value, and show the regular
placeholder instead of the value when editing a custom entry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the bind:value getter/setter and placeholder-as-display hack with
a standard controlled input pattern (value={inputValue} + oninput handler).

- Remove showPlaceholderOnOpen prop (replaced by default behavior)
- Add allowUserInput prop: typed text syncs to value in real-time
- Separate rawLabel (for filtering) from displayText (for transformed display)
- Hide dropdown when no items match in allowUserInput mode
- Simplify AddUser to use allowUserInput instead of createText/onCreateItem

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit updates the EE repository reference after PR #415 was merged in windmill-ee-private.

Previous ee-repo-ref: 8c214ec5039be5353f5fea920e27b0c6af61e1fd

New ee-repo-ref: c927593b0b49867284fc64d50c59daba6c70da84

Automated by sync-ee-ref workflow.
@windmill-internal-app
Copy link
Contributor

🤖 Updated ee-repo-ref.txt to c927593b0b49867284fc64d50c59daba6c70da84 after windmill-ee-private PR #415 was merged.

@Guilhem-lm Guilhem-lm changed the title feat: add list instance emails endpoint and Select in AddUser fix(frontend): add list instance emails endpoint and Select in AddUser Feb 16, 2026
@Guilhem-lm Guilhem-lm marked this pull request as ready for review February 16, 2026 19:07
@claude
Copy link
Contributor Author

claude bot commented Feb 16, 2026

Claude finished @Guilhem-lm's task in 2m 28s —— View job


Review Summary

  • Read all changed files
  • Review backend changes (Rust endpoint, SQL, OpenAPI)
  • Review frontend changes (AutocompleteSelect, AddUser, etc.)
  • Post inline comments for specific issues
  • Write final review summary with testing instructions

Overview

This PR adds an autocomplete dropdown for the "Add user" flow in workspace settings, backed by a new backend endpoint that returns all instance user emails. The approach is reasonable: a new list_instance_emails endpoint, a new AutocompleteSelect component, and a graceful fallback to plain text input on cloud instances or failure.

What works well

  • Clean separation: Creating AutocompleteSelect as a separate component rather than adding free-text mode to the existing Select avoids regressions on the widely-used Select.
  • Graceful degradation: Falls back to TextInput on cloud or API failure.
  • Filtering out existing members: The workspaceSet approach in instanceEmails is efficient.
  • Email validation: Simple and effective client-side check.
  • Select.svelte fix: The on:closeonClick change is correct for Svelte 5 migration.

Issues to address

See inline comments for detailed feedback on each file. The main points:

  1. No pagination on the backend endpointSELECT email FROM password ORDER BY email returns all instance emails unbounded. On large instances (thousands of users), this could be a large payload. Consider adding a LIMIT.

  2. UI flash on load — The component shows TextInput first, then switches to AutocompleteSelect once the API call resolves. This creates a visible layout shift. A loading state would smooth this transition.

  3. Noisy email validation — Since AutocompleteSelect syncs value on every keystroke, the email validation error flickers as the user types to filter (e.g., "ad" → error → "admin@..." → no error). Consider debouncing or only validating after the dropdown closes.

  4. Top-level loadInstanceEmails() call — Called during component initialization with $workspaceStore! non-null assertion. If workspaceStore isn't populated yet, this could error silently (caught by try/catch, but means no autocomplete).

  5. Minor: $effect interaction in AutocompleteSelect — Two effects interact in a subtle way around filterText and open state. A clarifying comment would help maintainability.

None of these are blocking — the code works correctly in the happy path. Items 1-3 are the most impactful for polish.


How to test

On a non-cloud Windmill instance, go to Workspace Settings (gear icon → Members tab). Click the "Add new user" button in the top-right corner. An autocomplete dropdown should appear instead of a plain text input. The dropdown should list all instance users that are not already members of the current workspace. Typing in the field should filter the list, and you should also be able to type a custom email that doesn't appear in the dropdown. Entering an invalid email (e.g., "notanemail") should show a validation error below the field, and the "Add" button should be disabled. On a cloud-hosted instance (or if the endpoint fails), the plain email text input should appear instead.

Guilhem-lm and others added 9 commits February 17, 2026 08:20
- Add LIMIT 1000 to list_instance_emails SQL query
- Add loading state to prevent UI flash in AddUser
- Show email validation error only after blur
- Guard loadInstanceEmails with workspaceStore check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add onClose callback to AutocompleteSelect and use it in AddUser
to defer validation until the user finishes interacting with the
dropdown, avoiding visual noise between the dropdown and error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit updates the EE repository reference after PR #420 was merged in windmill-ee-private.

Previous ee-repo-ref: 931813b75b8260faa13ddc07f36a11607b7e3bf6

New ee-repo-ref: 592848d59ca2304926fb2bd85d000668a7f46a77

Automated by sync-ee-ref workflow.
@windmill-internal-app
Copy link
Contributor

🤖 Updated ee-repo-ref.txt to 592848d59ca2304926fb2bd85d000668a7f46a77 after windmill-ee-private PR #420 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List instance user endpoint

1 participant