Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(studio): add server-side user pagination and username search (#5024)
Zayn Jarvisbc1384811d2a
diff --git a/docs/en/api/08-admin.md b/docs/en/api/08-admin.mdindex bbd930f14..f333f3939 100644--- a/docs/en/api/08-admin.md+++ b/docs/en/api/08-admin.md@@ -985,6 +985,14 @@ List active users in a workspace. Users with deletion in progress are omitted.- In `trusted` mode, `user_key` is omitted from the response- Users whose deletion has started are no longer returned+**Summary responses (HTTP):** Set `include_summary=true` to return an object in `result` with `users` (the current page), `total` (matching users), `account_total`, `manager_count` (admin/root), and `key_count` (users with a visible key or prefix). Account statistics ignore search/role filters and exclude deleting users; `key_count` is zero when key exposure is disabled. The default remains a user array for existing callers.++`query` performs a trimmed, case-insensitive literal substring match on user IDs. It combines with the existing `name` wildcard and `role` filters. For example:++```text+GET /api/v1/admin/accounts/acme/users?limit=20&page=1&query=alice&include_summary=true+```+#### 3. Usage Examples**HTTP API**diff --git a/docs/zh/api/08-admin.md b/docs/zh/api/08-admin.mdindex d65f4fdd9..04208cb26 100644--- a/docs/zh/api/08-admin.md+++ b/docs/zh/api/08-admin.md@@ -929,6 +929,14 @@ ov admin register-user acme bob-private --role user \- 在 `trusted` 模式下,响应中不会包含 `user_key` 字段- 用户删除开始后,不再出现在该列表中+**带统计的响应(HTTP):** 设置 `include_summary=true` 后,`result` 返回对象:`users` 为当前页,`total` 为匹配人数,`account_total` 为账号总人数,`manager_count` 为 admin/root 人数,`key_count` 为具有可见密钥或前缀的用户数。账号统计不受搜索和角色过滤影响,并排除正在删除的用户;禁用密钥展示时 `key_count` 为零。默认仍返回用户数组,兼容现有调用。++`query` 对用户 ID 做去除首尾空格、不区分大小写的字面包含匹配,可与已有的 `name` 通配符、`role` 过滤组合。例如:++```text+GET /api/v1/admin/accounts/acme/users?limit=20&page=1&query=alice&include_summary=true+```+#### 3. 使用示例**HTTP API**diff --git a/openviking/server/api_keys/legacy.py b/openviking/server/api_keys/legacy.pyindex 2d1ceeb39..dd4b0bead 100644--- a/openviking/server/api_keys/legacy.py+++ b/openviking/server/api_keys/legacy.py@@ -1044,43 +1044,76 @@ class LegacyAPIKeyManager:Pagination is opt-in via ``limit``/``page`` (1-based); ``limit=None``returns every matching user."""+ return self.get_users_page(+ account_id,+ limit=limit,+ name_filter=name_filter,+ role_filter=role_filter,+ expose_key=expose_key,+ page=page,+ )["users"]++ def get_users_page(+ self,+ account_id: str,+ limit: int | None = 100,+ name_filter: str | None = None,+ role_filter: str | None = None,+ expose_key: bool = True,+ page: int = 1,+ query_filter: str | None = None,+ ) -> dict:+ """Return one page, matching total, and unfiltered account statistics.++ Only materialize credentials for the requested page. Deleting users are+ excluded from both the results and statistics.+ """account = self._accounts.get(account_id)if account is None:raise NotFoundError(account_id, "account")result = []+ total = account_total = manager_count = key_count = 0+ start = (max(1, page) - 1) * limit if limit is not None else 0+ query = (query_filter or "").strip().casefold()for user_id, user_info in account.users.items():if user_info.get("deletion"):continue-user_role = user_info.get("role", "user")+ key = user_info.get("key")+ visible_key = bool(+ expose_key+ and key+ and (not key.startswith("$argon2") or user_info.get("key_prefix"))+ )+ account_total += 1+ manager_count += user_role in {"admin", "root"}+ key_count += visible_key- # Apply name filter if providedif name_filter and not fnmatch.fnmatch(user_id, name_filter):continue-- # Apply role filter if providedif role_filter and user_role != role_filter:continue+ if query and query not in user_id.casefold():+ continue+ total += 1+ if total <= start or (limit is not None and len(result) >= limit):+ continue- user_data = {- "user_id": user_id,- "role": user_role,- }- if expose_key:- key = user_info.get("key")- if key:- if key.startswith("$argon2"):- # Hashed key - show key_prefix-- key_prefix = user_info.get("key_prefix")- if key_prefix:- user_data["key_prefix"] = key_prefix- else:- # Plaintext key - show full api_key- user_data["api_key"] = key+ user_data = {"user_id": user_id, "role": user_role}+ if visible_key:+ if key.startswith("$argon2"):+ user_data["key_prefix"] = user_info["key_prefix"]+ else:+ user_data["api_key"] = keyresult.append(user_data)- return _paginate(result, limit, page)+ return {+ "users": result,+ "total": total,+ "account_total": account_total,+ "manager_count": manager_count,+ "key_count": key_count,+ }def has_user(self, account_id: str, user_id: str) -> bool:"""Return True when the account registry contains the given user."""diff --git a/openviking/server/api_keys/new.py b/openviking/server/api_keys/new.pyindex b372044c0..d33ee2598 100644--- a/openviking/server/api_keys/new.py+++ b/openviking/server/api_keys/new.py@@ -559,6 +559,26 @@ class NewAPIKeyManager:page=page,)+ def get_users_page(+ self,+ account_id: str,+ limit: int | None = 100,+ name_filter: str | None = None,+ role_filter: str | None = None,+ expose_key: bool = True,+ page: int = 1,+ query_filter: str | None = None,+ ) -> dict:+ return self._legacy.get_users_page(+ account_id,+ limit=limit,+ name_filter=name_filter,+ role_filter=role_filter,+ expose_key=expose_key,+ page=page,+ query_filter=query_filter,+ )+def has_user(self, account_id: str, user_id: str) -> bool:"""Return True when the account registry contains the given user."""return self._legacy.has_user(account_id, user_id)diff --git a/openviking/server/routers/admin.py b/openviking/server/routers/admin.pyindex 7d6d231f9..a29af961e 100644--- a/openviking/server/routers/admin.py+++ b/openviking/server/routers/admin.py@@ -620,6 +620,10 @@ async def list_users(name: str | None = None,role: str | None = None,page: int = Query(1, ge=1, description="1-based page number (requires limit)"),+ query: str | None = Query(None, description="Case-insensitive username substring"),+ include_summary: bool = Query(+ False, description="Return users, matching total and account statistics"+ ),ctx: RequestContext = Depends(get_request_context),):"""List users in an account, in creation order. `name` supports wildcard (* and ?) matching."""@@ -628,15 +632,16 @@ async def list_users(if not _registry_watcher_running(request):await manager.refresh_account_users_from_store(account_id)expose_key = _should_expose_user_key(request)- users = manager.get_users(+ users = manager.get_users_page(account_id,limit=limit,name_filter=name,role_filter=role,expose_key=expose_key,page=page,+ query_filter=query,)- return Response(status="ok", result=users)+ return Response(status="ok", result=users if include_summary else users["users"])@router.get("/accounts/{account_id}/users/{user_id}/settings")diff --git a/tests/server/test_admin_api.py b/tests/server/test_admin_api.pyindex 51aaf5c3d..d5399d6c9 100644--- a/tests/server/test_admin_api.py+++ b/tests/server/test_admin_api.py@@ -2761,3 +2761,93 @@ async def test_trusted_mode_create_account_lists_current_account_metadata(manager = trusted_admin_app.state.api_key_manageraccount = next(item for item in manager.get_accounts() if item["account_id"] == acct)assert set(account) == {"account_id", "created_at", "user_count"}+++async def test_user_page_summary_and_search_preserve_legacy_response(+ lightweight_admin_client: httpx.AsyncClient,+ lightweight_admin_app: FastAPI,+):+ acct = _uid()+ created = await lightweight_admin_client.post(+ "/api/v1/admin/accounts",+ json={"account_id": acct, "admin_user_id": "owner"},+ headers=root_headers(),+ )+ assert created.status_code == 200+ manager = lightweight_admin_app.state.api_key_manager+ seed = {+ f"user-{index}": {+ "role": "admin" if index == 2832 else "user",+ "key": f"test-key-{index}",+ }+ for index in range(1, 2833)+ }+ seed["deleting-user"] = {"role": "admin", "key": "deleted", "deletion": {"status": "pending"}}+ await manager._legacy._save_users_json(acct, seed)+ url = f"/api/v1/admin/accounts/{acct}/users"++ response = await lightweight_admin_client.get(+ url, params={"include_summary": True, "limit": 20, "page": 142}, headers=root_headers()+ )+ assert response.status_code == 200, response.text+ result = response.json()["result"]+ assert len(result["users"]) == 13+ assert result["users"][-1]["user_id"] == "user-2832"+ assert result["total"] == result["account_total"] == result["key_count"] == 2833+ assert result["manager_count"] == 2++ response = await lightweight_admin_client.get(+ url,+ params={"include_summary": True, "limit": 20, "query": " UsEr-2832 "},+ headers=root_headers(),+ )+ result = response.json()["result"]+ assert result["total"] == 1+ assert result["users"][0]["user_id"] == "user-2832"+ assert result["account_total"] == 2833+ assert result["manager_count"] == 2++ response = await lightweight_admin_client.get(+ url,+ params={"include_summary": True, "limit": 20, "query": "missing"},+ headers=root_headers(),+ )+ assert response.json()["result"]["total"] == 0+ assert response.json()["result"]["users"] == []+ assert response.json()["result"]["account_total"] == 2833++ response = await lightweight_admin_client.get(url, headers=root_headers())+ assert isinstance(response.json()["result"], list)+ assert len(response.json()["result"]) == 2833+ response = await lightweight_admin_client.get(+ url,+ params={"limit": 1, "page": 2, "name": "user-*", "role": "user"},+ headers=root_headers(),+ )+ assert response.json()["result"][0]["user_id"] == "user-2"++ hidden = manager.get_users_page(acct, expose_key=False, limit=1)+ assert hidden["key_count"] == 0+ assert "api_key" not in hidden["users"][0]+ assert "key_prefix" not in hidden["users"][0]+++async def test_user_page_summary_respects_account_access(lightweight_admin_client):+ acct = _uid()+ response = await lightweight_admin_client.post(+ "/api/v1/admin/accounts",+ json={"account_id": acct, "admin_user_id": "owner"},+ headers=root_headers(),+ )+ admin_key = response.json()["result"]["user_key"]+ own = await lightweight_admin_client.get(+ f"/api/v1/admin/accounts/{acct}/users?include_summary=true&limit=20",+ headers={"X-API-Key": admin_key},+ )+ assert own.status_code == 200+ assert own.json()["result"]["account_total"] == 1+ denied = await lightweight_admin_client.get(+ "/api/v1/admin/accounts/default/users?include_summary=true&limit=20",+ headers={"X-API-Key": admin_key},+ )+ assert denied.status_code == 403diff --git a/web-studio/src/i18n/locales/en/workspace.ts b/web-studio/src/i18n/locales/en/workspace.tsindex 63ee28a6a..0490d43be 100644--- a/web-studio/src/i18n/locales/en/workspace.ts+++ b/web-studio/src/i18n/locales/en/workspace.ts@@ -859,6 +859,19 @@ const workspace = {title: 'New API key',},loading: 'Loading identities...',+ userList: {+ search: 'Search all users by username',+ noResults: 'No matching users',+ noResultsDescription: 'Try another username or clear the search.',+ pagination: 'User pagination',+ summary: '{{total}} users · Page {{page}} of {{pageCount}}',+ pageSize: 'Users per page',+ pageSizeValue: '{{count}} per page',+ first: 'First',+ previous: 'Previous',+ next: 'Next',+ last: 'Last',+ },management: {accountFilter: 'Accounts',accessDeniedDescription:diff --git a/web-studio/src/i18n/locales/zh-CN/workspace.ts b/web-studio/src/i18n/locales/zh-CN/workspace.tsindex e6b93f381..41f4e6fcb 100644--- a/web-studio/src/i18n/locales/zh-CN/workspace.ts+++ b/web-studio/src/i18n/locales/zh-CN/workspace.ts@@ -822,6 +822,19 @@ const workspace = {title: '新的 API 密钥',},loading: '正在加载身份...',+ userList: {+ search: '按用户名搜索全部用户',+ noResults: '没有匹配的用户',+ noResultsDescription: '试试其他用户名,或清空搜索。',+ pagination: '用户列表分页',+ summary: '共 {{total}} 个用户 · 第 {{page}} / {{pageCount}} 页',+ pageSize: '每页用户数',+ pageSizeValue: '每页 {{count}} 个',+ first: '首页',+ previous: '上一页',+ next: '下一页',+ last: '末页',+ },management: {accountFilter: '账号',accessDeniedDescription:diff --git a/web-studio/src/lib/admin.test.ts b/web-studio/src/lib/admin.test.tsnew file mode 100644index 000000000..105645366--- /dev/null+++ b/web-studio/src/lib/admin.test.ts@@ -0,0 +1,73 @@+import { beforeEach, describe, expect, it, vi } from 'vitest'+import type * as Client from '#/gen/ov-client/client'+import { fetchAdminUsersPage } from './admin'++const { getMock } = vi.hoisted(() => ({ getMock: vi.fn() }))+vi.mock('#/gen/ov-client/client', async (importOriginal) => {+ const original = await importOriginal<typeof Client>()+ return {+ ...original,+ createClient: () => ({ ...original.createClient(), get: getMock }),+ }+})++const connection = {+ accountId: 'default',+ apiKey: 'test-key',+ baseUrl: 'http://localhost:1933',+ userId: 'root',+}++describe('fetchAdminUsersPage', () => {+ beforeEach(() => {+ getMock.mockReset()+ })++ it('requests only the selected page and uses server totals', async () => {+ getMock.mockResolvedValue({+ status: 200,+ headers: {},+ data: {+ status: 'ok',+ result: {+ users: [{ user_id: 'user-2833', role: 'admin' }],+ total: 1,+ account_total: 2833,+ manager_count: 2,+ key_count: 2830,+ },+ },+ })+ const result = await fetchAdminUsersPage(connection, 'customer_agent_as', {+ page: 2,+ pageSize: 20,+ search: ' USER-2833 ',+ })+ expect(getMock).toHaveBeenCalledWith({+ url: '/api/v1/admin/accounts/{account_id}/users',+ path: { account_id: 'customer_agent_as' },+ query: { page: 2, limit: 20, query: 'USER-2833', include_summary: true },+ })+ expect(result).toMatchObject({+ total: 1,+ accountTotal: 2833,+ managerCount: 2,+ keyCount: 2830,+ users: [+ { accountId: 'customer_agent_as', userId: 'user-2833', role: 'admin' },+ ],+ })+ })++ it('propagates errors instead of falling back to an unbounded request', async () => {+ getMock.mockRejectedValue(new Error('Request failed'))+ await expect(+ fetchAdminUsersPage(connection, 'account', {+ page: 1,+ pageSize: 20,+ search: '',+ }),+ ).rejects.toMatchObject({ message: 'Request failed' })+ expect(getMock).toHaveBeenCalledTimes(1)+ })+})diff --git a/web-studio/src/lib/admin.ts b/web-studio/src/lib/admin.tsindex 4f5cb2790..f3799d404 100644--- a/web-studio/src/lib/admin.ts+++ b/web-studio/src/lib/admin.ts@@ -368,9 +368,6 @@ export async function fetchAdminUsers(path: {account_id: accountId,},- query: {- limit: 500,- },}),)return result@@ -378,6 +375,48 @@ export async function fetchAdminUsers(.filter((item): item is AdminUser => Boolean(item))}+export type AdminUserPage = {+ users: AdminUser[]+ total: number+ accountTotal: number+ managerCount: number+ keyCount: number+}++export async function fetchAdminUsersPage(+ connection: AdminConnection,+ accountId: string,+ options: { page: number; pageSize: number; search: string },+): Promise<AdminUserPage> {+ const result = await getOvResult<{+ users: unknown[]+ total: number+ account_total: number+ manager_count: number+ key_count: number+ }>(+ createAdminClient(connection).get({+ url: '/api/v1/admin/accounts/{account_id}/users',+ path: { account_id: accountId },+ query: {+ page: options.page,+ limit: options.pageSize,+ query: options.search.trim() || undefined,+ include_summary: true,+ },+ }),+ )+ return {+ users: result.users+ .map((item) => normalizeUser(accountId, item))+ .filter((item): item is AdminUser => Boolean(item)),+ total: result.total,+ accountTotal: result.account_total,+ managerCount: result.manager_count,+ keyCount: result.key_count,+ }+}+export async function createAdminAccount(connection: AdminConnection,input: CreateAccountInput,diff --git a/web-studio/src/routes/users/-components/user-pagination.tsx b/web-studio/src/routes/users/-components/user-pagination.tsxnew file mode 100644index 000000000..825d1d156--- /dev/null+++ b/web-studio/src/routes/users/-components/user-pagination.tsx@@ -0,0 +1,92 @@+import { useTranslation } from 'react-i18next'+import { Button } from '#/components/ui/button'+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '#/components/ui/select'++type Props = {+ page: number+ pageCount: number+ pageSize: number+ total: number+ setPage: (page: number) => void+ setPageSize: (size: number) => void+}++export function UserPagination({+ page,+ pageCount,+ pageSize,+ total,+ setPage,+ setPageSize,+}: Props) {+ const { t } = useTranslation('settings')+ return (+ <nav+ aria-label={t('userList.pagination')}+ className="flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3"+ >+ <p className="text-sm text-muted-foreground" aria-live="polite">+ {t('userList.summary', { page, pageCount, total })}+ </p>+ <div className="flex flex-wrap items-center gap-2">+ <Select+ value={String(pageSize)}+ onValueChange={(value) => {+ if (value) setPageSize(Number(value))+ }}+ >+ <SelectTrigger size="sm" aria-label={t('userList.pageSize')}>+ <SelectValue>+ {t('userList.pageSizeValue', { count: pageSize })}+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {[20, 50, 100].map((size) => (+ <SelectItem key={size} value={String(size)}>+ {t('userList.pageSizeValue', { count: size })}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <Button+ variant="outline"+ size="sm"+ disabled={page === 1}+ onClick={() => setPage(1)}+ >+ {t('userList.first')}+ </Button>+ <Button+ variant="outline"+ size="sm"+ disabled={page === 1}+ onClick={() => setPage(page - 1)}+ >+ {t('userList.previous')}+ </Button>+ <Button+ variant="outline"+ size="sm"+ disabled={page === pageCount}+ onClick={() => setPage(page + 1)}+ >+ {t('userList.next')}+ </Button>+ <Button+ variant="outline"+ size="sm"+ disabled={page === pageCount}+ onClick={() => setPage(pageCount)}+ >+ {t('userList.last')}+ </Button>+ </div>+ </nav>+ )+}diff --git a/web-studio/src/routes/users/-lib/use-user-list.test.ts b/web-studio/src/routes/users/-lib/use-user-list.test.tsnew file mode 100644index 000000000..43ee36d71--- /dev/null+++ b/web-studio/src/routes/users/-lib/use-user-list.test.ts@@ -0,0 +1,31 @@+// @vitest-environment jsdom+import { act, renderHook } from '@testing-library/react'+import { describe, expect, it } from 'vitest'+import { useUserList } from './use-user-list'++describe('user list request state', () => {+ it('resets the page when searching or changing page size', () => {+ const { result } = renderHook(() => useUserList('account'))+ expect(result.current.pageSize).toBe(20)+ act(() => result.current.setPage(142))+ expect(result.current.page).toBe(142)+ act(() => result.current.setSearch('user-2833'))+ expect(result.current.page).toBe(1)+ expect(result.current.search).toBe('user-2833')+ act(() => result.current.setPage(2))+ act(() => result.current.setPageSize(100))+ expect(result.current.page).toBe(1)+ expect(result.current.pageSize).toBe(100)+ })++ it('resets search and page when switching accounts', () => {+ const { result, rerender } = renderHook((scope) => useUserList(scope), {+ initialProps: 'account',+ })+ act(() => result.current.setSearch('alice'))+ act(() => result.current.setPage(2))+ rerender('other-account')+ expect(result.current.search).toBe('')+ expect(result.current.page).toBe(1)+ })+})diff --git a/web-studio/src/routes/users/-lib/use-user-list.ts b/web-studio/src/routes/users/-lib/use-user-list.tsnew file mode 100644index 000000000..6b781e7b7--- /dev/null+++ b/web-studio/src/routes/users/-lib/use-user-list.ts@@ -0,0 +1,23 @@+import { useState } from 'react'++export function useUserList(scope: string) {+ const [state, setState] = useState({+ scope,+ search: '',+ page: 1,+ pageSize: 20,+ })+ const current =+ state.scope === scope+ ? state+ : { scope, search: '', page: 1, pageSize: state.pageSize }+ if (state.scope !== scope) setState(current)+ return {+ ...current,+ setSearch: (search: string) => setState({ ...current, search, page: 1 }),+ setPage: (page: number) =>+ setState({ ...current, page: Math.max(1, page) }),+ setPageSize: (pageSize: number) =>+ setState({ ...current, pageSize, page: 1 }),+ }+}diff --git a/web-studio/src/routes/users/route.tsx b/web-studio/src/routes/users/route.tsxindex ab034cb9b..d56092f36 100644--- a/web-studio/src/routes/users/route.tsx+++ b/web-studio/src/routes/users/route.tsx@@ -18,6 +18,9 @@ import { toast } from 'sonner'import { Badge } from '#/components/ui/badge'import { Button } from '#/components/ui/button'+import { Input } from '#/components/ui/input'+import { UserPagination } from './-components/user-pagination'+import { useUserList } from './-lib/use-user-list'import {Card,CardContent,@@ -58,7 +61,7 @@ import {import { useAppConnection } from '#/hooks/use-app-connection'import {createAdminUser,- fetchAdminUsers,+ fetchAdminUsersPage,regenerateAdminUserKey,removeAdminUser,updateAdminUserRole,@@ -146,17 +149,50 @@ function UserManagementRoute() {],)+ const userList = useUserList(+ JSON.stringify([+ adminConnection.baseUrl,+ adminConnection.apiKey,+ connection.accountId,+ ]),+ )+ const [searchQuery, setSearchQuery] = React.useState('')+ React.useEffect(() => {+ const timer = setTimeout(() => setSearchQuery(userList.search), 250)+ return () => clearTimeout(timer)+ }, [userList.search])const usersQuery = useQuery({- enabled: canManageUsers && Boolean(connection.accountId),- queryFn: () => fetchAdminUsers(adminConnection, connection.accountId),+ enabled:+ canManageUsers &&+ Boolean(connection.accountId) &&+ searchQuery === userList.search,+ queryFn: () =>+ fetchAdminUsersPage(adminConnection, connection.accountId, {+ page: userList.page,+ pageSize: userList.pageSize,+ search: searchQuery,+ }),queryKey: ['managed-users',adminConnection.baseUrl,adminConnection.apiKey,connection.accountId,+ userList.page,+ userList.pageSize,+ searchQuery,],retry: false,})+ const users = usersQuery.data?.users ?? []+ const total = usersQuery.data?.total ?? 0+ const accountTotal = usersQuery.data?.accountTotal ?? 0+ const managerCount = usersQuery.data?.managerCount ?? 0+ const visibleKeys = usersQuery.data?.keyCount ?? 0+ const pageCount = Math.max(1, Math.ceil(total / userList.pageSize))+ React.useEffect(() => {+ if (usersQuery.isSuccess && userList.page > pageCount)+ userList.setPage(pageCount)+ }, [usersQuery.isSuccess, userList, pageCount])const createUser = useMutation({mutationFn: (input: CreateUserInput) =>@@ -302,13 +338,6 @@ function UserManagementRoute() {)}- const users = usersQuery.data ?? []- const managerCount = users.filter(- (user) => user.role === 'admin' || user.role === 'root',- ).length- const visibleKeys = users.filter(- (user) => user.apiKey || user.keyPrefix,- ).lengthreturn (<div className="flex w-full min-w-0 flex-col gap-5"><header className="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">@@ -370,7 +399,7 @@ function UserManagementRoute() {{t('stats.users')}</p><p className="mt-1 text-2xl font-semibold tabular-nums">- {users.length || '-'}+ {usersQuery.isSuccess ? accountTotal : '-'}</p></div><div className="flex size-10 items-center justify-center rounded-md border bg-background/70 text-primary">@@ -385,7 +414,7 @@ function UserManagementRoute() {{t('stats.apiKeys')}</p><p className="mt-1 text-2xl font-semibold tabular-nums">- {visibleKeys || '-'}+ {usersQuery.isSuccess ? visibleKeys : '-'}</p></div><div className="flex size-10 items-center justify-center rounded-md border bg-background/70 text-primary">@@ -405,9 +434,17 @@ function UserManagementRoute() {: 'management.memberListDescription',)}</CardDescription>+ <Input+ type="search"+ className="max-w-sm"+ aria-label={t('userList.search')}+ placeholder={t('userList.search')}+ value={userList.search}+ onChange={(event) => userList.setSearch(event.target.value)}+ /></CardHeader><CardContent className="p-0">- {usersQuery.isLoading ? (+ {usersQuery.isPending || searchQuery !== userList.search ? (<div className="flex min-h-56 items-center justify-center gap-2 text-sm text-muted-foreground"><LoaderCircleIcon className="size-4 animate-spin" />{t('loading')}@@ -419,11 +456,17 @@ function UserManagementRoute() {{getErrorMessage(usersQuery.error)}</p></div>- ) : users.length === 0 ? (+ ) : total === 0 ? (<div className="flex min-h-56 flex-col items-center justify-center gap-2 px-6 text-center">- <p className="font-medium">{t('empty.usersTitle')}</p>+ <p className="font-medium">+ {t(accountTotal ? 'userList.noResults' : 'empty.usersTitle')}+ </p><p className="text-sm text-muted-foreground">- {t('empty.usersDescription')}+ {t(+ accountTotal+ ? 'userList.noResultsDescription'+ : 'empty.usersDescription',+ )}</p></div>) : (@@ -649,6 +692,11 @@ function UserManagementRoute() {})}</TableBody></Table>+ <UserPagination+ {...userList}+ total={total}+ pageCount={pageCount}+ /></div>)}</CardContent>