From 5da0b5f4df9ff380b8aecb0edc0fdff3b380540f Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Wed, 4 Mar 2026 21:53:26 +0100 Subject: [PATCH] Fix Last Scanned display and add Graph button in repositories page - Show updated_at as relative time (e.g. "5m ago", "3d ago") instead of the last_scanned_commit hex SHA which was not a date - Add Graph link button next to Scan button for quick navigation to the repository's code knowledge graph Co-Authored-By: Claude Opus 4.6 --- .../src/pages/repositories.rs | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/compliance-dashboard/src/pages/repositories.rs b/compliance-dashboard/src/pages/repositories.rs index eb6d4f1..91a6e4e 100644 --- a/compliance-dashboard/src/pages/repositories.rs +++ b/compliance-dashboard/src/pages/repositories.rs @@ -1,5 +1,6 @@ use dioxus::prelude::*; +use crate::app::Route; use crate::components::page_header::PageHeader; use crate::components::pagination::Pagination; use crate::components::toast::{ToastType, Toasts}; @@ -122,12 +123,29 @@ pub fn RepositoriesPage() -> Element { td { "{repo.default_branch}" } td { "{repo.findings_count}" } td { - match &repo.last_scanned_commit { - Some(sha) => rsx! { span { style: "font-family: monospace; font-size: 12px;", "{&sha[..7.min(sha.len())]}" } }, - None => rsx! { span { style: "color: var(--text-secondary);", "Never" } }, + { + let now = chrono::Utc::now(); + let diff = now.signed_duration_since(repo.updated_at); + let label = if diff.num_minutes() < 1 { + "just now".to_string() + } else if diff.num_hours() < 1 { + format!("{}m ago", diff.num_minutes()) + } else if diff.num_days() < 1 { + format!("{}h ago", diff.num_hours()) + } else if diff.num_days() < 30 { + format!("{}d ago", diff.num_days()) + } else { + repo.updated_at.format("%Y-%m-%d").to_string() + }; + rsx! { span { style: "font-size: 12px;", "{label}" } } } } - td { + td { style: "display: flex; gap: 4px;", + Link { + to: Route::GraphExplorerPage { repo_id: repo_id.clone() }, + class: "btn btn-ghost", + "Graph" + } button { class: "btn btn-ghost", onclick: move |_| {