feat: 重构接口日志页面与接口监控看板,支持HTTP方法过滤和实时轮询
This commit is contained in:
@@ -462,6 +462,64 @@ export const customPagesApi = {
|
||||
delete: (id: number) => api.delete(`/api/custom-pages/${id}`),
|
||||
}
|
||||
|
||||
// ——— External API Logs ———
|
||||
export interface ExternalApiLogData {
|
||||
id: number
|
||||
direction: string
|
||||
target_type: string
|
||||
target_id: number | null
|
||||
target_name: string | null
|
||||
method: string
|
||||
path: string
|
||||
url_host: string
|
||||
status_code: number | null
|
||||
success: boolean
|
||||
duration_ms: number
|
||||
error_type: string | null
|
||||
error_message: string | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface ExternalApiLogSummaryItem {
|
||||
direction: string
|
||||
target_type: string
|
||||
target_id: number | null
|
||||
target_name: string | null
|
||||
method: string
|
||||
path: string
|
||||
call_count: number
|
||||
success_count: number
|
||||
fail_count: number
|
||||
avg_duration_ms: number
|
||||
max_duration_ms: number
|
||||
slow_count: number
|
||||
}
|
||||
|
||||
export const externalApiLogsApi = {
|
||||
list: (params?: {
|
||||
direction?: string
|
||||
target_type?: string
|
||||
target_id?: number
|
||||
method?: string
|
||||
success?: boolean
|
||||
status_code?: number
|
||||
path?: string
|
||||
limit?: number
|
||||
offset?: number
|
||||
}) => api.get<ExternalApiLogData[]>('/api/external-api-logs', { params }),
|
||||
count: (params?: {
|
||||
direction?: string
|
||||
target_type?: string
|
||||
target_id?: number
|
||||
method?: string
|
||||
success?: boolean
|
||||
status_code?: number
|
||||
path?: string
|
||||
}) => api.get<{ total: number }>('/api/external-api-logs/count', { params }),
|
||||
summary: (params?: { slow_ms?: number }) =>
|
||||
api.get<ExternalApiLogSummaryItem[]>('/api/external-api-logs/summary', { params }),
|
||||
}
|
||||
|
||||
// ——— Auth Capture ———
|
||||
export interface BrowserImportSession {
|
||||
session_id: string
|
||||
|
||||
@@ -47,6 +47,13 @@
|
||||
<small>响应记录、筛选、追踪异常</small>
|
||||
</span>
|
||||
</router-link>
|
||||
<router-link to="/external-api-logs" class="nav-item" active-class="active" @click="closeMobileNav">
|
||||
<span class="nav-icon"><el-icon><Monitor /></el-icon></span>
|
||||
<span class="nav-copy">
|
||||
<strong>接口日志</strong>
|
||||
<small>外部请求耗时、慢接口汇总</small>
|
||||
</span>
|
||||
</router-link>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ const router = createRouter({
|
||||
{ path: 'websites', component: () => import('@/views/Websites.vue') },
|
||||
{ path: 'webhooks', component: () => import('@/views/Webhooks.vue') },
|
||||
{ path: 'logs', component: () => import('@/views/NotificationLogs.vue') },
|
||||
{ path: 'external-api-logs', component: () => import('@/views/ExternalApiLogs.vue') },
|
||||
{ path: 'custom-pages', component: () => import('@/views/CustomPages.vue') },
|
||||
{ path: 'page/:id', redirect: '/custom-pages' },
|
||||
],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user