swarm ui: a diff column on the pull requests card, and "approved" as its header
The pull requests card gets a diff column, the lines a PR adds and removes (`+120 −8`), sortable on the total. The controller takes the counts from the forge's pull request list, so no call is added. The column that said "has all approvals" is now headed "approved".
This commit is contained in:
parent
f633963b77
commit
944fd5b726
1 changed files with 46 additions and 3 deletions
|
|
@ -41,6 +41,9 @@ pub struct PrReportRow {
|
|||
pub head_branch: String,
|
||||
pub created_unix: Option<i64>,
|
||||
pub updated_unix: Option<i64>,
|
||||
/// Lines the PR adds and removes, as the forge counts them.
|
||||
pub additions: Option<i64>,
|
||||
pub deletions: Option<i64>,
|
||||
/// The forge's draft flag (setting a `WIP:` title is what sets it).
|
||||
pub wip: bool,
|
||||
/// The forge cannot merge the PR as it is: its head conflicts with the
|
||||
|
|
@ -200,6 +203,8 @@ fn row(
|
|||
head_branch: head.r#ref.clone().unwrap_or_default(),
|
||||
created_unix: pr.created_at.as_ref().map(|t| t.unix_timestamp()),
|
||||
updated_unix: pr.updated_at.as_ref().map(|t| t.unix_timestamp()),
|
||||
additions: pr.additions,
|
||||
deletions: pr.deletions,
|
||||
wip: pr.draft.unwrap_or(false),
|
||||
has_conflicts: pr.mergeable == Some(false),
|
||||
targets_protected_branch: protection.is_some(),
|
||||
|
|
@ -483,6 +488,8 @@ mod tests {
|
|||
"head": { "ref": "iris/thing", "sha": "h1" },
|
||||
"created_at": "2026-11-07T08:00:00Z",
|
||||
"updated_at": "2026-11-07T09:00:00Z",
|
||||
"additions": 120,
|
||||
"deletions": 8,
|
||||
}))
|
||||
.expect("a pull request");
|
||||
let status: CombinedStatus = serde_json::from_value(serde_json::json!({
|
||||
|
|
@ -504,6 +511,7 @@ mod tests {
|
|||
assert_eq!(r.author.as_deref(), Some("iris"));
|
||||
assert_eq!(r.requested_reviewers, ["argus"]);
|
||||
assert_eq!(r.updated_unix, Some(1_794_042_000));
|
||||
assert_eq!((r.additions, r.deletions), (Some(120), Some(8)));
|
||||
|
||||
// The same PR into a branch no rule names has nothing to approve.
|
||||
let r = row("o/r", &pr, &[], &reviews, &status).expect("a row");
|
||||
|
|
|
|||
Loading…
Reference in a new issue