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 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-03-04 21:53:26 +01:00
parent 0a365515e9
commit 5da0b5f4df

View File

@@ -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 |_| {