From c1d23a803fc533bbc14e85affadc97c4510317ea Mon Sep 17 00:00:00 2001 From: arferreira Date: Sun, 8 Mar 2026 13:57:51 -0400 Subject: [PATCH 1/2] Add GitHub links to Recent Activity section --- src/dashboard.rs | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/src/dashboard.rs b/src/dashboard.rs index 269b701..d686213 100644 --- a/src/dashboard.rs +++ b/src/dashboard.rs @@ -6,6 +6,7 @@ use rapina::http::header::CONTENT_TYPE; use rapina::prelude::*; use rapina::response::BoxBody; use rapina::sea_orm::{ColumnTrait, EntityTrait, QueryFilter, QueryOrder, QuerySelect}; +use std::collections::HashMap; use crate::entity::batch::Column as BatchColumn; use crate::entity::merge_event::Column as EventColumn; @@ -114,21 +115,50 @@ pub async fn dashboard(db: Db) -> Result> { } html.push_str(""); - // Recent Activity section + // Recent Activity section — look up PR info for links html.push_str("

Recent Activity

"); if events.is_empty() { html.push_str("

No events yet.

"); } else { + let pr_ids: Vec = events.iter().map(|e| e.pull_request_id).collect(); + let prs = PullRequest::find() + .filter(PrColumn::Id.is_in(pr_ids)) + .all(db.conn()) + .await + .map_err(DbError)?; + let pr_map: HashMap = prs.into_iter().map(|p| (p.id, p)).collect(); + html.push_str( - "", + "
EventPR IDBatch IDDetails
", ); for event in &events { + let pr_cell = if let Some(pr) = pr_map.get(&event.pull_request_id) { + format!( + "#{}", + pr.repo_owner, pr.repo_name, pr.pr_number, pr.pr_number + ) + } else { + format!("#{}", event.pull_request_id) + }; + + let details = match event.details.as_deref() { + Some(sha) if sha.len() >= 7 && sha.chars().all(|c| c.is_ascii_hexdigit()) => { + if let Some(pr) = pr_map.get(&event.pull_request_id) { + format!( + "{}", + pr.repo_owner, pr.repo_name, sha, &sha[..7] + ) + } else { + sha[..7].to_string() + } + } + Some(d) => d.to_string(), + None => "\u{2014}".to_string(), + }; + html.push_str(&format!( - "", - event.event_type, - event.pull_request_id, - event.batch_id, - event.details.as_deref().unwrap_or("\u{2014}"), + "", + event.event_type, event.event_type, pr_cell, details, )); } html.push_str("
EventPRDetails
{}{}{}{}
{}{}{}
"); @@ -194,6 +224,9 @@ tr:hover td { background: #fafafa; } .status-pending { background: #e0e7ff; color: #3730a3; } .status-testing { background: #fef3c7; color: #92400e; } .status-done { background: #d1fae5; color: #065f46; } +.status-merge_created { background: #e0e7ff; color: #3730a3; } +.status-ci_passed { background: #d1fae5; color: #065f46; } +.status-ci_failed { background: #fee2e2; color: #991b1b; } a { color: #1e40af; text-decoration: none; } a:hover { text-decoration: underline; } .empty { color: #999; font-style: italic; padding: 1rem 0; } From bb78020654ec4b9d3fe4ed612ef80713e5c6cd6a Mon Sep 17 00:00:00 2001 From: arferreira Date: Sun, 8 Mar 2026 14:06:34 -0400 Subject: [PATCH 2/2] Fix formatting --- src/dashboard.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dashboard.rs b/src/dashboard.rs index d686213..a682758 100644 --- a/src/dashboard.rs +++ b/src/dashboard.rs @@ -146,7 +146,10 @@ pub async fn dashboard(db: Db) -> Result> { if let Some(pr) = pr_map.get(&event.pull_request_id) { format!( "{}", - pr.repo_owner, pr.repo_name, sha, &sha[..7] + pr.repo_owner, + pr.repo_name, + sha, + &sha[..7] ) } else { sha[..7].to_string()