generated from coulomb/repo-seed
Repository detail page when approved
This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from html import escape
|
from html import escape
|
||||||
|
from urllib.parse import quote_plus
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Form, HTTPException, Query
|
from fastapi import APIRouter, Depends, Form, HTTPException, Query
|
||||||
from fastapi.responses import HTMLResponse, PlainTextResponse, RedirectResponse
|
from fastapi.responses import HTMLResponse, PlainTextResponse, RedirectResponse
|
||||||
@@ -527,6 +528,7 @@ def repository_detail(
|
|||||||
facts_count=None,
|
facts_count=None,
|
||||||
base_href=f"/ui/repos/{repository_id}/elements?scope=approved",
|
base_href=f"/ui/repos/{repository_id}/elements?scope=approved",
|
||||||
)}
|
)}
|
||||||
|
{render_approved_registry_actions(repository_id, asdict(ability_map))}
|
||||||
<h2>Latest Candidate Graph</h2>
|
<h2>Latest Candidate Graph</h2>
|
||||||
{render_latest_candidate_counts(repository_id, latest_candidate, service)}
|
{render_latest_candidate_counts(repository_id, latest_candidate, service)}
|
||||||
{render_ability_map(asdict(ability_map), repository_id)}
|
{render_ability_map(asdict(ability_map), repository_id)}
|
||||||
@@ -1768,6 +1770,24 @@ def render_count_pills(
|
|||||||
return "".join(items)
|
return "".join(items)
|
||||||
|
|
||||||
|
|
||||||
|
def render_approved_registry_actions(repository_id: int, ability_map: dict) -> str:
|
||||||
|
abilities = ability_map.get("abilities", [])
|
||||||
|
if not abilities:
|
||||||
|
return ""
|
||||||
|
search_query = abilities[0]["name"]
|
||||||
|
return f"""
|
||||||
|
<div class="notice" style="margin-top:12px">
|
||||||
|
<h3>Use Approved Registry</h3>
|
||||||
|
<div class="actions">
|
||||||
|
<a class="button secondary" href="/ui/search?q={quote_plus(search_query)}">Search Profile</a>
|
||||||
|
<a class="button secondary" href="/ui/discovery">Discovery</a>
|
||||||
|
<a class="button secondary" href="/ui/repos/{repository_id}/export">Export</a>
|
||||||
|
<a class="button secondary" href="/ui/repos/{repository_id}/elements?scope=approved&type=abilities">Approved Elements</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def graph_element_rows(graph: dict, item_type: str) -> list[dict]:
|
def graph_element_rows(graph: dict, item_type: str) -> list[dict]:
|
||||||
rows: list[dict] = []
|
rows: list[dict] = []
|
||||||
for ability in graph.get("abilities", []):
|
for ability in graph.get("abilities", []):
|
||||||
|
|||||||
@@ -1166,6 +1166,12 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
|||||||
assert "2 candidate capabilities" in approved_detail.text
|
assert "2 candidate capabilities" in approved_detail.text
|
||||||
assert "2 candidate features" in approved_detail.text
|
assert "2 candidate features" in approved_detail.text
|
||||||
assert "7 candidate facts" in approved_detail.text
|
assert "7 candidate facts" in approved_detail.text
|
||||||
|
assert "Use Approved Registry" in approved_detail.text
|
||||||
|
assert "Search Profile" in approved_detail.text
|
||||||
|
assert "Discovery" in approved_detail.text
|
||||||
|
assert "Export" in approved_detail.text
|
||||||
|
assert "Approved Elements" in approved_detail.text
|
||||||
|
assert "q=Report+Service+Status" in approved_detail.text
|
||||||
assert (
|
assert (
|
||||||
f"/ui/repos/{repository_id}/elements?scope=approved&type=abilities"
|
f"/ui/repos/{repository_id}/elements?scope=approved&type=abilities"
|
||||||
in approved_detail.text
|
in approved_detail.text
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ against feature granularity collapsing into one feature per observed fact.
|
|||||||
|
|
||||||
```task
|
```task
|
||||||
id: RREG-WP-0003-T03
|
id: RREG-WP-0003-T03
|
||||||
status: in_progress
|
status: done
|
||||||
priority: medium
|
priority: medium
|
||||||
state_hub_task_id: "5c4b5bb1-390c-4782-bb70-104b0006fe67"
|
state_hub_task_id: "5c4b5bb1-390c-4782-bb70-104b0006fe67"
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user