fix(home): render findings flat — drop per-tool grouping
The home page was calling ``render_findings_panel``, which groups findings by tool into expanders and renders an "Open <Tool>" page link under each. After uploading a file, the user still saw a tool list (just under a different shape) — defeating the earlier cleanup that removed the tool-cards grid. Inline a flat renderer in ``_home_page``: per uploaded file, render the filename header + severity summary + a flat list of findings via ``_render_one_finding`` directly. No expanders, no tool names as section headers, no per-tool page-link buttons. Tool discovery happens in the sidebar. ``render_findings_panel`` itself is unchanged — it still groups by tool and remains tested via the findings-panel harness, but is no longer used on the home page. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,8 +31,13 @@ if str(_project_root) not in sys.path:
|
||||
|
||||
def _home_page() -> None:
|
||||
"""Render the home page — multi-file upload + per-file analysis."""
|
||||
from src.gui.components import hide_streamlit_chrome, render_findings_panel
|
||||
from src.gui.components._legacy import _run_analysis_on_upload
|
||||
from src.gui.components import hide_streamlit_chrome
|
||||
from src.gui.components._legacy import (
|
||||
_render_one_finding,
|
||||
_run_analysis_on_upload,
|
||||
_SEVERITY_ICON,
|
||||
)
|
||||
from src.core.text_clean import hidden_char_css
|
||||
from src.i18n import t
|
||||
|
||||
st.set_page_config(
|
||||
@@ -121,18 +126,39 @@ def _home_page() -> None:
|
||||
|
||||
if findings_by_file:
|
||||
st.divider()
|
||||
# Hidden-char badge CSS is needed once for any finding-sample
|
||||
# tables ``_render_one_finding`` may emit further down.
|
||||
st.markdown(hidden_char_css(), unsafe_allow_html=True)
|
||||
|
||||
# Preserve uploader order so the user sees results in the same
|
||||
# order they appear in the file list above.
|
||||
# order they appear in the file list above. Findings render as
|
||||
# a flat list per file — no per-tool grouping, no "Open <Tool>"
|
||||
# buttons. Tool discovery happens in the sidebar.
|
||||
for f in uploaded_files:
|
||||
if f.name not in findings_by_file:
|
||||
continue
|
||||
findings = findings_by_file[f.name]
|
||||
with st.container(border=True):
|
||||
st.markdown(f"### 📄 {f.name}")
|
||||
if not findings:
|
||||
st.markdown(f"### 📄 {f.name}")
|
||||
st.success(t("findings.none"))
|
||||
else:
|
||||
render_findings_panel(findings, header=f"📄 {f.name}")
|
||||
continue
|
||||
by_sev: dict[str, int] = {}
|
||||
for finding in findings:
|
||||
by_sev[finding.severity] = by_sev.get(finding.severity, 0) + 1
|
||||
summary = " · ".join(
|
||||
t(
|
||||
"findings.severity_summary_segment",
|
||||
icon=_SEVERITY_ICON[s],
|
||||
n=by_sev[s],
|
||||
severity=s,
|
||||
)
|
||||
for s in ("error", "warn", "info") if by_sev.get(s)
|
||||
)
|
||||
if summary:
|
||||
st.caption(summary)
|
||||
for finding in findings:
|
||||
_render_one_finding(finding)
|
||||
|
||||
st.divider()
|
||||
st.caption(t("chrome.footer"))
|
||||
|
||||
Reference in New Issue
Block a user