Enhance admin endpoints and queries for improved filtering and management
- Updated `ListPaymentRequestsQuery` to include `Kind` and `Search` parameters for better filtering of payment requests. - Enhanced `ListAuditLogsQuery` to support additional filters: `Source`, `TargetType`, and `Action`, improving audit log retrieval. - Modified `ListUsersQuery` to accept new filters: `RoleId`, `IsActivated`, `IsBlocked`, and `BillingExpired`, allowing for more granular user management. - Introduced `DeleteInbound` endpoint to allow deletion of inbounds that are not currently available, enhancing inbound management capabilities. - Updated frontend API calls to reflect new query parameters and support for additional filtering options in the admin interface. - Revised API documentation to include new parameters and endpoint functionalities for better clarity and usage guidance.
This commit is contained in:
@@ -4,9 +4,14 @@ import { useQuery } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Button } from '@/shared/ui/button'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/shared/ui/card'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/shared/ui/select'
|
||||
import { TicketStatusBadge } from '@/features/support/TicketStatusBadge'
|
||||
import { AdminTicketDetailDialog } from '@/features/admin/support/AdminTicketDetailDialog'
|
||||
import { listAllTickets } from '@/features/admin/support/api'
|
||||
import type { TicketStatus, TicketType } from '@/shared/api/types'
|
||||
|
||||
const TYPES: TicketType[] = ['BugReport', 'RoleRequest', 'ExtensionRequest']
|
||||
const STATUSES: TicketStatus[] = ['Open', 'Resolved', 'Closed']
|
||||
|
||||
export const Route = createFileRoute('/admin/support')({
|
||||
component: AdminSupportPage,
|
||||
@@ -24,14 +29,60 @@ function AdminSupportPage() {
|
||||
const navigate = useNavigate({ from: Route.fullPath })
|
||||
const { ticket: selectedTicketId } = Route.useSearch()
|
||||
const [page, setPage] = useState(1)
|
||||
const [type, setType] = useState<TicketType | 'all'>('all')
|
||||
const [status, setStatus] = useState<TicketStatus | 'all'>('all')
|
||||
|
||||
const typeFilter = type === 'all' ? undefined : type
|
||||
const statusFilter = status === 'all' ? undefined : status
|
||||
|
||||
const { data, isLoading, isError, refetch } = useQuery({
|
||||
queryKey: ['admin-tickets', page],
|
||||
queryFn: () => listAllTickets(undefined, undefined, page, PAGE_SIZE),
|
||||
queryKey: ['admin-tickets', page, typeFilter, statusFilter],
|
||||
queryFn: () => listAllTickets(typeFilter, statusFilter, page, PAGE_SIZE),
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Select
|
||||
value={type}
|
||||
onValueChange={(v) => {
|
||||
setType(v as TicketType | 'all')
|
||||
setPage(1)
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="w-56">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">{t('admin.support.allTypes')}</SelectItem>
|
||||
{TYPES.map((ty) => (
|
||||
<SelectItem key={ty} value={ty}>
|
||||
{t(`support.type.${ty}`)}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select
|
||||
value={status}
|
||||
onValueChange={(v) => {
|
||||
setStatus(v as TicketStatus | 'all')
|
||||
setPage(1)
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="w-48">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">{t('admin.support.allStatuses')}</SelectItem>
|
||||
{STATUSES.map((st) => (
|
||||
<SelectItem key={st} value={st}>
|
||||
{t(`support.status.${st}`)}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{isLoading && <p className="text-sm text-muted-foreground">…</p>}
|
||||
|
||||
{isError && (
|
||||
|
||||
Reference in New Issue
Block a user