mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: search usage by name or username (#23317)
## Summary The search field on `/agents/settings/usage` previously only matched against usernames. This updates the SQL query to also match against the user's display name via `ILIKE`, and updates the frontend placeholder and variable names to reflect the broader search scope. ## Changes - **SQL** (`coderd/database/queries/chats.sql`, `coderd/database/queries.sql.go`): Added `OR u.name ILIKE '%' || @username::text || '%'` to the `GetChatCostPerUser` query's WHERE clause. - **Frontend** (`site/src/pages/AgentsPage/SettingsPageContent.tsx`): Renamed `usernameFilter`/`debouncedUsername` to `searchFilter`/`debouncedSearch`, updated placeholder to "Search by name or username". --- PR generated with Coder Agents
This commit is contained in:
@@ -4062,6 +4062,7 @@ WITH chat_cost_users AS (
|
||||
AND (
|
||||
$5::text = ''
|
||||
OR u.username ILIKE '%' || $5::text || '%'
|
||||
OR u.name ILIKE '%' || $5::text || '%'
|
||||
)
|
||||
GROUP BY
|
||||
c.owner_id,
|
||||
|
||||
@@ -725,6 +725,7 @@ WITH chat_cost_users AS (
|
||||
AND (
|
||||
@username::text = ''
|
||||
OR u.username ILIKE '%' || @username::text || '%'
|
||||
OR u.name ILIKE '%' || @username::text || '%'
|
||||
)
|
||||
GROUP BY
|
||||
c.owner_id,
|
||||
|
||||
Reference in New Issue
Block a user