fix: keep related fact views in place and clarify import outcomes

This commit is contained in:
Ed1s0nZ committed 2026-10-06 02:58:56 +08:00
1 parent fa4e5ef4cb
commit bb96a084e0
9 files changed
+96 -20

No files matched your search

+2 -16
View File
@@ -1901,28 +1901,16 @@ function openVulnerabilityDetail(vulnId) {
async function viewFactsForVulnerability(vulnId) {
if (!currentProjectId) return;
switchProjectTab('facts');
const searchEl = document.getElementById('project-facts-search');
const catEl = document.getElementById('project-facts-filter-category');
const confEl = document.getElementById('project-facts-filter-confidence');
const sparseEl = document.getElementById('project-facts-filter-sparse');
const hideDepEl = document.getElementById('project-facts-filter-hide-deprecated');
if (searchEl) searchEl.value = '';
if (catEl) catEl.value = '';
if (confEl) confEl.value = '';
if (sparseEl) sparseEl.checked = false;
if (hideDepEl) hideDepEl.checked = true;
const params = new URLSearchParams({ limit: '50', related_vulnerability_id: vulnId });
const res = await apiFetch(`/api/projects/${currentProjectId}/facts?${params}`);
if (!res.ok) return alert(tp('projects.loadRelatedFactsFailed'));
const facts = await res.json();
if (!facts.length) {
alert(tp('projects.noFactsForVulnerability'));
loadProjectFacts();
return;
}
if (facts.length === 1) {
viewProjectFactBody(facts[0].fact_key);
await viewProjectFactBody(facts[0].fact_key);
return;
}
const pick = prompt(
@@ -1933,12 +1921,10 @@ async function viewFactsForVulnerability(vulnId) {
}) || `This vulnerability is linked to ${facts.length} facts. Enter index to view:\n${facts.map((f, i) => `${i + 1}. ${f.fact_key}`).join('\n')}`,
);
if (pick == null || pick === '') {
loadProjectFacts();
return;
}
const idx = parseInt(pick, 10) - 1;
if (facts[idx]) viewProjectFactBody(facts[idx].fact_key);
else loadProjectFacts();
if (facts[idx]) await viewProjectFactBody(facts[idx].fact_key);
}
function openProjectsOverlay(id, opts) {