generated from coulomb/repo-seed
search and inspection polish
This commit is contained in:
@@ -184,7 +184,11 @@ def search_page(
|
||||
<tr>
|
||||
<td><a href="/ui/repos/{result.repository_id}">{escape(result.repository_name)}</a></td>
|
||||
<td><span class="pill">{escape(result.match_type)}</span></td>
|
||||
<td>{escape(result.match_name)}</td>
|
||||
<td>
|
||||
<strong>{escape(result.match_name)}</strong>
|
||||
{render_search_context(asdict(result))}
|
||||
</td>
|
||||
<td>{escape(result.matched_field)}</td>
|
||||
<td>{result.confidence:.2f}</td>
|
||||
</tr>
|
||||
"""
|
||||
@@ -208,7 +212,7 @@ def search_page(
|
||||
</section>
|
||||
<section class="panel" style="margin-top:18px">
|
||||
<table>
|
||||
<thead><tr><th>Repository</th><th>Match</th><th>Name</th><th>Confidence</th></tr></thead>
|
||||
<thead><tr><th>Repository</th><th>Match</th><th>Name</th><th>Field</th><th>Confidence</th></tr></thead>
|
||||
<tbody>{rows or empty}</tbody>
|
||||
</table>
|
||||
</section>
|
||||
@@ -917,3 +921,20 @@ def render_sources(source_refs: list[dict]) -> str:
|
||||
if len(source_refs) > 5:
|
||||
sources += f' <span class="muted">+{len(source_refs) - 5} more</span>'
|
||||
return f"<p>{sources}</p>"
|
||||
|
||||
|
||||
def render_search_context(result: dict) -> str:
|
||||
details = []
|
||||
if result.get("ability_name"):
|
||||
details.append(f"Ability: {escape(result['ability_name'])}")
|
||||
if result.get("capability_name"):
|
||||
details.append(f"Capability: {escape(result['capability_name'])}")
|
||||
if result.get("evidence_level"):
|
||||
details.append(f"Evidence: {escape(result['evidence_level'])}")
|
||||
if result.get("source_reference"):
|
||||
details.append(f"Source: {escape(result['source_reference'])}")
|
||||
if result.get("match_description"):
|
||||
details.append(escape(result["match_description"]))
|
||||
if not details:
|
||||
return ""
|
||||
return f'<p class="muted">{" · ".join(details)}</p>'
|
||||
|
||||
Reference in New Issue
Block a user