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:
@@ -1,5 +1,6 @@
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
use crate::app::Route;
|
||||||
use crate::components::page_header::PageHeader;
|
use crate::components::page_header::PageHeader;
|
||||||
use crate::components::pagination::Pagination;
|
use crate::components::pagination::Pagination;
|
||||||
use crate::components::toast::{ToastType, Toasts};
|
use crate::components::toast::{ToastType, Toasts};
|
||||||
@@ -122,12 +123,29 @@ pub fn RepositoriesPage() -> Element {
|
|||||||
td { "{repo.default_branch}" }
|
td { "{repo.default_branch}" }
|
||||||
td { "{repo.findings_count}" }
|
td { "{repo.findings_count}" }
|
||||||
td {
|
td {
|
||||||
match &repo.last_scanned_commit {
|
{
|
||||||
Some(sha) => rsx! { span { style: "font-family: monospace; font-size: 12px;", "{&sha[..7.min(sha.len())]}" } },
|
let now = chrono::Utc::now();
|
||||||
None => rsx! { span { style: "color: var(--text-secondary);", "Never" } },
|
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 {
|
button {
|
||||||
class: "btn btn-ghost",
|
class: "btn btn-ghost",
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
|
|||||||
Reference in New Issue
Block a user