fix: add username search support to workspace and admin pages (#20780)
This fix restores and extends the username/email search functionality across workspace pages that was originally added in PR #14002. The issue was that: 1. The backend search functions for Models and Knowledge only searched `User.name` and `User.email`, but not `User.username` 2. The Functions admin page lacked user search entirely Changes made: Added User.username to backend search conditions for Models and Knowledge pages Added complete user search (name, email, username) to the Functions admin page client-side filter
This commit is contained in:
@@ -229,6 +229,9 @@ class KnowledgeTable:
|
||||
or_(
|
||||
Knowledge.name.ilike(f"%{query_key}%"),
|
||||
Knowledge.description.ilike(f"%{query_key}%"),
|
||||
User.name.ilike(f"%{query_key}%"),
|
||||
User.email.ilike(f"%{query_key}%"),
|
||||
User.username.ilike(f"%{query_key}%"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -294,6 +294,9 @@ class ModelsTable:
|
||||
or_(
|
||||
Model.name.ilike(f"%{query_key}%"),
|
||||
Model.base_model_id.ilike(f"%{query_key}%"),
|
||||
User.name.ilike(f"%{query_key}%"),
|
||||
User.email.ilike(f"%{query_key}%"),
|
||||
User.username.ilike(f"%{query_key}%"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -86,7 +86,10 @@
|
||||
(selectedType !== '' ? f.type === selectedType : true) &&
|
||||
(query === '' ||
|
||||
f.name.toLowerCase().includes(query.toLowerCase()) ||
|
||||
f.id.toLowerCase().includes(query.toLowerCase())) &&
|
||||
f.id.toLowerCase().includes(query.toLowerCase()) ||
|
||||
(f.user?.name || '').toLowerCase().includes(query.toLowerCase()) ||
|
||||
(f.user?.email || '').toLowerCase().includes(query.toLowerCase()) ||
|
||||
(f.user?.username || '').toLowerCase().includes(query.toLowerCase())) &&
|
||||
(viewOption === '' ||
|
||||
(viewOption === 'created' && f.user_id === $user?.id) ||
|
||||
(viewOption === 'shared' && f.user_id !== $user?.id))
|
||||
|
||||
Reference in New Issue
Block a user