revert(home): keep per-tool grouping for per-file findings
Restoring ``render_findings_panel`` on the home page. Previous commit (c575efd) inlined a flat renderer that dropped the per-tool grouping and the "Open <Tool>" jump links — that was an over-correction. The user only wanted the bottom tool-card grid gone (already removed inff2eaeb). The grouping inside the findings panel is what lets a user land on a specific finding and one-click into the cleaner that fixes it; without it they'd have to guess which sidebar entry to open. Tool-card grid stays removed. Sidebar nav is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,13 +31,8 @@ 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
|
||||
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.gui.components import hide_streamlit_chrome, render_findings_panel
|
||||
from src.gui.components._legacy import _run_analysis_on_upload
|
||||
from src.i18n import t
|
||||
|
||||
st.set_page_config(
|
||||
@@ -126,39 +121,22 @@ 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. Findings render as
|
||||
# a flat list per file — no per-tool grouping, no "Open <Tool>"
|
||||
# buttons. Tool discovery happens in the sidebar.
|
||||
# order they appear in the file list above. Each file's findings
|
||||
# render via ``render_findings_panel`` so the per-tool grouping
|
||||
# (and the "Open <Tool>" jump link under each group) is kept —
|
||||
# that's how the user reaches the cleaner that fixes a specific
|
||||
# finding without hunting through 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"))
|
||||
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)
|
||||
else:
|
||||
render_findings_panel(findings, header=f"📄 {f.name}")
|
||||
|
||||
st.divider()
|
||||
st.caption(t("chrome.footer"))
|
||||
|
||||
Reference in New Issue
Block a user