feat: remove login logs clear

This commit is contained in:
engigu
2026-03-10 15:05:25 +08:00
parent 44ab6b39f7
commit 27a7bfb147
+1 -46
View File
@@ -3,18 +3,7 @@ import { ref, onMounted } from 'vue'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
import Pagination from '@/components/Pagination.vue' import Pagination from '@/components/Pagination.vue'
import { RefreshCw, Search, Loader2, Trash2 } from 'lucide-vue-next' import { RefreshCw, Search, Loader2 } from 'lucide-vue-next'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import { LOG_CATEGORY } from '@/api'
import TextOverflow from '@/components/TextOverflow.vue' import TextOverflow from '@/components/TextOverflow.vue'
import { api } from '@/api' import { api } from '@/api'
import { toast } from 'vue-sonner' import { toast } from 'vue-sonner'
@@ -59,7 +48,6 @@ const filterUsername = ref('')
const currentPage = ref(1) const currentPage = ref(1)
const total = ref(0) const total = ref(0)
const loading = ref(false) const loading = ref(false)
const showClearConfirm = ref(false)
let searchTimer: ReturnType<typeof setTimeout> | null = null let searchTimer: ReturnType<typeof setTimeout> | null = null
// IP 地理位置弹窗 // IP 地理位置弹窗
@@ -115,17 +103,6 @@ function handlePageChange(page: number) {
loadLogs() loadLogs()
} }
async function handleClear() {
try {
await api.appLogs.clear(LOG_CATEGORY.LOGIN_LOG)
toast.success('清空成功')
currentPage.value = 1
loadLogs()
} catch (e: any) {
toast.error('清空失败: ' + (e.message || ''))
}
}
onMounted(loadLogs) onMounted(loadLogs)
</script> </script>
@@ -143,28 +120,6 @@ onMounted(loadLogs)
title="刷新"> title="刷新">
<RefreshCw class="h-4 w-4" :class="{ 'animate-spin': loading }" /> <RefreshCw class="h-4 w-4" :class="{ 'animate-spin': loading }" />
</Button> </Button>
<AlertDialog :open="showClearConfirm" @update:open="showClearConfirm = $event">
<Button variant="outline"
class="h-9 px-4 shrink-0 text-sm text-destructive hover:bg-destructive/10 hover:text-destructive border-destructive/20"
@click="showClearConfirm = true">
<Trash2 class="h-4 w-4 sm:mr-2" /> <span class="hidden sm:inline"
style="padding-left: 2px;">清空记录</span>
</Button>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>确认清空所有登录日志</AlertDialogTitle>
<AlertDialogDescription>
此操作将永久清空所有记录操作后无法恢复确认要继续吗
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>取消</AlertDialogCancel>
<AlertDialogAction @click="handleClear" variant="destructive">
确认清空
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div> </div>
</div> </div>
</div> </div>