From 1d621ece7fd8bd346456d6ac05bdccb17d2695aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20B=C3=BCchse?= Date: Sun, 3 Nov 2024 21:21:44 +0000 Subject: [PATCH] UX improvement: table_full leads to detail_full (#798) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matthias Büchse --- compliance-monitor/monitor.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compliance-monitor/monitor.py b/compliance-monitor/monitor.py index aa02cbae1..413c9f473 100755 --- a/compliance-monitor/monitor.py +++ b/compliance-monitor/monitor.py @@ -544,13 +544,13 @@ async def get_status( return convert_result_rows_to_dict2(rows2, get_scopes(), include_report=True) -def render_view(view, view_type, base_url='/', title=None, **kwargs): +def render_view(view, view_type, detail_page='detail', base_url='/', title=None, **kwargs): media_type = {ViewType.markdown: 'text/markdown'}.get(view_type, 'text/html') stage1 = stage2 = view[view_type] if view_type is ViewType.page: stage1 = view[ViewType.fragment] def scope_url(uuid): return f"{base_url}page/scope/{uuid}" # noqa: E306,E704 - def detail_url(subject, scope): return f"{base_url}page/detail/{subject}/{scope}" # noqa: E306,E704 + def detail_url(subject, scope): return f"{base_url}page/{detail_page}/{subject}/{scope}" # noqa: E306,E704 def report_url(report): return f"{base_url}reports/{report}" # noqa: E306,E704 fragment = templates_map[stage1].render(detail_url=detail_url, report_url=report_url, scope_url=scope_url, **kwargs) if view_type != ViewType.markdown and stage1.endswith('.md'): @@ -618,7 +618,11 @@ async def get_table_full( with conn.cursor() as cur: rows2 = db_get_relevant_results2(cur, approved_only=False) results2 = convert_result_rows_to_dict2(rows2, get_scopes()) - return render_view(VIEW_TABLE, view_type, results=results2, base_url=settings.base_url, title="SCS compliance overview") + return render_view( + VIEW_TABLE, view_type, results=results2, + detail_page='detail_full', base_url=settings.base_url, + title="SCS compliance overview", + ) @app.get("/{view_type}/scope/{scopeuuid}")