Enhance user and media management with sorting and statistics: add sorting options to user and media listing endpoints, implement media statistics retrieval, and update frontend components for sorting and displaying media processing times. Refactor related query handlers and API types to support new features.
build / backend (push) Successful in 1m35s
build / frontend (push) Successful in 31s
tests / backend-tests (push) Successful in 1m48s

This commit is contained in:
Leonid Pershin
2026-07-26 00:28:22 +03:00
parent d6ad8e11a4
commit 64a2dade74
27 changed files with 1634 additions and 39 deletions
@@ -18,6 +18,7 @@ import {
} from '@/shared/ui/dialog'
import { Input } from '@/shared/ui/input'
import { Label } from '@/shared/ui/label'
import { SortHeader, sortRows, useTableSort } from '@/shared/ui/sortable'
import { toast } from '@/shared/ui/toast-store'
import { createRole, deleteRole, listRoles, updateRole } from './api'
@@ -27,6 +28,11 @@ export function RolesPanel() {
const { t } = useTranslation()
const queryClient = useQueryClient()
const { data: roles, isLoading } = useQuery({ queryKey: ['admin', 'roles'], queryFn: listRoles })
const { sort, toggle } = useTableSort('name', false)
const sortedRoles = sortRows(roles ?? [], sort, {
name: (r) => r.name.toLowerCase(),
system: (r) => r.isSystem,
})
const invalidate = () => queryClient.invalidateQueries({ queryKey: ['admin', 'roles'] })
@@ -97,8 +103,18 @@ export function RolesPanel() {
<table className="w-full text-sm">
<thead className="border-b border-border text-left text-muted-foreground">
<tr>
<th className="px-4 py-2 font-medium">{t('admin.roles.name')}</th>
<th className="px-4 py-2 font-medium">{t('admin.roles.system')}</th>
<SortHeader
label={t('admin.roles.name')}
sortKey="name"
sort={sort}
onToggle={toggle}
/>
<SortHeader
label={t('admin.roles.system')}
sortKey="system"
sort={sort}
onToggle={toggle}
/>
<th className="px-4 py-2 font-medium">{t('common.actions')}</th>
</tr>
</thead>
@@ -110,7 +126,7 @@ export function RolesPanel() {
</td>
</tr>
)}
{roles?.map((role) => (
{sortedRoles.map((role) => (
<tr key={role.id} className="border-b border-border last:border-0">
<td className="px-4 py-2">{role.name}</td>
<td className="px-4 py-2">