fix: optimize compliance scan performance and improve error handling
- Refactor scan_compliance to eliminate N+1 queries using joinedload and batch loading - Add try-except wrapper in compliance scan API endpoint - Improve frontend axios error interceptor to display detail/message/timeout errors - Update CORS config and nginx for domain deployment
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
# HTTP redirect to HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name datapointer.cnroc.cn localhost _;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name datapointer.cnroc.cn localhost _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# SSL certificates
|
||||
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
|
||||
@@ -35,7 +35,7 @@ export function deleteProject(id: number) {
|
||||
}
|
||||
|
||||
export function autoClassifyProject(id: number, background: boolean = true) {
|
||||
return request.post(`/projects/${id}/auto-classify`, null, { params: { background } })
|
||||
return request.post(`/projects/${id}/auto-classify`, undefined, { params: { background } })
|
||||
}
|
||||
|
||||
export function getAutoClassifyStatus(id: number) {
|
||||
|
||||
@@ -36,7 +36,11 @@ request.interceptors.response.use(
|
||||
localStorage.removeItem('dp_refresh')
|
||||
window.location.href = '/login'
|
||||
} else {
|
||||
ElMessage.error((error.response?.data as any)?.message || '网络错误')
|
||||
const data = error.response?.data as any
|
||||
const detail = Array.isArray(data?.detail)
|
||||
? data.detail.map((d: any) => d.msg || JSON.stringify(d)).join(', ')
|
||||
: data?.detail
|
||||
ElMessage.error(detail || data?.message || error.message || '网络错误')
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
@@ -220,7 +220,8 @@ async function handleAutoClassify(p: ProjectItem) {
|
||||
}
|
||||
fetchData()
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '自动分类失败')
|
||||
const msg = e?.response?.data?.detail || e?.response?.data?.message || e?.message || '自动分类失败'
|
||||
ElMessage.error(msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user