Add files via upload

This commit is contained in:
公明
2026-06-09 20:23:09 +08:00
committed by GitHub
parent abef51b805
commit 3392fefedf
8 changed files with 613 additions and 61 deletions
+25 -18
View File
@@ -855,11 +855,6 @@ function renderVulnerabilities(vulnerabilities) {
if (typeof window.applyTranslations === 'function') {
window.applyTranslations(listContainer);
}
// 清空分页信息
const paginationContainer = document.getElementById('vulnerability-pagination');
if (paginationContainer) {
paginationContainer.innerHTML = '';
}
return;
}
@@ -960,12 +955,6 @@ function renderVulnerabilityPagination() {
const { currentPage, totalPages, total, pageSize } = vulnerabilityPagination;
// 如果没有数据,不显示分页控件
if (total === 0) {
paginationContainer.innerHTML = '';
return;
}
// 计算显示范围
const start = total === 0 ? 0 : (currentPage - 1) * pageSize + 1;
const end = total === 0 ? 0 : Math.min(currentPage * pageSize, total);
@@ -1052,13 +1041,23 @@ async function populateVulnerabilityModalProjectSelect(selectedId) {
const sel = document.getElementById('vulnerability-project-id');
if (!sel) return;
try {
const res = await apiFetch('/api/projects?limit=200');
if (res.ok) {
const list = await res.json();
let list = [];
if (typeof fetchAllProjects === 'function') {
list = await fetchAllProjects();
} else {
const res = await apiFetch('/api/projects?limit=500');
if (res.ok) {
const data = await res.json();
list = typeof parseProjectsListResponse === 'function'
? parseProjectsListResponse(data).items
: (Array.isArray(data) ? data : (data.projects || []));
}
}
if (list.length) {
if (typeof rebuildProjectNameMap === 'function') {
rebuildProjectNameMap(list);
} else if (typeof projectNameById !== 'undefined') {
(list || []).forEach((p) => { if (p.id) projectNameById[p.id] = p.name || p.id; });
list.forEach((p) => { if (p.id) projectNameById[p.id] = p.name || p.id; });
}
}
} catch (e) {
@@ -1722,9 +1721,17 @@ async function refreshVulnerabilityProjectFilter() {
const sel = document.getElementById('vulnerability-project-filter');
if (!sel) return;
try {
const res = await apiFetch('/api/projects?limit=200');
if (!res.ok) return;
const list = await res.json();
let list = [];
if (typeof fetchAllProjects === 'function') {
list = await fetchAllProjects(true);
} else {
const res = await apiFetch('/api/projects?limit=500');
if (!res.ok) return;
const data = await res.json();
list = typeof parseProjectsListResponse === 'function'
? parseProjectsListResponse(data).items
: (Array.isArray(data) ? data : (data.projects || []));
}
if (typeof rebuildProjectNameMap === 'function') {
rebuildProjectNameMap(list);
} else if (typeof projectNameById !== 'undefined') {