Add factory reset functionality and update identity service
- Introduced a new DELETE endpoint `/api/admin/maintenance/factory-reset` for a complete reset of the admin panel, removing all users except the current admin and clearing various data. - Implemented the `FactoryReset` method in `AdminMaintenanceEndpoints` to handle the reset logic. - Added a new method `ListAllUserIdsExceptAsync` in `IIdentityService` to retrieve user IDs excluding a specified user, aiding in the factory reset process. - Updated the frontend to include a confirmation dialog for the factory reset action, enhancing user experience and safety. - Enhanced localization support for the new factory reset feature in both Russian and English, ensuring clarity for all users.
This commit is contained in:
@@ -7,6 +7,7 @@ import { Button } from '@/shared/ui/button'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/shared/ui/card'
|
||||
import { Input } from '@/shared/ui/input'
|
||||
import { deleteClosedTickets, deleteDisabledApps, deleteOldAuditLogs } from '@/features/admin/maintenance/api'
|
||||
import { FactoryResetDialog } from '@/features/admin/maintenance/FactoryResetDialog'
|
||||
|
||||
export const Route = createFileRoute('/admin/maintenance')({ component: AdminMaintenancePage })
|
||||
|
||||
@@ -118,6 +119,25 @@ function AdminMaintenancePage() {
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<details className="group rounded-md border border-red-900/50">
|
||||
<summary className="cursor-pointer select-none px-4 py-3 text-sm font-medium text-red-400">
|
||||
{t('admin.maintenance.factoryReset.dangerZone')}
|
||||
</summary>
|
||||
<div className="border-t border-red-900/50 px-4 py-4">
|
||||
<Card className="border-red-900/50">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base text-red-400">{t('admin.maintenance.factoryReset.title')}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col gap-3">
|
||||
<p className="text-sm text-muted-foreground">{t('admin.maintenance.factoryReset.description')}</p>
|
||||
<div>
|
||||
<FactoryResetDialog />
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user