Every page follows one design language: pages run the full window width, repo pages have one head row with the tabs and actions and every other page has a page head at the same height, lists and details sit in panes that fill the window, section headings are labels, and empty states are left aligned
Browse files at this commit9011044ce16dd1a1c050f1b0118c18e4c0922ad5Parent: 474bafa- style
- every page follows one design language: pages run the full window width, repo pages have one head row with the tabs and actions and every other page has a page head at the same height, lists and details sit in panes that fill the window, section headings are labels, and empty states are left aligned
- the repo page is calmer, with a thin dock under the panes, a tree column that hides Last commit when narrow and no repeated title or description
- issue labels wrap as left-aligned chips
- feat
- every link, back and forward uses the same page transition, not only list rows
- fix
- the sticky file header no longer covers code on a commit's diff
- the latest commit bar parses the commit message like the lists do
- the CI timeline's text stays one size on wide windows and a job label is no longer cut off at the edge
- refactor
- dead CI job CSS is removed
137 changed files +2588 -917
- crates/forge-core/src/store/contributions.rs +5 -1
- crates/forge-core/src/store/migrate.rs +8 -2
- crates/forge-core/src/store/needs.rs +12 -3
- crates/forge-core/src/store/pull_viewed.rs +1 -5
- crates/forge-core/src/store/user_prefs.rs +12 -3
- crates/forge-git/src/search.rs +3 -9
- crates/forge-git/src/trailers.rs +6 -1
- crates/forge-runner/src/config.rs +4 -1
- crates/forge-runner/src/executor.rs +32 -7
- crates/forge-runner/src/lib.rs +1 -1
- crates/forge-runner/src/sandbox/helper.rs +3 -2
- crates/forge-runner/src/workspace.rs +10 -2
- crates/forge-runner/tests/integration/builtin.rs +12 -5
- crates/forge-web/assets/nav.js +22 -16
- crates/forge-web/src/advisories/worker.rs +8 -6
- crates/forge-web/src/api/releases.rs +6 -1
- crates/forge-web/src/api/statuses.rs +105 -18
- crates/forge-web/src/auth.rs +1 -1
- crates/forge-web/src/backup/tests.rs +4 -1
- crates/forge-web/src/ci/api.rs +8 -2
- crates/forge-web/src/ci/mod.rs +1 -1
- crates/forge-web/src/ci/release.rs +9 -2
- crates/forge-web/src/ci/schedule.rs +7 -2
- crates/forge-web/src/exporter.rs +7 -4
- crates/forge-web/src/i18n/integrations.rs +7 -13
- crates/forge-web/src/i18n/link.rs +10 -1
- crates/forge-web/src/i18n/migrate.rs +7 -2
- crates/forge-web/src/i18n/misc.rs +9 -3
- crates/forge-web/src/i18n/pulls.rs +6 -2
- crates/forge-web/src/i18n/repo_admin.rs +2 -6
- crates/forge-web/src/importer/tests.rs +14 -2
- crates/forge-web/src/internal.rs +4 -1
- crates/forge-web/src/live.rs +19 -16
- crates/forge-web/src/mail/templates.rs +5 -1
- crates/forge-web/src/main.rs +5 -2
- crates/forge-web/src/pages/activity.rs +2 -2
- crates/forge-web/src/pages/admin_backups.rs +1 -1
- crates/forge-web/src/pages/admin_health.rs +9 -11
- crates/forge-web/src/pages/admin_live_tests.rs +5 -1
- crates/forge-web/src/pages/admin_mail.rs +1 -1
- crates/forge-web/src/pages/admin_replication.rs +1 -1
- crates/forge-web/src/pages/admin_runners.rs +25 -15
- crates/forge-web/src/pages/admin_server.rs +15 -5
- crates/forge-web/src/pages/admin_user_detail.rs +8 -2
- crates/forge-web/src/pages/admin_users.rs +1 -1
- crates/forge-web/src/pages/audit_log.rs +4 -10
- crates/forge-web/src/pages/blame.rs +1 -1
- crates/forge-web/src/pages/branches.rs +16 -10
- crates/forge-web/src/pages/ci_fail.rs +1 -3
- crates/forge-web/src/pages/ci_job.rs +78 -68
- crates/forge-web/src/pages/ci_runs.rs +72 -47
- crates/forge-web/src/pages/ci_tests.rs +18 -5
- crates/forge-web/src/pages/code_live.rs +10 -4
- crates/forge-web/src/pages/code_search.rs +2 -0
- crates/forge-web/src/pages/commit.rs +1 -3
- crates/forge-web/src/pages/commits.rs +9 -5
- crates/forge-web/src/pages/compare.rs +77 -44
- crates/forge-web/src/pages/discussion_view.rs +1 -1
- crates/forge-web/src/pages/discussions.rs +2 -0
- crates/forge-web/src/pages/edit_history.rs +1 -1
- crates/forge-web/src/pages/explore.rs +4 -2
- crates/forge-web/src/pages/home.rs +2 -2
- crates/forge-web/src/pages/import.rs +31 -16
- crates/forge-web/src/pages/issue_meta_tests.rs +18 -3
- crates/forge-web/src/pages/issue_view.rs +2 -9
- crates/forge-web/src/pages/issues_list.rs +21 -15
- crates/forge-web/src/pages/labels_page.rs +7 -5
- crates/forge-web/src/pages/media.rs +6 -3
- crates/forge-web/src/pages/merge_queue.rs +14 -10
- crates/forge-web/src/pages/milestones_page.rs +7 -5
- crates/forge-web/src/pages/mod.rs +1 -1
- crates/forge-web/src/pages/needs_you.rs +9 -8
- crates/forge-web/src/pages/new_repo.rs +79 -17
- crates/forge-web/src/pages/notifications.rs +17 -10
- crates/forge-web/src/pages/org_ctx.rs +3 -1
- crates/forge-web/src/pages/org_new.rs +3 -1
- crates/forge-web/src/pages/palette.rs +27 -5
- crates/forge-web/src/pages/passkeys.rs +1 -4
- crates/forge-web/src/pages/profile.rs +9 -6
- crates/forge-web/src/pages/profile_calendar.rs +1 -1
- crates/forge-web/src/pages/profile_pins.rs +24 -11
- crates/forge-web/src/pages/pull_files.rs +1 -3
- crates/forge-web/src/pages/pull_view.rs +3 -1
- crates/forge-web/src/pages/pulls_list.rs +24 -20
- crates/forge-web/src/pages/push.rs +3 -7
- crates/forge-web/src/pages/reactions_tests.rs +4 -1
- crates/forge-web/src/pages/refs.rs +6 -2
- crates/forge-web/src/pages/register.rs +4 -1
- crates/forge-web/src/pages/releases.rs +15 -17
- crates/forge-web/src/pages/repo.rs +21 -39
- crates/forge-web/src/pages/repo_collaborators.rs +3 -2
- crates/forge-web/src/pages/repo_ctx.rs +0 -4
- crates/forge-web/src/pages/repo_mirrors.rs +19 -16
- crates/forge-web/src/pages/repo_rename.rs +3 -2
- crates/forge-web/src/pages/repo_secrets.rs +8 -4
- crates/forge-web/src/pages/repo_security.rs +13 -11
- crates/forge-web/src/pages/repo_settings.rs +40 -21
- crates/forge-web/src/pages/repo_side.rs +20 -20
- crates/forge-web/src/pages/repo_webhooks.rs +12 -6
- crates/forge-web/src/pages/review_requests.rs +1 -1
- crates/forge-web/src/pages/settings_appearance.rs +8 -2
- crates/forge-web/src/pages/settings_gpg.rs +1 -1
- crates/forge-web/src/pages/settings_gpg_tests.rs +22 -4
- crates/forge-web/src/pages/settings_keys.rs +47 -9
- crates/forge-web/src/pages/settings_profile.rs +4 -1
- crates/forge-web/src/pages/settings_security.rs +1 -1
- crates/forge-web/src/pages/settings_sessions.rs +7 -9
- crates/forge-web/src/pages/settings_tokens.rs +1 -1
- crates/forge-web/src/pages/snippets.rs +53 -17
- crates/forge-web/src/pages/tree.rs +2 -2
- crates/forge-web/src/pages/wiki.rs +8 -5
- crates/forge-web/src/render/commit_message.rs +4 -1
- crates/forge-web/src/repo_stats.rs +8 -1
- crates/forge-web/src/views/diff.rs +1 -5
- crates/forge-web/src/views/mod.rs +117 -24
- crates/forge-web/src/web_push/crypto.rs +2 -3
- crates/forge-web/src/web_push/mod.rs +1 -2
- crates/forge-web/tests/e2e/orgs_ui_e2e.rs +4 -1
- crates/forge-web/tests/e2e/repo_settings_e2e.rs +8 -2
- crates/forge-web/tests/e2e/ui_prefs_e2e.rs +2 -3
- style/_continuity.scss +57 -7
- style/_empty.scss +4 -4
- style/_fit_code.scss +0 -38
- style/_lang_admin.scss +90 -0
- style/_lang_browse.scss +124 -0
- style/_lang_ci.scss +85 -0
- style/_lang_issues.scss +274 -0
- style/_lang_lists.scss +181 -0
- style/_lang_people.scss +152 -0
- style/_language.scss +16 -0
- style/_look.scss +0 -1
- style/_pull.scss +5 -0
- style/_repo.scss +2 -5
- style/_shell.scss +3 -4
- style/_timeline.scss +63 -45
- style/_timeline_ci.scss +2 -11
- style/main.scss +7 -8
crates/forge-core/src/store/contributions.rsmodified+5 -1
| @@ -430,7 +430,11 @@ mod tests { | ||
| 430 | 430 | let since = "2026-03-01T00:00:00.000000000Z"; |
| 431 | 431 | let until = "2026-03-02T00:00:00.000000000Z"; |
| 432 | 432 | assert_eq!( |
| 433 | - store.contribution_counts(&tahinli.id, since, "UTC").await.unwrap().len(), | |
| 433 | + store | |
| 434 | + .contribution_counts(&tahinli.id, since, "UTC") | |
| 435 | + .await | |
| 436 | + .unwrap() | |
| 437 | + .len(), | |
| 434 | 438 | 1 |
| 435 | 439 | ); |
| 436 | 440 |
crates/forge-core/src/store/migrate.rsmodified+8 -2
| @@ -106,10 +106,16 @@ pub const MIGRATIONS: &[(u32, &str)] = &[ | ||
| 106 | 106 | (64, include_str!("../../migrations/0064_merge_queue.sql")), |
| 107 | 107 | (65, include_str!("../../migrations/0065_hue_colours.sql")), |
| 108 | 108 | (66, include_str!("../../migrations/0066_session_ip.sql")), |
| 109 | - (67, include_str!("../../migrations/0067_coauthored_commits.sql")), | |
| 109 | + ( | |
| 110 | + 67, | |
| 111 | + include_str!("../../migrations/0067_coauthored_commits.sql"), | |
| 112 | + ), | |
| 110 | 113 | (68, include_str!("../../migrations/0068_ci_jobs_runner.sql")), |
| 111 | 114 | (69, include_str!("../../migrations/0069_user_prefs.sql")), |
| 112 | - (70, include_str!("../../migrations/0070_pull_viewed_files.sql")), | |
| 115 | + ( | |
| 116 | + 70, | |
| 117 | + include_str!("../../migrations/0070_pull_viewed_files.sql"), | |
| 118 | + ), | |
| 113 | 119 | ]; |
| 114 | 120 | |
| 115 | 121 | /// The highest migration version this binary knows about. |
crates/forge-core/src/store/needs.rsmodified+12 -3
| @@ -272,8 +272,11 @@ impl Store { | ||
| 272 | 272 | |
| 273 | 273 | /// How many issues `assigned_issues` lists in all. |
| 274 | 274 | pub async fn assigned_issues_total(&self, user_id: &str) -> Result<u64> { |
| 275 | - self.count_rows(&assigned_issues_sql(&readable_repo()), viewer_params(user_id)) | |
| 276 | - .await | |
| 275 | + self.count_rows( | |
| 276 | + &assigned_issues_sql(&readable_repo()), | |
| 277 | + viewer_params(user_id), | |
| 278 | + ) | |
| 279 | + .await | |
| 277 | 280 | } |
| 278 | 281 | |
| 279 | 282 | /// The user's unread mentions, newest first, one page at a time. Mentions in repos the user |
| @@ -347,7 +350,13 @@ mod tests { | ||
| 347 | 350 | .set_repo_visibility(&repo.id, Visibility::Private) |
| 348 | 351 | .await |
| 349 | 352 | .unwrap(); |
| 350 | - assert!(store.assigned_issues(&bob.id, 8, 0).await.unwrap().is_empty()); | |
| 353 | + assert!( | |
| 354 | + store | |
| 355 | + .assigned_issues(&bob.id, 8, 0) | |
| 356 | + .await | |
| 357 | + .unwrap() | |
| 358 | + .is_empty() | |
| 359 | + ); | |
| 351 | 360 | assert_eq!(store.assigned_issues_total(&bob.id).await.unwrap(), 0); |
| 352 | 361 | } |
| 353 | 362 | } |
crates/forge-core/src/store/pull_viewed.rsmodified+1 -5
| @@ -64,11 +64,7 @@ impl Store { | ||
| 64 | 64 | let conn = self.inner.conn.lock().await; |
| 65 | 65 | conn.execute( |
| 66 | 66 | "DELETE FROM pull_viewed_files WHERE user_id = ?1 AND issue_id = ?2 AND path = ?3", |
| 67 | - ( | |
| 68 | - user_id.to_string(), | |
| 69 | - issue_id.to_string(), | |
| 70 | - path.to_string(), | |
| 71 | - ), | |
| 67 | + (user_id.to_string(), issue_id.to_string(), path.to_string()), | |
| 72 | 68 | ) |
| 73 | 69 | .await |
| 74 | 70 | .map_err(db_err)?; |
crates/forge-core/src/store/user_prefs.rsmodified+12 -3
| @@ -72,12 +72,21 @@ mod tests { | ||
| 72 | 72 | async fn density_and_sound_round_trip_and_replace() { |
| 73 | 73 | let dir = tempfile::tempdir().unwrap(); |
| 74 | 74 | let store = Store::open(&dir.path().join("forge.db")).await.unwrap(); |
| 75 | - let user = store.create_user("tahinli", None, "unused", false).await.unwrap(); | |
| 75 | + let user = store | |
| 76 | + .create_user("tahinli", None, "unused", false) | |
| 77 | + .await | |
| 78 | + .unwrap(); | |
| 76 | 79 | |
| 77 | 80 | assert!(store.user_prefs(&user.id).await.unwrap().is_empty()); |
| 78 | - store.set_user_pref(&user.id, DENSITY, "compact").await.unwrap(); | |
| 81 | + store | |
| 82 | + .set_user_pref(&user.id, DENSITY, "compact") | |
| 83 | + .await | |
| 84 | + .unwrap(); | |
| 79 | 85 | store.set_user_pref(&user.id, SOUND, "on").await.unwrap(); |
| 80 | - store.set_user_pref(&user.id, DENSITY, "comfortable").await.unwrap(); | |
| 86 | + store | |
| 87 | + .set_user_pref(&user.id, DENSITY, "comfortable") | |
| 88 | + .await | |
| 89 | + .unwrap(); | |
| 81 | 90 | |
| 82 | 91 | let prefs = store.user_prefs(&user.id).await.unwrap(); |
| 83 | 92 | assert_eq!(prefs.get(DENSITY).map(String::as_str), Some("comfortable")); |
crates/forge-git/src/search.rsmodified+3 -9
| @@ -343,15 +343,9 @@ mod tests { | ||
| 343 | 343 | assert!(res.truncated, "max matches"); |
| 344 | 344 | |
| 345 | 345 | // No match is an empty result, not an error. |
| 346 | - let res = grep( | |
| 347 | - &env, | |
| 348 | - &repo, | |
| 349 | - &oid, | |
| 350 | - "zzz-not-here", | |
| 351 | - GrepOptions::default(), | |
| 352 | - ) | |
| 353 | - .await | |
| 354 | - .unwrap(); | |
| 346 | + let res = grep(&env, &repo, &oid, "zzz-not-here", GrepOptions::default()) | |
| 347 | + .await | |
| 348 | + .unwrap(); | |
| 355 | 349 | assert!(res.hits.is_empty(), "no match"); |
| 356 | 350 | assert!(!res.truncated, "no match"); |
| 357 | 351 | } |
crates/forge-git/src/trailers.rsmodified+6 -1
| @@ -30,7 +30,12 @@ pub fn strip_co_authors(message: &str) -> String { | ||
| 30 | 30 | let kept: Vec<&str> = lines[..start] |
| 31 | 31 | .iter() |
| 32 | 32 | .copied() |
| 33 | - .chain(lines[start..].iter().copied().filter(|line| !is_trailer(line))) | |
| 33 | + .chain( | |
| 34 | + lines[start..] | |
| 35 | + .iter() | |
| 36 | + .copied() | |
| 37 | + .filter(|line| !is_trailer(line)), | |
| 38 | + ) | |
| 34 | 39 | .collect(); |
| 35 | 40 | kept.join("\n").trim_end().to_owned() |
| 36 | 41 | } |
crates/forge-runner/src/config.rsmodified+4 -1
| @@ -700,7 +700,10 @@ mod tests { | ||
| 700 | 700 | assert_eq!(bad.job_memory_limit(None), None); |
| 701 | 701 | assert_eq!(bad.for_job(None).memory, "lots"); |
| 702 | 702 | // Builtin: no `memory` means the whole budget; a declared one keeps its slack. |
| 703 | - assert_eq!(limits.for_builtin_job(None, Some(6 * gib)).memory, (6 * gib).to_string()); | |
| 703 | + assert_eq!( | |
| 704 | + limits.for_builtin_job(None, Some(6 * gib)).memory, | |
| 705 | + (6 * gib).to_string() | |
| 706 | + ); | |
| 704 | 707 | assert_eq!( |
| 705 | 708 | limits.for_builtin_job(Some(gib), Some(6 * gib)).memory, |
| 706 | 709 | limits.for_job(Some(gib)).memory |
crates/forge-runner/src/executor.rsmodified+32 -7
| @@ -15,9 +15,9 @@ use std::fs; | ||
| 15 | 15 | use std::future::Future; |
| 16 | 16 | use std::path::{Path, PathBuf}; |
| 17 | 17 | use std::pin::Pin; |
| 18 | +use std::process::{ExitStatus, Stdio}; | |
| 18 | 19 | use std::sync::Arc; |
| 19 | 20 | use std::sync::atomic::{AtomicBool, Ordering}; |
| 20 | -use std::process::{ExitStatus, Stdio}; | |
| 21 | 21 | use std::time::Duration; |
| 22 | 22 | |
| 23 | 23 | use forge_ci::proto::{JobAssignment, Outcome}; |
| @@ -135,7 +135,11 @@ pub fn job_env_with_defaults( | ||
| 135 | 135 | let n = job_parallelism(limits); |
| 136 | 136 | let mut pairs: Vec<(String, String)> = [ |
| 137 | 137 | ("FORGE_CPUS", n.to_string()), |
| 138 | - ("FORGE_MEMORY_BYTES", crate::sandbox::spec::parse_bytes(&limits.memory).map_or_else(|_| "0".to_owned(), |b| b.to_string())), | |
| 138 | + ( | |
| 139 | + "FORGE_MEMORY_BYTES", | |
| 140 | + crate::sandbox::spec::parse_bytes(&limits.memory) | |
| 141 | + .map_or_else(|_| "0".to_owned(), |b| b.to_string()), | |
| 142 | + ), | |
| 139 | 143 | ("CARGO_BUILD_JOBS", n.to_string()), |
| 140 | 144 | ("MAKEFLAGS", format!("-j{n}")), |
| 141 | 145 | ("CMAKE_BUILD_PARALLEL_LEVEL", n.to_string()), |
| @@ -992,7 +996,13 @@ mod tests { | ||
| 992 | 996 | fn sweep_removes_only_leftover_jobs_and_ulid_workspaces() { |
| 993 | 997 | let dir = tempfile::tempdir().unwrap(); |
| 994 | 998 | let work = dir.path(); |
| 995 | - for d in ["jobs/job_01/overlay", "01JD6Z8Q4XW3N5R7T9V2B4C6E8/src", "oci", "notes", "check-7"] { | |
| 999 | + for d in [ | |
| 1000 | + "jobs/job_01/overlay", | |
| 1001 | + "01JD6Z8Q4XW3N5R7T9V2B4C6E8/src", | |
| 1002 | + "oci", | |
| 1003 | + "notes", | |
| 1004 | + "check-7", | |
| 1005 | + ] { | |
| 996 | 1006 | fs::create_dir_all(work.join(d)).unwrap(); |
| 997 | 1007 | } |
| 998 | 1008 | fs::create_dir_all(work.join(".cache")).unwrap(); |
| @@ -1053,7 +1063,15 @@ mod tests { | ||
| 1053 | 1063 | .collect(); |
| 1054 | 1064 | assert_eq!( |
| 1055 | 1065 | names, |
| 1056 | - vec!["FORGE_CPUS", "FORGE_MEMORY_BYTES", "CARGO_BUILD_JOBS", "MAKEFLAGS", "CMAKE_BUILD_PARALLEL_LEVEL", "PLAIN", "MY_TOKEN"] | |
| 1066 | + vec![ | |
| 1067 | + "FORGE_CPUS", | |
| 1068 | + "FORGE_MEMORY_BYTES", | |
| 1069 | + "CARGO_BUILD_JOBS", | |
| 1070 | + "MAKEFLAGS", | |
| 1071 | + "CMAKE_BUILD_PARALLEL_LEVEL", | |
| 1072 | + "PLAIN", | |
| 1073 | + "MY_TOKEN" | |
| 1074 | + ] | |
| 1057 | 1075 | ); |
| 1058 | 1076 | } |
| 1059 | 1077 | |
| @@ -1096,12 +1114,19 @@ mod tests { | ||
| 1096 | 1114 | #[test] |
| 1097 | 1115 | fn parallelism_defaults_follow_the_cpu_limit_and_job_env_wins() { |
| 1098 | 1116 | let mut job = fixture_job("true"); |
| 1099 | - let limits = Limits { cpus: "0.5".to_owned(), ..Limits::default() }; | |
| 1117 | + let limits = Limits { | |
| 1118 | + cpus: "0.5".to_owned(), | |
| 1119 | + ..Limits::default() | |
| 1120 | + }; | |
| 1100 | 1121 | let env = job_env_with_defaults(&job, &limits).expect("env"); |
| 1101 | 1122 | assert!(env.contains(&("CARGO_BUILD_JOBS".to_owned(), "1".to_owned()))); |
| 1102 | - job.env.insert("CARGO_BUILD_JOBS".to_owned(), "7".to_owned()); | |
| 1123 | + job.env | |
| 1124 | + .insert("CARGO_BUILD_JOBS".to_owned(), "7".to_owned()); | |
| 1103 | 1125 | let env = job_env_with_defaults(&job, &limits).expect("env"); |
| 1104 | - let jobs: Vec<_> = env.iter().filter(|(k, _)| k == "CARGO_BUILD_JOBS").collect(); | |
| 1126 | + let jobs: Vec<_> = env | |
| 1127 | + .iter() | |
| 1128 | + .filter(|(k, _)| k == "CARGO_BUILD_JOBS") | |
| 1129 | + .collect(); | |
| 1105 | 1130 | assert_eq!(jobs, [&("CARGO_BUILD_JOBS".to_owned(), "7".to_owned())]); |
| 1106 | 1131 | } |
| 1107 | 1132 |
crates/forge-runner/src/lib.rsmodified+1 -1
| @@ -14,8 +14,8 @@ pub mod disk; | ||
| 14 | 14 | pub mod executor; |
| 15 | 15 | pub mod limiter; |
| 16 | 16 | pub mod logs; |
| 17 | -pub mod metrics; | |
| 18 | 17 | pub mod memory; |
| 18 | +pub mod metrics; | |
| 19 | 19 | pub mod oci; |
| 20 | 20 | pub mod oom; |
| 21 | 21 | pub mod pressure; |
crates/forge-runner/src/sandbox/helper.rsmodified+3 -2
| @@ -248,8 +248,9 @@ fn prepare_dirs(layout: &Layout) -> Result<(), SandboxError> { | ||
| 248 | 248 | fs::set_permissions(dir, fs::Permissions::from_mode(0o700)) |
| 249 | 249 | .map_err(SandboxError::io(format!("cannot chmod {}", dir.display())))?; |
| 250 | 250 | } |
| 251 | - fs::set_permissions(&layout.tmp, fs::Permissions::from_mode(0o1777)) | |
| 252 | - .map_err(SandboxError::io(format!("cannot chmod {}", layout.tmp.display())))?; | |
| 251 | + fs::set_permissions(&layout.tmp, fs::Permissions::from_mode(0o1777)).map_err( | |
| 252 | + SandboxError::io(format!("cannot chmod {}", layout.tmp.display())), | |
| 253 | + )?; | |
| 253 | 254 | Ok(()) |
| 254 | 255 | } |
| 255 | 256 |
crates/forge-runner/src/workspace.rsmodified+10 -2
| @@ -211,13 +211,21 @@ mod tests { | ||
| 211 | 211 | fn clone_urls_are_checked_against_the_forge_scheme() { |
| 212 | 212 | // (clone url, forge url, accepted) |
| 213 | 213 | let cases: &[(&str, &str, bool)] = &[ |
| 214 | - ("https://forge.example/o/r.git", "https://forge.example", true), | |
| 214 | + ( | |
| 215 | + "https://forge.example/o/r.git", | |
| 216 | + "https://forge.example", | |
| 217 | + true, | |
| 218 | + ), | |
| 215 | 219 | ("--upload-pack=sh", "https://forge.example", false), |
| 216 | 220 | ("ext::sh -c id", "https://forge.example", false), |
| 217 | 221 | ("https://a b/x", "https://forge.example", false), |
| 218 | 222 | // Plain http is only accepted when the forge itself is http. |
| 219 | 223 | ("http://forge.example/o/r.git", "http://forge.example", true), |
| 220 | - ("http://forge.example/o/r.git", "https://forge.example", false), | |
| 224 | + ( | |
| 225 | + "http://forge.example/o/r.git", | |
| 226 | + "https://forge.example", | |
| 227 | + false, | |
| 228 | + ), | |
| 221 | 229 | ]; |
| 222 | 230 | for (url, forge, ok) in cases { |
| 223 | 231 | assert_eq!(validate_clone_url(url, forge).is_ok(), *ok, "case {url}"); |
crates/forge-runner/tests/integration/builtin.rsmodified+12 -5
| @@ -321,7 +321,10 @@ async fn sigkilled_helper_leaves_no_process_behind() { | ||
| 321 | 321 | "job process {pid} survived the helper" |
| 322 | 322 | ); |
| 323 | 323 | } |
| 324 | - assert!(!dir.path().join("jobs").join(job_id).exists(), "job dir was kept"); | |
| 324 | + assert!( | |
| 325 | + !dir.path().join("jobs").join(job_id).exists(), | |
| 326 | + "job dir was kept" | |
| 327 | + ); | |
| 325 | 328 | } |
| 326 | 329 | |
| 327 | 330 | #[tokio::test] |
| @@ -344,9 +347,13 @@ async fn network_job_gets_its_own_network_without_private_ranges() { | ||
| 344 | 347 | assert!(logs.contains("meta=blocked"), "{logs}"); |
| 345 | 348 | assert!(!logs.contains("pasta is not installed"), "{logs}"); |
| 346 | 349 | let pid_file = dir.path().join("jobs/job_01/pasta.pid"); |
| 347 | - let leftover = fs::read_dir("/proc").expect("read /proc").flatten().any(|entry| { | |
| 348 | - fs::read(entry.path().join("cmdline")) | |
| 349 | - .is_ok_and(|cmd| String::from_utf8_lossy(&cmd).contains(&*pid_file.to_string_lossy())) | |
| 350 | - }); | |
| 350 | + let leftover = fs::read_dir("/proc") | |
| 351 | + .expect("read /proc") | |
| 352 | + .flatten() | |
| 353 | + .any(|entry| { | |
| 354 | + fs::read(entry.path().join("cmdline")).is_ok_and(|cmd| { | |
| 355 | + String::from_utf8_lossy(&cmd).contains(&*pid_file.to_string_lossy()) | |
| 356 | + }) | |
| 357 | + }); | |
| 351 | 358 | assert!(!leftover, "pasta outlived the job"); |
| 352 | 359 | } |
crates/forge-web/assets/nav.jsmodified+22 -16
| @@ -352,12 +352,14 @@ | ||
| 352 | 352 | else { window.scrollTo(0, 0); } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - // Continuity: the row a reader clicked grows into the title of the page it opens. The row takes the | |
| 356 | - // name forge-row once the response has arrived, just before the transition; the new page's main | |
| 357 | - // heading takes it in the transition's update callback, where the swap runs, after the old state | |
| 358 | - // is captured. Names are removed when the transition ends, since a duplicate name aborts a transition. | |
| 359 | - // Without the API or with reduced motion the swap runs as it always has. Only a link from a row | |
| 360 | - // comes here: live refreshes, back and forward and form posts never animate. | |
| 355 | + // Continuity: every navigation (a link, back or forward) is one calm View Transition. The top bar and | |
| 356 | + // the repo head stay still, the active tab slides to its new place, and the page body fades in. A link | |
| 357 | + // from a row also grows into the title of the page it opens: the row takes the name forge-row once the | |
| 358 | + // response has arrived, the new page's title takes it in the transition's update callback, where the | |
| 359 | + // swap runs. Names are on only for the transition: `html.is-navigating` in _continuity.scss, and the | |
| 360 | + // row's and title's own names are removed when it ends, since a duplicate name aborts a transition. | |
| 361 | + // Without the API or with reduced motion the swap runs as it always has. Live refreshes and form | |
| 362 | + // posts never animate. | |
| 361 | 363 | var MORPH_NAME = 'forge-row'; |
| 362 | 364 | |
| 363 | 365 | // The title a row grows into, by page: commit, issue and pull, CI run and job, a repo's title row, |
| @@ -375,8 +377,10 @@ | ||
| 375 | 377 | } |
| 376 | 378 | |
| 377 | 379 | function morph(row, run) { |
| 378 | - if (!row || !document.startViewTransition || motionHeld()) { run(); return undefined; } | |
| 379 | - row.style.viewTransitionName = MORPH_NAME; | |
| 380 | + if (!document.startViewTransition || motionHeld()) { run(); return undefined; } | |
| 381 | + var root = document.documentElement; | |
| 382 | + root.classList.add('is-navigating'); | |
| 383 | + if (row) { row.style.viewTransitionName = MORPH_NAME; } | |
| 380 | 384 | return new Promise(function (resolve, reject) { |
| 381 | 385 | var ran = false; |
| 382 | 386 | var title = null; |
| @@ -384,9 +388,9 @@ | ||
| 384 | 388 | if (ran) { return; } |
| 385 | 389 | ran = true; |
| 386 | 390 | // The old row leaves the page now, so its name goes with it. |
| 387 | - row.style.viewTransitionName = ''; | |
| 391 | + if (row) { row.style.viewTransitionName = ''; } | |
| 388 | 392 | try { run(); } catch (err) { reject(err); return; } |
| 389 | - title = pageTitle(); | |
| 393 | + title = row ? pageTitle() : null; | |
| 390 | 394 | if (title) { title.style.viewTransitionName = MORPH_NAME; } |
| 391 | 395 | resolve(); |
| 392 | 396 | } |
| @@ -400,10 +404,12 @@ | ||
| 400 | 404 | // A skipped transition may never call its callback: the swap then runs here instead. |
| 401 | 405 | transition.ready.catch(function () { }); |
| 402 | 406 | transition.updateCallbackDone.then(update, update); |
| 403 | - transition.finished.then(function () { | |
| 404 | - row.style.viewTransitionName = ''; | |
| 407 | + var done = function () { | |
| 408 | + root.classList.remove('is-navigating'); | |
| 409 | + if (row) { row.style.viewTransitionName = ''; } | |
| 405 | 410 | if (title) { title.style.viewTransitionName = ''; } |
| 406 | - }, function () { }); | |
| 411 | + }; | |
| 412 | + transition.finished.then(done, done); | |
| 407 | 413 | }); |
| 408 | 414 | } |
| 409 | 415 | |
| @@ -560,8 +566,8 @@ | ||
| 560 | 566 | // Other parts of this file follow page changes through this event (list memory, say). |
| 561 | 567 | document.dispatchEvent(new CustomEvent('forge:swapped', { detail: { how: how, url: dest } })); |
| 562 | 568 | }; |
| 563 | - // A link from a row swaps inside its transition, and the load counts as done only after it. | |
| 564 | - if (how === 'nav' && o.morph) { return morph(o.morph, finish); } | |
| 569 | + // A navigation swaps inside its transition, and the load counts as done only after it. | |
| 570 | + if (how === 'nav' || how === 'pop') { return morph(o.morph, finish); } | |
| 565 | 571 | finish(); |
| 566 | 572 | }).catch(function () { |
| 567 | 573 | if (mark !== latest || o.how === 'live') { return; } |
| @@ -1594,7 +1600,7 @@ | ||
| 1594 | 1600 | } |
| 1595 | 1601 | saveScroll(); |
| 1596 | 1602 | // The row the link sits in, if any: the page it opens grows out of that row (see morph). |
| 1597 | - var row = a.closest('[data-kb-row]'); | |
| 1603 | + var row = a.closest('nav, .repo-tabs, .pathbar, .topbar') ? null : a.closest('[data-kb-row], tbody tr, ul > li'); | |
| 1598 | 1604 | load({ target: withoutHash(url), dest: url, init: GET_INIT, how: 'nav', keep: false, post: false, form: null, morph: row }); |
| 1599 | 1605 | }, true); |
| 1600 | 1606 |
crates/forge-web/src/advisories/worker.rsmodified+8 -6
| @@ -217,12 +217,14 @@ async fn import(state: &AppState, ecosystem: &str, path: &Path) -> Result<()> { | ||
| 217 | 217 | let owned_path = path.to_owned(); |
| 218 | 218 | let eco = ecosystem.to_owned(); |
| 219 | 219 | let parser = tokio::task::spawn_blocking(move || -> usize { |
| 220 | - let parsed = File::open(&owned_path).map_err(Error::from).and_then(|file| { | |
| 221 | - read_dump(BufReader::new(file), &eco, |batch| { | |
| 222 | - tx.blocking_send(Ok(Some(batch))) | |
| 223 | - .map_err(|_| Error::Invalid("advisory import was stopped".into())) | |
| 224 | - }) | |
| 225 | - }); | |
| 220 | + let parsed = File::open(&owned_path) | |
| 221 | + .map_err(Error::from) | |
| 222 | + .and_then(|file| { | |
| 223 | + read_dump(BufReader::new(file), &eco, |batch| { | |
| 224 | + tx.blocking_send(Ok(Some(batch))) | |
| 225 | + .map_err(|_| Error::Invalid("advisory import was stopped".into())) | |
| 226 | + }) | |
| 227 | + }); | |
| 226 | 228 | // The store commits only on `Ok(None)`, so a panic above (sender dropped) rolls back. |
| 227 | 229 | match parsed { |
| 228 | 230 | Ok(skipped) => { |
crates/forge-web/src/api/releases.rsmodified+6 -1
| @@ -656,7 +656,12 @@ mod tests { | ||
| 656 | 656 | 401, |
| 657 | 657 | false, |
| 658 | 658 | ), |
| 659 | - ("token without repo scope", Some(scopeless.as_str()), 403, false), | |
| 659 | + ( | |
| 660 | + "token without repo scope", | |
| 661 | + Some(scopeless.as_str()), | |
| 662 | + 403, | |
| 663 | + false, | |
| 664 | + ), | |
| 660 | 665 | ]; |
| 661 | 666 | for (name, auth, want, error_body) in cases { |
| 662 | 667 | let (status, body) = post_json(&f, auth, r#"{"tag":"v1"}"#).await; |
crates/forge-web/src/api/statuses.rsmodified+105 -18
| @@ -344,13 +344,12 @@ mod tests { | ||
| 344 | 344 | #[tokio::test] |
| 345 | 345 | async fn refused_writes_return_their_status() { |
| 346 | 346 | let s = setup(Visibility::Public).await; |
| 347 | - let owner = s | |
| 348 | - .fx | |
| 349 | - .store | |
| 350 | - .user_by_username(OWNER) | |
| 351 | - .await | |
| 352 | - .unwrap() | |
| 353 | - .expect("owner"); | |
| 347 | + let owner = | |
| 348 | + s.fx.store | |
| 349 | + .user_by_username(OWNER) | |
| 350 | + .await | |
| 351 | + .unwrap() | |
| 352 | + .expect("owner"); | |
| 354 | 353 | let session = generate_token(); |
| 355 | 354 | crate::test_support::create_session(&s.fx.store, &owner.id, &session, "csrf-value").await; |
| 356 | 355 | let cookie = format!("__Host-{SESSION_COOKIE}={session}"); |
| @@ -361,18 +360,106 @@ mod tests { | ||
| 361 | 360 | let bad_sha = report_uri("abc123"); |
| 362 | 361 | let missing = report_uri(&"0".repeat(40)); |
| 363 | 362 | // (case, uri, auth, cookie, body, expected status, expects a JSON error body) |
| 364 | - type Case<'a> = (&'a str, &'a str, Option<&'a str>, Option<&'a str>, Option<&'a str>, u16, bool); | |
| 363 | + type Case<'a> = ( | |
| 364 | + &'a str, | |
| 365 | + &'a str, | |
| 366 | + Option<&'a str>, | |
| 367 | + Option<&'a str>, | |
| 368 | + Option<&'a str>, | |
| 369 | + u16, | |
| 370 | + bool, | |
| 371 | + ); | |
| 365 | 372 | let cases: [Case<'_>; 10] = [ |
| 366 | - ("read-only token", report.as_str(), Some(reader.as_str()), None, Some(SUCCESS), 403, true), | |
| 367 | - ("anonymous", report.as_str(), None, None, Some(SUCCESS), 401, true), | |
| 368 | - ("bad token", report.as_str(), Some("Bearer forge_not_a_real_token"), None, Some(SUCCESS), 401, false), | |
| 369 | - ("session cookie alone", report.as_str(), None, Some(cookie.as_str()), Some(SUCCESS), 401, false), | |
| 370 | - ("token without repo scope", report.as_str(), Some(unscoped.as_str()), None, Some(SUCCESS), 403, false), | |
| 371 | - ("sha too short", bad_sha.as_str(), Some(writer.as_str()), None, Some(SUCCESS), 422, false), | |
| 372 | - ("unknown state", report.as_str(), Some(writer.as_str()), None, Some(r#"{"state":"maybe"}"#), 422, false), | |
| 373 | - ("malformed json", report.as_str(), Some(writer.as_str()), None, Some("{not json"), 400, false), | |
| 374 | - ("javascript target url", report.as_str(), Some(writer.as_str()), None, Some(r#"{"state":"success","target_url":"javascript:alert(1)"}"#), 422, false), | |
| 375 | - ("unknown commit", missing.as_str(), Some(writer.as_str()), None, Some(SUCCESS), 404, false), | |
| 373 | + ( | |
| 374 | + "read-only token", | |
| 375 | + report.as_str(), | |
| 376 | + Some(reader.as_str()), | |
| 377 | + None, | |
| 378 | + Some(SUCCESS), | |
| 379 | + 403, | |
| 380 | + true, | |
| 381 | + ), | |
| 382 | + ( | |
| 383 | + "anonymous", | |
| 384 | + report.as_str(), | |
| 385 | + None, | |
| 386 | + None, | |
| 387 | + Some(SUCCESS), | |
| 388 | + 401, | |
| 389 | + true, | |
| 390 | + ), | |
| 391 | + ( | |
| 392 | + "bad token", | |
| 393 | + report.as_str(), | |
| 394 | + Some("Bearer forge_not_a_real_token"), | |
| 395 | + None, | |
| 396 | + Some(SUCCESS), | |
| 397 | + 401, | |
| 398 | + false, | |
| 399 | + ), | |
| 400 | + ( | |
| 401 | + "session cookie alone", | |
| 402 | + report.as_str(), | |
| 403 | + None, | |
| 404 | + Some(cookie.as_str()), | |
| 405 | + Some(SUCCESS), | |
| 406 | + 401, | |
| 407 | + false, | |
| 408 | + ), | |
| 409 | + ( | |
| 410 | + "token without repo scope", | |
| 411 | + report.as_str(), | |
| 412 | + Some(unscoped.as_str()), | |
| 413 | + None, | |
| 414 | + Some(SUCCESS), | |
| 415 | + 403, | |
| 416 | + false, | |
| 417 | + ), | |
| 418 | + ( | |
| 419 | + "sha too short", | |
| 420 | + bad_sha.as_str(), | |
| 421 | + Some(writer.as_str()), | |
| 422 | + None, | |
| 423 | + Some(SUCCESS), | |
| 424 | + 422, | |
| 425 | + false, | |
| 426 | + ), | |
| 427 | + ( | |
| 428 | + "unknown state", | |
| 429 | + report.as_str(), | |
| 430 | + Some(writer.as_str()), | |
| 431 | + None, | |
| 432 | + Some(r#"{"state":"maybe"}"#), | |
| 433 | + 422, | |
| 434 | + false, | |
| 435 | + ), | |
| 436 | + ( | |
| 437 | + "malformed json", | |
| 438 | + report.as_str(), | |
| 439 | + Some(writer.as_str()), | |
| 440 | + None, | |
| 441 | + Some("{not json"), | |
| 442 | + 400, | |
| 443 | + false, | |
| 444 | + ), | |
| 445 | + ( | |
| 446 | + "javascript target url", | |
| 447 | + report.as_str(), | |
| 448 | + Some(writer.as_str()), | |
| 449 | + None, | |
| 450 | + Some(r#"{"state":"success","target_url":"javascript:alert(1)"}"#), | |
| 451 | + 422, | |
| 452 | + false, | |
| 453 | + ), | |
| 454 | + ( | |
| 455 | + "unknown commit", | |
| 456 | + missing.as_str(), | |
| 457 | + Some(writer.as_str()), | |
| 458 | + None, | |
| 459 | + Some(SUCCESS), | |
| 460 | + 404, | |
| 461 | + false, | |
| 462 | + ), | |
| 376 | 463 | ]; |
| 377 | 464 | for (name, uri, auth, cookie, body, want, error_body) in cases { |
| 378 | 465 | let (status, json) = send(&s.fx.router, "POST", uri, auth, cookie, body).await; |
crates/forge-web/src/auth.rsmodified+1 -1
| @@ -11,10 +11,10 @@ use forge_core::session::{new_csrf_token, new_session_token}; | ||
| 11 | 11 | use forge_core::time::stamp_after; |
| 12 | 12 | use forge_core::token::{constant_time_eq, hash_token}; |
| 13 | 13 | use forge_core::{Session, Store, User, secret, totp}; |
| 14 | +use tokio::sync::Semaphore; | |
| 14 | 15 | use topcoat::Result; |
| 15 | 16 | use topcoat::context::{Cx, app_context}; |
| 16 | 17 | use topcoat::cookie::{Cookie, Cookies, SameSite, cookies, time}; |
| 17 | -use tokio::sync::Semaphore; | |
| 18 | 18 | use topcoat::router::error::{forbidden, see_other}; |
| 19 | 19 | use topcoat::router::request::{headers, uri}; |
| 20 | 20 |
crates/forge-web/src/backup/tests.rsmodified+4 -1
| @@ -417,7 +417,10 @@ async fn failed_backups_leave_no_partial_directory() { | ||
| 417 | 417 | .expect("out") |
| 418 | 418 | .map(|e| e.expect("entry").file_name().to_string_lossy().into_owned()) |
| 419 | 419 | .collect(); |
| 420 | - assert!(left.is_empty(), "case broken repo, nothing may be left behind: {left:?}"); | |
| 420 | + assert!( | |
| 421 | + left.is_empty(), | |
| 422 | + "case broken repo, nothing may be left behind: {left:?}" | |
| 423 | + ); | |
| 421 | 424 | } |
| 422 | 425 | |
| 423 | 426 | #[tokio::test] |
crates/forge-web/src/ci/api.rsmodified+8 -2
| @@ -254,7 +254,9 @@ fn target_labels(target: Option<&str>) -> Vec<String> { | ||
| 254 | 254 | let plain = |part: &str| { |
| 255 | 255 | !part.is_empty() |
| 256 | 256 | && part.len() <= 32 |
| 257 | - && part.bytes().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'_') | |
| 257 | + && part | |
| 258 | + .bytes() | |
| 259 | + .all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'_') | |
| 258 | 260 | }; |
| 259 | 261 | match target.split_once('-') { |
| 260 | 262 | Some((arch, os)) if plain(arch) && plain(os) => { |
| @@ -781,7 +783,11 @@ async fn heartbeat(cx: &Cx) -> topcoat::Result<Response> { | ||
| 781 | 783 | // A busy runner only heartbeats here. Its state is read only when it is not |
| 782 | 784 | // recorded online, so a steady heartbeat costs a map lookup. |
| 783 | 785 | if !state.ci_live.runner_recorded_online(runner_id) { |
| 784 | - let disabled = state.store.runner_disabled(runner_id).await.unwrap_or(false); | |
| 786 | + let disabled = state | |
| 787 | + .store | |
| 788 | + .runner_disabled(runner_id) | |
| 789 | + .await | |
| 790 | + .unwrap_or(false); | |
| 785 | 791 | state.ci_live.note_runner_online(runner_id, !disabled); |
| 786 | 792 | } |
| 787 | 793 | let said = headers(cx) |
crates/forge-web/src/ci/mod.rsmodified+1 -1
| @@ -12,9 +12,9 @@ use crate::state::AppState; | ||
| 12 | 12 | |
| 13 | 13 | pub mod api; |
| 14 | 14 | pub mod live; |
| 15 | +pub mod metrics_chart; | |
| 15 | 16 | pub mod reaper; |
| 16 | 17 | pub mod release; |
| 17 | -pub mod metrics_chart; | |
| 18 | 18 | pub mod runner_log; |
| 19 | 19 | pub mod runner_metrics; |
| 20 | 20 | pub mod schedule; |
crates/forge-web/src/ci/release.rsmodified+9 -2
| @@ -370,7 +370,10 @@ fn grouped_bullets(commits: &[CommitInfo], footer_len: usize) -> String { | ||
| 370 | 370 | .iter() |
| 371 | 371 | .flat_map(|group| { |
| 372 | 372 | let section = section_of(&group.kind); |
| 373 | - group.clauses.iter().map(move |clause| (section, clause.clone())) | |
| 373 | + group | |
| 374 | + .clauses | |
| 375 | + .iter() | |
| 376 | + .map(move |clause| (section, clause.clone())) | |
| 374 | 377 | }) |
| 375 | 378 | .collect(), |
| 376 | 379 | None => vec![(section_of(""), commit.summary.clone())], |
| @@ -645,7 +648,11 @@ title = "forge {tag}" | ||
| 645 | 648 | let release = release_named(&fx, "v1.1").await.expect("release made"); |
| 646 | 649 | let short = &oid[..7]; |
| 647 | 650 | assert!(release.body.starts_with("### Features\n- one (")); |
| 648 | - assert!(release.body.contains(&format!("### Fixes\n- two ({short})"))); | |
| 651 | + assert!( | |
| 652 | + release | |
| 653 | + .body | |
| 654 | + .contains(&format!("### Fixes\n- two ({short})")) | |
| 655 | + ); | |
| 649 | 656 | assert!(release.body.ends_with("Full changelog: v1.0...v1.1")); |
| 650 | 657 | assert!( |
| 651 | 658 | !release.body.contains("- change ("), |
crates/forge-web/src/ci/schedule.rsmodified+7 -2
| @@ -1185,7 +1185,8 @@ run = "make" | ||
| 1185 | 1185 | ( |
| 1186 | 1186 | "kept", |
| 1187 | 1187 | on( |
| 1188 | - &CONFIG_SUPERSEDE.replace("cancel_superseded = true", "cancel_superseded = false"), | |
| 1188 | + &CONFIG_SUPERSEDE | |
| 1189 | + .replace("cancel_superseded = true", "cancel_superseded = false"), | |
| 1189 | 1190 | "kept", |
| 1190 | 1191 | ), |
| 1191 | 1192 | false, |
| @@ -1217,7 +1218,11 @@ run = "make" | ||
| 1217 | 1218 | assert_eq!(second.state, RunState::Queued, "{case}: the newest run"); |
| 1218 | 1219 | if cancelled { |
| 1219 | 1220 | let jobs = store.jobs_for_run(&first.id).await.unwrap(); |
| 1220 | - assert_eq!(state_of(&jobs, "build"), Some(JobState::Cancelled), "{case}"); | |
| 1221 | + assert_eq!( | |
| 1222 | + state_of(&jobs, "build"), | |
| 1223 | + Some(JobState::Cancelled), | |
| 1224 | + "{case}" | |
| 1225 | + ); | |
| 1221 | 1226 | } |
| 1222 | 1227 | } |
| 1223 | 1228 | } |
crates/forge-web/src/exporter.rsmodified+7 -4
| @@ -279,9 +279,8 @@ async fn stage_repo(state: &AppState, repo: &Repo, dir: &Path) -> Result<(), Str | ||
| 279 | 279 | write_json(&dir.join("repo.json"), &meta).await?; |
| 280 | 280 | |
| 281 | 281 | // Issues go to the file as they are built, so a repo's issues are never all in memory at once. |
| 282 | - let mut out = BufWriter::new( | |
| 283 | - std::fs::File::create(dir.join("issues.json")).map_err(|e| e.to_string())?, | |
| 284 | - ); | |
| 282 | + let mut out = | |
| 283 | + BufWriter::new(std::fs::File::create(dir.join("issues.json")).map_err(|e| e.to_string())?); | |
| 285 | 284 | let mut written = 0usize; |
| 286 | 285 | let mut page = 1; |
| 287 | 286 | loop { |
| @@ -316,7 +315,11 @@ async fn stage_repo(state: &AppState, repo: &Repo, dir: &Path) -> Result<(), Str | ||
| 316 | 315 | .map_err(|e| e.to_string())?; |
| 317 | 316 | let names: HashMap<String, String> = |
| 318 | 317 | names.into_iter().map(|(k, (name, _))| (k, name)).collect(); |
| 319 | - write_array_item(&mut out, &mut written, &issue_json(&item, &comments, &names))?; | |
| 318 | + write_array_item( | |
| 319 | + &mut out, | |
| 320 | + &mut written, | |
| 321 | + &issue_json(&item, &comments, &names), | |
| 322 | + )?; | |
| 320 | 323 | } |
| 321 | 324 | if got == 0 || (u64::from(page) * u64::from(PAGE)) >= total { |
| 322 | 325 | break; |
crates/forge-web/src/i18n/integrations.rsmodified+7 -13
| @@ -339,12 +339,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 339 | 339 | (HookArchivedNotice, Tr) => { |
| 340 | 340 | "Bu depo arşivlenmiş. Web kancaları salt okunurdur: değiştirilemez, test edilemez ya da yeniden teslim edilemez." |
| 341 | 341 | } |
| 342 | - (HookNoticeConfirm, En) => { | |
| 343 | - "The delete was not confirmed. Nothing was deleted." | |
| 344 | - } | |
| 345 | - (HookNoticeConfirm, Tr) => { | |
| 346 | - "Silme onaylanmadı. Hiçbir şey silinmedi." | |
| 347 | - } | |
| 342 | + (HookNoticeConfirm, En) => "The delete was not confirmed. Nothing was deleted.", | |
| 343 | + (HookNoticeConfirm, Tr) => "Silme onaylanmadı. Hiçbir şey silinmedi.", | |
| 348 | 344 | (HookNoticeCreated, En) => "Webhook created. A ping was queued.", |
| 349 | 345 | (HookNoticeCreated, Tr) => "Web kancası oluşturuldu. Bir ping sıraya alındı.", |
| 350 | 346 | (HookNoticeDeleted, En) => "Webhook deleted.", |
| @@ -374,17 +370,15 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 374 | 370 | (NoMirrors, En) => "No mirrors yet.", |
| 375 | 371 | (NoMirrors, Tr) => "Henüz yansı yok.", |
| 376 | 372 | (NoWebhooks, En) => "No webhooks yet. Add one to send events to another service.", |
| 377 | - (NoWebhooks, Tr) => "Henüz web kancası yok. Olayları başka bir servise göndermek için bir tane ekleyin.", | |
| 373 | + (NoWebhooks, Tr) => { | |
| 374 | + "Henüz web kancası yok. Olayları başka bir servise göndermek için bir tane ekleyin." | |
| 375 | + } | |
| 378 | 376 | (NoneYet, En) => "none yet", |
| 379 | 377 | (NoneYet, Tr) => "henüz yok", |
| 380 | 378 | (NoResponse, En) => "no response", |
| 381 | 379 | (NoResponse, Tr) => "yanıt yok", |
| 382 | - (NoticeConfirm, En) => { | |
| 383 | - "The delete was not confirmed. Nothing was deleted." | |
| 384 | - } | |
| 385 | - (NoticeConfirm, Tr) => { | |
| 386 | - "Silme onaylanmadı. Hiçbir şey silinmedi." | |
| 387 | - } | |
| 380 | + (NoticeConfirm, En) => "The delete was not confirmed. Nothing was deleted.", | |
| 381 | + (NoticeConfirm, Tr) => "Silme onaylanmadı. Hiçbir şey silinmedi.", | |
| 388 | 382 | (NoticeCreated, En) => { |
| 389 | 383 | "Push mirror created. It will be pushed after the next push or on its interval." |
| 390 | 384 | } |
crates/forge-web/src/i18n/link.rsmodified+10 -1
| @@ -51,7 +51,16 @@ mod tests { | ||
| 51 | 51 | #[test] |
| 52 | 52 | fn every_string_has_no_em_dash() { |
| 53 | 53 | for lang in [Lang::En, Lang::Tr] { |
| 54 | - for key in [K::Restarting, K::BackSubmit, K::Saved, K::Done, K::DraftRestored, K::DraftDiscard, K::SelectFilter, K::SelectNone] { | |
| 54 | + for key in [ | |
| 55 | + K::Restarting, | |
| 56 | + K::BackSubmit, | |
| 57 | + K::Saved, | |
| 58 | + K::Done, | |
| 59 | + K::DraftRestored, | |
| 60 | + K::DraftDiscard, | |
| 61 | + K::SelectFilter, | |
| 62 | + K::SelectNone, | |
| 63 | + ] { | |
| 55 | 64 | assert!(!t(lang, key).contains('\u{2014}')); |
| 56 | 65 | } |
| 57 | 66 | } |
crates/forge-web/src/i18n/migrate.rsmodified+7 -2
| @@ -286,7 +286,10 @@ fn pair(key: K) -> (&'static str, &'static str) { | ||
| 286 | 286 | K::JobProgress => ("Progress", "İlerleme"), |
| 287 | 287 | K::JobNoLog => ("Nothing yet.", "Henüz bir şey yok."), |
| 288 | 288 | K::JobStarted => ("Started", "Başladı"), |
| 289 | - K::RetryFailedTitle => ("Retry failed imports", "Başarısız içe aktarmaları yeniden dene"), | |
| 289 | + K::RetryFailedTitle => ( | |
| 290 | + "Retry failed imports", | |
| 291 | + "Başarısız içe aktarmaları yeniden dene", | |
| 292 | + ), | |
| 290 | 293 | K::RetrySelected => ("Retry selected", "Seçilenleri yeniden dene"), |
| 291 | 294 | K::RetryNone => ("No failed imports", "Başarısız içe aktarma yok"), |
| 292 | 295 | K::RetryTokenHelp => ( |
| @@ -369,7 +372,9 @@ pub fn export_ttl_note(lang: Lang, days: u64) -> String { | ||
| 369 | 372 | pub fn bulk_skipped(lang: Lang, list: &str) -> String { |
| 370 | 373 | match lang { |
| 371 | 374 | Lang::En => format!("Not imported: {list}. Import them one by one to choose another name."), |
| 372 | - Lang::Tr => format!("İçe aktarılmayanlar: {list}. Başka bir ad seçmek için onları tek tek içe aktarın."), | |
| 375 | + Lang::Tr => format!( | |
| 376 | + "İçe aktarılmayanlar: {list}. Başka bir ad seçmek için onları tek tek içe aktarın." | |
| 377 | + ), | |
| 373 | 378 | } |
| 374 | 379 | } |
| 375 | 380 |
crates/forge-web/src/i18n/misc.rsmodified+9 -3
| @@ -666,7 +666,9 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 666 | 666 | (InvalidRepoName, Tr) => "geçersiz depo adı", |
| 667 | 667 | (ReadmeLabel, En) => "Add a README", |
| 668 | 668 | (ReadmeLabel, Tr) => "README ekle", |
| 669 | - (ReadmeHelp, En) => "A README.md with the name and description, so the repository is not empty.", | |
| 669 | + (ReadmeHelp, En) => { | |
| 670 | + "A README.md with the name and description, so the repository is not empty." | |
| 671 | + } | |
| 670 | 672 | (ReadmeHelp, Tr) => "Adı ve açıklamasıyla bir README.md; depo boş başlamaz.", |
| 671 | 673 | (LicenseLabel, En) => "License", |
| 672 | 674 | (LicenseLabel, Tr) => "Lisans", |
| @@ -676,8 +678,12 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 676 | 678 | (LicenseHelp, Tr) => "Tam metniyle bir LICENSE dosyası ekler.", |
| 677 | 679 | (UnknownLicense, En) => "unknown license", |
| 678 | 680 | (UnknownLicense, Tr) => "Bilinmeyen lisans.", |
| 679 | - (MirrorWithFiles, En) => "A mirror fills the repository from its source; leave README and license off.", | |
| 680 | - (MirrorWithFiles, Tr) => "Yansı, depoyu kaynağından doldurur; README ve lisansı kapalı bırakın.", | |
| 681 | + (MirrorWithFiles, En) => { | |
| 682 | + "A mirror fills the repository from its source; leave README and license off." | |
| 683 | + } | |
| 684 | + (MirrorWithFiles, Tr) => { | |
| 685 | + "Yansı, depoyu kaynağından doldurur; README ve lisansı kapalı bırakın." | |
| 686 | + } | |
| 681 | 687 | (ContributionsTitle, En) => "Contributions", |
| 682 | 688 | (ContributionsTitle, Tr) => "Katkılar", |
| 683 | 689 | (ContributionsLastYear, En) => "contributions in the last year", |
crates/forge-web/src/i18n/pulls.rsmodified+6 -2
| @@ -116,8 +116,12 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 116 | 116 | (FiltersApplied, Tr) => "Filtreler uygulandı · ", |
| 117 | 117 | (ClearFilters, En) => "Clear filters", |
| 118 | 118 | (ClearFilters, Tr) => "Filtreleri temizle", |
| 119 | - (NoPullRequestsYet, En) => "No pull requests yet. Push a branch, then open one to propose its changes.", | |
| 120 | - (NoPullRequestsYet, Tr) => "Henüz çekme isteği yok. Bir dal gönderin, ardından değişikliklerini önermek için bir çekme isteği açın.", | |
| 119 | + (NoPullRequestsYet, En) => { | |
| 120 | + "No pull requests yet. Push a branch, then open one to propose its changes." | |
| 121 | + } | |
| 122 | + (NoPullRequestsYet, Tr) => { | |
| 123 | + "Henüz çekme isteği yok. Bir dal gönderin, ardından değişikliklerini önermek için bir çekme isteği açın." | |
| 124 | + } | |
| 121 | 125 | (NoPullRequestsMatch, En) => "No pull requests match these filters.", |
| 122 | 126 | (NoPullRequestsMatch, Tr) => "Bu filtrelere uyan çekme isteği yok.", |
| 123 | 127 | (SortNewest, En) => "Newest", |
crates/forge-web/src/i18n/repo_admin.rsmodified+2 -6
| @@ -499,12 +499,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 499 | 499 | (TypeToConfirmBefore, Tr) => "Onaylamak için ", |
| 500 | 500 | (UnarchiveRepo, En) => "Unarchive repository", |
| 501 | 501 | (UnarchiveRepo, Tr) => "Depoyu arşivden çıkar", |
| 502 | - (UnderstandNeeded, En) => { | |
| 503 | - "The change was not confirmed. Nothing was changed." | |
| 504 | - } | |
| 505 | - (UnderstandNeeded, Tr) => { | |
| 506 | - "Değişiklik onaylanmadı. Hiçbir şey değiştirilmedi." | |
| 507 | - } | |
| 502 | + (UnderstandNeeded, En) => "The change was not confirmed. Nothing was changed.", | |
| 503 | + (UnderstandNeeded, Tr) => "Değişiklik onaylanmadı. Hiçbir şey değiştirilmedi.", | |
| 508 | 504 | (UnknownUser, En) => "No user has that username.", |
| 509 | 505 | (UnknownUser, Tr) => "Bu kullanıcı adına sahip bir kullanıcı yok.", |
| 510 | 506 | (Username, En) => "Username", |
crates/forge-web/src/importer/tests.rsmodified+14 -2
| @@ -313,7 +313,13 @@ async fn git_url_import_copies_all_branches_and_tags_into_a_normal_repo() { | ||
| 313 | 313 | &Transport::Local("/nonexistent/path.git".into()), |
| 314 | 314 | ) |
| 315 | 315 | .await; |
| 316 | - let bad_job = fx.state.store.import_job(&bad_job.id).await.unwrap().unwrap(); | |
| 316 | + let bad_job = fx | |
| 317 | + .state | |
| 318 | + .store | |
| 319 | + .import_job(&bad_job.id) | |
| 320 | + .await | |
| 321 | + .unwrap() | |
| 322 | + .unwrap(); | |
| 317 | 323 | assert_eq!(bad_job.state, ImportState::Failed); |
| 318 | 324 | assert!(bad_job.error.is_some()); |
| 319 | 325 | } |
| @@ -513,7 +519,13 @@ async fn retry_submit_leaves_another_users_failed_job_alone() { | ||
| 513 | 519 | .set_import_state(&job.id, ImportState::Failed, Some("rate limit")) |
| 514 | 520 | .await |
| 515 | 521 | .unwrap(); |
| 516 | - create_session(&fx.state.store, &other.id, "retry-other-session", "retry-csrf").await; | |
| 522 | + create_session( | |
| 523 | + &fx.state.store, | |
| 524 | + &other.id, | |
| 525 | + "retry-other-session", | |
| 526 | + "retry-csrf", | |
| 527 | + ) | |
| 528 | + .await; | |
| 517 | 529 | |
| 518 | 530 | let router = app_router(fx.state.clone()); |
| 519 | 531 | let cookie = format!("__Host-{SESSION_COOKIE}=retry-other-session"); |
crates/forge-web/src/internal.rsmodified+4 -1
| @@ -253,7 +253,10 @@ async fn admin_live_endpoint(cx: &Cx, body: Body) -> topcoat::Result<Response> { | ||
| 253 | 253 | for id in &req.account_ids { |
| 254 | 254 | state.live.bump(&Topic::Account(id.clone())); |
| 255 | 255 | } |
| 256 | - Ok(admin_response(StatusCode::OK, serde_json::json!({ "ok": true }))) | |
| 256 | + Ok(admin_response( | |
| 257 | + StatusCode::OK, | |
| 258 | + serde_json::json!({ "ok": true }), | |
| 259 | + )) | |
| 257 | 260 | } |
| 258 | 261 | |
| 259 | 262 | /// `POST /internal/admin/lfs-gc`. The body is ignored. |
crates/forge-web/src/live.rsmodified+19 -16
| @@ -293,25 +293,28 @@ where | ||
| 293 | 293 | topics.iter().map(|topic| hub.subscribe(topic)).collect(); |
| 294 | 294 | wakes.extend(extra); |
| 295 | 295 | let last = read().await?; |
| 296 | - Ok(stream::unfold(Follow { wakes, read, last }, move |mut follow| async move { | |
| 297 | - loop { | |
| 298 | - if !wait_any(&mut follow.wakes).await { | |
| 299 | - return None; | |
| 300 | - } | |
| 301 | - let now = match (follow.read)().await { | |
| 302 | - Ok(now) => now, | |
| 303 | - Err(e) => { | |
| 304 | - tracing::error!(error = %e, "live: could not read the page state"); | |
| 296 | + Ok(stream::unfold( | |
| 297 | + Follow { wakes, read, last }, | |
| 298 | + move |mut follow| async move { | |
| 299 | + loop { | |
| 300 | + if !wait_any(&mut follow.wakes).await { | |
| 305 | 301 | return None; |
| 306 | 302 | } |
| 307 | - }; | |
| 308 | - if now == follow.last { | |
| 309 | - continue; | |
| 303 | + let now = match (follow.read)().await { | |
| 304 | + Ok(now) => now, | |
| 305 | + Err(e) => { | |
| 306 | + tracing::error!(error = %e, "live: could not read the page state"); | |
| 307 | + return None; | |
| 308 | + } | |
| 309 | + }; | |
| 310 | + if now == follow.last { | |
| 311 | + continue; | |
| 312 | + } | |
| 313 | + follow.last = now; | |
| 314 | + return Some((named_event(name), follow)); | |
| 310 | 315 | } |
| 311 | - follow.last = now; | |
| 312 | - return Some((named_event(name), follow)); | |
| 313 | - } | |
| 314 | - })) | |
| 316 | + }, | |
| 317 | + )) | |
| 315 | 318 | } |
| 316 | 319 | |
| 317 | 320 | #[cfg(test)] |
crates/forge-web/src/mail/templates.rsmodified+5 -1
| @@ -217,7 +217,11 @@ mod tests { | ||
| 217 | 217 | fn subject_names_the_repo_title_and_number_and_stays_on_one_line() { |
| 218 | 218 | // A plain title is named as-is; a newline in the title cannot split the subject. |
| 219 | 219 | let cases = [ |
| 220 | - ("plain", "Crash on start", "[bob/widgets] Crash on start (#7)"), | |
| 220 | + ( | |
| 221 | + "plain", | |
| 222 | + "Crash on start", | |
| 223 | + "[bob/widgets] Crash on start (#7)", | |
| 224 | + ), | |
| 221 | 225 | ("newline", "two\r\nlines", "[bob/widgets] two lines (#7)"), |
| 222 | 226 | ]; |
| 223 | 227 | for (name, title, want) in cases { |
crates/forge-web/src/main.rsmodified+5 -2
| @@ -49,8 +49,8 @@ mod pulls_sync; | ||
| 49 | 49 | mod raw; |
| 50 | 50 | mod release_ops; |
| 51 | 51 | mod render; |
| 52 | -mod repo_stats; | |
| 53 | 52 | mod replication; |
| 53 | +mod repo_stats; | |
| 54 | 54 | mod self_update; |
| 55 | 55 | mod signatures; |
| 56 | 56 | mod ssh_backend; |
| @@ -145,7 +145,10 @@ fn reexec_with_allocator_env(raw: &[std::ffi::OsString]) { | ||
| 145 | 145 | }; |
| 146 | 146 | use std::os::unix::process::CommandExt; |
| 147 | 147 | // exec only returns on failure; the server then runs on without the variable. |
| 148 | - let e = std::process::Command::new(exe).args(raw).env(VAR, "0").exec(); | |
| 148 | + let e = std::process::Command::new(exe) | |
| 149 | + .args(raw) | |
| 150 | + .env(VAR, "0") | |
| 151 | + .exec(); | |
| 149 | 152 | eprintln!("forge: cannot re-run with {VAR}=0: {e}"); |
| 150 | 153 | } |
| 151 | 154 |
crates/forge-web/src/pages/activity.rsmodified+2 -2
| @@ -15,10 +15,10 @@ use topcoat::router::{Body, HeaderValue, StatusCode, route}; | ||
| 15 | 15 | |
| 16 | 16 | use crate::auth::current_user; |
| 17 | 17 | use crate::pages::ci_runs::{changed_stream, events_response, run_href}; |
| 18 | -use futures_util::Stream; | |
| 19 | -use topcoat::router::content::sse::Event; | |
| 20 | 18 | use crate::state::AppState; |
| 21 | 19 | use crate::views::repo_href; |
| 20 | +use futures_util::Stream; | |
| 21 | +use topcoat::router::content::sse::Event; | |
| 22 | 22 | |
| 23 | 23 | /// How far back a finished run still counts as recent in the activity JSON, in seconds. |
| 24 | 24 | const RECENT_SECS: i64 = 120; |
crates/forge-web/src/pages/admin_backups.rsmodified+1 -1
| @@ -141,8 +141,8 @@ async fn backups_view( | ||
| 141 | 141 | <div data-live="/admin/backups/events"> |
| 142 | 142 | <section class="page-head"> |
| 143 | 143 | <h1>(g::t(lang, K::Backups))</h1> |
| 144 | - <p class="muted">(g::t(lang, K::BackupsIntro))</p> | |
| 145 | 144 | </section> |
| 145 | + <p class="muted page-lede">(g::t(lang, K::BackupsIntro))</p> | |
| 146 | 146 | if let Some(message) = notice { |
| 147 | 147 | <section class="card notice" role="status"> |
| 148 | 148 | <p>(message.as_str())</p> |
crates/forge-web/src/pages/admin_health.rsmodified+9 -11
| @@ -446,12 +446,10 @@ async fn alert_rows(state: &AppState, lang: Lang) -> Result<Vec<AlertRow>> { | ||
| 446 | 446 | .active_alerts() |
| 447 | 447 | .await? |
| 448 | 448 | .into_iter() |
| 449 | - .map(|alert| { | |
| 450 | - AlertRow { | |
| 451 | - title: alert_text::title(lang, &alert.kind, &alert.subject, false), | |
| 452 | - body: alert_text::body(lang, &alert.kind, &alert.subject, &alert.detail, false), | |
| 453 | - stamp: alert.raised_at.clone(), | |
| 454 | - } | |
| 449 | + .map(|alert| AlertRow { | |
| 450 | + title: alert_text::title(lang, &alert.kind, &alert.subject, false), | |
| 451 | + body: alert_text::body(lang, &alert.kind, &alert.subject, &alert.detail, false), | |
| 452 | + stamp: alert.raised_at.clone(), | |
| 455 | 453 | }) |
| 456 | 454 | .collect()) |
| 457 | 455 | } |
| @@ -498,12 +496,12 @@ async fn health_view( | ||
| 498 | 496 | <div data-live="/admin/health/events" class="health-page"> |
| 499 | 497 | <section class="page-head"> |
| 500 | 498 | <h1>(at(lang, A::Health))</h1> |
| 501 | - <p class="health-summary"> | |
| 502 | - <span class=(format!("health-dot {}", summary_dot.class()))></span> | |
| 503 | - (summary) | |
| 504 | - </p> | |
| 505 | - <p class="muted small">(at(lang, A::HealthIntro))</p> | |
| 506 | 499 | </section> |
| 500 | + <p class="health-summary page-lede"> | |
| 501 | + <span class=(format!("health-dot {}", summary_dot.class()))></span> | |
| 502 | + (summary) | |
| 503 | + </p> | |
| 504 | + <p class="muted small page-lede">(at(lang, A::HealthIntro))</p> | |
| 507 | 505 | if count > 0 { |
| 508 | 506 | <section class="admin-alerts" role="alert"> |
| 509 | 507 | <h2>(alert_text::banner_heading(lang, count))</h2> |
crates/forge-web/src/pages/admin_live_tests.rsmodified+5 -1
| @@ -280,5 +280,9 @@ async fn backups_replication_health_and_server_send_for_their_changes() { | ||
| 280 | 280 | |
| 281 | 281 | // Any saved or reset setting wakes the server stream. |
| 282 | 282 | admin().bump(&Topic::AdminServer); |
| 283 | - assert_eq!(next_event(&mut settings).await, changed("settings"), "setting"); | |
| 283 | + assert_eq!( | |
| 284 | + next_event(&mut settings).await, | |
| 285 | + changed("settings"), | |
| 286 | + "setting" | |
| 287 | + ); | |
| 284 | 288 | } |
crates/forge-web/src/pages/admin_mail.rsmodified+1 -1
| @@ -230,8 +230,8 @@ async fn mail_view( | ||
| 230 | 230 | Ok(view! { |
| 231 | 231 | <section class="page-head"> |
| 232 | 232 | <h1>(g::t(lang, K::Mail))</h1> |
| 233 | - <p class="muted">(g::t(lang, K::MailIntro))</p> | |
| 234 | 233 | </section> |
| 234 | + <p class="muted page-lede">(g::t(lang, K::MailIntro))</p> | |
| 235 | 235 | <nav class="subnav" aria-label=(g::t(lang, K::Mail))> |
| 236 | 236 | <a class=(settings_class) href="/admin/mail">(g::t(lang, K::MailTabSettings))</a> |
| 237 | 237 | <a class=(queue_class) href="/admin/mail?tab=queue">(g::t(lang, K::MailTabQueue))</a> |
crates/forge-web/src/pages/admin_replication.rsmodified+1 -1
| @@ -191,8 +191,8 @@ async fn replication_view( | ||
| 191 | 191 | <div data-live="/admin/replication/events"> |
| 192 | 192 | <section class="page-head"> |
| 193 | 193 | <h1>(g::t(lang, K::Replication))</h1> |
| 194 | - <p class="muted">(g::t(lang, K::ReplicationIntro))</p> | |
| 195 | 194 | </section> |
| 195 | + <p class="muted page-lede">(g::t(lang, K::ReplicationIntro))</p> | |
| 196 | 196 | if let Some(message) = notice { |
| 197 | 197 | <section class="card notice" role="status"> |
| 198 | 198 | <p>(message.as_str())</p> |
crates/forge-web/src/pages/admin_runners.rsmodified+25 -15
| @@ -26,12 +26,12 @@ use topcoat::router::{page, path_param, query_params, route}; | ||
| 26 | 26 | use topcoat::view::{View, component, view}; |
| 27 | 27 | |
| 28 | 28 | use crate::audit::{self, Actor, Target}; |
| 29 | +use crate::auth::check_csrf; | |
| 29 | 30 | use crate::ci::metrics_chart::{self, Bucket}; |
| 30 | 31 | use crate::ci::runner_log::Line; |
| 31 | -use crate::auth::check_csrf; | |
| 32 | 32 | use crate::i18n::admin::{self as g, K}; |
| 33 | -use crate::i18n::{self, Key, Lang}; | |
| 34 | 33 | use crate::i18n::releases_ci as rc; |
| 34 | +use crate::i18n::{self, Key, Lang}; | |
| 35 | 35 | use crate::pages::admin_users::admin_only; |
| 36 | 36 | use crate::pages::ci_runs::{age_text, duration_text, events_response, run_href, state_text}; |
| 37 | 37 | use crate::pages::repo_mirrors::stamp_in_tz; |
| @@ -555,7 +555,13 @@ async fn concurrency_form( | ||
| 555 | 555 | let meter_max = max.max(1).to_string(); |
| 556 | 556 | let use_pips = (1..=PIP_MAX).contains(&max); |
| 557 | 557 | let pips: Vec<&'static str> = (0..max) |
| 558 | - .map(|slot| if slot < running { "runner-pip is-on" } else { "runner-pip" }) | |
| 558 | + .map(|slot| { | |
| 559 | + if slot < running { | |
| 560 | + "runner-pip is-on" | |
| 561 | + } else { | |
| 562 | + "runner-pip" | |
| 563 | + } | |
| 564 | + }) | |
| 559 | 565 | .collect(); |
| 560 | 566 | let pips_label = match lang { |
| 561 | 567 | Lang::En => format!("{running} of {max} jobs running"), |
| @@ -1465,16 +1471,8 @@ fn mx_chart( | ||
| 1465 | 1471 | caption, |
| 1466 | 1472 | legend, |
| 1467 | 1473 | grids: svg.grids.iter().map(|y| n(*y)).collect(), |
| 1468 | - ticks: svg | |
| 1469 | - .ticks | |
| 1470 | - .iter() | |
| 1471 | - .map(|(y, v)| (n(*y), tick(*v))) | |
| 1472 | - .collect(), | |
| 1473 | - bands: svg | |
| 1474 | - .bands | |
| 1475 | - .iter() | |
| 1476 | - .map(|(x, w)| (n(*x), n(*w))) | |
| 1477 | - .collect(), | |
| 1474 | + ticks: svg.ticks.iter().map(|(y, v)| (n(*y), tick(*v))).collect(), | |
| 1475 | + bands: svg.bands.iter().map(|(x, w)| (n(*x), n(*w))).collect(), | |
| 1478 | 1476 | paths: svg |
| 1479 | 1477 | .paths |
| 1480 | 1478 | .into_iter() |
| @@ -1552,7 +1550,12 @@ fn metrics_view(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsVie | ||
| 1552 | 1550 | &[(rx_of, "mx-line"), (tx_of, "mx-line mx-line-sent")], |
| 1553 | 1551 | false, |
| 1554 | 1552 | &rate_text, |
| 1555 | - &|b| vec![format!("↓ {}", rate_text(b.rx)), format!("↑ {}", rate_text(b.tx))], | |
| 1553 | + &|b| { | |
| 1554 | + vec![ | |
| 1555 | + format!("↓ {}", rate_text(b.rx)), | |
| 1556 | + format!("↑ {}", rate_text(b.tx)), | |
| 1557 | + ] | |
| 1558 | + }, | |
| 1556 | 1559 | net_caption, |
| 1557 | 1560 | vec![ |
| 1558 | 1561 | ("mx-key", s(lang, "Received", "Alınan")), |
| @@ -2520,7 +2523,14 @@ mod tests { | ||
| 2520 | 2523 | store.list_runners().await.unwrap()[0].concurrency_override, |
| 2521 | 2524 | None |
| 2522 | 2525 | ); |
| 2523 | - let (status, _) = send(&router, "GET", "/admin/runners/events", Some(USER_TOKEN), None).await; | |
| 2526 | + let (status, _) = send( | |
| 2527 | + &router, | |
| 2528 | + "GET", | |
| 2529 | + "/admin/runners/events", | |
| 2530 | + Some(USER_TOKEN), | |
| 2531 | + None, | |
| 2532 | + ) | |
| 2533 | + .await; | |
| 2524 | 2534 | assert_eq!(status, 404); |
| 2525 | 2535 | let (status, _) = send(&router, "GET", &detail_uri, Some(USER_TOKEN), None).await; |
| 2526 | 2536 | assert_eq!(status, 404); |
crates/forge-web/src/pages/admin_server.rsmodified+15 -5
| @@ -235,9 +235,9 @@ async fn server_view( | ||
| 235 | 235 | <div data-live=(live.as_str()) class="srv-page"> |
| 236 | 236 | <section class="page-head"> |
| 237 | 237 | <h1>(g::t(lang, K::ServerSettings))</h1> |
| 238 | - <p class="muted">(g::t(lang, K::ServerSettingsIntro))</p> | |
| 239 | - <p class="muted small">(match lang { Lang::Tr => "Sürüm", _ => "Version" }) " " (forge_ci::build::display())</p> | |
| 240 | 238 | </section> |
| 239 | + <p class="muted page-lede">(g::t(lang, K::ServerSettingsIntro))</p> | |
| 240 | + <p class="muted small page-lede">(match lang { Lang::Tr => "Sürüm", _ => "Version" }) " " (forge_ci::build::display())</p> | |
| 241 | 241 | if restart == Restart::Pending { |
| 242 | 242 | <section class="card notice srv-restarting" role="status" aria-live="polite"> |
| 243 | 243 | <p><strong>(s(lang, "Restarting...", "Yeniden başlatılıyor..."))</strong> " " (s(lang, "This page comes back by itself when the server is up again.", "Sunucu tekrar ayağa kalkınca bu sayfa kendiliğinden geri gelir."))</p> |
| @@ -682,8 +682,14 @@ mod tests { | ||
| 682 | 682 | send(&fx.router, "POST", "/admin/server/reset", token, Some(form)).await; |
| 683 | 683 | assert_eq!(post, 404); |
| 684 | 684 | let form = format!("csrf={CSRF}&tab=general"); |
| 685 | - let (post, _, _) = | |
| 686 | - send(&fx.router, "POST", "/admin/server/restart", token, Some(form)).await; | |
| 685 | + let (post, _, _) = send( | |
| 686 | + &fx.router, | |
| 687 | + "POST", | |
| 688 | + "/admin/server/restart", | |
| 689 | + token, | |
| 690 | + Some(form), | |
| 691 | + ) | |
| 692 | + .await; | |
| 687 | 693 | assert_eq!(post, 404, "restart"); |
| 688 | 694 | let (events, _, _) = send(&fx.router, "GET", "/admin/server/events", token, None).await; |
| 689 | 695 | assert_eq!(events, 404, "events"); |
| @@ -861,7 +867,11 @@ mod tests { | ||
| 861 | 867 | .filter(|e| e.action == AuditAction::ServerSettingsUpdated) |
| 862 | 868 | .collect(); |
| 863 | 869 | assert!(updates.iter().any(|e| e.data.contains("ci.max_log_mb"))); |
| 864 | - assert!(updates.iter().any(|e| e.data.contains("backup.healthcheck_url"))); | |
| 870 | + assert!( | |
| 871 | + updates | |
| 872 | + .iter() | |
| 873 | + .any(|e| e.data.contains("backup.healthcheck_url")) | |
| 874 | + ); | |
| 865 | 875 | for entry in &updates { |
| 866 | 876 | assert!(!entry.data.contains("77"), "{}", entry.data); |
| 867 | 877 | assert!(!entry.data.contains("TOPSECRET"), "{}", entry.data); |
crates/forge-web/src/pages/admin_user_detail.rsmodified+8 -2
| @@ -24,7 +24,9 @@ use crate::live::{Topic, stream_changes}; | ||
| 24 | 24 | use crate::pages::admin_users::admin_only; |
| 25 | 25 | use crate::pages::passkeys::s; |
| 26 | 26 | use crate::state::AppState; |
| 27 | -use crate::views::{alert, avatar_url, enc, rel_time, rel_time_or_never, shell, user_facing_message}; | |
| 27 | +use crate::views::{ | |
| 28 | + alert, avatar_url, enc, rel_time, rel_time_or_never, shell, user_facing_message, | |
| 29 | +}; | |
| 28 | 30 | |
| 29 | 31 | #[query_params(error = bad_request)] |
| 30 | 32 | pub(crate) struct DoneQuery { |
| @@ -138,7 +140,11 @@ async fn detail_body( | ||
| 138 | 140 | "user-dot is-active" |
| 139 | 141 | }; |
| 140 | 142 | let tfa_on = facts.two_factor; |
| 141 | - let tfa = if tfa_on { at(lang, A::On) } else { at(lang, A::Off) }; | |
| 143 | + let tfa = if tfa_on { | |
| 144 | + at(lang, A::On) | |
| 145 | + } else { | |
| 146 | + at(lang, A::Off) | |
| 147 | + }; | |
| 142 | 148 | let is_admin = target.is_admin; |
| 143 | 149 | let suspended_note = match suspension.as_ref().map(|s| s.reason.clone()) { |
| 144 | 150 | Some(reason) if !reason.is_empty() => reason, |
crates/forge-web/src/pages/admin_users.rsmodified+1 -1
| @@ -65,7 +65,7 @@ async fn users_view( | ||
| 65 | 65 | <section class="page-head"> |
| 66 | 66 | <h1>(g::t(lang, K::Users))</h1> |
| 67 | 67 | </section> |
| 68 | - <section class="card"> | |
| 68 | + <section class="card fit-pane"> | |
| 69 | 69 | <div class="table-wrap"> |
| 70 | 70 | <table class="table queue-table"> |
| 71 | 71 | <thead> |
crates/forge-web/src/pages/audit_log.rsmodified+4 -10
| @@ -148,8 +148,8 @@ async fn admin_audit_view( | ||
| 148 | 148 | <div data-live=(live.as_str())> |
| 149 | 149 | <section class="page-head"> |
| 150 | 150 | <h1>(g::t(lang, K::AuditLog))</h1> |
| 151 | - <p class="muted">(g::t(lang, K::AuditIntro))</p> | |
| 152 | 151 | </section> |
| 152 | + <p class="muted page-lede">(g::t(lang, K::AuditIntro))</p> | |
| 153 | 153 | <section class="card"> |
| 154 | 154 | <form method="get" action="/admin/audit" class="filter-bar"> |
| 155 | 155 | <label class="filter-action"> |
| @@ -194,8 +194,8 @@ async fn own_log_view( | ||
| 194 | 194 | Ok(view! { |
| 195 | 195 | <section class="page-head"> |
| 196 | 196 | <h1>(g::t(lang, K::SecurityLogTitle))</h1> |
| 197 | - <p class="muted">(g::t(lang, K::OwnLogIntro))</p> | |
| 198 | 197 | </section> |
| 198 | + <p class="muted page-lede">(g::t(lang, K::OwnLogIntro))</p> | |
| 199 | 199 | <section class="card fit-pane fit-list"> |
| 200 | 200 | audit_table(lang: lang, rows: rows, show_actor: false) |
| 201 | 201 | if let Some(href) = older_href { |
| @@ -237,10 +237,7 @@ async fn admin_audit_page(cx: &Cx) -> Result<impl View> { | ||
| 237 | 237 | fetch_page(store, &filter, query.before.as_deref(), ADMIN_PAGE_SIZE).await? |
| 238 | 238 | }; |
| 239 | 239 | |
| 240 | - let rows: Vec<RowView> = entries | |
| 241 | - .iter() | |
| 242 | - .map(|entry| row_view(entry, lang)) | |
| 243 | - .collect(); | |
| 240 | + let rows: Vec<RowView> = entries.iter().map(|entry| row_view(entry, lang)).collect(); | |
| 244 | 241 | let older_href = next.map(|cursor| { |
| 245 | 242 | list_href( |
| 246 | 243 | "/admin/audit", |
| @@ -315,10 +312,7 @@ async fn own_log_page(cx: &Cx) -> Result<impl View> { | ||
| 315 | 312 | let (entries, next) = |
| 316 | 313 | fetch_page(store, &filter, query.before.as_deref(), OWN_PAGE_SIZE).await?; |
| 317 | 314 | |
| 318 | - let rows: Vec<RowView> = entries | |
| 319 | - .iter() | |
| 320 | - .map(|entry| row_view(entry, lang)) | |
| 321 | - .collect(); | |
| 315 | + let rows: Vec<RowView> = entries.iter().map(|entry| row_view(entry, lang)).collect(); | |
| 322 | 316 | let older_href = |
| 323 | 317 | next.map(|cursor| list_href("/settings/security/log", &[("before", cursor.as_str())])); |
| 324 | 318 | let title = g::t(lang, K::SecurityLogTitle); |
crates/forge-web/src/pages/blame.rsmodified+1 -1
| @@ -228,7 +228,7 @@ async fn blame_page(cx: &Cx) -> Result<impl View> { | ||
| 228 | 228 | <div class="browse-bar"> |
| 229 | 229 | breadcrumb(lang: lang, crumbs: crumbs) |
| 230 | 230 | </div> |
| 231 | - <section class="file" data-lines=""> | |
| 231 | + <section class="file fit-pane" data-lines=""> | |
| 232 | 232 | <header class="file-head"> |
| 233 | 233 | <span class="muted small">(b::t(lang, b::K::BlameTitle)) " \u{b7} " (size)</span> |
| 234 | 234 | <nav class="file-actions" aria-label=(g::t(lang, K::FileNav))> |
crates/forge-web/src/pages/branches.rsmodified+16 -10
| @@ -155,7 +155,7 @@ async fn branch_table( | ||
| 155 | 155 | </thead> |
| 156 | 156 | <tbody> |
| 157 | 157 | for row in rows.into_iter() { |
| 158 | - <tr> | |
| 158 | + <tr data-kb-row=""> | |
| 159 | 159 | <td class="tree-name"> |
| 160 | 160 | <span class="tree-label"> |
| 161 | 161 | <a href=(row.href.as_str())>(row.name.as_str())</a> |
| @@ -313,15 +313,21 @@ async fn branches_page(cx: &Cx) -> Result<impl View> { | ||
| 313 | 313 | <p class="notice" role="status">(b::t(lang, key))</p> |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | - if can_write { | |
| 317 | - new_branch_form(lang: lang, action: action.clone(), csrf: csrf.clone(), | |
| 318 | - default_branch: default_branch, options: options) | |
| 319 | - } | |
| 320 | - if empty { | |
| 321 | - empty_state(title: g::t(lang, K::NothingHere)) | |
| 322 | - } else { | |
| 323 | - branch_table(rows: rows, lang: lang, csrf: csrf.clone(), delete_action: delete_action, can_delete: can_write) | |
| 324 | - } | |
| 316 | + <div class="lang-list fit-pane"> | |
| 317 | + <div class="list-bar"> | |
| 318 | + if can_write { | |
| 319 | + new_branch_form(lang: lang, action: action.clone(), csrf: csrf.clone(), | |
| 320 | + default_branch: default_branch, options: options) | |
| 321 | + } | |
| 322 | + </div> | |
| 323 | + <div class="list-scroll"> | |
| 324 | + if empty { | |
| 325 | + empty_state(title: g::t(lang, K::NothingHere)) | |
| 326 | + } else { | |
| 327 | + branch_table(rows: rows, lang: lang, csrf: csrf.clone(), delete_action: delete_action, can_delete: can_write) | |
| 328 | + } | |
| 329 | + </div> | |
| 330 | + </div> | |
| 325 | 331 | ) |
| 326 | 332 | }) |
| 327 | 333 | } |
crates/forge-web/src/pages/ci_fail.rsmodified+1 -3
| @@ -115,9 +115,7 @@ pub(crate) async fn read( | ||
| 115 | 115 | /// The failure block. The job's name links to its page; the first error links to its line there. |
| 116 | 116 | #[component] |
| 117 | 117 | pub(crate) async fn fail_first_block(lang: Lang, fail: FailFirst) -> Result<impl View> { |
| 118 | - let line_href = fail | |
| 119 | - .line_no | |
| 120 | - .map(|no| format!("{}#L{no}", fail.job_href)); | |
| 118 | + let line_href = fail.line_no.map(|no| format!("{}#L{no}", fail.job_href)); | |
| 121 | 119 | Ok(view! { |
| 122 | 120 | <section class="fail-first" data-fail-first="true"> |
| 123 | 121 | <p class="fail-first-head"> |
crates/forge-web/src/pages/ci_job.rsmodified+78 -68
| @@ -351,7 +351,10 @@ async fn job_fingerprint_now(store: &Store, job_id: &str) -> Result<Option<Strin | ||
| 351 | 351 | return Ok(None); |
| 352 | 352 | }; |
| 353 | 353 | let artifacts = store.list_artifacts(job_id).await?; |
| 354 | - let ids: Vec<&str> = artifacts.iter().map(|artifact| artifact.id.as_str()).collect(); | |
| 354 | + let ids: Vec<&str> = artifacts | |
| 355 | + .iter() | |
| 356 | + .map(|artifact| artifact.id.as_str()) | |
| 357 | + .collect(); | |
| 355 | 358 | Ok(Some(job_fingerprint( |
| 356 | 359 | job_status(&job), |
| 357 | 360 | &ids, |
| @@ -375,74 +378,78 @@ async fn job_body( | ||
| 375 | 378 | ) -> Result<impl View> { |
| 376 | 379 | Ok(view! { |
| 377 | 380 | repo_head(head: RepoHead { live: String::new(), ..head }) |
| 378 | - <div data-live=(live.as_str()) data-live-state=(job.fingerprint.as_str())> | |
| 379 | - <p class="muted small"><a href=(job.run_href.as_str())>(g::t(lang, K::RunNumber)) (job.run_number)</a></p> | |
| 380 | - <div class="ci-job-grid fit-pane"> | |
| 381 | - <section class="card"> | |
| 382 | - <h2 class="ci-job-title">(job.name.as_str())</h2> | |
| 383 | - <p class="muted small"> | |
| 384 | - <span class=(job.state_class.as_str())>(job.state.as_str())</span> | |
| 385 | - if !job.runner.is_empty() { | |
| 386 | - " \u{b7} " (g::t(lang, K::Runner)) " " (job.runner.as_str()) | |
| 387 | - } | |
| 388 | - if !job.exit_code.is_empty() { | |
| 389 | - " \u{b7} " (g::t(lang, K::Exit)) " " (job.exit_code.as_str()) | |
| 390 | - } | |
| 391 | - </p> | |
| 392 | - if !job.started.is_empty() { | |
| 393 | - <p class="muted small">(g::t(lang, K::Started)) " " <time datetime=(job.started_full.as_str()) data-rel="true" title=(full_date(job.started_full.as_str()))>(job.started.as_str())</time></p> | |
| 394 | - } | |
| 395 | - if !job.finished.is_empty() { | |
| 396 | - <p class="muted small">(g::t(lang, K::Finished)) " " <time datetime=(job.finished_full.as_str()) data-rel="true" title=(full_date(job.finished_full.as_str()))>(job.finished.as_str())</time></p> | |
| 397 | - } | |
| 398 | - if !job.duration.is_empty() { | |
| 399 | - <p class="muted small">(g::t(lang, K::Duration)) " " (job.duration.as_str())</p> | |
| 400 | - } | |
| 401 | - if !job.message.is_empty() { | |
| 402 | - <p>(job.message.as_str())</p> | |
| 403 | - } | |
| 404 | - if let Some(kills) = job.oom_kills { | |
| 405 | - <p class="alert" title=(format!("oom_kill {kills}"))>(if matches!(lang, Lang::Tr) { "sonlandırıldı: bellek yetersiz" } else { "killed: out of memory" })</p> | |
| 406 | - } | |
| 407 | - if let Some((action, csrf)) = job.rerun.as_ref() { | |
| 408 | - <div class="ci-actions"> | |
| 409 | - <form method="post" action=(action.as_str()) class="inline-form"> | |
| 410 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | |
| 411 | - <button type="submit" data-palette-action="post">(g::t(lang, K::RerunJob))</button> | |
| 412 | - </form> | |
| 381 | + <div data-live=(live.as_str()) data-live-state=(job.fingerprint.as_str()) class="ci-job fit-pane"> | |
| 382 | + <header class="ci-tl-head"> | |
| 383 | + <div class="ci-tl-headmain"> | |
| 384 | + <div class="ci-tl-line"> | |
| 385 | + <span class="ci-tl-no"><a href=(job.run_href.as_str())>(g::t(lang, K::RunNumber)) (job.run_number)</a></span> | |
| 386 | + <h2 class="ci-tl-title ci-job-title">(job.name.as_str())</h2> | |
| 387 | + </div> | |
| 388 | + <div class="ci-tl-meta"> | |
| 389 | + <span class=(job.state_class.as_str())>(job.state.as_str())</span> | |
| 390 | + if !job.runner.is_empty() { | |
| 391 | + <span class="muted">(g::t(lang, K::Runner)) " " (job.runner.as_str())</span> | |
| 392 | + } | |
| 393 | + if !job.exit_code.is_empty() { | |
| 394 | + <span class="muted">(g::t(lang, K::Exit)) " " (job.exit_code.as_str())</span> | |
| 395 | + } | |
| 396 | + if !job.duration.is_empty() { | |
| 397 | + <span class="ci-tl-dur">(g::t(lang, K::Duration)) " " (job.duration.as_str())</span> | |
| 398 | + } | |
| 399 | + </div> | |
| 413 | 400 | </div> |
| 414 | - } | |
| 415 | - </section> | |
| 416 | - <section class="card ci-logcard"> | |
| 417 | - <h2>(g::t(lang, K::Log))</h2> | |
| 418 | - <p class="muted small"><a href=(job.log_href.as_str())>(g::t(lang, K::FullLog))</a></p> | |
| 419 | - if truncated { | |
| 420 | - <p class="muted small">(g::t(lang, K::LogTruncated))</p> | |
| 421 | - } | |
| 422 | - <div class="ci-logbar"> | |
| 423 | - <input type="search" class="ci-logsearch" data-log-q="true" placeholder=(g::t(lang, K::LogSearch)) aria-label=(g::t(lang, K::LogSearch)) autocomplete="off" spellcheck="false"> | |
| 424 | - <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span> | |
| 425 | - <button type="button" class="ci-mini" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev)) title=(g::t(lang, K::LogPrev))>"\u{2191}"</button> | |
| 426 | - <button type="button" class="ci-mini" data-log-next="true" aria-label=(g::t(lang, K::LogNext)) title=(g::t(lang, K::LogNext))>"\u{2193}"</button> | |
| 427 | - <button type="button" class="ci-mini" data-copy-log=(job.log_href.as_str()) data-palette-action="click" data-copied=(g::t(lang, K::CopyDone)) data-failed=(g::t(lang, K::CopyFailed))>(g::t(lang, K::CopyLog))</button> | |
| 428 | - <span class="ci-logfold" data-log-fold-box="true" hidden="hidden"> | |
| 429 | - <button type="button" class="ci-mini" data-log-fold="close">(g::t(lang, K::LogCollapseAll))</button> | |
| 430 | - <button type="button" class="ci-mini" data-log-fold="open">(g::t(lang, K::LogExpandAll))</button> | |
| 431 | - </span> | |
| 432 | - </div> | |
| 433 | - <pre class="ci-log" data-live-log="true" data-offset=(log_offset.as_str()) data-first=(first_line.as_str())>(log.as_str())</pre> | |
| 434 | - </section> | |
| 435 | - if !artifacts.is_empty() { | |
| 436 | - <section class="card"> | |
| 437 | - <h2>(g::t(lang, K::Artifacts))</h2> | |
| 438 | - <ul class="ci-artifacts"> | |
| 439 | - for artifact in artifacts.iter() { | |
| 440 | - <li><a href=(artifact.href.as_str())>(artifact.name.as_str())</a> " (" (artifact.size.as_str()) ")"</li> | |
| 401 | + if let Some((action, csrf)) = job.rerun.as_ref() { | |
| 402 | + <div class="ci-actions ci-tl-actions"> | |
| 403 | + <form method="post" action=(action.as_str()) class="inline-form"> | |
| 404 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | |
| 405 | + <button type="submit" data-palette-action="post">(g::t(lang, K::RerunJob))</button> | |
| 406 | + </form> | |
| 407 | + </div> | |
| 408 | + } | |
| 409 | + </header> | |
| 410 | + <div class="ci-tl-main"> | |
| 411 | + <section class="card ci-tl-jobs"> | |
| 412 | + if !job.started.is_empty() { | |
| 413 | + <p class="muted small">(g::t(lang, K::Started)) " " <time datetime=(job.started_full.as_str()) data-rel="true" title=(full_date(job.started_full.as_str()))>(job.started.as_str())</time></p> | |
| 441 | 414 | } |
| 442 | - </ul> | |
| 443 | - </section> | |
| 444 | - } | |
| 445 | - </div> | |
| 415 | + if !job.finished.is_empty() { | |
| 416 | + <p class="muted small">(g::t(lang, K::Finished)) " " <time datetime=(job.finished_full.as_str()) data-rel="true" title=(full_date(job.finished_full.as_str()))>(job.finished.as_str())</time></p> | |
| 417 | + } | |
| 418 | + if !job.message.is_empty() { | |
| 419 | + <p>(job.message.as_str())</p> | |
| 420 | + } | |
| 421 | + if let Some(kills) = job.oom_kills { | |
| 422 | + <p class="alert" title=(format!("oom_kill {kills}"))>(if matches!(lang, Lang::Tr) { "sonlandırıldı: bellek yetersiz" } else { "killed: out of memory" })</p> | |
| 423 | + } | |
| 424 | + if !artifacts.is_empty() { | |
| 425 | + <p class="ci-tl-label">(g::t(lang, K::Artifacts))</p> | |
| 426 | + <ul class="ci-artifacts"> | |
| 427 | + for artifact in artifacts.iter() { | |
| 428 | + <li><a href=(artifact.href.as_str())>(artifact.name.as_str())</a> " (" (artifact.size.as_str()) ")"</li> | |
| 429 | + } | |
| 430 | + </ul> | |
| 431 | + } | |
| 432 | + </section> | |
| 433 | + <section class="card ci-tl-log"> | |
| 434 | + <div class="ci-logbar ci-tl-logbar"> | |
| 435 | + <span class="ci-tl-label">(g::t(lang, K::Log))</span> | |
| 436 | + <input type="search" class="ci-logsearch" data-log-q="true" placeholder=(g::t(lang, K::LogSearch)) aria-label=(g::t(lang, K::LogSearch)) autocomplete="off" spellcheck="false"> | |
| 437 | + <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span> | |
| 438 | + <button type="button" class="ci-mini" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev)) title=(g::t(lang, K::LogPrev))>"\u{2191}"</button> | |
| 439 | + <button type="button" class="ci-mini" data-log-next="true" aria-label=(g::t(lang, K::LogNext)) title=(g::t(lang, K::LogNext))>"\u{2193}"</button> | |
| 440 | + <button type="button" class="ci-mini" data-copy-log=(job.log_href.as_str()) data-palette-action="click" data-copied=(g::t(lang, K::CopyDone)) data-failed=(g::t(lang, K::CopyFailed))>(g::t(lang, K::CopyLog))</button> | |
| 441 | + <a class="ci-mini" href=(job.log_href.as_str())>(g::t(lang, K::FullLog))</a> | |
| 442 | + <span class="ci-logfold" data-log-fold-box="true" hidden="hidden"> | |
| 443 | + <button type="button" class="ci-mini" data-log-fold="close">(g::t(lang, K::LogCollapseAll))</button> | |
| 444 | + <button type="button" class="ci-mini" data-log-fold="open">(g::t(lang, K::LogExpandAll))</button> | |
| 445 | + </span> | |
| 446 | + </div> | |
| 447 | + if truncated { | |
| 448 | + <p class="muted small">(g::t(lang, K::LogTruncated))</p> | |
| 449 | + } | |
| 450 | + <pre class="ci-log ci-tl-code" data-live-log="true" data-offset=(log_offset.as_str()) data-first=(first_line.as_str())>(log.as_str())</pre> | |
| 451 | + </section> | |
| 452 | + </div> | |
| 446 | 453 | </div> |
| 447 | 454 | }) |
| 448 | 455 | } |
| @@ -632,7 +639,10 @@ fn job_stream(follow: JobFollow) -> impl Stream<Item = Result<Event>> + Send + ' | ||
| 632 | 639 | } |
| 633 | 640 | if let Some((text, end)) = f.pending_log.take() { |
| 634 | 641 | let text = if f.plain { |
| 635 | - text.split('\n').map(strip_ansi).collect::<Vec<_>>().join("\n") | |
| 642 | + text.split('\n') | |
| 643 | + .map(strip_ansi) | |
| 644 | + .collect::<Vec<_>>() | |
| 645 | + .join("\n") | |
| 636 | 646 | } else { |
| 637 | 647 | text |
| 638 | 648 | }; |
crates/forge-web/src/pages/ci_runs.rsmodified+72 -47
| @@ -34,22 +34,24 @@ use topcoat::view::{View, component, view}; | ||
| 34 | 34 | |
| 35 | 35 | use crate::auth::{current_user, require_csrf}; |
| 36 | 36 | use crate::ci::log_path; |
| 37 | +use crate::i18n::timeline::{self as tl, K as TK}; | |
| 37 | 38 | use crate::i18n::{ |
| 38 | 39 | self, Lang, |
| 39 | 40 | releases_ci::{self as g, K}, |
| 40 | 41 | }; |
| 41 | 42 | use crate::pages::ci_estimate::{self, Est, Step}; |
| 42 | -use crate::pages::ci_job::{Tail, log_tail}; | |
| 43 | -use crate::i18n::timeline::{self as tl, K as TK}; | |
| 44 | -use crate::pages::repo_side::{commit_strip, run_states, strip_bars}; | |
| 45 | -use crate::views::timeline::{StripBar, history_strip}; | |
| 46 | 43 | use crate::pages::ci_fail::{self, FailFirst, fail_first_block}; |
| 44 | +use crate::pages::ci_job::{Tail, log_tail}; | |
| 47 | 45 | use crate::pages::refs::load_refs; |
| 48 | 46 | use crate::pages::repo::repo_head; |
| 49 | 47 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo, still_readable}; |
| 48 | +use crate::pages::repo_side::{commit_strip, run_states, strip_bars}; | |
| 50 | 49 | use crate::state::AppState; |
| 51 | 50 | use crate::views::commit_line::{commit_line, headline}; |
| 52 | -use crate::views::{alert, empty_state, enc, human_size, now_unix, rel_time, relative_time, shell, short_oid}; | |
| 51 | +use crate::views::timeline::{StripBar, history_strip}; | |
| 52 | +use crate::views::{ | |
| 53 | + alert, empty_state, enc, human_size, now_unix, rel_time, relative_time, shell, short_oid, | |
| 54 | +}; | |
| 53 | 55 | |
| 54 | 56 | path_param!(owner); |
| 55 | 57 | path_param!(repo); |
| @@ -294,7 +296,9 @@ pub(crate) async fn after_change(state: &AppState, run_id: &str, before: &[CiJob | ||
| 294 | 296 | let changed = before |
| 295 | 297 | .iter() |
| 296 | 298 | .find(|old| old.id == job.id) |
| 297 | - .is_none_or(|old| old.state != job.state || old.cancel_requested != job.cancel_requested); | |
| 299 | + .is_none_or(|old| { | |
| 300 | + old.state != job.state || old.cancel_requested != job.cancel_requested | |
| 301 | + }); | |
| 298 | 302 | if changed { |
| 299 | 303 | if job.state.is_terminal() { |
| 300 | 304 | state.ci_live.close_job(&job.id); |
| @@ -1130,7 +1134,13 @@ fn gantt(jobs: &[Timing], origin: i64, run_end: Option<i64>, now: i64, lang: Lan | ||
| 1130 | 1134 | |
| 1131 | 1135 | /// The estimate of a running run: the time its jobs are expected to take, judged from the repo's |
| 1132 | 1136 | /// samples. None when a job still to run has no estimate yet. |
| 1133 | -fn live_est(lang: Lang, run: &CiRun, jobs: &[Timing], samples: &[JobSample], now: i64) -> Option<Est> { | |
| 1137 | +fn live_est( | |
| 1138 | + lang: Lang, | |
| 1139 | + run: &CiRun, | |
| 1140 | + jobs: &[Timing], | |
| 1141 | + samples: &[JobSample], | |
| 1142 | + now: i64, | |
| 1143 | +) -> Option<Est> { | |
| 1134 | 1144 | let steps: Vec<Step> = jobs |
| 1135 | 1145 | .iter() |
| 1136 | 1146 | .map(|job| Step { |
| @@ -1403,7 +1413,10 @@ async fn runs_split(cx: &Cx, number: Option<&str>, job: Option<&str>) -> Result< | ||
| 1403 | 1413 | let samples = if live_refs.is_empty() { |
| 1404 | 1414 | Vec::new() |
| 1405 | 1415 | } else { |
| 1406 | - state.store.recent_job_samples(&ctx.repo.id, &live_refs).await? | |
| 1416 | + state | |
| 1417 | + .store | |
| 1418 | + .recent_job_samples(&ctx.repo.id, &live_refs) | |
| 1419 | + .await? | |
| 1407 | 1420 | }; |
| 1408 | 1421 | let spans: Vec<i64> = runs.iter().map(|run| run_span(run, now)).collect(); |
| 1409 | 1422 | let scale = bar_scale(&spans); |
| @@ -1475,7 +1488,12 @@ async fn runs_split(cx: &Cx, number: Option<&str>, job: Option<&str>) -> Result< | ||
| 1475 | 1488 | rerun: csrf |
| 1476 | 1489 | .as_ref() |
| 1477 | 1490 | .filter(|_| run_finished(&run.state)) |
| 1478 | - .map(|token| (format!("{}/rerun", run_href(&title, run.number)), token.clone())), | |
| 1491 | + .map(|token| { | |
| 1492 | + ( | |
| 1493 | + format!("{}/rerun", run_href(&title, run.number)), | |
| 1494 | + token.clone(), | |
| 1495 | + ) | |
| 1496 | + }), | |
| 1479 | 1497 | meta: row_meta(run, jobs, &actor, lang), |
| 1480 | 1498 | } |
| 1481 | 1499 | }) |
| @@ -1694,9 +1712,9 @@ async fn run_detail( | ||
| 1694 | 1712 | .iter() |
| 1695 | 1713 | .find(|job| matches!(job.state, JobState::Failure | JobState::Error)) |
| 1696 | 1714 | { |
| 1697 | - Some(job) if matches!(run.state, RunState::Failure | RunState::Error) => Some( | |
| 1698 | - ci_fail::read(state, title, &job.id, &job.name, &job.message).await?, | |
| 1699 | - ), | |
| 1715 | + Some(job) if matches!(run.state, RunState::Failure | RunState::Error) => { | |
| 1716 | + Some(ci_fail::read(state, title, &job.id, &job.name, &job.message).await?) | |
| 1717 | + } | |
| 1700 | 1718 | _ => None, |
| 1701 | 1719 | }; |
| 1702 | 1720 | Ok(RunDetail { |
| @@ -1801,7 +1819,7 @@ async fn runs_body( | ||
| 1801 | 1819 | <section class="card notice" role="status">(text)</section> |
| 1802 | 1820 | } |
| 1803 | 1821 | } |
| 1804 | - <div data-live=(live.as_deref()) class="ci-split" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())> | |
| 1822 | + <div data-live=(live.as_deref()) class="ci-split fit-pane" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())> | |
| 1805 | 1823 | <svg class="ci-defs" width="0" height="0" focusable="false" aria-hidden="true"> |
| 1806 | 1824 | <defs> |
| 1807 | 1825 | <pattern id="ci-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"> |
| @@ -1897,10 +1915,35 @@ async fn runs_body( | ||
| 1897 | 1915 | </section> |
| 1898 | 1916 | <section class="card ci-main"> |
| 1899 | 1917 | if let Some(run) = detail { |
| 1900 | - <div class="ci-main-head" data-run=(run.number)> | |
| 1901 | - <h2 class="ci-eyebrow">(g::t(lang, K::RunNumber)) (run.number)</h2> | |
| 1918 | + <header class="ci-tl-head" data-run=(run.number)> | |
| 1919 | + <div class="ci-tl-headmain"> | |
| 1920 | + <div class="ci-tl-line"> | |
| 1921 | + <span class="ci-tl-no">(g::t(lang, K::RunNumber)) (run.number)</span> | |
| 1922 | + <h2 class="ci-tl-title">(headline(run.title.as_str()))</h2> | |
| 1923 | + <details class="ci-tl-more"> | |
| 1924 | + <summary>(crate::i18n::code::t(lang, crate::i18n::code::K::ShowFullMessage))</summary> | |
| 1925 | + <p class="small">(run.title.as_str())</p> | |
| 1926 | + </details> | |
| 1927 | + </div> | |
| 1928 | + <div class="ci-tl-meta"> | |
| 1929 | + <span class=(run.state_class.as_str())>(run.state.as_str())</span> | |
| 1930 | + <span class="muted">(run.trigger.as_str()) " \u{b7} " (run.branch.as_str())</span> | |
| 1931 | + <a href=(run.commit_href.as_str())><code>(run.commit.as_str())</code></a> | |
| 1932 | + if !run.actor.is_empty() { | |
| 1933 | + <span class="muted">(run.actor.as_str())</span> | |
| 1934 | + } | |
| 1935 | + if !run.duration.is_empty() { | |
| 1936 | + if let Some(est) = run.est.as_ref() { | |
| 1937 | + <span class="ci-tl-dur" data-since=(run.since.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(run.duration.as_str())</span> | |
| 1938 | + } else { | |
| 1939 | + <span class="ci-tl-dur" data-since=(run.since.as_deref())>(run.duration.as_str())</span> | |
| 1940 | + } | |
| 1941 | + } | |
| 1942 | + <time class="muted" datetime=(run.when_at.as_str()) data-rel="true">(run.when.as_str())</time> | |
| 1943 | + </div> | |
| 1944 | + </div> | |
| 1902 | 1945 | if let Some(csrf) = run.writer_csrf.as_ref() { |
| 1903 | - <div class="ci-actions"> | |
| 1946 | + <div class="ci-actions ci-tl-actions"> | |
| 1904 | 1947 | if run.can_approve { |
| 1905 | 1948 | action_button(action: format!("{}/approve", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::ApproveAndRun)) |
| 1906 | 1949 | } |
| @@ -1915,30 +1958,7 @@ async fn runs_body( | ||
| 1915 | 1958 | action_button(action: format!("{}/rerun", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::Rerun)) |
| 1916 | 1959 | </div> |
| 1917 | 1960 | } |
| 1918 | - </div> | |
| 1919 | - <h3 class="ci-run-title">(headline(run.title.as_str()))</h3> | |
| 1920 | - <details class="ci-run-message"> | |
| 1921 | - <summary class="small muted">(crate::i18n::code::t(lang, crate::i18n::code::K::ShowFullMessage))</summary> | |
| 1922 | - <p class="small">(run.title.as_str())</p> | |
| 1923 | - </details> | |
| 1924 | - <p class="ci-run-top"> | |
| 1925 | - <span class=(run.state_class.as_str())>(run.state.as_str())</span> | |
| 1926 | - <span class="muted small"> | |
| 1927 | - (run.trigger.as_str()) " \u{b7} " (run.branch.as_str()) " \u{b7} " <a href=(run.commit_href.as_str())><code>(run.commit.as_str())</code></a> | |
| 1928 | - if !run.actor.is_empty() { | |
| 1929 | - " \u{b7} " (run.actor.as_str()) | |
| 1930 | - } | |
| 1931 | - " \u{b7} " <time datetime=(run.when_at.as_str()) data-rel="true">(run.when.as_str())</time> | |
| 1932 | - if !run.duration.is_empty() { | |
| 1933 | - " \u{b7} " | |
| 1934 | - if let Some(est) = run.est.as_ref() { | |
| 1935 | - <span data-since=(run.since.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(run.duration.as_str())</span> | |
| 1936 | - } else { | |
| 1937 | - <span data-since=(run.since.as_deref())>(run.duration.as_str())</span> | |
| 1938 | - } | |
| 1939 | - } | |
| 1940 | - </span> | |
| 1941 | - </p> | |
| 1961 | + </header> | |
| 1942 | 1962 | if let Some(est) = run.est.as_ref() { |
| 1943 | 1963 | <progress class="ci-est ci-est-run" max="100" value=(est.pct.as_str()) data-est="true" data-since=(run.since.as_deref()) data-expected=(est.expected.as_str())></progress> |
| 1944 | 1964 | } |
| @@ -1961,10 +1981,7 @@ async fn runs_body( | ||
| 1961 | 1981 | } |
| 1962 | 1982 | run_timeline(lang: lang, run: &run) |
| 1963 | 1983 | } else { |
| 1964 | - <div class="ci-empty"> | |
| 1965 | - <p>(g::t(lang, K::NoRunsYet))</p> | |
| 1966 | - <p class="muted small">(g::t(lang, K::NoRunsHint))</p> | |
| 1967 | - </div> | |
| 1984 | + empty_state(title: g::t(lang, K::NoRunsYet), hint: Some(g::t(lang, K::NoRunsHint))) | |
| 1968 | 1985 | } |
| 1969 | 1986 | </section> |
| 1970 | 1987 | </div> |
| @@ -2105,7 +2122,7 @@ async fn run_body( | ||
| 2105 | 2122 | ) -> Result<impl View> { |
| 2106 | 2123 | let (fm, fs) = duration_templates(lang); |
| 2107 | 2124 | Ok(view! { |
| 2108 | - repo_head(head: RepoHead { live: String::new(), compact_tabs: true, ..head }) | |
| 2125 | + repo_head(head: RepoHead { live: String::new(), ..head }) | |
| 2109 | 2126 | if let Some((text, is_error)) = notice { |
| 2110 | 2127 | if is_error { |
| 2111 | 2128 | alert(message: text) |
| @@ -2959,8 +2976,16 @@ mod tests { | ||
| 2959 | 2976 | fn refs_and_images_shorten_to_their_last_part() { |
| 2960 | 2977 | assert_eq!(short_ref("refs/heads/main"), "main", "branch ref"); |
| 2961 | 2978 | assert_eq!(short_ref("refs/tags/v1.2"), "v1.2", "tag ref"); |
| 2962 | - assert_eq!(short_ref("refs/pull/7/head"), "refs/pull/7/head", "pull ref"); | |
| 2963 | - assert_eq!(image_short("docker.io/library/rust:1"), "rust:1", "registry image"); | |
| 2979 | + assert_eq!( | |
| 2980 | + short_ref("refs/pull/7/head"), | |
| 2981 | + "refs/pull/7/head", | |
| 2982 | + "pull ref" | |
| 2983 | + ); | |
| 2984 | + assert_eq!( | |
| 2985 | + image_short("docker.io/library/rust:1"), | |
| 2986 | + "rust:1", | |
| 2987 | + "registry image" | |
| 2988 | + ); | |
| 2964 | 2989 | assert_eq!(image_short("alpine"), "alpine", "bare image"); |
| 2965 | 2990 | } |
| 2966 | 2991 |
crates/forge-web/src/pages/ci_tests.rsmodified+18 -5
| @@ -301,7 +301,9 @@ async fn run_list_pages_and_its_live_marker() { | ||
| 301 | 301 | let first = get(&fx.app, RUN_BASE, Some(&cookie_for("tahinli-token"))).await; |
| 302 | 302 | let text = first.text(); |
| 303 | 303 | // The topbar's live strip links the viewer's own running runs too; only the list counts. |
| 304 | - let list = text.split_once("</header>").map_or(text.as_str(), |(_, rest)| rest); | |
| 304 | + let list = text | |
| 305 | + .split_once("</header>") | |
| 306 | + .map_or(text.as_str(), |(_, rest)| rest); | |
| 305 | 307 | assert_eq!(list.matches("href=\"/tahinli/proj/ci/runs/").count(), 25); |
| 306 | 308 | assert!(text.contains("?page=2"), "older link"); |
| 307 | 309 | assert!(!text.contains(">Newer<")); |
| @@ -312,7 +314,9 @@ async fn run_list_pages_and_its_live_marker() { | ||
| 312 | 314 | ) |
| 313 | 315 | .await; |
| 314 | 316 | let text = second.text(); |
| 315 | - let list = text.split_once("</header>").map_or(text.as_str(), |(_, rest)| rest); | |
| 317 | + let list = text | |
| 318 | + .split_once("</header>") | |
| 319 | + .map_or(text.as_str(), |(_, rest)| rest); | |
| 316 | 320 | assert_eq!(list.matches("href=\"/tahinli/proj/ci/runs/").count(), 5); |
| 317 | 321 | assert!(text.contains(">Newer<"), "newer link"); |
| 318 | 322 | assert!(!text.contains("?page=3"), "no older link on the last page"); |
| @@ -324,7 +328,9 @@ async fn run_list_pages_and_its_live_marker() { | ||
| 324 | 328 | .await; |
| 325 | 329 | assert_eq!(bogus.status, 200); |
| 326 | 330 | let text = bogus.text(); |
| 327 | - let list = text.split_once("</header>").map_or(text.as_str(), |(_, rest)| rest); | |
| 331 | + let list = text | |
| 332 | + .split_once("</header>") | |
| 333 | + .map_or(text.as_str(), |(_, rest)| rest); | |
| 328 | 334 | assert_eq!(list.matches("href=\"/tahinli/proj/ci/runs/").count(), 25); |
| 329 | 335 | } |
| 330 | 336 | |
| @@ -500,7 +506,11 @@ async fn live_pages_and_streams_follow_a_job_to_its_end() { | ||
| 500 | 506 | let last = next_event(&mut job_frames).await.expect("the final status"); |
| 501 | 507 | assert_eq!( |
| 502 | 508 | last, |
| 503 | - format!("event: changed\ndata: {}||nolog\n\n", JobState::Success.as_str()).into_bytes() | |
| 509 | + format!( | |
| 510 | + "event: changed\ndata: {}||nolog\n\n", | |
| 511 | + JobState::Success.as_str() | |
| 512 | + ) | |
| 513 | + .into_bytes() | |
| 504 | 514 | ); |
| 505 | 515 | assert!(next_event(&mut job_frames).await.is_none(), "stream ends"); |
| 506 | 516 | } |
| @@ -540,7 +550,10 @@ async fn split_view_draws_the_newest_run_or_the_one_named() { | ||
| 540 | 550 | assert!(named.contains(&format!("data-run=\"{}\"", first.number))); |
| 541 | 551 | // The run page is the focused view now: it links back to the list, and its one aria-current is the |
| 542 | 552 | // selected job, not a run row. |
| 543 | - assert!(named.contains(&format!("href=\"{RUN_BASE}\"")), "All runs link"); | |
| 553 | + assert!( | |
| 554 | + named.contains(&format!("href=\"{RUN_BASE}\"")), | |
| 555 | + "All runs link" | |
| 556 | + ); | |
| 544 | 557 | assert_eq!(named.matches("aria-current=\"true\"").count(), 1); |
| 545 | 558 | |
| 546 | 559 | // Thirty runs make two pages. Run 1 is on page 2, so page 1 marks no row and draws run 1. |
crates/forge-web/src/pages/code_live.rsmodified+10 -4
| @@ -110,9 +110,11 @@ async fn header_fingerprint( | ||
| 110 | 110 | ), |
| 111 | 111 | None => String::new(), |
| 112 | 112 | }; |
| 113 | - Ok(header_text(&repo, [stars, watchers, forks, open_issues, open_pulls], &format!( | |
| 114 | - "{discussions} {wiki} {watch}\n{mirror}" | |
| 115 | - ))) | |
| 113 | + Ok(header_text( | |
| 114 | + &repo, | |
| 115 | + [stars, watchers, forks, open_issues, open_pulls], | |
| 116 | + &format!("{discussions} {wiki} {watch}\n{mirror}"), | |
| 117 | + )) | |
| 116 | 118 | } |
| 117 | 119 | |
| 118 | 120 | /// Joins the header's fields into the fingerprint text. |
| @@ -126,7 +128,11 @@ fn header_text(repo: &RepoRecord, counts: [u64; 5], rest: &str) -> String { | ||
| 126 | 128 | } |
| 127 | 129 | |
| 128 | 130 | /// The state the home page's latest release and linked-package card show. |
| 129 | -async fn home_fingerprint(state: &AppState, repo_id: &str, viewer: Option<&User>) -> Result<String> { | |
| 131 | +async fn home_fingerprint( | |
| 132 | + state: &AppState, | |
| 133 | + repo_id: &str, | |
| 134 | + viewer: Option<&User>, | |
| 135 | +) -> Result<String> { | |
| 130 | 136 | let mut release_text = String::new(); |
| 131 | 137 | if let Some(release) = state.store.latest_release(repo_id).await? { |
| 132 | 138 | let assets = state.store.list_release_assets(&release.id).await?; |
crates/forge-web/src/pages/code_search.rsmodified+2 -0
| @@ -209,6 +209,7 @@ async fn search_page(cx: &Cx) -> Result<impl View> { | ||
| 209 | 209 | Ok(view! { |
| 210 | 210 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 211 | 211 | repo_head(head: header) |
| 212 | + <div class="search-page fit-pane"> | |
| 212 | 213 | <form method="get" action=(action.as_str()) class="search-form" role="search"> |
| 213 | 214 | <div class="search-row"> |
| 214 | 215 | <input type="search" name="q" value=(q.as_str()) placeholder=(g::t(lang, K::SearchCodePlaceholder)) aria-label=(g::t(lang, K::SearchCodePlaceholder))> |
| @@ -263,6 +264,7 @@ async fn search_page(cx: &Cx) -> Result<impl View> { | ||
| 263 | 264 | empty_state(title: g::t(lang, K::NoMatches)) |
| 264 | 265 | } |
| 265 | 266 | } |
| 267 | + </div> | |
| 266 | 268 | ) |
| 267 | 269 | }) |
| 268 | 270 | } |
crates/forge-web/src/pages/commit.rsmodified+1 -3
| @@ -22,8 +22,8 @@ use crate::signatures; | ||
| 22 | 22 | use crate::state::AppState; |
| 23 | 23 | use crate::views::commit_status::{StatusLang, StatusSummary, checks_summary}; |
| 24 | 24 | use crate::views::diff::{DiffLang, DiffOpts, LIMITS, diff_section}; |
| 25 | -use crate::views::{avatar_url, display_name, relative_time, user_href}; | |
| 26 | 25 | use crate::views::shell; |
| 26 | +use crate::views::{avatar_url, display_name, relative_time, user_href}; | |
| 27 | 27 | |
| 28 | 28 | path_param!(owner); |
| 29 | 29 | path_param!(repo); |
| @@ -212,7 +212,6 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | ||
| 212 | 212 | let others = g::co_author_others(lang, rest.len()); |
| 213 | 213 | let coauthors_label = g::t(lang, K::CoAuthorsLabel); |
| 214 | 214 | let title = format!("{owner_name}/{repo_name}"); |
| 215 | - let repo_href = format!("/{owner_name}/{repo_name}"); | |
| 216 | 215 | let tree_href = format!("/{owner_name}/{repo_name}/tree/{}", info.oid); |
| 217 | 216 | let summary = emojify(&info.summary).into_owned(); |
| 218 | 217 | // A typed subject shows its first clause as the title and its groups as a list below. |
| @@ -244,7 +243,6 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | ||
| 244 | 243 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 245 | 244 | repo_head(head: header) |
| 246 | 245 | <h2 class="commit-summary-title">(heading.as_str())</h2> |
| 247 | - <p class="muted small"><a href=(repo_href.as_str())>(title.as_str())</a></p> | |
| 248 | 246 | <section class="card commit-info"> |
| 249 | 247 | <p class="commit-full-oid"> |
| 250 | 248 | <span class="copy-box"> |
crates/forge-web/src/pages/commits.rsmodified+9 -5
| @@ -284,11 +284,14 @@ async fn commits_page(cx: &Cx) -> Result<impl View> { | ||
| 284 | 284 | Ok(view! { |
| 285 | 285 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 286 | 286 | repo_head(head: header) |
| 287 | - <p class="muted">(g::t(lang, K::CommitsOn)) <code>(ref_name.as_str())</code></p> | |
| 288 | - if has_filter { | |
| 289 | - <p class="muted">(g::t(lang, K::FilteredTo)) <code>(filter_text.as_str())</code> " · " <a href=(clear_href.as_str())>(g::t(lang, K::ClearFilter))</a></p> | |
| 290 | - } | |
| 291 | - <div class="commits-fit fit-pane"> | |
| 287 | + <div class="commits-fit fit-pane lang-list"> | |
| 288 | + <div class="list-bar"> | |
| 289 | + <p class="muted">(g::t(lang, K::CommitsOn)) <code>(ref_name.as_str())</code></p> | |
| 290 | + if has_filter { | |
| 291 | + <p class="muted">(g::t(lang, K::FilteredTo)) <code>(filter_text.as_str())</code> " · " <a href=(clear_href.as_str())>(g::t(lang, K::ClearFilter))</a></p> | |
| 292 | + } | |
| 293 | + </div> | |
| 294 | + <div class="list-scroll"> | |
| 292 | 295 | if empty { |
| 293 | 296 | empty_state(title: g::t(lang, K::NoCommits), |
| 294 | 297 | if has_filter { |
| @@ -327,6 +330,7 @@ async fn commits_page(cx: &Cx) -> Result<impl View> { | ||
| 327 | 330 | } |
| 328 | 331 | </ul> |
| 329 | 332 | } |
| 333 | + </div> | |
| 330 | 334 | if has_newer || has_older { |
| 331 | 335 | <nav class="pager"> |
| 332 | 336 | if has_newer { |
crates/forge-web/src/pages/compare.rsmodified+77 -44
| @@ -242,7 +242,6 @@ async fn compare_view( | ||
| 242 | 242 | let tz = ctx.viewer_tz().to_owned(); |
| 243 | 243 | let now = now_secs(); |
| 244 | 244 | let title = format!("{owner}/{name}"); |
| 245 | - let repo_href_root = repo_href(&owner, &name, "", ""); | |
| 246 | 245 | let base = cmp.base.clone(); |
| 247 | 246 | let head = head_value(&ctx, &cmp.head); |
| 248 | 247 | let head_for_form = head.clone(); |
| @@ -333,46 +332,53 @@ async fn compare_view( | ||
| 333 | 332 | Ok(view! { |
| 334 | 333 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 335 | 334 | repo_head(head: header) |
| 335 | + <div class="lang-split is-list"> | |
| 336 | + if has_commits { | |
| 337 | + <div class="lang-list fit-pane"> | |
| 338 | + <div class="list-bar"> | |
| 339 | + <h2>(commits_label.as_str())</h2> | |
| 340 | + </div> | |
| 341 | + <div class="list-scroll"> | |
| 342 | + <ul class="commit-list compare-commits"> | |
| 343 | + for row in rows.iter() { | |
| 344 | + <li class="commit-row" data-kb-row=""> | |
| 345 | + <div class="commit-main"> | |
| 346 | + <a class="commit-summary" href=(row.commit_href.as_str())>commit_line(subject: row.summary.clone())</a> | |
| 347 | + <div class="commit-meta muted small"> | |
| 348 | + <span class="commit-author">(row.author.as_str())</span> | |
| 349 | + if !row.email.is_empty() { | |
| 350 | + <span class="commit-email">(row.email.as_str())</span> | |
| 351 | + } | |
| 352 | + if lang == i18n::Lang::Tr { | |
| 353 | + <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> | |
| 354 | + <span>(g::t(lang, K::Committed))</span> | |
| 355 | + } else { | |
| 356 | + <span>(g::t(lang, K::Committed))</span> | |
| 357 | + <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> | |
| 358 | + } | |
| 359 | + </div> | |
| 360 | + </div> | |
| 361 | + <div class="commit-actions"> | |
| 362 | + <a class="mono commit-oid" href=(row.commit_href.as_str())>(row.short.as_str())</a> | |
| 363 | + <a class="small muted" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFiles))</a> | |
| 364 | + </div> | |
| 365 | + </li> | |
| 366 | + } | |
| 367 | + </ul> | |
| 368 | + </div> | |
| 369 | + </div> | |
| 370 | + } | |
| 371 | + <div class="lang-pane fit-pane compare-detail"> | |
| 336 | 372 | <h2>(g::t(lang, K::ComparingPrefix)) <code>(heading_base.as_str())</code> "..." <code>(heading_head.as_str())</code></h2> |
| 337 | - <p class="muted small"><a href=(repo_href_root.as_str())>(title.as_str())</a></p> | |
| 338 | 373 | if unrelated { |
| 339 | 374 | <p class="muted">(g::t(lang, K::Unrelated))</p> |
| 340 | 375 | } |
| 341 | 376 | if nothing { |
| 342 | 377 | empty_state(title: g::t(lang, K::NothingToCompare)) |
| 343 | 378 | } |
| 344 | - if has_commits { | |
| 345 | - <h3>(commits_label.as_str())</h3> | |
| 346 | - <ul class="commit-list compare-commits"> | |
| 347 | - for row in rows.iter() { | |
| 348 | - <li class="commit-row"> | |
| 349 | - <div class="commit-main"> | |
| 350 | - <a class="commit-summary" href=(row.commit_href.as_str())>commit_line(subject: row.summary.clone())</a> | |
| 351 | - <div class="commit-meta muted small"> | |
| 352 | - <span class="commit-author">(row.author.as_str())</span> | |
| 353 | - if !row.email.is_empty() { | |
| 354 | - <span class="commit-email">(row.email.as_str())</span> | |
| 355 | - } | |
| 356 | - if lang == i18n::Lang::Tr { | |
| 357 | - <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> | |
| 358 | - <span>(g::t(lang, K::Committed))</span> | |
| 359 | - } else { | |
| 360 | - <span>(g::t(lang, K::Committed))</span> | |
| 361 | - <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> | |
| 362 | - } | |
| 363 | - </div> | |
| 364 | - </div> | |
| 365 | - <div class="commit-actions"> | |
| 366 | - <a class="mono commit-oid" href=(row.commit_href.as_str())>(row.short.as_str())</a> | |
| 367 | - <a class="small muted" href=(row.tree_href.as_str())>(g::t(lang, K::BrowseFiles))</a> | |
| 368 | - </div> | |
| 369 | - </li> | |
| 370 | - } | |
| 371 | - </ul> | |
| 372 | - } | |
| 373 | 379 | if show_form { |
| 374 | - <section class="card"> | |
| 375 | - <h3>(g::t(lang, K::OpenPullRequest))</h3> | |
| 380 | + <section class="compare-open"> | |
| 381 | + <h2>(g::t(lang, K::OpenPullRequest))</h2> | |
| 376 | 382 | if has_error { |
| 377 | 383 | alert(message: error_text.as_str()) |
| 378 | 384 | } |
| @@ -400,6 +406,8 @@ async fn compare_view( | ||
| 400 | 406 | diff_section(diff: d, owner: owner.as_str(), repo: name.as_str(), oid: cmp.head_oid.as_str(), parent: parent.as_deref(), subject: g::t(lang, K::ThisComparison), lang: DiffLang(lang), opts: opts.clone()) |
| 401 | 407 | } |
| 402 | 408 | } |
| 409 | + </div> | |
| 410 | + </div> | |
| 403 | 411 | ) |
| 404 | 412 | }) |
| 405 | 413 | } |
| @@ -423,6 +431,7 @@ async fn picker_view(cx: &Cx, ctx: RepoCtx, base: String, head: String) -> Resul | ||
| 423 | 431 | Ok(view! { |
| 424 | 432 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 425 | 433 | repo_head(head: header) |
| 434 | + <section class="lang-form"> | |
| 426 | 435 | <h2>(g::t(lang, K::CompareBranches))</h2> |
| 427 | 436 | <form method="get" action=(action.as_str())> |
| 428 | 437 | <p><label>(g::t(lang, K::BasePrefix)) <input type="text" name="base" list="compare-branches" value=(base.as_str())></label></p> |
| @@ -434,6 +443,7 @@ async fn picker_view(cx: &Cx, ctx: RepoCtx, base: String, head: String) -> Resul | ||
| 434 | 443 | </datalist> |
| 435 | 444 | <p><button type="submit">(g::t(lang, K::Compare))</button></p> |
| 436 | 445 | </form> |
| 446 | + </section> | |
| 437 | 447 | ) |
| 438 | 448 | }) |
| 439 | 449 | } |
| @@ -621,9 +631,7 @@ async fn pull_create(cx: &Cx, Form(form): Form<PullForm>) -> Result<impl View> { | ||
| 621 | 631 | }; |
| 622 | 632 | emit_pull(state, &ctx.repo, &Sender::of(&user), "opened", &pr).await; |
| 623 | 633 | // The author's contribution calendar counts the pull request. |
| 624 | - state | |
| 625 | - .live | |
| 626 | - .bump(&crate::live::Topic::User(user.id.clone())); | |
| 634 | + state.live.bump(&crate::live::Topic::User(user.id.clone())); | |
| 627 | 635 | if !as_draft { |
| 628 | 636 | // A draft tells nobody until it is marked ready for review. |
| 629 | 637 | notify::dispatch( |
| @@ -893,8 +901,14 @@ mod tests { | ||
| 893 | 901 | ) |
| 894 | 902 | .await; |
| 895 | 903 | assert_eq!(status, 200, "anonymous"); |
| 896 | - assert!(!body.contains("action=\"/tahinli/demo/pulls\""), "anonymous has no form"); | |
| 897 | - assert!(!body.contains("Open a pull request"), "anonymous has no form"); | |
| 904 | + assert!( | |
| 905 | + !body.contains("action=\"/tahinli/demo/pulls\""), | |
| 906 | + "anonymous has no form" | |
| 907 | + ); | |
| 908 | + assert!( | |
| 909 | + !body.contains("Open a pull request"), | |
| 910 | + "anonymous has no form" | |
| 911 | + ); | |
| 898 | 912 | |
| 899 | 913 | // Signed-in viewers get the form, prefilled with the head commit's title. |
| 900 | 914 | let (_, _, body) = send( |
| @@ -905,8 +919,14 @@ mod tests { | ||
| 905 | 919 | None, |
| 906 | 920 | ) |
| 907 | 921 | .await; |
| 908 | - assert!(body.contains("action=\"/tahinli/demo/pulls\""), "signed in form"); | |
| 909 | - assert!(body.contains("value=\"Add feature file\""), "signed in form"); | |
| 922 | + assert!( | |
| 923 | + body.contains("action=\"/tahinli/demo/pulls\""), | |
| 924 | + "signed in form" | |
| 925 | + ); | |
| 926 | + assert!( | |
| 927 | + body.contains("value=\"Add feature file\""), | |
| 928 | + "signed in form" | |
| 929 | + ); | |
| 910 | 930 | |
| 911 | 931 | // A head from an unrelated owner, or a missing branch, is 404. |
| 912 | 932 | let (status, _, _) = send( |
| @@ -955,7 +975,10 @@ mod tests { | ||
| 955 | 975 | ) |
| 956 | 976 | .await; |
| 957 | 977 | assert_eq!(status, 403, "wrong csrf"); |
| 958 | - assert!(rev(&fx.bare, "refs/pull/1/head").is_none(), "rejected posts make no pull"); | |
| 978 | + assert!( | |
| 979 | + rev(&fx.bare, "refs/pull/1/head").is_none(), | |
| 980 | + "rejected posts make no pull" | |
| 981 | + ); | |
| 959 | 982 | |
| 960 | 983 | let form = create_form("main", "feature", "Add+feature+file"); |
| 961 | 984 | let (status, location, _) = send( |
| @@ -983,7 +1006,11 @@ mod tests { | ||
| 983 | 1006 | ) |
| 984 | 1007 | .await; |
| 985 | 1008 | assert_eq!(status, 303, "duplicate"); |
| 986 | - assert_eq!(location.as_deref(), Some("/tahinli/demo/pulls/1"), "duplicate"); | |
| 1009 | + assert_eq!( | |
| 1010 | + location.as_deref(), | |
| 1011 | + Some("/tahinli/demo/pulls/1"), | |
| 1012 | + "duplicate" | |
| 1013 | + ); | |
| 987 | 1014 | let repo = fx |
| 988 | 1015 | .store |
| 989 | 1016 | .repo_by_owner_and_name(OWNER, REPO) |
| @@ -1008,8 +1035,14 @@ mod tests { | ||
| 1008 | 1035 | None, |
| 1009 | 1036 | ) |
| 1010 | 1037 | .await; |
| 1011 | - assert!(!body.contains("action=\"/tahinli/demo/pulls\""), "open pull hides the form"); | |
| 1012 | - assert!(body.contains("/tahinli/demo/pulls/1"), "open pull is linked"); | |
| 1038 | + assert!( | |
| 1039 | + !body.contains("action=\"/tahinli/demo/pulls\""), | |
| 1040 | + "open pull hides the form" | |
| 1041 | + ); | |
| 1042 | + assert!( | |
| 1043 | + body.contains("/tahinli/demo/pulls/1"), | |
| 1044 | + "open pull is linked" | |
| 1045 | + ); | |
| 1013 | 1046 | } |
| 1014 | 1047 | |
| 1015 | 1048 | #[tokio::test] |
crates/forge-web/src/pages/discussion_view.rsmodified+1 -1
| @@ -477,7 +477,7 @@ async fn discussion_page( | ||
| 477 | 477 | <p class="muted">(g::t(lang, K::ArchivedDiscussions))</p> |
| 478 | 478 | } |
| 479 | 479 | </div> |
| 480 | - <aside class="issue-sidebar"> | |
| 480 | + <aside class="issue-sidebar fit-pane"> | |
| 481 | 481 | if triage && !archived { |
| 482 | 482 | <section class="card"> |
| 483 | 483 | <h2>(g::t(lang, K::Conversation))</h2> |
crates/forge-web/src/pages/discussions.rsmodified+2 -0
| @@ -303,6 +303,7 @@ async fn discussions_list_page(cx: &Cx) -> Result<impl View> { | ||
| 303 | 303 | Ok(view! { |
| 304 | 304 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 305 | 305 | repo_head(head: header) |
| 306 | + <section class="issue-pane fit-pane"> | |
| 306 | 307 | <div class="issue-toolbar" data-live=(live_href.as_str()) data-live-now=""> |
| 307 | 308 | <nav class="issue-tabs" aria-label=(nav_label)> |
| 308 | 309 | <a class=(all_class) href=(all_href.as_str())>(all_label)</a> |
| @@ -359,6 +360,7 @@ async fn discussions_list_page(cx: &Cx) -> Result<impl View> { | ||
| 359 | 360 | } |
| 360 | 361 | </nav> |
| 361 | 362 | } |
| 363 | + </section> | |
| 362 | 364 | ) |
| 363 | 365 | }) |
| 364 | 366 | } |
crates/forge-web/src/pages/edit_history.rsmodified+1 -1
| @@ -245,7 +245,7 @@ async fn history_page( | ||
| 245 | 245 | (count_label.as_str()) |
| 246 | 246 | </p> |
| 247 | 247 | </section> |
| 248 | - <div class="issue-timeline"> | |
| 248 | + <div class="issue-timeline fit-pane"> | |
| 249 | 249 | if entries.is_empty() { |
| 250 | 250 | <p class="muted">(g::t(lang, K::NoEarlierVersions))</p> |
| 251 | 251 | } |
crates/forge-web/src/pages/explore.rsmodified+4 -2
| @@ -199,9 +199,11 @@ async fn explore_body( | ||
| 199 | 199 | let (links, prev, next) = nav; |
| 200 | 200 | let clear_href = explore_href("", sort, 1); |
| 201 | 201 | Ok(view! { |
| 202 | - <section class="explore" data-live=(live.as_str())> | |
| 202 | + <section class="page-head"> | |
| 203 | 203 | <h1>(g::t(lang, K::Explore))</h1> |
| 204 | - <p class="muted">(g::t(lang, K::PublicReposIntro))</p> | |
| 204 | + <p class="muted small page-note">(g::t(lang, K::PublicReposIntro))</p> | |
| 205 | + </section> | |
| 206 | + <section class="explore list-pane fit-pane" data-live=(live.as_str())> | |
| 205 | 207 | if has_orgs { |
| 206 | 208 | <section class="explore-orgs"> |
| 207 | 209 | <h2>(g::t(lang, K::Organizations))</h2> |
crates/forge-web/src/pages/home.rsmodified+2 -2
| @@ -33,9 +33,9 @@ async fn home(cx: &Cx) -> Result<impl View> { | ||
| 33 | 33 | #[component] |
| 34 | 34 | async fn landing(has_users: bool, lang: Lang) -> Result<impl View> { |
| 35 | 35 | Ok(view! { |
| 36 | - <section class="hero"> | |
| 36 | + <section class="page-head home-head"> | |
| 37 | 37 | <h1>"forge"</h1> |
| 38 | - <p class="muted">(g::t(lang, K::LandingTagline))</p> | |
| 38 | + <p class="muted small page-note">(g::t(lang, K::LandingTagline))</p> | |
| 39 | 39 | <div class="actions"> |
| 40 | 40 | <a class="button primary" href="/login">(g::t(lang, K::LogIn))</a> |
| 41 | 41 | if !has_users { |
crates/forge-web/src/pages/import.rsmodified+31 -16
| @@ -22,11 +22,11 @@ use crate::auth::{require_csrf, require_user}; | ||
| 22 | 22 | use crate::i18n::migrate::{self as g, K}; |
| 23 | 23 | use crate::i18n::{self, Key, Lang}; |
| 24 | 24 | use crate::importer::api::{ApiError, RemoteApi}; |
| 25 | -use crate::live::{Topic, stream_changes}; | |
| 26 | 25 | use crate::importer::{ |
| 27 | 26 | self, ImportOptions, JobSpec, Source, default_name, make_forgejo, make_github, make_gitlab, |
| 28 | 27 | parse_remote, source_ref, |
| 29 | 28 | }; |
| 29 | +use crate::live::{Topic, stream_changes}; | |
| 30 | 30 | use crate::pages::ci_runs::{changed_event, events_response}; |
| 31 | 31 | use crate::pages::new_repo::{owner_choices, repo_owner}; |
| 32 | 32 | use crate::pages::repo_ctx::still_readable; |
| @@ -325,7 +325,7 @@ async fn import_form( | ||
| 325 | 325 | <form method="post" action="/new/import" class="newrepo-form fit-pane"> |
| 326 | 326 | csrf_field(token: csrf) |
| 327 | 327 | <input type="hidden" name="source" value=(source_value)> |
| 328 | - <header class="newrepo-head"> | |
| 328 | + <header class="newrepo-head page-head"> | |
| 329 | 329 | <h1>(g::t(lang, K::ImportTitle))</h1> |
| 330 | 330 | <div class="newrepo-head-actions"> |
| 331 | 331 | visibility_pick(lang: lang, private: private) |
| @@ -638,7 +638,7 @@ async fn bulk_form( | ||
| 638 | 638 | csrf_field(token: csrf) |
| 639 | 639 | <input type="hidden" name="source" value=(source_value)> |
| 640 | 640 | <input type="hidden" name="stage" value="list"> |
| 641 | - <header class="newrepo-head"> | |
| 641 | + <header class="newrepo-head page-head"> | |
| 642 | 642 | <h1>(g::t(lang, K::BulkTitle))</h1> |
| 643 | 643 | <div class="newrepo-head-actions"> |
| 644 | 644 | <button type="submit" class="primary">(g::t(lang, K::BulkListButton))</button> |
| @@ -703,7 +703,7 @@ async fn bulk_select( | ||
| 703 | 703 | <input type="hidden" name="instance" value=(form.instance.as_str())> |
| 704 | 704 | <input type="hidden" name="token" value=(form.token.as_str())> |
| 705 | 705 | <input type="hidden" name="from" value=(form.from.as_str())> |
| 706 | - <header class="newrepo-head"> | |
| 706 | + <header class="newrepo-head page-head"> | |
| 707 | 707 | <h1>(g::t(lang, K::BulkSelectHeading))</h1> |
| 708 | 708 | <div class="newrepo-head-actions"> |
| 709 | 709 | visibility_pick(lang: lang, private: private) |
| @@ -1160,10 +1160,15 @@ async fn jobs_fingerprint(state: &AppState, user_id: &str) -> Result<String> { | ||
| 1160 | 1160 | Ok(rows |
| 1161 | 1161 | .iter() |
| 1162 | 1162 | .map(|(job, repo)| { |
| 1163 | - let repo = repo | |
| 1164 | - .as_ref() | |
| 1165 | - .map_or(String::new(), |repo| format!("{}/{}", repo.owner_name, repo.name)); | |
| 1166 | - format!("{} {} {} {repo}", job.id, job.state.as_str(), job.source_ref) | |
| 1163 | + let repo = repo.as_ref().map_or(String::new(), |repo| { | |
| 1164 | + format!("{}/{}", repo.owner_name, repo.name) | |
| 1165 | + }); | |
| 1166 | + format!( | |
| 1167 | + "{} {} {} {repo}", | |
| 1168 | + job.id, | |
| 1169 | + job.state.as_str(), | |
| 1170 | + job.source_ref | |
| 1171 | + ) | |
| 1167 | 1172 | }) |
| 1168 | 1173 | .collect::<Vec<_>>() |
| 1169 | 1174 | .join("\n")) |
| @@ -1176,11 +1181,16 @@ async fn jobs_events(cx: &Cx) -> Result<Response> { | ||
| 1176 | 1181 | let viewer = require_user(cx).await?; |
| 1177 | 1182 | let state = app_context::<AppState>(cx).clone(); |
| 1178 | 1183 | let user_id = viewer.0.id.clone(); |
| 1179 | - stream_changes(cx, &state.live.clone(), &[Topic::Imports(user_id.clone())], move || { | |
| 1180 | - let state = state.clone(); | |
| 1181 | - let user_id = user_id.clone(); | |
| 1182 | - async move { jobs_fingerprint(&state, &user_id).await } | |
| 1183 | - }) | |
| 1184 | + stream_changes( | |
| 1185 | + cx, | |
| 1186 | + &state.live.clone(), | |
| 1187 | + &[Topic::Imports(user_id.clone())], | |
| 1188 | + move || { | |
| 1189 | + let state = state.clone(); | |
| 1190 | + let user_id = user_id.clone(); | |
| 1191 | + async move { jobs_fingerprint(&state, &user_id).await } | |
| 1192 | + }, | |
| 1193 | + ) | |
| 1184 | 1194 | .await |
| 1185 | 1195 | } |
| 1186 | 1196 | |
| @@ -1231,7 +1241,7 @@ async fn job_view( | ||
| 1231 | 1241 | Ok(view! { |
| 1232 | 1242 | newrepo_tabs(lang: lang, active: "import") |
| 1233 | 1243 | <section class="import-job" data-live=(live.as_deref()) data-live-state=(state_word)> |
| 1234 | - <header class="newrepo-head"> | |
| 1244 | + <header class="newrepo-head page-head"> | |
| 1235 | 1245 | <h1 class="import-job-title">(job.source_ref.as_str())</h1> |
| 1236 | 1246 | <span class=(badge_class)>(badge_text)</span> |
| 1237 | 1247 | <div class="newrepo-head-actions"> |
| @@ -1428,7 +1438,12 @@ async fn retry_candidates(state: &AppState, viewer: &User) -> Result<Vec<(Import | ||
| 1428 | 1438 | let Some(repo) = job_repo(state, Some(viewer), &job).await? else { |
| 1429 | 1439 | continue; |
| 1430 | 1440 | }; |
| 1431 | - if state.store.active_import_for_repo(&repo.id).await?.is_some() { | |
| 1441 | + if state | |
| 1442 | + .store | |
| 1443 | + .active_import_for_repo(&repo.id) | |
| 1444 | + .await? | |
| 1445 | + .is_some() | |
| 1446 | + { | |
| 1432 | 1447 | continue; |
| 1433 | 1448 | } |
| 1434 | 1449 | rows.push((job, repo)); |
| @@ -1449,7 +1464,7 @@ async fn retry_list(lang: Lang, csrf: &str, rows: Vec<(ImportJob, Repo)>) -> Res | ||
| 1449 | 1464 | newrepo_tabs(lang: lang, active: "import") |
| 1450 | 1465 | <form method="post" action="/import/retry" class="newrepo-form"> |
| 1451 | 1466 | csrf_field(token: csrf) |
| 1452 | - <header class="newrepo-head"> | |
| 1467 | + <header class="newrepo-head page-head"> | |
| 1453 | 1468 | <h1>(g::t(lang, K::RetryFailedTitle))</h1> |
| 1454 | 1469 | <div class="newrepo-head-actions"> |
| 1455 | 1470 | if !empty { |
crates/forge-web/src/pages/issue_meta_tests.rsmodified+18 -3
| @@ -199,7 +199,13 @@ async fn label_writes_follow_csrf_roles_and_archive_rules() { | ||
| 199 | 199 | ) |
| 200 | 200 | .await; |
| 201 | 201 | assert_eq!(res.status, 403, "read-only collaborator"); |
| 202 | - assert!(store.list_labels(&s.repo_id).await.expect("labels").is_empty()); | |
| 202 | + assert!( | |
| 203 | + store | |
| 204 | + .list_labels(&s.repo_id) | |
| 205 | + .await | |
| 206 | + .expect("labels") | |
| 207 | + .is_empty() | |
| 208 | + ); | |
| 203 | 209 | |
| 204 | 210 | // [create] the owner creates a label; a case-insensitive duplicate is refused. |
| 205 | 211 | let created = call( |
| @@ -268,7 +274,13 @@ async fn label_writes_follow_csrf_roles_and_archive_rules() { | ||
| 268 | 274 | ) |
| 269 | 275 | .await; |
| 270 | 276 | assert_eq!(deleted.status, 303, "delete"); |
| 271 | - assert!(store.list_labels(&s.repo_id).await.expect("labels").is_empty()); | |
| 277 | + assert!( | |
| 278 | + store | |
| 279 | + .list_labels(&s.repo_id) | |
| 280 | + .await | |
| 281 | + .expect("labels") | |
| 282 | + .is_empty() | |
| 283 | + ); | |
| 272 | 284 | |
| 273 | 285 | // [archive] an archived repo refuses label writes (last, it changes the repo). |
| 274 | 286 | store |
| @@ -536,7 +548,10 @@ async fn issue_metadata_and_milestone_progress() { | ||
| 536 | 548 | .await |
| 537 | 549 | .expect("issue") |
| 538 | 550 | .expect("issues keep existing"); |
| 539 | - assert!(survivor.milestone_id.is_none(), "issue kept, milestone gone"); | |
| 551 | + assert!( | |
| 552 | + survivor.milestone_id.is_none(), | |
| 553 | + "issue kept, milestone gone" | |
| 554 | + ); | |
| 540 | 555 | } |
| 541 | 556 | |
| 542 | 557 | /// Locking on forge: only triage holders may lock, CSRF is required, and a locked issue refuses |
crates/forge-web/src/pages/issue_view.rsmodified+2 -9
| @@ -899,15 +899,8 @@ mod tests { | ||
| 899 | 899 | .create_issue(&id, &owner.id, "G", "body") |
| 900 | 900 | .await |
| 901 | 901 | .unwrap(); |
| 902 | - let first = fx | |
| 903 | - .store | |
| 904 | - .add_comment(&g.id, &owner.id, "one") | |
| 905 | - .await | |
| 906 | - .unwrap(); | |
| 907 | - fx.store | |
| 908 | - .add_comment(&g.id, &owner.id, "two") | |
| 909 | - .await | |
| 910 | - .unwrap(); | |
| 902 | + let first = fx.store.add_comment(&g.id, &owner.id, "one").await.unwrap(); | |
| 903 | + fx.store.add_comment(&g.id, &owner.id, "two").await.unwrap(); | |
| 911 | 904 | assert_eq!( |
| 912 | 905 | fx.store |
| 913 | 906 | .issue_by_number(&id, g.number) |
crates/forge-web/src/pages/issues_list.rsmodified+21 -15
| @@ -496,12 +496,27 @@ async fn issues_list_page(cx: &Cx) -> Result<impl View> { | ||
| 496 | 496 | Ok(view! { |
| 497 | 497 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), extra_stylesheet: Some(labels_href.as_str()), |
| 498 | 498 | repo_head(head: header) |
| 499 | + <section class="issue-pane fit-pane"> | |
| 499 | 500 | <div class="issue-toolbar" data-live=(live_href.as_str()) data-live-now=""> |
| 500 | 501 | <nav class="issue-tabs" aria-label=(g::t(lang, K::IssuesByState))> |
| 501 | 502 | <a class=(state_tab_class(state_word == "open")) href=(open_href.as_str())>(open_text.as_str())</a> |
| 502 | 503 | <a class=(state_tab_class(state_word == "closed")) href=(closed_href.as_str())>(closed_text.as_str())</a> |
| 503 | 504 | <a class=(state_tab_class(state_word == "all")) href=(all_href.as_str())>(all_text.as_str())</a> |
| 504 | 505 | </nav> |
| 506 | + <form method="get" action=(base.as_str()) class="issue-search"> | |
| 507 | + <input type="hidden" name="state" value=(sel.state)> | |
| 508 | + <input type="hidden" name="label" value=(sel.label.as_str())> | |
| 509 | + <input type="hidden" name="milestone" value=(sel.milestone.as_str())> | |
| 510 | + <input type="hidden" name="author" value=(sel.author.as_str())> | |
| 511 | + <input type="hidden" name="assignee" value=(sel.assignee.as_str())> | |
| 512 | + <input type="search" name="q" value=(search_value.as_str()) placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256"> | |
| 513 | + <select name="sort" aria-label=(g::t(lang, K::Sort))> | |
| 514 | + for option in sort_options.iter() { | |
| 515 | + <option value=(option.value) selected=(option.selected)>(option.label)</option> | |
| 516 | + } | |
| 517 | + </select> | |
| 518 | + <button type="submit">(g::t(lang, K::Search))</button> | |
| 519 | + </form> | |
| 505 | 520 | <div class="issue-tools"> |
| 506 | 521 | <nav aria-label=(g::t(lang, K::LabelsAndMilestones))> |
| 507 | 522 | <a class="button" href=(labels_page_href.as_str())>(g::t(lang, K::Labels))</a> |
| @@ -512,20 +527,6 @@ async fn issues_list_page(cx: &Cx) -> Result<impl View> { | ||
| 512 | 527 | } |
| 513 | 528 | </div> |
| 514 | 529 | </div> |
| 515 | - <form method="get" action=(base.as_str()) class="issue-search"> | |
| 516 | - <input type="hidden" name="state" value=(sel.state)> | |
| 517 | - <input type="hidden" name="label" value=(sel.label.as_str())> | |
| 518 | - <input type="hidden" name="milestone" value=(sel.milestone.as_str())> | |
| 519 | - <input type="hidden" name="author" value=(sel.author.as_str())> | |
| 520 | - <input type="hidden" name="assignee" value=(sel.assignee.as_str())> | |
| 521 | - <input type="search" name="q" value=(search_value.as_str()) placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256"> | |
| 522 | - <select name="sort" aria-label=(g::t(lang, K::Sort))> | |
| 523 | - for option in sort_options.iter() { | |
| 524 | - <option value=(option.value) selected=(option.selected)>(option.label)</option> | |
| 525 | - } | |
| 526 | - </select> | |
| 527 | - <button type="submit">(g::t(lang, K::Search))</button> | |
| 528 | - </form> | |
| 529 | 530 | if has_filters { |
| 530 | 531 | <p class="muted small">(g::t(lang, K::FiltersApplied)) <a href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a></p> |
| 531 | 532 | } |
| @@ -614,6 +615,7 @@ async fn issues_list_page(cx: &Cx) -> Result<impl View> { | ||
| 614 | 615 | } |
| 615 | 616 | </nav> |
| 616 | 617 | } |
| 618 | + </section> | |
| 617 | 619 | ) |
| 618 | 620 | }) |
| 619 | 621 | } |
| @@ -1036,7 +1038,11 @@ mod tests { | ||
| 1036 | 1038 | } |
| 1037 | 1039 | let empty = send(&fx.router, "GET", &base(), true, None, &[]).await; |
| 1038 | 1040 | assert_eq!(empty.status, 200, "empty list"); |
| 1039 | - assert!(empty.text().contains("No issues yet. Open one to start a conversation.")); | |
| 1041 | + assert!( | |
| 1042 | + empty | |
| 1043 | + .text() | |
| 1044 | + .contains("No issues yet. Open one to start a conversation.") | |
| 1045 | + ); | |
| 1040 | 1046 | assert_eq!(rows(&empty.text()), 0); |
| 1041 | 1047 | let tr = send( |
| 1042 | 1048 | &fx.router, |
crates/forge-web/src/pages/labels_page.rsmodified+7 -5
| @@ -95,13 +95,15 @@ async fn labels_body( | ||
| 95 | 95 | let header = frame.head.clone(); |
| 96 | 96 | Ok(view! { |
| 97 | 97 | repo_head(head: header) |
| 98 | - issue_subnav(lang: lang, title: frame.title.clone(), active: "labels".to_owned()) | |
| 99 | 98 | if archived { |
| 100 | 99 | <section class="card notice" role="status">(g::t(lang, K::LabelsArchived))</section> |
| 101 | 100 | } |
| 102 | 101 | <div class="fit-split"> |
| 103 | - <section class="card fit-pane fit-card fit-main" data-live=(live.as_str()) data-live-now=""> | |
| 104 | - <h2>(g::t(lang, K::Labels))</h2> | |
| 102 | + <section class="card fit-pane fit-card fit-main lang-list" data-live=(live.as_str()) data-live-now=""> | |
| 103 | + <h2 class="sr-only">(g::t(lang, K::Labels))</h2> | |
| 104 | + <div class="list-bar"> | |
| 105 | + issue_subnav(lang: lang, title: frame.title.clone(), active: "labels".to_owned()) | |
| 106 | + </div> | |
| 105 | 107 | if empty { |
| 106 | 108 | empty_state(title: g::t(lang, K::NoLabelsYet), |
| 107 | 109 | if can_triage && !archived { |
| @@ -117,7 +119,7 @@ async fn labels_body( | ||
| 117 | 119 | <div class="fit-scroll"> |
| 118 | 120 | <ul class="label-list"> |
| 119 | 121 | for row in rows.iter() { |
| 120 | - <li class="label-row"> | |
| 122 | + <li class="label-row" data-kb-row=""> | |
| 121 | 123 | <div class="label-head"> |
| 122 | 124 | <a class=(row.chip_class.as_str()) href=(row.issues_href.as_str())>(row.name.as_str())</a> |
| 123 | 125 | <a class="small" href=(row.issues_href.as_str())>(row.open_text.as_str())</a> |
| @@ -161,7 +163,7 @@ async fn labels_body( | ||
| 161 | 163 | pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) |
| 162 | 164 | </section> |
| 163 | 165 | if can_triage { |
| 164 | - <section class="card fit-side"> | |
| 166 | + <section class="card fit-side lang-side"> | |
| 165 | 167 | <h2>(g::t(lang, K::NewLabel))</h2> |
| 166 | 168 | <form method="post" action=(labels_action.as_str()) class="stack"> |
| 167 | 169 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
crates/forge-web/src/pages/media.rsmodified+6 -3
| @@ -424,13 +424,16 @@ mod tests { | ||
| 424 | 424 | // Scenario: a token signed for the public repo does not open the private one. |
| 425 | 425 | let other = sign_raw(&fx.state.key, &fx.public.id, now + 60); |
| 426 | 426 | let res = get(&fx.router, "GET", &format!("{path}?token={other}")).await; |
| 427 | - assert_eq!(res.status(), StatusCode::NOT_FOUND, "token for another repo"); | |
| 427 | + assert_eq!( | |
| 428 | + res.status(), | |
| 429 | + StatusCode::NOT_FOUND, | |
| 430 | + "token for another repo" | |
| 431 | + ); | |
| 428 | 432 | |
| 429 | 433 | // Scenario: a public URL is encoded and unsigned. |
| 430 | 434 | let public = media_url(&fx.state, &fx.public, "main", "a b/big.bin"); |
| 431 | 435 | assert_eq!( |
| 432 | - public, | |
| 433 | - "http://127.0.0.1:7661/tahinli/pub/-/media/main/a%20b/big.bin", | |
| 436 | + public, "http://127.0.0.1:7661/tahinli/pub/-/media/main/a%20b/big.bin", | |
| 434 | 437 | "public url" |
| 435 | 438 | ); |
| 436 | 439 |
crates/forge-web/src/pages/merge_queue.rsmodified+14 -10
| @@ -361,14 +361,17 @@ async fn queue_body( | ||
| 361 | 361 | let hint = g::t(lang, K::MergeQueueHint); |
| 362 | 362 | Ok(view! { |
| 363 | 363 | repo_head(head: head) |
| 364 | - <div data-live=(live.as_str())> | |
| 365 | - <nav class="issue-tabs" aria-label=(g::t(lang, K::MergeQueueNav))> | |
| 366 | - <a class=(tab_class(!history)) href=(waiting_href.as_str())>(g::t(lang, K::QueueWaiting))</a> | |
| 367 | - <a class=(tab_class(history)) href=(history_href.as_str())>(g::t(lang, K::QueueHistory))</a> | |
| 368 | - </nav> | |
| 369 | - if !protected { | |
| 370 | - <section class="card notice" role="status">(g::t(lang, K::QueueNoBranch))</section> | |
| 371 | - } | |
| 364 | + if !protected { | |
| 365 | + <section class="card notice" role="status">(g::t(lang, K::QueueNoBranch))</section> | |
| 366 | + } | |
| 367 | + <div class="lang-list fit-pane" data-live=(live.as_str())> | |
| 368 | + <div class="list-bar"> | |
| 369 | + <nav class="issue-tabs" aria-label=(g::t(lang, K::MergeQueueNav))> | |
| 370 | + <a class=(tab_class(!history)) href=(waiting_href.as_str())>(g::t(lang, K::QueueWaiting))</a> | |
| 371 | + <a class=(tab_class(history)) href=(history_href.as_str())>(g::t(lang, K::QueueHistory))</a> | |
| 372 | + </nav> | |
| 373 | + </div> | |
| 374 | + <div class="list-scroll"> | |
| 372 | 375 | if empty { |
| 373 | 376 | <p class="muted">(g::t(lang, K::QueueEmpty))</p> |
| 374 | 377 | } else { |
| @@ -389,7 +392,7 @@ async fn queue_body( | ||
| 389 | 392 | </thead> |
| 390 | 393 | <tbody> |
| 391 | 394 | for row in rows.iter() { |
| 392 | - <tr> | |
| 395 | + <tr data-kb-row=""> | |
| 393 | 396 | <td class="mono" data-label=(g::t(lang, K::QueueColPosition))>(row.position.as_str())</td> |
| 394 | 397 | <td data-label=(g::t(lang, K::QueueColPull))><a href=(row.pull_href.as_str())>"#"(row.pull_number)" "(row.pull_title.as_str())</a></td> |
| 395 | 398 | <td data-label=(g::t(lang, K::QueueColBranch))><code>(row.branch.as_str())</code></td> |
| @@ -418,7 +421,8 @@ async fn queue_body( | ||
| 418 | 421 | </table> |
| 419 | 422 | </div> |
| 420 | 423 | } |
| 421 | - <p class="muted small">(hint)</p> | |
| 424 | + </div> | |
| 425 | + <p class="list-foot muted small">(hint)</p> | |
| 422 | 426 | </div> |
| 423 | 427 | }) |
| 424 | 428 | } |
crates/forge-web/src/pages/milestones_page.rsmodified+7 -5
| @@ -133,7 +133,7 @@ async fn milestone_row( | ||
| 133 | 133 | let open_text = g::open_milestone_count(lang, row.open); |
| 134 | 134 | let closed_text = g::closed_milestone_count(lang, row.closed); |
| 135 | 135 | Ok(view! { |
| 136 | - <li class="milestone-row"> | |
| 136 | + <li class="milestone-row" data-kb-row=""> | |
| 137 | 137 | <h3><a href=(row.edit_href.as_str())>(row.title.as_str())</a></h3> |
| 138 | 138 | <p class="muted small"> |
| 139 | 139 | if let Some(due) = row.due.as_deref() { |
| @@ -170,7 +170,7 @@ async fn milestone_row( | ||
| 170 | 170 | #[component] |
| 171 | 171 | async fn milestone_create_form(lang: Lang, csrf: String, action: String) -> Result<impl View> { |
| 172 | 172 | Ok(view! { |
| 173 | - <section class="card"> | |
| 173 | + <section class="card lang-side"> | |
| 174 | 174 | <h2>(g::t(lang, K::NewMilestone))</h2> |
| 175 | 175 | <form method="post" action=(action.as_str()) class="stack"> |
| 176 | 176 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| @@ -292,13 +292,15 @@ async fn milestones_body( | ||
| 292 | 292 | }; |
| 293 | 293 | Ok(view! { |
| 294 | 294 | repo_head(head: header) |
| 295 | - issue_subnav(lang: lang, title: title.clone(), active: "milestones".to_owned()) | |
| 296 | 295 | if frame.archived { |
| 297 | 296 | <section class="card notice" role="status">(g::t(lang, K::MilestonesArchived))</section> |
| 298 | 297 | } |
| 299 | - state_tabs(lang: lang, title: title.clone(), closed: closed) | |
| 300 | 298 | <div class="fit-split"> |
| 301 | - <section class="card fit-pane fit-card fit-main" data-live=(live.as_str()) data-live-now=""> | |
| 299 | + <section class="card fit-pane fit-card fit-main lang-list" data-live=(live.as_str()) data-live-now=""> | |
| 300 | + <div class="list-bar"> | |
| 301 | + issue_subnav(lang: lang, title: title.clone(), active: "milestones".to_owned()) | |
| 302 | + state_tabs(lang: lang, title: title.clone(), closed: closed) | |
| 303 | + </div> | |
| 302 | 304 | if empty { |
| 303 | 305 | empty_state(title: empty_text) |
| 304 | 306 | } |
crates/forge-web/src/pages/mod.rsmodified+1 -1
| @@ -117,10 +117,10 @@ pub mod repo_rename; | ||
| 117 | 117 | pub mod repo_secrets; |
| 118 | 118 | pub mod repo_security; |
| 119 | 119 | pub mod repo_settings; |
| 120 | -pub mod repo_side; | |
| 121 | 120 | pub mod repo_settings_live; |
| 122 | 121 | #[cfg(test)] |
| 123 | 122 | mod repo_settings_live_tests; |
| 123 | +pub mod repo_side; | |
| 124 | 124 | pub mod repo_transfer; |
| 125 | 125 | pub mod repo_webhooks; |
| 126 | 126 | pub mod review_requests; |
crates/forge-web/src/pages/needs_you.rsmodified+9 -8
| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | //! `?section=<slug>` shows one section as a full list, 15 rows a page. `/needs-you/events` wakes the |
| 6 | 6 | //! page on the viewer's review-request and inbox topics. |
| 7 | 7 | |
| 8 | +use forge_core::User; | |
| 8 | 9 | use forge_core::authz::{Action, authorize}; |
| 9 | 10 | use forge_core::store::needs::Verdict; |
| 10 | -use forge_core::User; | |
| 11 | 11 | use topcoat::Result; |
| 12 | 12 | use topcoat::context::{Cx, app_context}; |
| 13 | 13 | use topcoat::router::response::Response; |
| @@ -348,13 +348,14 @@ pub(crate) async fn need_section(lang: Lang, section: NeedSection) -> Result<imp | ||
| 348 | 348 | heading, |
| 349 | 349 | more, |
| 350 | 350 | rows, |
| 351 | - pager: NeedPager { | |
| 352 | - page, | |
| 353 | - pages, | |
| 354 | - links, | |
| 355 | - prev, | |
| 356 | - next, | |
| 357 | - }, | |
| 351 | + pager: | |
| 352 | + NeedPager { | |
| 353 | + page, | |
| 354 | + pages, | |
| 355 | + links, | |
| 356 | + prev, | |
| 357 | + next, | |
| 358 | + }, | |
| 358 | 359 | } = section; |
| 359 | 360 | Ok(view! { |
| 360 | 361 | <section class="card needs-section"> |
crates/forge-web/src/pages/new_repo.rsmodified+79 -17
| @@ -31,18 +31,66 @@ const DEFAULT_BRANCH: &str = "main"; | ||
| 31 | 31 | |
| 32 | 32 | /// The licenses the form offers, in menu order: SPDX id, menu label and the full SPDX text. |
| 33 | 33 | const LICENSES: &[(&str, &str, &str)] = &[ |
| 34 | - ("MIT", "MIT License", include_str!("../../assets/licenses/MIT.txt")), | |
| 35 | - ("Apache-2.0", "Apache License 2.0", include_str!("../../assets/licenses/Apache-2.0.txt")), | |
| 36 | - ("GPL-3.0-only", "GNU GPL v3", include_str!("../../assets/licenses/GPL-3.0-only.txt")), | |
| 37 | - ("AGPL-3.0-only", "GNU AGPL v3", include_str!("../../assets/licenses/AGPL-3.0-only.txt")), | |
| 38 | - ("LGPL-3.0-only", "GNU LGPL v3", include_str!("../../assets/licenses/LGPL-3.0-only.txt")), | |
| 39 | - ("GPL-2.0-only", "GNU GPL v2", include_str!("../../assets/licenses/GPL-2.0-only.txt")), | |
| 40 | - ("MPL-2.0", "Mozilla Public License 2.0", include_str!("../../assets/licenses/MPL-2.0.txt")), | |
| 41 | - ("BSD-3-Clause", "BSD 3-Clause", include_str!("../../assets/licenses/BSD-3-Clause.txt")), | |
| 42 | - ("BSD-2-Clause", "BSD 2-Clause", include_str!("../../assets/licenses/BSD-2-Clause.txt")), | |
| 43 | - ("ISC", "ISC License", include_str!("../../assets/licenses/ISC.txt")), | |
| 44 | - ("BSL-1.0", "Boost Software License 1.0", include_str!("../../assets/licenses/BSL-1.0.txt")), | |
| 45 | - ("Unlicense", "The Unlicense", include_str!("../../assets/licenses/Unlicense.txt")), | |
| 34 | + ( | |
| 35 | + "MIT", | |
| 36 | + "MIT License", | |
| 37 | + include_str!("../../assets/licenses/MIT.txt"), | |
| 38 | + ), | |
| 39 | + ( | |
| 40 | + "Apache-2.0", | |
| 41 | + "Apache License 2.0", | |
| 42 | + include_str!("../../assets/licenses/Apache-2.0.txt"), | |
| 43 | + ), | |
| 44 | + ( | |
| 45 | + "GPL-3.0-only", | |
| 46 | + "GNU GPL v3", | |
| 47 | + include_str!("../../assets/licenses/GPL-3.0-only.txt"), | |
| 48 | + ), | |
| 49 | + ( | |
| 50 | + "AGPL-3.0-only", | |
| 51 | + "GNU AGPL v3", | |
| 52 | + include_str!("../../assets/licenses/AGPL-3.0-only.txt"), | |
| 53 | + ), | |
| 54 | + ( | |
| 55 | + "LGPL-3.0-only", | |
| 56 | + "GNU LGPL v3", | |
| 57 | + include_str!("../../assets/licenses/LGPL-3.0-only.txt"), | |
| 58 | + ), | |
| 59 | + ( | |
| 60 | + "GPL-2.0-only", | |
| 61 | + "GNU GPL v2", | |
| 62 | + include_str!("../../assets/licenses/GPL-2.0-only.txt"), | |
| 63 | + ), | |
| 64 | + ( | |
| 65 | + "MPL-2.0", | |
| 66 | + "Mozilla Public License 2.0", | |
| 67 | + include_str!("../../assets/licenses/MPL-2.0.txt"), | |
| 68 | + ), | |
| 69 | + ( | |
| 70 | + "BSD-3-Clause", | |
| 71 | + "BSD 3-Clause", | |
| 72 | + include_str!("../../assets/licenses/BSD-3-Clause.txt"), | |
| 73 | + ), | |
| 74 | + ( | |
| 75 | + "BSD-2-Clause", | |
| 76 | + "BSD 2-Clause", | |
| 77 | + include_str!("../../assets/licenses/BSD-2-Clause.txt"), | |
| 78 | + ), | |
| 79 | + ( | |
| 80 | + "ISC", | |
| 81 | + "ISC License", | |
| 82 | + include_str!("../../assets/licenses/ISC.txt"), | |
| 83 | + ), | |
| 84 | + ( | |
| 85 | + "BSL-1.0", | |
| 86 | + "Boost Software License 1.0", | |
| 87 | + include_str!("../../assets/licenses/BSL-1.0.txt"), | |
| 88 | + ), | |
| 89 | + ( | |
| 90 | + "Unlicense", | |
| 91 | + "The Unlicense", | |
| 92 | + include_str!("../../assets/licenses/Unlicense.txt"), | |
| 93 | + ), | |
| 46 | 94 | ]; |
| 47 | 95 | |
| 48 | 96 | /// The LICENSE file for `spdx` with the copyright line filled in. `None` for an id that is not in |
| @@ -192,7 +240,7 @@ async fn new_repo_form( | ||
| 192 | 240 | } |
| 193 | 241 | <form method="post" action="/new" class="newrepo-form"> |
| 194 | 242 | csrf_field(token: csrf) |
| 195 | - <header class="newrepo-head"> | |
| 243 | + <header class="newrepo-head page-head"> | |
| 196 | 244 | <h1>(i18n::t(lang, Key::NewRepository))</h1> |
| 197 | 245 | <div class="newrepo-head-actions"> |
| 198 | 246 | <fieldset class="newrepo-visibility"> |
| @@ -609,7 +657,11 @@ mod tests { | ||
| 609 | 657 | |
| 610 | 658 | /// POSTs `/new` as tahinli for a repo called `name` with the extra fields. Returns the status |
| 611 | 659 | /// and the repo created, if any. The form's token is the shared CSRF value. |
| 612 | - async fn post_new(site: &Site, name: &str, fields: &[(&str, &str)]) -> (u16, Option<forge_core::Repo>) { | |
| 660 | + async fn post_new( | |
| 661 | + site: &Site, | |
| 662 | + name: &str, | |
| 663 | + fields: &[(&str, &str)], | |
| 664 | + ) -> (u16, Option<forge_core::Repo>) { | |
| 613 | 665 | let mut pairs = vec![("csrf", CSRF), ("name", name)]; |
| 614 | 666 | pairs.extend_from_slice(fields); |
| 615 | 667 | let body = form_urlencoded::Serializer::new(String::new()) |
| @@ -687,7 +739,11 @@ mod tests { | ||
| 687 | 739 | .await |
| 688 | 740 | .expect("query") |
| 689 | 741 | .expect("valid mirror: a pull mirror"); |
| 690 | - assert_eq!(mirror.direction, MirrorDirection::Pull, "valid mirror: direction"); | |
| 742 | + assert_eq!( | |
| 743 | + mirror.direction, | |
| 744 | + MirrorDirection::Pull, | |
| 745 | + "valid mirror: direction" | |
| 746 | + ); | |
| 691 | 747 | assert_eq!( |
| 692 | 748 | mirror.url, "https://example.com/upstream/proj.git", |
| 693 | 749 | "valid mirror: url" |
| @@ -707,8 +763,14 @@ mod tests { | ||
| 707 | 763 | &[("mirror_url", "https://127.0.0.1/upstream/proj.git")], |
| 708 | 764 | ) |
| 709 | 765 | .await; |
| 710 | - assert_eq!(status, 200, "loopback: the form is shown again with the error"); | |
| 711 | - assert!(repo.is_none(), "loopback: no repo is created for a refused mirror"); | |
| 766 | + assert_eq!( | |
| 767 | + status, 200, | |
| 768 | + "loopback: the form is shown again with the error" | |
| 769 | + ); | |
| 770 | + assert!( | |
| 771 | + repo.is_none(), | |
| 772 | + "loopback: no repo is created for a refused mirror" | |
| 773 | + ); | |
| 712 | 774 | |
| 713 | 775 | // Case: a blank URL creates the repo without a mirror. |
| 714 | 776 | let (status, repo) = post_new(&site, "mirror-blank", &[("mirror_url", " ")]).await; |
crates/forge-web/src/pages/notifications.rsmodified+17 -10
| @@ -35,7 +35,9 @@ use crate::pages::repo_ctx::{RepoCtx, load_repo}; | ||
| 35 | 35 | use crate::pages::repo_transfer::transfer_list_for; |
| 36 | 36 | use crate::pages::star::return_path; |
| 37 | 37 | use crate::state::AppState; |
| 38 | -use crate::views::{csrf_field, display_name, empty_state, iso_time, now_unix, relative_time, repo_href, shell}; | |
| 38 | +use crate::views::{ | |
| 39 | + csrf_field, display_name, empty_state, iso_time, now_unix, relative_time, repo_href, shell, | |
| 40 | +}; | |
| 39 | 41 | |
| 40 | 42 | /// Rows per inbox page: a group head and its rows, with the older link, fit the window's height |
| 41 | 43 | /// (about 44px a row and 62px a group head at 1440×900). The list scrolls inside its pane when a page |
| @@ -1132,14 +1134,14 @@ async fn inbox_list( | ||
| 1132 | 1134 | } |
| 1133 | 1135 | </section> |
| 1134 | 1136 | transfer_list_for(lang: lang, transfers: transfers, csrf: csrf.clone()) |
| 1135 | - <nav class="notif-tabs" aria-label=(g::t(lang, K::NotificationFilter))> | |
| 1136 | - <a href="/notifications" class=(unread_class)>(unread_text.as_str())</a> | |
| 1137 | - <a href="/notifications?all=1" class=(all_class)>(g::t(lang, K::AllTab))</a> | |
| 1138 | - <a href="/review-requests">(crate::i18n::authoring::t(lang, crate::i18n::authoring::K::ReviewRequestsTab))</a> | |
| 1139 | - </nav> | |
| 1140 | - // The groups and the older link share one pane that fits the window, so the page itself does | |
| 1141 | - // not scroll; the older link ends the pane. | |
| 1142 | - <div class="notif-pane fit-pane"> | |
| 1137 | + // The filter tabs, the groups and the older link share one pane that fits the window, so the | |
| 1138 | + // page itself does not scroll; the older link ends the pane. | |
| 1139 | + <div class="notif-pane fit-pane list-pane"> | |
| 1140 | + <nav class="notif-tabs" aria-label=(g::t(lang, K::NotificationFilter))> | |
| 1141 | + <a href="/notifications" class=(unread_class)>(unread_text.as_str())</a> | |
| 1142 | + <a href="/notifications?all=1" class=(all_class)>(g::t(lang, K::AllTab))</a> | |
| 1143 | + <a href="/review-requests">(crate::i18n::authoring::t(lang, crate::i18n::authoring::K::ReviewRequestsTab))</a> | |
| 1144 | + </nav> | |
| 1143 | 1145 | if empty { |
| 1144 | 1146 | empty_state(title: empty_text, |
| 1145 | 1147 | if !all { |
| @@ -1497,7 +1499,12 @@ mod tests { | ||
| 1497 | 1499 | assert_eq!(site.store.unread_count(&w.bob.id).await.expect("count"), 1); |
| 1498 | 1500 | |
| 1499 | 1501 | // Bob opens his own row: it redirects to the issue and marks the row read. |
| 1500 | - let res = get(&site, &format!("/notifications/{id}/open"), Some(&bob_cookie)).await; | |
| 1502 | + let res = get( | |
| 1503 | + &site, | |
| 1504 | + &format!("/notifications/{id}/open"), | |
| 1505 | + Some(&bob_cookie), | |
| 1506 | + ) | |
| 1507 | + .await; | |
| 1501 | 1508 | assert_eq!(res.status, 303); |
| 1502 | 1509 | assert_eq!(res.location.as_deref(), Some("/tahinli/demo/issues/1")); |
| 1503 | 1510 | assert_eq!(site.store.unread_count(&w.bob.id).await.expect("count"), 0); |
crates/forge-web/src/pages/org_ctx.rsmodified+3 -1
| @@ -208,7 +208,9 @@ pub async fn org_tab_counts(state: &AppState, org: &User, viewer: &User) -> Resu | ||
| 208 | 208 | .store |
| 209 | 209 | .count_visible_repos(RepoScope::OwnedBy(&org.id), Some(viewer)) |
| 210 | 210 | .await?; |
| 211 | - let packages = packages::package_rows(state, Some(viewer), org).await?.len(); | |
| 211 | + let packages = packages::package_rows(state, Some(viewer), org) | |
| 212 | + .await? | |
| 213 | + .len(); | |
| 212 | 214 | Ok((repos, packages)) |
| 213 | 215 | } |
| 214 | 216 |
crates/forge-web/src/pages/org_new.rsmodified+3 -1
| @@ -49,8 +49,10 @@ async fn new_org_form( | ||
| 49 | 49 | lang: Lang, |
| 50 | 50 | ) -> Result<impl View> { |
| 51 | 51 | Ok(view! { |
| 52 | - <section class="card narrow"> | |
| 52 | + <section class="page-head"> | |
| 53 | 53 | <h1>(g::t(lang, K::NewOrganization))</h1> |
| 54 | + </section> | |
| 55 | + <section class="card org-new"> | |
| 54 | 56 | <p class="muted small">(g::t(lang, K::NewOrgIntro))</p> |
| 55 | 57 | if let Some(message) = error { |
| 56 | 58 | alert(message: message.as_str()) |
crates/forge-web/src/pages/palette.rsmodified+27 -5
| @@ -19,8 +19,8 @@ use topcoat::router::response::Response; | ||
| 19 | 19 | use topcoat::router::{Body, HeaderValue, StatusCode, route}; |
| 20 | 20 | |
| 21 | 21 | use crate::auth::current_user; |
| 22 | -use crate::i18n::orgs::{self as g, K}; | |
| 23 | 22 | use crate::i18n; |
| 23 | +use crate::i18n::orgs::{self as g, K}; | |
| 24 | 24 | use crate::pages::org_new::may_create_org; |
| 25 | 25 | use crate::state::AppState; |
| 26 | 26 | use crate::views::{ |
| @@ -66,12 +66,30 @@ async fn palette(cx: &Cx) -> Result<Response> { | ||
| 66 | 66 | let base = format!("/org/{}", enc(name)); |
| 67 | 67 | push(&mut items, &mut seen, name, &user_href(name), "org"); |
| 68 | 68 | let members = format!("{name} \u{b7} {}", g::t(lang, K::Members)); |
| 69 | - push(&mut items, &mut seen, &members, &format!("{base}/members"), "page"); | |
| 69 | + push( | |
| 70 | + &mut items, | |
| 71 | + &mut seen, | |
| 72 | + &members, | |
| 73 | + &format!("{base}/members"), | |
| 74 | + "page", | |
| 75 | + ); | |
| 70 | 76 | let teams = format!("{name} \u{b7} {}", g::t(lang, K::Teams)); |
| 71 | - push(&mut items, &mut seen, &teams, &format!("{base}/teams"), "page"); | |
| 77 | + push( | |
| 78 | + &mut items, | |
| 79 | + &mut seen, | |
| 80 | + &teams, | |
| 81 | + &format!("{base}/teams"), | |
| 82 | + "page", | |
| 83 | + ); | |
| 72 | 84 | if role == OrgMemberRole::Owner { |
| 73 | 85 | let settings = format!("{name} \u{b7} {}", g::t(lang, K::Settings)); |
| 74 | - push(&mut items, &mut seen, &settings, &format!("{base}/settings"), "page"); | |
| 86 | + push( | |
| 87 | + &mut items, | |
| 88 | + &mut seen, | |
| 89 | + &settings, | |
| 90 | + &format!("{base}/settings"), | |
| 91 | + "page", | |
| 92 | + ); | |
| 75 | 93 | } |
| 76 | 94 | } |
| 77 | 95 | |
| @@ -142,7 +160,11 @@ mod tests { | ||
| 142 | 160 | let tabs = profile_items(Lang::En, "tahinli", false, true, false); |
| 143 | 161 | assert!(!tabs.is_empty()); |
| 144 | 162 | for tab in tabs { |
| 145 | - assert!(hrefs.contains(&tab.href.as_str()), "palette lacks {}", tab.href); | |
| 163 | + assert!( | |
| 164 | + hrefs.contains(&tab.href.as_str()), | |
| 165 | + "palette lacks {}", | |
| 166 | + tab.href | |
| 167 | + ); | |
| 146 | 168 | } |
| 147 | 169 | } |
| 148 | 170 | } |
crates/forge-web/src/pages/passkeys.rsmodified+1 -4
| @@ -637,10 +637,7 @@ pub struct PasskeyPanel { | ||
| 637 | 637 | pub problem: Option<Unavailable>, |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | -pub async fn build_panel( | |
| 641 | - state: &AppState, | |
| 642 | - user_id: &str, | |
| 643 | -) -> forge_core::Result<PasskeyPanel> { | |
| 640 | +pub async fn build_panel(state: &AppState, user_id: &str) -> forge_core::Result<PasskeyPanel> { | |
| 644 | 641 | let rows = state.store.list_passkeys(user_id).await?; |
| 645 | 642 | let items = rows |
| 646 | 643 | .into_iter() |
crates/forge-web/src/pages/profile.rsmodified+9 -6
| @@ -29,8 +29,8 @@ use crate::i18n::{self, Lang}; | ||
| 29 | 29 | use crate::live::{Topic, stream_changes}; |
| 30 | 30 | use crate::pages::org_new::may_create_org; |
| 31 | 31 | use crate::pages::packages::{self as packages, PackageRow}; |
| 32 | -use crate::pages::repo_settings::{notice_banner_for, take_notice}; | |
| 33 | 32 | use crate::pages::profile_calendar::{calendar_since, load_calendar}; |
| 33 | +use crate::pages::repo_settings::{notice_banner_for, take_notice}; | |
| 34 | 34 | use crate::pages::snippets::{ListRow, list_row, snippet_rows}; |
| 35 | 35 | use crate::render::markdown::render_markdown; |
| 36 | 36 | use crate::state::AppState; |
| @@ -102,7 +102,7 @@ async fn profile_page(cx: &Cx) -> Result<impl View> { | ||
| 102 | 102 | let actor = viewer.as_ref().map(|(u, _)| u); |
| 103 | 103 | let lang = i18n::lang(cx, actor); |
| 104 | 104 | // Whether the viewer is this person. Only the person sees their Organizations tab and edit links. |
| 105 | - let own =!user.is_org() && actor.is_some_and(|u| u.id == user.id); | |
| 105 | + let own = !user.is_org() && actor.is_some_and(|u| u.id == user.id); | |
| 106 | 106 | let tab = tab_key(query.tab.as_deref()); |
| 107 | 107 | // An organization cannot be starred or keep snippets, so those tabs show the overview instead. |
| 108 | 108 | // The Organizations tab is the viewer's own, so anyone else gets the overview. |
| @@ -663,10 +663,10 @@ async fn profile_card( | ||
| 663 | 663 | </div> |
| 664 | 664 | } |
| 665 | 665 | </div> |
| 666 | + if has_about { | |
| 667 | + <section class="profile-about markdown-body">(Unescaped::new_unchecked(about_html))</section> | |
| 668 | + } | |
| 666 | 669 | </header> |
| 667 | - if has_about { | |
| 668 | - <section class="profile-about markdown-body">(Unescaped::new_unchecked(about_html))</section> | |
| 669 | - } | |
| 670 | 670 | profile_tabs(username: user.username.clone(), items: tab_items, current: tab.clone(), counts: tab_counts) |
| 671 | 671 | if overview_on { |
| 672 | 672 | if let Some((calendar, selected)) = heat { |
| @@ -1303,7 +1303,10 @@ mod tests { | ||
| 1303 | 1303 | assert!(overview.contains("class=\"heat\""), "overview: calendar"); |
| 1304 | 1304 | let (_, old) = get(&site.router, "/tahinli?tab=contributions", None).await; |
| 1305 | 1305 | assert!(old.contains("class=\"heat\""), "old tab link: calendar"); |
| 1306 | - assert!(!overview.contains("tab=contributions"), "nav: no contributions tab"); | |
| 1306 | + assert!( | |
| 1307 | + !overview.contains("tab=contributions"), | |
| 1308 | + "nav: no contributions tab" | |
| 1309 | + ); | |
| 1307 | 1310 | let (_, day) = get(&site.router, "/tahinli?day=2020-01-01", None).await; |
| 1308 | 1311 | assert!(day.contains("class=\"heat\""), "day link: calendar"); |
| 1309 | 1312 | } |
crates/forge-web/src/pages/profile_calendar.rsmodified+1 -1
| @@ -3,8 +3,8 @@ | ||
| 3 | 3 | |
| 4 | 4 | use std::time::Duration; |
| 5 | 5 | |
| 6 | -use forge_core::time::stamp_from_unix; | |
| 7 | 6 | use forge_core::User; |
| 7 | +use forge_core::time::stamp_from_unix; | |
| 8 | 8 | use jiff::{Timestamp, civil}; |
| 9 | 9 | use topcoat::Result; |
| 10 | 10 |
crates/forge-web/src/pages/profile_pins.rsmodified+24 -11
| @@ -152,7 +152,10 @@ async fn pins_fingerprint(store: &Store, owner_id: &str) -> Result<String> { | ||
| 152 | 152 | lines.push(format!("pin {}", repo.id)); |
| 153 | 153 | } |
| 154 | 154 | for repo in store.list_repos_by_owner(owner_id).await? { |
| 155 | - lines.push(format!("repo {} {}/{}", repo.id, repo.owner_name, repo.name)); | |
| 155 | + lines.push(format!( | |
| 156 | + "repo {} {}/{}", | |
| 157 | + repo.id, repo.owner_name, repo.name | |
| 158 | + )); | |
| 156 | 159 | } |
| 157 | 160 | Ok(lines.join("\n")) |
| 158 | 161 | } |
| @@ -164,11 +167,16 @@ async fn pins_events(cx: &Cx) -> Result<Response> { | ||
| 164 | 167 | let state = app_context::<AppState>(cx); |
| 165 | 168 | let owner_id = viewer.0.id.clone(); |
| 166 | 169 | let store = state.store.clone(); |
| 167 | - stream_changes(cx, &state.live, &[Topic::User(owner_id.clone())], move || { | |
| 168 | - let store = store.clone(); | |
| 169 | - let owner_id = owner_id.clone(); | |
| 170 | - async move { pins_fingerprint(&store, &owner_id).await } | |
| 171 | - }) | |
| 170 | + stream_changes( | |
| 171 | + cx, | |
| 172 | + &state.live, | |
| 173 | + &[Topic::User(owner_id.clone())], | |
| 174 | + move || { | |
| 175 | + let store = store.clone(); | |
| 176 | + let owner_id = owner_id.clone(); | |
| 177 | + async move { pins_fingerprint(&store, &owner_id).await } | |
| 178 | + }, | |
| 179 | + ) | |
| 172 | 180 | .await |
| 173 | 181 | } |
| 174 | 182 | |
| @@ -201,11 +209,16 @@ async fn org_pins_events(cx: &Cx) -> Result<Response> { | ||
| 201 | 209 | let state = app_context::<AppState>(cx); |
| 202 | 210 | let owner_id = ctx.org.id.clone(); |
| 203 | 211 | let store = state.store.clone(); |
| 204 | - stream_changes(cx, &state.live, &[Topic::User(owner_id.clone())], move || { | |
| 205 | - let store = store.clone(); | |
| 206 | - let owner_id = owner_id.clone(); | |
| 207 | - async move { pins_fingerprint(&store, &owner_id).await } | |
| 208 | - }) | |
| 212 | + stream_changes( | |
| 213 | + cx, | |
| 214 | + &state.live, | |
| 215 | + &[Topic::User(owner_id.clone())], | |
| 216 | + move || { | |
| 217 | + let store = store.clone(); | |
| 218 | + let owner_id = owner_id.clone(); | |
| 219 | + async move { pins_fingerprint(&store, &owner_id).await } | |
| 220 | + }, | |
| 221 | + ) | |
| 209 | 222 | .await |
| 210 | 223 | } |
| 211 | 224 |
crates/forge-web/src/pages/pull_files.rsmodified+1 -3
| @@ -24,9 +24,7 @@ use crate::auth::require_user; | ||
| 24 | 24 | use crate::i18n::pulls::{self as g, K}; |
| 25 | 25 | use crate::i18n::{self, Lang}; |
| 26 | 26 | use crate::pages::edit_history::thread_edit_counts; |
| 27 | -use crate::pages::issue_parts::{ | |
| 28 | - check_write, csrf_of, may_converse, parse_number, triage, viewer, | |
| 29 | -}; | |
| 27 | +use crate::pages::issue_parts::{check_write, csrf_of, may_converse, parse_number, triage, viewer}; | |
| 30 | 28 | use crate::pages::pull_reviews::{error_text_in, pull_diff, suggest_states}; |
| 31 | 29 | use crate::pages::pull_view::{commits_of, frame_in, is_merged, pull_header, pull_subnav_in}; |
| 32 | 30 | use crate::pages::repo::repo_head; |
crates/forge-web/src/pages/pull_view.rsmodified+3 -1
| @@ -1033,7 +1033,9 @@ async fn pull_commits(cx: &Cx) -> Result<impl View> { | ||
| 1033 | 1033 | pull_header(frame: frame.clone()) |
| 1034 | 1034 | pull_subnav_in(lang: lang, href: href, active: "commits".to_owned(), |
| 1035 | 1035 | commits: frame.commit_count, files: frame.file_count) |
| 1036 | - commit_list(rows: rows, lang: lang) | |
| 1036 | + <div class="issue-pane fit-pane"> | |
| 1037 | + commit_list(rows: rows, lang: lang) | |
| 1038 | + </div> | |
| 1037 | 1039 | ) |
| 1038 | 1040 | }) |
| 1039 | 1041 | } |
crates/forge-web/src/pages/pulls_list.rsmodified+24 -20
| @@ -266,12 +266,32 @@ async fn pulls_list_page(cx: &Cx) -> Result<impl View> { | ||
| 266 | 266 | Ok(view! { |
| 267 | 267 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), extra_stylesheet: Some(labels_href.as_str()), |
| 268 | 268 | repo_head(head: header) |
| 269 | + <section class="issue-pane fit-pane"> | |
| 269 | 270 | <div class="issue-toolbar" data-live=(live_url.as_str())> |
| 270 | 271 | <nav class="issue-tabs" aria-label=(g::t(lang, K::ListStateNavLabel))> |
| 271 | 272 | <a class=(state_tab_class(state_word == "open")) href=(open_href.as_str())>(open_text.as_str())</a> |
| 272 | 273 | <a class=(state_tab_class(state_word == "closed")) href=(closed_href.as_str())>(closed_text.as_str())</a> |
| 273 | 274 | <a class=(state_tab_class(state_word == "all")) href=(all_href.as_str())>(all_text.as_str())</a> |
| 274 | 275 | </nav> |
| 276 | + <form method="get" action=(base.as_str()) class="issue-search"> | |
| 277 | + <input type="hidden" name="state" value=(sel.state)> | |
| 278 | + <input type="hidden" name="label" value=(sel.label.as_str())> | |
| 279 | + <input type="hidden" name="milestone" value=(sel.milestone.as_str())> | |
| 280 | + <input type="hidden" name="author" value=(sel.author.as_str())> | |
| 281 | + <input type="hidden" name="assignee" value=(sel.assignee.as_str())> | |
| 282 | + <input type="search" name="q" value=(search_value.as_str()) placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256"> | |
| 283 | + <select name="draft" aria-label=(g::t(lang, K::DraftFilterLabel)) data-autosubmit=(true)> | |
| 284 | + <option value="" selected=(draft_sel.is_empty())>(g::t(lang, K::DraftAny))</option> | |
| 285 | + <option value="true" selected=(draft_sel == "true")>(g::t(lang, K::DraftOnly))</option> | |
| 286 | + <option value="false" selected=(draft_sel == "false")>(g::t(lang, K::DraftReadyOnly))</option> | |
| 287 | + </select> | |
| 288 | + <select name="sort" aria-label=(g::t(lang, K::SortLabel))> | |
| 289 | + for option in sort_options.iter() { | |
| 290 | + <option value=(option.value) selected=(option.selected)>(option.label)</option> | |
| 291 | + } | |
| 292 | + </select> | |
| 293 | + <button type="submit">(g::t(lang, K::Search))</button> | |
| 294 | + </form> | |
| 275 | 295 | <div class="issue-tools"> |
| 276 | 296 | <a class="issue-tab-link" href=(queue_href.as_str())>(mq::t(lang, mq::K::MergeQueueTitle))</a> |
| 277 | 297 | if can_create { |
| @@ -279,25 +299,6 @@ async fn pulls_list_page(cx: &Cx) -> Result<impl View> { | ||
| 279 | 299 | } |
| 280 | 300 | </div> |
| 281 | 301 | </div> |
| 282 | - <form method="get" action=(base.as_str()) class="issue-search"> | |
| 283 | - <input type="hidden" name="state" value=(sel.state)> | |
| 284 | - <input type="hidden" name="label" value=(sel.label.as_str())> | |
| 285 | - <input type="hidden" name="milestone" value=(sel.milestone.as_str())> | |
| 286 | - <input type="hidden" name="author" value=(sel.author.as_str())> | |
| 287 | - <input type="hidden" name="assignee" value=(sel.assignee.as_str())> | |
| 288 | - <input type="search" name="q" value=(search_value.as_str()) placeholder=(g::t(lang, K::SearchTitles)) aria-label=(g::t(lang, K::SearchTitles)) maxlength="256"> | |
| 289 | - <select name="draft" aria-label=(g::t(lang, K::DraftFilterLabel)) data-autosubmit=(true)> | |
| 290 | - <option value="" selected=(draft_sel.is_empty())>(g::t(lang, K::DraftAny))</option> | |
| 291 | - <option value="true" selected=(draft_sel == "true")>(g::t(lang, K::DraftOnly))</option> | |
| 292 | - <option value="false" selected=(draft_sel == "false")>(g::t(lang, K::DraftReadyOnly))</option> | |
| 293 | - </select> | |
| 294 | - <select name="sort" aria-label=(g::t(lang, K::SortLabel))> | |
| 295 | - for option in sort_options.iter() { | |
| 296 | - <option value=(option.value) selected=(option.selected)>(option.label)</option> | |
| 297 | - } | |
| 298 | - </select> | |
| 299 | - <button type="submit">(g::t(lang, K::Search))</button> | |
| 300 | - </form> | |
| 301 | 302 | if has_filters { |
| 302 | 303 | <p class="muted small">(g::t(lang, K::FiltersApplied)) <a href=(clear_href.as_str())>(g::t(lang, K::ClearFilters))</a></p> |
| 303 | 304 | } |
| @@ -378,6 +379,7 @@ async fn pulls_list_page(cx: &Cx) -> Result<impl View> { | ||
| 378 | 379 | } |
| 379 | 380 | </nav> |
| 380 | 381 | } |
| 382 | + </section> | |
| 381 | 383 | ) |
| 382 | 384 | }) |
| 383 | 385 | } |
| @@ -404,7 +406,9 @@ mod tests { | ||
| 404 | 406 | let fx = fixture(Visibility::Public).await; |
| 405 | 407 | let reply = send(&fx.router, "GET", &base(), true, None, &[]).await; |
| 406 | 408 | assert_eq!(reply.status, 200); |
| 407 | - assert!(reply.text().contains("No pull requests yet. Push a branch, then open one to propose its changes.")); | |
| 409 | + assert!(reply.text().contains( | |
| 410 | + "No pull requests yet. Push a branch, then open one to propose its changes." | |
| 411 | + )); | |
| 408 | 412 | assert_eq!(rows(&reply.text()), 0); |
| 409 | 413 | } |
| 410 | 414 |
crates/forge-web/src/pages/push.rsmodified+3 -7
| @@ -94,10 +94,7 @@ fn check_endpoint(endpoint: &str, policy: &WebhookPolicy) -> forge_core::Result< | ||
| 94 | 94 | /// The browser's P-256 public key must be an uncompressed point, and its auth secret 16 bytes. |
| 95 | 95 | fn check_keys(p256dh: &str, auth: &str) -> forge_core::Result<()> { |
| 96 | 96 | let point = crypto::decode_b64(p256dh)?; |
| 97 | - if point.len() != 65 | |
| 98 | - || point[0] != 0x04 | |
| 99 | - || p256::PublicKey::from_sec1_bytes(&point).is_err() | |
| 100 | - { | |
| 97 | + if point.len() != 65 || point[0] != 0x04 || p256::PublicKey::from_sec1_bytes(&point).is_err() { | |
| 101 | 98 | return Err(forge_core::Error::Invalid( |
| 102 | 99 | "the browser key is not a P-256 public key".into(), |
| 103 | 100 | )); |
| @@ -298,9 +295,9 @@ async fn apple_touch_icon() -> Result<(StatusCode, HeaderMap, &'static [u8])> { | ||
| 298 | 295 | #[cfg(test)] |
| 299 | 296 | mod tests { |
| 300 | 297 | use forge_core::Store; |
| 298 | + use p256::elliptic_curve::sec1::ToSec1Point; | |
| 301 | 299 | use topcoat::router::request::Request; |
| 302 | 300 | use topcoat::router::{Body, Router, to_bytes}; |
| 303 | - use p256::elliptic_curve::sec1::ToSec1Point; | |
| 304 | 301 | |
| 305 | 302 | use crate::auth::SESSION_COOKIE; |
| 306 | 303 | use crate::test_support::{app_router, create_session, test_state}; |
| @@ -339,8 +336,7 @@ mod tests { | ||
| 339 | 336 | |
| 340 | 337 | /// A browser key and auth secret as a browser would send them: base64url, uncompressed point. |
| 341 | 338 | fn browser_keys() -> (String, String) { |
| 342 | - let secret = p256::SecretKey::from_slice(&crypto::new_vapid_private()) | |
| 343 | - .expect("scalar"); | |
| 339 | + let secret = p256::SecretKey::from_slice(&crypto::new_vapid_private()).expect("scalar"); | |
| 344 | 340 | let point = secret.public_key().to_sec1_point(false); |
| 345 | 341 | ( |
| 346 | 342 | crypto::encode_b64(point.as_bytes()), |
crates/forge-web/src/pages/reactions_tests.rsmodified+4 -1
| @@ -295,7 +295,10 @@ async fn refused_reactions_are_rejected_and_change_nothing() { | ||
| 295 | 295 | ) |
| 296 | 296 | .await; |
| 297 | 297 | assert_eq!(wrong_comment.status, 404, "comment of another issue"); |
| 298 | - assert!(on_issue(&s).await.is_empty(), "wrong target: nothing changes"); | |
| 298 | + assert!( | |
| 299 | + on_issue(&s).await.is_empty(), | |
| 300 | + "wrong target: nothing changes" | |
| 301 | + ); | |
| 299 | 302 | |
| 300 | 303 | // Case: an unknown reaction and an unknown target kind are 400. |
| 301 | 304 | let bad_reaction = post( |
crates/forge-web/src/pages/refs.rsmodified+6 -2
| @@ -122,7 +122,7 @@ async fn refs_table(rows: Vec<RefRow>, kind_label: &str, lang: Lang) -> Result<i | ||
| 122 | 122 | </thead> |
| 123 | 123 | <tbody> |
| 124 | 124 | for row in rows.into_iter() { |
| 125 | - <tr> | |
| 125 | + <tr data-kb-row=""> | |
| 126 | 126 | <td class="tree-name"> |
| 127 | 127 | <span class="tree-label"> |
| 128 | 128 | <a href=(row.href)>(row.name)</a> |
| @@ -193,7 +193,11 @@ async fn tags_page(cx: &Cx) -> Result<impl View> { | ||
| 193 | 193 | Ok(view! { |
| 194 | 194 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 195 | 195 | repo_head(head: header) |
| 196 | - refs_table(rows: rows, kind_label: g::t(lang, K::TagKindLabel), lang: lang) | |
| 196 | + <div class="lang-list fit-pane"> | |
| 197 | + <div class="list-scroll"> | |
| 198 | + refs_table(rows: rows, kind_label: g::t(lang, K::TagKindLabel), lang: lang) | |
| 199 | + </div> | |
| 200 | + </div> | |
| 197 | 201 | ) |
| 198 | 202 | }) |
| 199 | 203 | } |
crates/forge-web/src/pages/register.rsmodified+4 -1
| @@ -564,7 +564,10 @@ mod tests { | ||
| 564 | 564 | let (status, _, html) = |
| 565 | 565 | send(&router, "GET", "/register?invite=forge_nope", None, None).await; |
| 566 | 566 | assert_eq!(status, 200, "bad invite: status"); |
| 567 | - assert!(html.contains("This invite is invalid"), "bad invite: notice"); | |
| 567 | + assert!( | |
| 568 | + html.contains("This invite is invalid"), | |
| 569 | + "bad invite: notice" | |
| 570 | + ); | |
| 568 | 571 | |
| 569 | 572 | // Case: a valid invite creates one verified account with the invited address. |
| 570 | 573 | let admin = state |
crates/forge-web/src/pages/releases.rsmodified+15 -17
| @@ -25,7 +25,9 @@ use topcoat::router::content::Form; | ||
| 25 | 25 | use topcoat::router::error::{SeeOther, forbidden, not_found, see_other}; |
| 26 | 26 | use topcoat::router::request::headers; |
| 27 | 27 | use topcoat::router::response::Response; |
| 28 | -use topcoat::router::{Body, HeaderName, HeaderValue, StatusCode, page, path_param, query_params, route}; | |
| 28 | +use topcoat::router::{ | |
| 29 | + Body, HeaderName, HeaderValue, StatusCode, page, path_param, query_params, route, | |
| 30 | +}; | |
| 29 | 31 | use topcoat::view::{Unescaped, View, component, view}; |
| 30 | 32 | |
| 31 | 33 | use crate::auth::require_csrf; |
| @@ -34,11 +36,11 @@ use crate::i18n::{ | ||
| 34 | 36 | self, Key, Lang, |
| 35 | 37 | releases_ci::{self as g, K}, |
| 36 | 38 | }; |
| 39 | +use crate::pages::issue_parts::When; | |
| 37 | 40 | use crate::pages::refs::load_refs; |
| 38 | 41 | use crate::pages::releases_live; |
| 39 | 42 | use crate::pages::repo::repo_head; |
| 40 | 43 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 41 | -use crate::pages::issue_parts::When; | |
| 42 | 44 | use crate::release_ops::{self, CreateRelease, EditRelease, ReleaseError}; |
| 43 | 45 | use crate::render::markdown::render_markdown; |
| 44 | 46 | use crate::state::AppState; |
| @@ -502,23 +504,19 @@ async fn list_body( | ||
| 502 | 504 | <section class="card notice" role="status">(text)</section> |
| 503 | 505 | } |
| 504 | 506 | } |
| 505 | - <section class="card fit-pane fit-card" data-live=(live.as_str())> | |
| 506 | - <div class="release-list-head"> | |
| 507 | + <section class="lang-list fit-pane" data-live=(live.as_str())> | |
| 508 | + <div class="release-list-head list-bar"> | |
| 507 | 509 | <h2>(g::t(lang, K::Releases))</h2> |
| 508 | 510 | if let Some(href) = &new_href { |
| 509 | - <a class="button" href=(href.as_str())>(g::t(lang, K::NewRelease))</a> | |
| 511 | + <a class="button primary" href=(href.as_str())>(g::t(lang, K::NewRelease))</a> | |
| 510 | 512 | } |
| 511 | 513 | </div> |
| 512 | 514 | if cards.is_empty() { |
| 513 | - empty_state(title: g::t(lang, K::NoReleasesYet), | |
| 514 | - if let Some(href) = &new_href { | |
| 515 | - <a class="button primary" href=(href.as_str())>(g::t(lang, K::NewRelease))</a> | |
| 516 | - } | |
| 517 | - ) | |
| 515 | + empty_state(title: g::t(lang, K::NoReleasesYet)) | |
| 518 | 516 | } |
| 519 | - <div class="fit-scroll"> | |
| 517 | + <div class="list-scroll"> | |
| 520 | 518 | for card in cards.iter() { |
| 521 | - <article class="release-card"> | |
| 519 | + <article class="release-card" data-kb-row=""> | |
| 522 | 520 | <h3> |
| 523 | 521 | <a href=(card.href.as_str())>(card.title.as_str())</a> |
| 524 | 522 | if card.latest { |
| @@ -637,7 +635,7 @@ async fn new_form_body( | ||
| 637 | 635 | ) -> Result<impl View> { |
| 638 | 636 | Ok(view! { |
| 639 | 637 | repo_head(head: head) |
| 640 | - <section class="card fit-pane"> | |
| 638 | + <section class="lang-form"> | |
| 641 | 639 | <h2>(g::t(lang, K::NewRelease))</h2> |
| 642 | 640 | release_form(action: action, csrf: csrf, lang: lang, is_new: true, move_target: true, draft: draft, branches: branches, submit: g::t(lang, K::SaveRelease)) |
| 643 | 641 | </section> |
| @@ -908,12 +906,13 @@ async fn edit_body( | ||
| 908 | 906 | <section class="card notice" role="status">(text)</section> |
| 909 | 907 | } |
| 910 | 908 | } |
| 911 | - <section class="card"> | |
| 909 | + <div class="lang-split"> | |
| 910 | + <section class="lang-pane fit-pane"> | |
| 912 | 911 | <p class="muted small"><a href=(view_tag.as_str())>(g::t(lang, K::BackToRelease))</a></p> |
| 913 | 912 | <h2>(g::t(lang, K::EditRelease))</h2> |
| 914 | 913 | release_form(action: action, csrf: csrf.clone(), lang: lang, is_new: false, move_target: move_target, draft: draft, branches: branches, submit: g::t(lang, K::SaveRelease)) |
| 915 | 914 | </section> |
| 916 | - <section class="card"> | |
| 915 | + <section class="lang-pane fit-pane"> | |
| 917 | 916 | <h2>(g::t(lang, K::Assets))</h2> |
| 918 | 917 | <p class="muted small">(upload_hint.as_str())</p> |
| 919 | 918 | asset_rows(assets: assets, delete_actions: delete_actions, upload_action: upload_action.clone(), csrf: csrf.clone(), lang: lang) |
| @@ -927,8 +926,6 @@ async fn edit_body( | ||
| 927 | 926 | <button type="submit">(g::t(lang, K::UploadAsset))</button> |
| 928 | 927 | </div> |
| 929 | 928 | </form> |
| 930 | - </section> | |
| 931 | - <section class="card"> | |
| 932 | 929 | <h2>(g::t(lang, K::DeleteRelease))</h2> |
| 933 | 930 | <p class="muted small">(g::t(lang, K::DeleteReleaseHelp))</p> |
| 934 | 931 | <div> |
| @@ -946,6 +943,7 @@ async fn edit_body( | ||
| 946 | 943 | </details> |
| 947 | 944 | </div> |
| 948 | 945 | </section> |
| 946 | + </div> | |
| 949 | 947 | }) |
| 950 | 948 | } |
| 951 | 949 |
crates/forge-web/src/pages/repo.rsmodified+21 -39
| @@ -20,24 +20,24 @@ use topcoat::view::{View, component, view}; | ||
| 20 | 20 | |
| 21 | 21 | use crate::i18n::code::{self as g, K}; |
| 22 | 22 | use crate::i18n::{self, Lang}; |
| 23 | -use crate::pages::passkeys::s; | |
| 24 | 23 | use crate::pages::code_live::{follows_branch, home_live_url}; |
| 25 | 24 | use crate::pages::finder::file_finder; |
| 26 | -use crate::pages::repo_side::{ | |
| 27 | - StripFacts, commit_strip, commit_subject, readme_meta, repo_dock, repo_strip, run_rows, | |
| 28 | - run_states, strip_bars, tree_facts, | |
| 29 | -}; | |
| 30 | 25 | use crate::pages::issue_parts::stamp_unix; |
| 31 | 26 | use crate::pages::notifications::watch_form; |
| 32 | 27 | use crate::pages::packages; |
| 28 | +use crate::pages::passkeys::s; | |
| 33 | 29 | use crate::pages::refs::{load_refs, ref_links}; |
| 34 | 30 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 31 | +use crate::pages::repo_side::{ | |
| 32 | + StripFacts, commit_strip, readme_meta, repo_dock, repo_strip, run_rows, run_states, strip_bars, | |
| 33 | + tree_facts, | |
| 34 | +}; | |
| 35 | 35 | use crate::pages::tree::{ |
| 36 | 36 | entry_rows, last_commits, latest_bar, load_readme, read_dir, readme_card, tree_table, |
| 37 | 37 | }; |
| 38 | 38 | use crate::state::AppState; |
| 39 | 39 | use crate::views::repo_list::badge_class; |
| 40 | -use crate::views::{now_unix, ref_selector, rel_time, relative_time, repo_href, repo_tabs, shell, user_link}; | |
| 40 | +use crate::views::{now_unix, ref_selector, rel_time, relative_time, repo_href, repo_tabs, shell}; | |
| 41 | 41 | |
| 42 | 42 | path_param!(owner); |
| 43 | 43 | path_param!(repo); |
| @@ -93,12 +93,8 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> { | ||
| 93 | 93 | wiki, |
| 94 | 94 | security, |
| 95 | 95 | lang, |
| 96 | - compact_tabs, | |
| 97 | 96 | .. |
| 98 | 97 | } = head; |
| 99 | - // The title gets its own copies: the view below moves `owner` and `name` into `repo_tabs`. | |
| 100 | - let title_owner = owner.clone(); | |
| 101 | - let title_name = name.clone(); | |
| 102 | 98 | let badge = badge_class(visibility); |
| 103 | 99 | let vis = i18n::visibility_label(lang, visibility); |
| 104 | 100 | let active = active.to_owned(); |
| @@ -154,22 +150,14 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> { | ||
| 154 | 150 | None => ("", "", None, String::new()), |
| 155 | 151 | }; |
| 156 | 152 | let live_attr = (!live.is_empty()).then(|| live.clone()); |
| 157 | - // The Code tab has no title row: the path bar names the repo, and the tabs share a row with | |
| 153 | + // Every repo page has one head row: the path bar names the repo, and the tabs share a row with | |
| 158 | 154 | // the visibility and the counts and actions at the right end. |
| 159 | - let code = active == "code"; | |
| 160 | - // One row for the tabs: the Code tab, or a page that asks for it (`compact_tabs`). | |
| 161 | - let tabs_head = code || compact_tabs; | |
| 162 | 155 | let has_origin = fork_line.is_some() || mirror_line.is_some(); |
| 163 | 156 | Ok(view! { |
| 164 | - <section class=(if tabs_head { "page-head repo-head-code" } else { "page-head" }) data-live=(live_attr.as_deref())> | |
| 165 | - if !tabs_head || has_origin { | |
| 157 | + <section class="page-head repo-head-code" data-live=(live_attr.as_deref())> | |
| 158 | + <h1 class="sr-only">(owner.as_str()) "/" (name.as_str())</h1> | |
| 159 | + if has_origin { | |
| 166 | 160 | <div> |
| 167 | - if !tabs_head { | |
| 168 | - <div class="repo-title-row"> | |
| 169 | - <h1 class="repo-title">user_link(shown: title_owner.as_str(), login: title_owner.as_str()) "/" (title_name.as_str())</h1> | |
| 170 | - <span class=(badge)>(vis)</span> | |
| 171 | - </div> | |
| 172 | - } | |
| 173 | 161 | if let Some((href, label)) = fork_line { |
| 174 | 162 | <p class="muted small">(g::t(lang, K::ForkedFrom)) <a href=(href.as_str())>(label.as_str())</a></p> |
| 175 | 163 | } |
| @@ -184,13 +172,9 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> { | ||
| 184 | 172 | } |
| 185 | 173 | </div> |
| 186 | 174 | } |
| 187 | - if tabs_head { | |
| 188 | - repo_tabs(owner: owner.clone(), repo: name.clone(), default_branch: default_branch.clone(), active: active.clone(), can_admin: can_admin, lang: lang, open_issues: Some(open_issues), open_pulls: Some(open_pulls), discussions: discussions, wiki: wiki, security: security) | |
| 189 | - } | |
| 175 | + repo_tabs(owner: owner.clone(), repo: name.clone(), default_branch: default_branch.clone(), active: active.clone(), can_admin: can_admin, lang: lang, open_issues: Some(open_issues), open_pulls: Some(open_pulls), discussions: discussions, wiki: wiki, security: security) | |
| 190 | 176 | <div class="header-actions"> |
| 191 | - if tabs_head { | |
| 192 | - <span class=(badge)>(vis)</span> | |
| 193 | - } | |
| 177 | + <span class=(badge)>(vis)</span> | |
| 194 | 178 | if let Some((action, csrf)) = fork_control { |
| 195 | 179 | <form method="post" action=(action.as_str()) class="fork-form"> |
| 196 | 180 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| @@ -221,12 +205,9 @@ pub async fn repo_head(head: RepoHead) -> Result<impl View> { | ||
| 221 | 205 | </section> |
| 222 | 206 | } |
| 223 | 207 | // The description belongs to the Code tab only; sub-pages keep the compact head. |
| 224 | - if code && !description.is_empty() { | |
| 208 | + if active == "code" && !description.is_empty() { | |
| 225 | 209 | <p class="lead">(description.as_str())</p> |
| 226 | 210 | } |
| 227 | - if !tabs_head { | |
| 228 | - repo_tabs(owner: owner.clone(), repo: name.clone(), default_branch: default_branch.clone(), active: active.clone(), can_admin: can_admin, lang: lang, open_issues: Some(open_issues), open_pulls: Some(open_pulls), discussions: discussions, wiki: wiki, security: security) | |
| 229 | - } | |
| 230 | 211 | }) |
| 231 | 212 | } |
| 232 | 213 | |
| @@ -507,7 +488,12 @@ async fn repo_page(cx: &Cx) -> Result<impl View> { | ||
| 507 | 488 | let now = now_unix(); |
| 508 | 489 | let downloads = ( |
| 509 | 490 | repo_href(&owner_name, &repo_name, "archive", &format!("{branch}.zip")), |
| 510 | - repo_href(&owner_name, &repo_name, "archive", &format!("{branch}.tar.gz")), | |
| 491 | + repo_href( | |
| 492 | + &owner_name, | |
| 493 | + &repo_name, | |
| 494 | + "archive", | |
| 495 | + &format!("{branch}.tar.gz"), | |
| 496 | + ), | |
| 511 | 497 | ); |
| 512 | 498 | // The dock: the history strip of the newest commits (cached per head) and the latest run's |
| 513 | 499 | // commit subject. Empty repos have no tree, so they have no dock. |
| @@ -518,10 +504,6 @@ async fn repo_page(cx: &Cx) -> Result<impl View> { | ||
| 518 | 504 | let ci_states = run_states(state, &repo.id).await?; |
| 519 | 505 | let bars = strip_bars(&strip.commits, &ci_states); |
| 520 | 506 | let total = strip.total; |
| 521 | - let subject = match runs.first() { | |
| 522 | - Some(run) => commit_subject(state, &ctx.path, &run.commit).await, | |
| 523 | - None => None, | |
| 524 | - }; | |
| 525 | 507 | let search_href = repo_href(&owner_name, &repo_name, "search", ""); |
| 526 | 508 | let show_search = !header.hide_search; |
| 527 | 509 | let has_chips = latest.is_some() || !packages.is_empty(); |
| @@ -543,7 +525,7 @@ async fn repo_page(cx: &Cx) -> Result<impl View> { | ||
| 543 | 525 | file_finder(lang: lang, owner: owner_name.clone(), repo: repo_name.clone(), |
| 544 | 526 | ref_name: branch.clone()) |
| 545 | 527 | if show_search { |
| 546 | - <a class="small repo-search-link" href=(search_href.as_str())>(g::t(lang, K::SearchCodePlaceholder))</a> | |
| 528 | + <a class="small repo-search-link" href=(search_href.as_str()) data-palette-action="go">(g::t(lang, K::SearchCodePlaceholder))</a> | |
| 547 | 529 | } |
| 548 | 530 | clone_popover(https: https, ssh: ssh, downloads: Some(downloads), lang: lang) |
| 549 | 531 | </div> |
| @@ -559,7 +541,7 @@ async fn repo_page(cx: &Cx) -> Result<impl View> { | ||
| 559 | 541 | } |
| 560 | 542 | </div> |
| 561 | 543 | </div> |
| 562 | - repo_dock(lang: lang, runs: runs, subject: subject, total: total, ci_href: ci_href, | |
| 544 | + repo_dock(lang: lang, runs: runs, total: total, ci_href: ci_href, | |
| 563 | 545 | owner: owner_name.clone(), repo: repo_name.clone(), bars: bars) |
| 564 | 546 | } else { |
| 565 | 547 | <div class="browse-bar"> |
crates/forge-web/src/pages/repo_collaborators.rsmodified+3 -2
| @@ -28,7 +28,7 @@ use crate::i18n::{self, Lang}; | ||
| 28 | 28 | use crate::pages::passkeys; |
| 29 | 29 | use crate::pages::repo::repo_head; |
| 30 | 30 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 31 | -use crate::pages::repo_settings::settings_nav_for; | |
| 31 | +use crate::pages::repo_settings::settings_frame; | |
| 32 | 32 | use crate::pages::repo_settings_live::settings_head; |
| 33 | 33 | use crate::state::AppState; |
| 34 | 34 | use crate::views::{alert, avatar_url, display_name, empty_state, shell}; |
| @@ -306,7 +306,7 @@ async fn collaborators_body( | ||
| 306 | 306 | let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error)); |
| 307 | 307 | Ok(view! { |
| 308 | 308 | repo_head(head: header) |
| 309 | - settings_nav_for(lang: lang, title: nav_title, current: "collaborators") | |
| 309 | + settings_frame(lang: lang, title: nav_title, current: "collaborators", | |
| 310 | 310 | if let Some((text, is_error)) = notice { |
| 311 | 311 | if is_error { |
| 312 | 312 | alert(message: text) |
| @@ -326,6 +326,7 @@ async fn collaborators_body( | ||
| 326 | 326 | </section> |
| 327 | 327 | role_legend(lang: lang) |
| 328 | 328 | </div> |
| 329 | + ) | |
| 329 | 330 | }) |
| 330 | 331 | } |
| 331 | 332 |
crates/forge-web/src/pages/repo_ctx.rsmodified+0 -4
| @@ -60,9 +60,6 @@ pub struct RepoHead { | ||
| 60 | 60 | pub active: &'static str, |
| 61 | 61 | /// Hide the header's code-search box (the code search page draws its own). |
| 62 | 62 | pub hide_search: bool, |
| 63 | - /// One row for the header: no title row, the tabs at the left and the counts and actions at the | |
| 64 | - /// right, as on the Code tab. Set by the pages that have their own top (the CI run page). | |
| 65 | - pub compact_tabs: bool, | |
| 66 | 63 | /// Whether the viewer may open the Settings tab. |
| 67 | 64 | pub can_admin: bool, |
| 68 | 65 | /// Open issues, for the Issues tab count. |
| @@ -239,7 +236,6 @@ impl RepoCtx { | ||
| 239 | 236 | last_ok: mirror.last_ok, |
| 240 | 237 | }); |
| 241 | 238 | Ok(RepoHead { |
| 242 | - compact_tabs: false, | |
| 243 | 239 | lang: self.lang, |
| 244 | 240 | owner: self.repo.owner_name.clone(), |
| 245 | 241 | name: self.repo.name.clone(), |
crates/forge-web/src/pages/repo_mirrors.rsmodified+19 -16
| @@ -21,7 +21,7 @@ use topcoat::router::content::Form; | ||
| 21 | 21 | use topcoat::router::error::{SeeOther, forbidden, not_found, see_other}; |
| 22 | 22 | use topcoat::router::request::uri; |
| 23 | 23 | use topcoat::router::{page, path_param, route}; |
| 24 | -use topcoat::view::{View, component, view}; | |
| 24 | +use topcoat::view::{Child, View, component, view}; | |
| 25 | 25 | |
| 26 | 26 | use crate::audit::{self, Actor, Target}; |
| 27 | 27 | use crate::auth::{require_csrf, require_user}; |
| @@ -33,10 +33,12 @@ use crate::i18n::{ | ||
| 33 | 33 | use crate::pages::refs::load_refs; |
| 34 | 34 | use crate::pages::repo::repo_head; |
| 35 | 35 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 36 | -use crate::pages::repo_settings::settings_nav_for; | |
| 36 | +use crate::pages::repo_settings::settings_frame; | |
| 37 | 37 | use crate::pages::repo_settings_live::settings_head; |
| 38 | 38 | use crate::state::AppState; |
| 39 | -use crate::views::{alert, empty_state, enc, now_unix, rel_time_or_never, relative_time, shell, user_facing_message}; | |
| 39 | +use crate::views::{ | |
| 40 | + alert, empty_state, enc, now_unix, rel_time_or_never, relative_time, shell, user_facing_message, | |
| 41 | +}; | |
| 40 | 42 | use crate::webhooks::client::{WebhookPolicy, validate_url}; |
| 41 | 43 | |
| 42 | 44 | path_param!(owner); |
| @@ -392,10 +394,11 @@ async fn frame_top( | ||
| 392 | 394 | notice: Option<(&'static str, bool)>, |
| 393 | 395 | archived: bool, |
| 394 | 396 | lang: Lang, |
| 397 | + #[default] child: Child<'_>, | |
| 395 | 398 | ) -> Result<impl View> { |
| 396 | 399 | Ok(view! { |
| 397 | 400 | repo_head(head: head) |
| 398 | - settings_nav_for(lang: lang, title: title, current: "mirrors") | |
| 401 | + settings_frame(lang: lang, title: title, current: "mirrors", | |
| 399 | 402 | if let Some((text, is_error)) = notice { |
| 400 | 403 | if is_error { |
| 401 | 404 | alert(message: text) |
| @@ -406,6 +409,8 @@ async fn frame_top( | ||
| 406 | 409 | if archived { |
| 407 | 410 | <section class="card notice" role="status">(g::t(lang, K::ArchivedNotice))</section> |
| 408 | 411 | } |
| 412 | + (child) | |
| 413 | + ) | |
| 409 | 414 | }) |
| 410 | 415 | } |
| 411 | 416 | |
| @@ -506,7 +511,7 @@ async fn mirrors_list_body( | ||
| 506 | 511 | let add_action = mirrors_href(&title); |
| 507 | 512 | let can_pull = pull_form.is_some(); |
| 508 | 513 | Ok(view! { |
| 509 | - frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang) | |
| 514 | + frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, | |
| 510 | 515 | <div class="fit-pane settings-split"> |
| 511 | 516 | <section class="card"> |
| 512 | 517 | <h2>(g::t(lang, K::Mirrors))</h2> |
| @@ -577,6 +582,7 @@ async fn mirrors_list_body( | ||
| 577 | 582 | </section> |
| 578 | 583 | } |
| 579 | 584 | </div> |
| 585 | + ) | |
| 580 | 586 | }) |
| 581 | 587 | } |
| 582 | 588 | |
| @@ -797,7 +803,7 @@ async fn mirror_body( | ||
| 797 | 803 | }; |
| 798 | 804 | let current_url = redacted_url(&mirror.url); |
| 799 | 805 | Ok(view! { |
| 800 | - frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang) | |
| 806 | + frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, | |
| 801 | 807 | <section class="card"> |
| 802 | 808 | <h2>(mirror_kind(lang, mirror.direction))</h2> |
| 803 | 809 | if archived { |
| @@ -841,6 +847,7 @@ async fn mirror_body( | ||
| 841 | 847 | </div> |
| 842 | 848 | </section> |
| 843 | 849 | } |
| 850 | + ) | |
| 844 | 851 | }) |
| 845 | 852 | } |
| 846 | 853 | |
| @@ -1257,16 +1264,13 @@ mod tests { | ||
| 1257 | 1264 | .set_ui_prefs(&tahinli.id, "auto", "tr") |
| 1258 | 1265 | .await |
| 1259 | 1266 | .expect("set language"); |
| 1260 | - let (status, _, body) = send( | |
| 1261 | - &app, | |
| 1262 | - "GET", | |
| 1263 | - "/tahinli/proj/settings/mirrors", | |
| 1264 | - &cookie, | |
| 1265 | - &[], | |
| 1266 | - ) | |
| 1267 | - .await; | |
| 1267 | + let (status, _, body) = | |
| 1268 | + send(&app, "GET", "/tahinli/proj/settings/mirrors", &cookie, &[]).await; | |
| 1268 | 1269 | assert_eq!(status, 200, "{body}"); |
| 1269 | - assert!(body.contains("<h2>Yansılar</h2>"), "Turkish heading missing"); | |
| 1270 | + assert!( | |
| 1271 | + body.contains("<h2>Yansılar</h2>"), | |
| 1272 | + "Turkish heading missing" | |
| 1273 | + ); | |
| 1270 | 1274 | } |
| 1271 | 1275 | |
| 1272 | 1276 | /// The push form refuses a loopback destination and stores nothing, then adds a good mirror |
| @@ -1495,5 +1499,4 @@ mod tests { | ||
| 1495 | 1499 | assert!(store.pull_mirror(&repo.id).await.expect("query").is_none()); |
| 1496 | 1500 | assert!(store.list_mirrors(&repo.id).await.expect("list").is_empty()); |
| 1497 | 1501 | } |
| 1498 | - | |
| 1499 | 1502 | } |
crates/forge-web/src/pages/repo_rename.rsmodified+3 -2
| @@ -22,7 +22,7 @@ use crate::i18n::repo_admin::{self as g, K}; | ||
| 22 | 22 | use crate::i18n::{self, Lang}; |
| 23 | 23 | use crate::pages::repo::repo_head; |
| 24 | 24 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 25 | -use crate::pages::repo_settings::settings_nav_for; | |
| 25 | +use crate::pages::repo_settings::settings_frame; | |
| 26 | 26 | use crate::pages::repo_settings_live::settings_head; |
| 27 | 27 | use crate::state::AppState; |
| 28 | 28 | use crate::views::{alert, shell}; |
| @@ -120,7 +120,7 @@ async fn rename_body( | ||
| 120 | 120 | } = forms; |
| 121 | 121 | Ok(view! { |
| 122 | 122 | repo_head(head: head) |
| 123 | - settings_nav_for(lang: lang, title: nav_title, current: "rename") | |
| 123 | + settings_frame(lang: lang, title: nav_title, current: "rename", | |
| 124 | 124 | if let Some(key) = notice { |
| 125 | 125 | <section class="card notice" role="status">(g::t(lang, key))</section> |
| 126 | 126 | } |
| @@ -164,6 +164,7 @@ async fn rename_body( | ||
| 164 | 164 | </form> |
| 165 | 165 | </section> |
| 166 | 166 | } |
| 167 | + ) | |
| 167 | 168 | }) |
| 168 | 169 | } |
| 169 | 170 |
crates/forge-web/src/pages/repo_secrets.rsmodified+8 -4
| @@ -12,7 +12,7 @@ use topcoat::router::content::Form; | ||
| 12 | 12 | use topcoat::router::error::{SeeOther, forbidden, not_found, see_other}; |
| 13 | 13 | use topcoat::router::request::uri; |
| 14 | 14 | use topcoat::router::{page, path_param, route}; |
| 15 | -use topcoat::view::{View, component, view}; | |
| 15 | +use topcoat::view::{Child, View, component, view}; | |
| 16 | 16 | |
| 17 | 17 | use crate::audit::{self, Actor, Target}; |
| 18 | 18 | use crate::auth::{require_csrf, require_user}; |
| @@ -20,7 +20,7 @@ use crate::i18n::repo_admin::{self as g, K}; | ||
| 20 | 20 | use crate::i18n::{self, Lang}; |
| 21 | 21 | use crate::pages::repo::repo_head; |
| 22 | 22 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 23 | -use crate::pages::repo_settings::settings_nav_for; | |
| 23 | +use crate::pages::repo_settings::settings_frame; | |
| 24 | 24 | use crate::pages::repo_settings_live::settings_head; |
| 25 | 25 | use crate::state::AppState; |
| 26 | 26 | use crate::views::{alert, empty_state, enc, rel_time, shell}; |
| @@ -155,11 +155,12 @@ async fn frame_top( | ||
| 155 | 155 | title: String, |
| 156 | 156 | notice: Option<(K, bool)>, |
| 157 | 157 | archived: bool, |
| 158 | + #[default] child: Child<'_>, | |
| 158 | 159 | ) -> Result<impl View> { |
| 159 | 160 | let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error)); |
| 160 | 161 | Ok(view! { |
| 161 | 162 | repo_head(head: head) |
| 162 | - settings_nav_for(lang: lang, title: title, current: "secrets") | |
| 163 | + settings_frame(lang: lang, title: title, current: "secrets", | |
| 163 | 164 | if let Some((text, is_error)) = notice { |
| 164 | 165 | if is_error { |
| 165 | 166 | alert(message: text) |
| @@ -170,6 +171,8 @@ async fn frame_top( | ||
| 170 | 171 | if archived { |
| 171 | 172 | <section class="card notice" role="status">(g::t(lang, K::ArchivedSecrets))</section> |
| 172 | 173 | } |
| 174 | + (child) | |
| 175 | + ) | |
| 173 | 176 | }) |
| 174 | 177 | } |
| 175 | 178 | |
| @@ -190,7 +193,7 @@ async fn secrets_body( | ||
| 190 | 193 | let set_action = secrets_href(&title); |
| 191 | 194 | let delete_action = format!("{set_action}/delete"); |
| 192 | 195 | Ok(view! { |
| 193 | - frame_top(lang: lang, head: head, title: title.clone(), notice: notice, archived: archived) | |
| 196 | + frame_top(lang: lang, head: head, title: title.clone(), notice: notice, archived: archived, | |
| 194 | 197 | <div class="fit-pane settings-split"> |
| 195 | 198 | <section class="card"> |
| 196 | 199 | <h2>(g::t(lang, K::Secrets))</h2> |
| @@ -257,6 +260,7 @@ async fn secrets_body( | ||
| 257 | 260 | </section> |
| 258 | 261 | } |
| 259 | 262 | </div> |
| 263 | + ) | |
| 260 | 264 | }) |
| 261 | 265 | } |
| 262 | 266 |
crates/forge-web/src/pages/repo_security.rsmodified+13 -11
| @@ -121,16 +121,17 @@ async fn security_body( | ||
| 121 | 121 | let open_count = rows.iter().filter(|r| r.open).count(); |
| 122 | 122 | Ok(view! { |
| 123 | 123 | repo_head(head: head) |
| 124 | - <section class="card"> | |
| 125 | - <h2>(i18n::t(lang, Key::Security))</h2> | |
| 126 | - if !enabled { | |
| 127 | - <p class="muted small">(g::t(lang, K::SecurityOff))</p> | |
| 128 | - } else { | |
| 129 | - <p class="muted small">(g::dependencies_summary(lang, dependencies, open_count))</p> | |
| 130 | - <p class="muted small">(g::t(lang, K::LockfilesRead))</p> | |
| 131 | - } | |
| 132 | - </section> | |
| 133 | - <section class="card"> | |
| 124 | + <section class="card lang-list fit-pane"> | |
| 125 | + <div class="list-bar"> | |
| 126 | + <h2>(i18n::t(lang, Key::Security))</h2> | |
| 127 | + if !enabled { | |
| 128 | + <p class="muted small">(g::t(lang, K::SecurityOff))</p> | |
| 129 | + } else { | |
| 130 | + <p class="muted small">(g::dependencies_summary(lang, dependencies, open_count))</p> | |
| 131 | + <p class="muted small">(g::t(lang, K::LockfilesRead))</p> | |
| 132 | + } | |
| 133 | + </div> | |
| 134 | + <div class="list-scroll"> | |
| 134 | 135 | if rows.is_empty() { |
| 135 | 136 | empty_state(title: g::t(lang, K::NoAlerts)) |
| 136 | 137 | } else { |
| @@ -150,7 +151,7 @@ async fn security_body( | ||
| 150 | 151 | </thead> |
| 151 | 152 | <tbody> |
| 152 | 153 | for row in rows.iter() { |
| 153 | - <tr> | |
| 154 | + <tr data-kb-row=""> | |
| 154 | 155 | <td><a href=(row.osv_href.as_str()) rel="noopener noreferrer"><code>(row.advisory.as_str())</code></a></td> |
| 155 | 156 | <td><code>(row.package.as_str())</code></td> |
| 156 | 157 | <td><code>(row.version.as_str())</code></td> |
| @@ -186,6 +187,7 @@ async fn security_body( | ||
| 186 | 187 | </table> |
| 187 | 188 | </div> |
| 188 | 189 | } |
| 190 | + </div> | |
| 189 | 191 | </section> |
| 190 | 192 | }) |
| 191 | 193 | } |
crates/forge-web/src/pages/repo_settings.rsmodified+40 -21
| @@ -26,7 +26,7 @@ use topcoat::cookie::{Cookie, Cookies, SameSite, cookies}; | ||
| 26 | 26 | use topcoat::router::content::Form; |
| 27 | 27 | use topcoat::router::error::{SeeOther, forbidden, see_other}; |
| 28 | 28 | use topcoat::router::{page, path_param, route}; |
| 29 | -use topcoat::view::{View, component, view}; | |
| 29 | +use topcoat::view::{Child, View, component, view}; | |
| 30 | 30 | |
| 31 | 31 | use crate::audit::{self, Actor, Target}; |
| 32 | 32 | use crate::auth::{require_csrf, require_user}; |
| @@ -268,13 +268,15 @@ async fn danger_zone( | ||
| 268 | 268 | }) |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | -/// Sub-navigation for the settings pages. `current` names the page shown (`general` or `webhooks`) | |
| 272 | -/// and gets `aria-current`. | |
| 271 | +/// The settings frame: the sections in a left pane and the page's own content (its children) in a | |
| 272 | +/// right pane. Both fill the window below the repo head (see `.settings-layout` in `_lang_browse.scss`). | |
| 273 | +/// `current` names the section shown (`general`, `webhooks`, ...) and gets `aria-current`. | |
| 273 | 274 | #[component] |
| 274 | -pub async fn settings_nav_for( | |
| 275 | +pub async fn settings_frame( | |
| 275 | 276 | lang: Lang, |
| 276 | 277 | title: String, |
| 277 | 278 | current: &'static str, |
| 279 | + #[default] child: Child<'_>, | |
| 278 | 280 | ) -> Result<impl View> { |
| 279 | 281 | let general = format!("/{title}/settings"); |
| 280 | 282 | let collaborators = format!("/{title}/settings/collaborators"); |
| @@ -288,7 +290,10 @@ pub async fn settings_nav_for( | ||
| 288 | 290 | let hooks_on = current == "webhooks"; |
| 289 | 291 | let mirrors_on = current == "mirrors"; |
| 290 | 292 | let secrets_on = current == "secrets"; |
| 293 | + let wiki = format!("/{title}/settings/wiki"); | |
| 294 | + let wiki_on = current == "wiki"; | |
| 291 | 295 | Ok(view! { |
| 296 | + <div class="settings-layout"> | |
| 292 | 297 | <nav class="settings-nav" aria-label=(g::t(lang, K::SettingsNavLabel))> |
| 293 | 298 | if general_on { |
| 294 | 299 | <a href=(general) aria-current="page">(g::t(lang, K::General))</a> |
| @@ -320,7 +325,16 @@ pub async fn settings_nav_for( | ||
| 320 | 325 | } else { |
| 321 | 326 | <a href=(secrets)>(g::t(lang, K::Secrets))</a> |
| 322 | 327 | } |
| 328 | + if wiki_on { | |
| 329 | + <a href=(wiki) aria-current="page">(crate::i18n::code::t(lang, crate::i18n::code::K::TabWiki))</a> | |
| 330 | + } else { | |
| 331 | + <a href=(wiki)>(crate::i18n::code::t(lang, crate::i18n::code::K::TabWiki))</a> | |
| 332 | + } | |
| 323 | 333 | </nav> |
| 334 | + <div class="settings-main"> | |
| 335 | + (child) | |
| 336 | + </div> | |
| 337 | + </div> | |
| 324 | 338 | }) |
| 325 | 339 | } |
| 326 | 340 | |
| @@ -341,21 +355,22 @@ async fn general_section( | ||
| 341 | 355 | let visibility_action = format!("/{title}/settings/visibility"); |
| 342 | 356 | let archive_action = format!("/{title}/settings/archive"); |
| 343 | 357 | // The visibility row shows where the repo is now and offers the other side behind a confirm. |
| 344 | - let (current_visibility, flip_label, flip_confirm, flip_to) = if visibility == Visibility::Public { | |
| 345 | - ( | |
| 346 | - g::t(lang, K::PublicOption), | |
| 347 | - g::t(lang, K::MakePrivate), | |
| 348 | - g::t(lang, K::MakePrivateConfirm), | |
| 349 | - "private", | |
| 350 | - ) | |
| 351 | - } else { | |
| 352 | - ( | |
| 353 | - g::t(lang, K::PrivateOption), | |
| 354 | - g::t(lang, K::MakePublic), | |
| 355 | - g::t(lang, K::MakePublicConfirm), | |
| 356 | - "public", | |
| 357 | - ) | |
| 358 | - }; | |
| 358 | + let (current_visibility, flip_label, flip_confirm, flip_to) = | |
| 359 | + if visibility == Visibility::Public { | |
| 360 | + ( | |
| 361 | + g::t(lang, K::PublicOption), | |
| 362 | + g::t(lang, K::MakePrivate), | |
| 363 | + g::t(lang, K::MakePrivateConfirm), | |
| 364 | + "private", | |
| 365 | + ) | |
| 366 | + } else { | |
| 367 | + ( | |
| 368 | + g::t(lang, K::PrivateOption), | |
| 369 | + g::t(lang, K::MakePublic), | |
| 370 | + g::t(lang, K::MakePublicConfirm), | |
| 371 | + "public", | |
| 372 | + ) | |
| 373 | + }; | |
| 359 | 374 | let options: Vec<(String, bool)> = branches |
| 360 | 375 | .into_iter() |
| 361 | 376 | .map(|b| { |
| @@ -496,7 +511,10 @@ fn rule_pills(lang: Lang, rule: &BranchRule) -> Vec<RulePill> { | ||
| 496 | 511 | pills.push(pill(g::t(lang, K::DeletionAllowed), warn)); |
| 497 | 512 | } |
| 498 | 513 | if rule.required_approvals > 0 { |
| 499 | - pills.push(pill(&g::approvals_count(lang, rule.required_approvals), plain)); | |
| 514 | + pills.push(pill( | |
| 515 | + &g::approvals_count(lang, rule.required_approvals), | |
| 516 | + plain, | |
| 517 | + )); | |
| 500 | 518 | } |
| 501 | 519 | if rule.restrict_push { |
| 502 | 520 | pills.push(pill(g::t(lang, K::RulePrOnly), plain)); |
| @@ -839,7 +857,7 @@ async fn settings_body( | ||
| 839 | 857 | // danger zone. The pane holds them to one screen (see _fit_settings.scss). |
| 840 | 858 | Ok(view! { |
| 841 | 859 | repo_head(head: head) |
| 842 | - settings_nav_for(lang: lang, title: title.clone(), current: "general") | |
| 860 | + settings_frame(lang: lang, title: title.clone(), current: "general", | |
| 843 | 861 | if let Some((text, is_error)) = notice { |
| 844 | 862 | if is_error { |
| 845 | 863 | alert(message: text) |
| @@ -869,6 +887,7 @@ async fn settings_body( | ||
| 869 | 887 | } |
| 870 | 888 | </div> |
| 871 | 889 | </div> |
| 890 | + ) | |
| 872 | 891 | }) |
| 873 | 892 | } |
| 874 | 893 |
crates/forge-web/src/pages/repo_side.rsmodified+20 -20
| @@ -7,8 +7,8 @@ use std::collections::HashMap; | ||
| 7 | 7 | use std::path::{Path, PathBuf}; |
| 8 | 8 | use std::sync::{Mutex, OnceLock}; |
| 9 | 9 | |
| 10 | -use forge_core::ci::{JobState, RunState}; | |
| 11 | 10 | use forge_core::Repo; |
| 11 | +use forge_core::ci::{JobState, RunState}; | |
| 12 | 12 | use forge_git::churn::{self, CommitChurn}; |
| 13 | 13 | use forge_git::{browse, history}; |
| 14 | 14 | use time::OffsetDateTime; |
| @@ -26,7 +26,6 @@ use crate::pages::passkeys::s; | ||
| 26 | 26 | use crate::pages::releases::LatestRelease; |
| 27 | 27 | use crate::repo_stats::{LangShare, languages, license_file, license_id}; |
| 28 | 28 | use crate::state::AppState; |
| 29 | -use crate::views::commit_line::commit_line; | |
| 30 | 29 | use crate::views::timeline::{StripBar, history_strip}; |
| 31 | 30 | use crate::views::{human_size, now_unix, rel_time, short_oid}; |
| 32 | 31 | |
| @@ -185,16 +184,6 @@ pub fn strip_bars(commits: &[CommitChurn], ci: &HashMap<String, RunState>) -> Ve | ||
| 185 | 184 | .collect() |
| 186 | 185 | } |
| 187 | 186 | |
| 188 | -/// The subject of a commit, for the CI line. None when it cannot be read. | |
| 189 | -pub async fn commit_subject(state: &AppState, path: &Path, oid: &str) -> Option<String> { | |
| 190 | - history::log(&state.git, path, oid, None, 0, 1) | |
| 191 | - .await | |
| 192 | - .ok()? | |
| 193 | - .into_iter() | |
| 194 | - .next() | |
| 195 | - .map(|commit| commit.summary) | |
| 196 | -} | |
| 197 | - | |
| 198 | 187 | /// One CI run as the column shows it: a link to the run, its dot, and one line of words. A run |
| 199 | 188 | /// still going has a clock that ticks. |
| 200 | 189 | pub struct RunRow { |
| @@ -249,7 +238,10 @@ pub async fn run_rows(state: &AppState, lang: Lang, repo: &Repo) -> Result<Vec<R | ||
| 249 | 238 | ) |
| 250 | 239 | }) |
| 251 | 240 | .count(); |
| 252 | - let started = jobs.iter().filter_map(|job| job.started_at.as_deref()).min(); | |
| 241 | + let started = jobs | |
| 242 | + .iter() | |
| 243 | + .filter_map(|job| job.started_at.as_deref()) | |
| 244 | + .min(); | |
| 253 | 245 | let branch = run |
| 254 | 246 | .git_ref |
| 255 | 247 | .strip_prefix("refs/heads/") |
| @@ -385,7 +377,11 @@ fn lang_slices(langs: &[LangShare]) -> Vec<LangSlice> { | ||
| 385 | 377 | let slice = LangSlice { |
| 386 | 378 | x: format!("{at}%"), |
| 387 | 379 | width: format!("{}%", share.percent), |
| 388 | - class: if share.others.is_empty() { SHADES[i.min(3)] } else { SHADES[4] }, | |
| 380 | + class: if share.others.is_empty() { | |
| 381 | + SHADES[i.min(3)] | |
| 382 | + } else { | |
| 383 | + SHADES[4] | |
| 384 | + }, | |
| 389 | 385 | }; |
| 390 | 386 | at += share.percent; |
| 391 | 387 | slice |
| @@ -464,7 +460,11 @@ pub async fn readme_meta(lang: Lang, facts: Option<TreeFacts>) -> Result<impl Vi | ||
| 464 | 460 | let facts = facts.unwrap_or_default(); |
| 465 | 461 | let mut parts: Vec<String> = Vec::new(); |
| 466 | 462 | if let Some((file, id)) = facts.license.as_ref() { |
| 467 | - parts.push(if id.is_empty() { file.clone() } else { id.clone() }); | |
| 463 | + parts.push(if id.is_empty() { | |
| 464 | + file.clone() | |
| 465 | + } else { | |
| 466 | + id.clone() | |
| 467 | + }); | |
| 468 | 468 | } |
| 469 | 469 | if facts.size > 0 { |
| 470 | 470 | parts.push(human_size(lang, facts.size)); |
| @@ -497,7 +497,6 @@ pub async fn readme_meta(lang: Lang, facts: Option<TreeFacts>) -> Result<impl Vi | ||
| 497 | 497 | pub async fn repo_dock( |
| 498 | 498 | lang: Lang, |
| 499 | 499 | runs: Vec<RunRow>, |
| 500 | - subject: Option<String>, | |
| 501 | 500 | total: u64, |
| 502 | 501 | ci_href: String, |
| 503 | 502 | owner: String, |
| @@ -520,9 +519,6 @@ pub async fn repo_dock( | ||
| 520 | 519 | </a> |
| 521 | 520 | <span class="dock-state">(state_text(lang, run.state.as_str()))</span> |
| 522 | 521 | <span class="sha">(short_oid(&run.commit))</span> |
| 523 | - if let Some(subject) = subject.as_ref() { | |
| 524 | - <span class="dock-subject">commit_line(subject: subject.clone())</span> | |
| 525 | - } | |
| 526 | 522 | if let Some(since) = run.since.as_deref() { |
| 527 | 523 | if let Some(est) = run.est.as_ref() { |
| 528 | 524 | <span class="dock-clock muted" data-since=(since) data-pre=(run.pre.as_deref()) data-expected=(est.expected.as_str()) data-left=(est.left.as_str()) data-over=(est.over.as_str()) data-lm=(est.minutes.as_str())>(run.label.as_str())</span> |
| @@ -553,7 +549,11 @@ fn release_counts(lang: Lang, release: &LatestRelease) -> String { | ||
| 553 | 549 | Lang::En => format!( |
| 554 | 550 | " \u{b7} {assets} {} \u{b7} {downloads} {}", |
| 555 | 551 | if assets == 1 { "asset" } else { "assets" }, |
| 556 | - if downloads == 1 { "download" } else { "downloads" } | |
| 552 | + if downloads == 1 { | |
| 553 | + "download" | |
| 554 | + } else { | |
| 555 | + "downloads" | |
| 556 | + } | |
| 557 | 557 | ), |
| 558 | 558 | } |
| 559 | 559 | } |
crates/forge-web/src/pages/repo_webhooks.rsmodified+12 -6
| @@ -18,7 +18,7 @@ use topcoat::router::content::Form; | ||
| 18 | 18 | use topcoat::router::error::{SeeOther, forbidden, not_found, see_other}; |
| 19 | 19 | use topcoat::router::request::uri; |
| 20 | 20 | use topcoat::router::{page, path_param, route}; |
| 21 | -use topcoat::view::{View, component, view}; | |
| 21 | +use topcoat::view::{Child, View, component, view}; | |
| 22 | 22 | |
| 23 | 23 | use crate::audit::{self, Actor, Target}; |
| 24 | 24 | use crate::auth::{require_csrf, require_user}; |
| @@ -28,7 +28,7 @@ use crate::i18n::{ | ||
| 28 | 28 | }; |
| 29 | 29 | use crate::pages::repo::repo_head; |
| 30 | 30 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 31 | -use crate::pages::repo_settings::settings_nav_for; | |
| 31 | +use crate::pages::repo_settings::settings_frame; | |
| 32 | 32 | use crate::pages::repo_settings_live::settings_head; |
| 33 | 33 | use crate::state::AppState; |
| 34 | 34 | use crate::views::{alert, empty_state, enc, now_unix, relative_time, shell}; |
| @@ -493,10 +493,11 @@ async fn frame_top( | ||
| 493 | 493 | notice: Option<(&'static str, bool)>, |
| 494 | 494 | archived: bool, |
| 495 | 495 | lang: Lang, |
| 496 | + #[default] child: Child<'_>, | |
| 496 | 497 | ) -> Result<impl View> { |
| 497 | 498 | Ok(view! { |
| 498 | 499 | repo_head(head: head) |
| 499 | - settings_nav_for(lang: lang, title: title, current: "webhooks") | |
| 500 | + settings_frame(lang: lang, title: title, current: "webhooks", | |
| 500 | 501 | if let Some((text, is_error)) = notice { |
| 501 | 502 | if is_error { |
| 502 | 503 | alert(message: text) |
| @@ -507,6 +508,8 @@ async fn frame_top( | ||
| 507 | 508 | if archived { |
| 508 | 509 | <section class="card notice" role="status">(g::t(lang, K::HookArchivedNotice))</section> |
| 509 | 510 | } |
| 511 | + (child) | |
| 512 | + ) | |
| 510 | 513 | }) |
| 511 | 514 | } |
| 512 | 515 | |
| @@ -570,7 +573,7 @@ async fn hooks_list_body( | ||
| 570 | 573 | ) -> Result<impl View> { |
| 571 | 574 | let new_href = format!("{}/new", hooks_href(&title)); |
| 572 | 575 | Ok(view! { |
| 573 | - frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang) | |
| 576 | + frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, | |
| 574 | 577 | <section class="card"> |
| 575 | 578 | <h2>(g::t(lang, K::Webhooks))</h2> |
| 576 | 579 | <p class="muted small">(g::t(lang, K::WebhooksIntro))</p> |
| @@ -613,6 +616,7 @@ async fn hooks_list_body( | ||
| 613 | 616 | </ul> |
| 614 | 617 | } |
| 615 | 618 | </section> |
| 619 | + ) | |
| 616 | 620 | }) |
| 617 | 621 | } |
| 618 | 622 | |
| @@ -685,7 +689,7 @@ async fn hook_body( | ||
| 685 | 689 | let delete_action = format!("{edit_action}/delete"); |
| 686 | 690 | let events = event_boxes(lang, &draft.events); |
| 687 | 691 | Ok(view! { |
| 688 | - frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang) | |
| 692 | + frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, | |
| 689 | 693 | <section class="card"> |
| 690 | 694 | <h2>(g::t(lang, K::EditWebhook))</h2> |
| 691 | 695 | if archived { |
| @@ -732,6 +736,7 @@ async fn hook_body( | ||
| 732 | 736 | </div> |
| 733 | 737 | </section> |
| 734 | 738 | } |
| 739 | + ) | |
| 735 | 740 | }) |
| 736 | 741 | } |
| 737 | 742 | |
| @@ -811,7 +816,7 @@ async fn hook_new_body( | ||
| 811 | 816 | let events = event_boxes(lang, &draft.events); |
| 812 | 817 | let back = hooks_href(&title); |
| 813 | 818 | Ok(view! { |
| 814 | - frame_top(head: head, title: title.clone(), notice: None, archived: archived, lang: lang) | |
| 819 | + frame_top(head: head, title: title.clone(), notice: None, archived: archived, lang: lang, | |
| 815 | 820 | <div class="fit-pane settings-split"> |
| 816 | 821 | <section class="card"> |
| 817 | 822 | <h2>(g::t(lang, K::AddWebhook))</h2> |
| @@ -822,6 +827,7 @@ async fn hook_new_body( | ||
| 822 | 827 | <p><a href=(back.as_str())>(g::t(lang, K::BackToWebhooks))</a></p> |
| 823 | 828 | </section> |
| 824 | 829 | </div> |
| 830 | + ) | |
| 825 | 831 | }) |
| 826 | 832 | } |
| 827 | 833 |
crates/forge-web/src/pages/review_requests.rsmodified+1 -1
| @@ -292,7 +292,7 @@ async fn review_requests(cx: &Cx) -> Result<impl View> { | ||
| 292 | 292 | empty_state(title: ga::t(lang, AK::NoReviewRequests)) |
| 293 | 293 | } |
| 294 | 294 | if !empty { |
| 295 | - <section class="card"> | |
| 295 | + <section class="card list-pane fit-pane"> | |
| 296 | 296 | <ul class="notif-list review-request-list"> |
| 297 | 297 | for row in rows.iter() { |
| 298 | 298 | <li> |
crates/forge-web/src/pages/settings_appearance.rsmodified+8 -2
| @@ -588,7 +588,11 @@ pub fn sidebar_stored(stored: &str) -> &'static str { | ||
| 588 | 588 | |
| 589 | 589 | /// Builds the page for a viewer. Each choice shows the stored value, or the default when the |
| 590 | 590 | /// stored id is no longer offered, which is what the page renders on `<html>` too. |
| 591 | -fn page_for(viewer: &(User, Session), lang: Lang, prefs: &HashMap<String, String>) -> AppearancePage { | |
| 591 | +fn page_for( | |
| 592 | + viewer: &(User, Session), | |
| 593 | + lang: Lang, | |
| 594 | + prefs: &HashMap<String, String>, | |
| 595 | +) -> AppearancePage { | |
| 592 | 596 | let user = &viewer.0; |
| 593 | 597 | let density = match prefs.get(DENSITY).map(String::as_str) { |
| 594 | 598 | Some("compact") => "compact", |
| @@ -796,7 +800,9 @@ mod tests { | ||
| 796 | 800 | "accent upper case {id}" |
| 797 | 801 | ); |
| 798 | 802 | } |
| 799 | - for id in ["fern", "spark", "graphite", "dusk", "ink", "anvil", "hue-120"] { | |
| 803 | + for id in [ | |
| 804 | + "fern", "spark", "graphite", "dusk", "ink", "anvil", "hue-120", | |
| 805 | + ] { | |
| 800 | 806 | assert_eq!( |
| 801 | 807 | base_choice(Lang::Tr, Some(id), "fern").unwrap(), |
| 802 | 808 | id, |
crates/forge-web/src/pages/settings_gpg.rsmodified+1 -1
| @@ -50,7 +50,7 @@ async fn gpg_view( | ||
| 50 | 50 | if !available { |
| 51 | 51 | <p class="notice">(t(lang, Key::GpgUnavailable))</p> |
| 52 | 52 | } |
| 53 | - <section class="card"> | |
| 53 | + <section class="card fit-pane"> | |
| 54 | 54 | if keys.is_empty() { |
| 55 | 55 | empty_state(title: t(lang, Key::NoGpgKeys), |
| 56 | 56 | <a class="button" href="#add-gpg-key">(t(lang, Key::AddGpgKeyTitle))</a>) |
crates/forge-web/src/pages/settings_gpg_tests.rsmodified+22 -4
| @@ -132,7 +132,14 @@ async fn gpg_refusals_and_the_listing_share_one_site() { | ||
| 132 | 132 | .await |
| 133 | 133 | .unwrap(); |
| 134 | 134 | let anon_fields = [("csrf", CSRF), ("id", key.id.as_str())]; |
| 135 | - let anon = call(&site, "POST", "/settings/gpg/delete", None, Some(&anon_fields)).await; | |
| 135 | + let anon = call( | |
| 136 | + &site, | |
| 137 | + "POST", | |
| 138 | + "/settings/gpg/delete", | |
| 139 | + None, | |
| 140 | + Some(&anon_fields), | |
| 141 | + ) | |
| 142 | + .await; | |
| 136 | 143 | assert_eq!(anon.status, 303, "anonymous delete"); |
| 137 | 144 | let bad_delete = [("csrf", "wrong"), ("id", key.id.as_str())]; |
| 138 | 145 | let reply = call( |
| @@ -153,8 +160,14 @@ async fn gpg_refusals_and_the_listing_share_one_site() { | ||
| 153 | 160 | // The page lists the key. The notice shows only when GPG is missing on this server. |
| 154 | 161 | let reply = call(&site, "GET", "/settings/gpg", Some(&cookie), None).await; |
| 155 | 162 | assert_eq!(reply.status, 200, "listing page"); |
| 156 | - assert!(reply.body.contains(FINGERPRINT), "listing shows the fingerprint"); | |
| 157 | - assert!(reply.body.contains("tahinli@example.com"), "listing shows the email"); | |
| 163 | + assert!( | |
| 164 | + reply.body.contains(FINGERPRINT), | |
| 165 | + "listing shows the fingerprint" | |
| 166 | + ); | |
| 167 | + assert!( | |
| 168 | + reply.body.contains("tahinli@example.com"), | |
| 169 | + "listing shows the email" | |
| 170 | + ); | |
| 158 | 171 | let notice = "GPG verification is unavailable on this server"; |
| 159 | 172 | assert_eq!(reply.body.contains(notice), !available, "notice"); |
| 160 | 173 | } |
| @@ -175,7 +188,12 @@ async fn owners_delete_their_own_keys_and_no_one_elses() { | ||
| 175 | 188 | .unwrap(); |
| 176 | 189 | let bob_key = site |
| 177 | 190 | .store |
| 178 | - .add_gpg_key(&bob.id, BOB_FINGERPRINT, "armored", &["bob@example.com".into()]) | |
| 191 | + .add_gpg_key( | |
| 192 | + &bob.id, | |
| 193 | + BOB_FINGERPRINT, | |
| 194 | + "armored", | |
| 195 | + &["bob@example.com".into()], | |
| 196 | + ) | |
| 179 | 197 | .await |
| 180 | 198 | .unwrap(); |
| 181 | 199 | let own_key = site |
crates/forge-web/src/pages/settings_keys.rsmodified+47 -9
| @@ -147,7 +147,7 @@ async fn keys_view( | ||
| 147 | 147 | <section class="page-head"> |
| 148 | 148 | <h1>(t(lang, Key::SshKeys))</h1> |
| 149 | 149 | </section> |
| 150 | - <section class="card"> | |
| 150 | + <section class="card fit-pane"> | |
| 151 | 151 | if keys.is_empty() { |
| 152 | 152 | empty_state(title: t(lang, Key::NoSshKeys), |
| 153 | 153 | <a class="button" href="#add-key">(t(lang, Key::AddSshKeyTitle))</a>) |
| @@ -308,9 +308,27 @@ mod tests { | ||
| 308 | 308 | .collect::<Vec<_>>() |
| 309 | 309 | .join(" "); |
| 310 | 310 | let cases = [ |
| 311 | - ("ed25519 with comment", ED25519.to_owned(), "ssh-ed25519", "test@forge", ED25519_FP), | |
| 312 | - ("ed25519 bare and padded", format!(" {bare}\n"), "ssh-ed25519", "", ED25519_FP), | |
| 313 | - ("ecdsa", ECDSA.to_owned(), "ecdsa-sha2-nistp256", "tahinli@tFedora", ECDSA_FP), | |
| 311 | + ( | |
| 312 | + "ed25519 with comment", | |
| 313 | + ED25519.to_owned(), | |
| 314 | + "ssh-ed25519", | |
| 315 | + "test@forge", | |
| 316 | + ED25519_FP, | |
| 317 | + ), | |
| 318 | + ( | |
| 319 | + "ed25519 bare and padded", | |
| 320 | + format!(" {bare}\n"), | |
| 321 | + "ssh-ed25519", | |
| 322 | + "", | |
| 323 | + ED25519_FP, | |
| 324 | + ), | |
| 325 | + ( | |
| 326 | + "ecdsa", | |
| 327 | + ECDSA.to_owned(), | |
| 328 | + "ecdsa-sha2-nistp256", | |
| 329 | + "tahinli@tFedora", | |
| 330 | + ECDSA_FP, | |
| 331 | + ), | |
| 314 | 332 | ]; |
| 315 | 333 | for (name, input, algorithm, comment, fingerprint) in cases { |
| 316 | 334 | let parsed = parse_public_key(&input).unwrap_or_else(|e| panic!("case {name}: {e:?}")); |
| @@ -337,18 +355,38 @@ mod tests { | ||
| 337 | 355 | let relabelled = ED25519.replacen("ssh-ed25519", "ecdsa-sha2-nistp256", 1); |
| 338 | 356 | let huge = format!("ssh-ed25519 {}", "A".repeat(MAX_KEY_CHARS)); |
| 339 | 357 | let cases = [ |
| 340 | - ("rsa", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCn test@host".to_owned(), KeyProblem::Rsa), | |
| 358 | + ( | |
| 359 | + "rsa", | |
| 360 | + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCn test@host".to_owned(), | |
| 361 | + KeyProblem::Rsa, | |
| 362 | + ), | |
| 341 | 363 | ( |
| 342 | 364 | "dss", |
| 343 | 365 | "ssh-dss AAAAB3NzaC1kc3MAAACBAP test@host".to_owned(), |
| 344 | 366 | KeyProblem::UnsupportedType("ssh-dss".into()), |
| 345 | 367 | ), |
| 346 | 368 | ("relabelled", relabelled, KeyProblem::Mismatch), |
| 347 | - ("bad base64", "ssh-ed25519 !!!notbase64".to_owned(), KeyProblem::BadBase64), | |
| 348 | - ("truncated", "ssh-ed25519 AAAA".to_owned(), KeyProblem::Truncated), | |
| 349 | - ("length past the end", format!("ssh-ed25519 {body}"), KeyProblem::Truncated), | |
| 369 | + ( | |
| 370 | + "bad base64", | |
| 371 | + "ssh-ed25519 !!!notbase64".to_owned(), | |
| 372 | + KeyProblem::BadBase64, | |
| 373 | + ), | |
| 374 | + ( | |
| 375 | + "truncated", | |
| 376 | + "ssh-ed25519 AAAA".to_owned(), | |
| 377 | + KeyProblem::Truncated, | |
| 378 | + ), | |
| 379 | + ( | |
| 380 | + "length past the end", | |
| 381 | + format!("ssh-ed25519 {body}"), | |
| 382 | + KeyProblem::Truncated, | |
| 383 | + ), | |
| 350 | 384 | ("empty", " ".to_owned(), KeyProblem::Empty), |
| 351 | - ("no key body", "ssh-ed25519".to_owned(), KeyProblem::MissingBody), | |
| 385 | + ( | |
| 386 | + "no key body", | |
| 387 | + "ssh-ed25519".to_owned(), | |
| 388 | + KeyProblem::MissingBody, | |
| 389 | + ), | |
| 352 | 390 | ("too long", huge, KeyProblem::TooLong), |
| 353 | 391 | ]; |
| 354 | 392 | for (name, input, want) in cases { |
crates/forge-web/src/pages/settings_profile.rsmodified+4 -1
| @@ -318,7 +318,10 @@ pub(crate) async fn store_avatar( | ||
| 318 | 318 | }; |
| 319 | 319 | // Decoding and resizing are CPU-bound; keep them off the async workers. A decode can take |
| 320 | 320 | // around 128 MiB, so only a couple run at once. |
| 321 | - let _permit = avatar_slots().acquire().await.map_err(std::io::Error::other)?; | |
| 321 | + let _permit = avatar_slots() | |
| 322 | + .acquire() | |
| 323 | + .await | |
| 324 | + .map_err(std::io::Error::other)?; | |
| 322 | 325 | let joined = tokio::task::spawn_blocking(move || process_avatar(&bytes)).await; |
| 323 | 326 | let processed = joined.map_err(std::io::Error::other)??; |
| 324 | 327 | store |
crates/forge-web/src/pages/settings_security.rsmodified+1 -1
| @@ -241,7 +241,7 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | ||
| 241 | 241 | <div class="settings-layout"> |
| 242 | 242 | <section class="page-head"> |
| 243 | 243 | <h1>(t(lang, Key::Security))</h1> |
| 244 | - <p class="muted"><a href="/settings/security/log">(t(lang, Key::SecurityLog))</a>(t(lang, Key::SecurityLogRest))</p> | |
| 244 | + <p class="muted page-action"><a href="/settings/security/log">(t(lang, Key::SecurityLog))</a>(t(lang, Key::SecurityLogRest))</p> | |
| 245 | 245 | </section> |
| 246 | 246 | if let Some(message) = notice { |
| 247 | 247 | <section class="card notice" role="status"> |
crates/forge-web/src/pages/settings_sessions.rsmodified+7 -9
| @@ -59,8 +59,14 @@ async fn sessions_view( | ||
| 59 | 59 | Ok(view! { |
| 60 | 60 | <section class="page-head"> |
| 61 | 61 | <h1>(t(lang, Key::Sessions))</h1> |
| 62 | + if others > 0 { | |
| 63 | + <form method="post" action="/settings/sessions/revoke-others" class="inline-form"> | |
| 64 | + <input type="hidden" name="csrf" value=(csrf)> | |
| 65 | + <button type="submit" class="danger">(t(lang, Key::RevokeAllOthers))</button> | |
| 66 | + </form> | |
| 67 | + } | |
| 62 | 68 | </section> |
| 63 | - <section class="card"> | |
| 69 | + <section class="card fit-pane"> | |
| 64 | 70 | <ul class="item-list"> |
| 65 | 71 | for session in sessions.into_iter() { |
| 66 | 72 | <li class="item"> |
| @@ -91,14 +97,6 @@ async fn sessions_view( | ||
| 91 | 97 | } |
| 92 | 98 | </ul> |
| 93 | 99 | </section> |
| 94 | - if others > 0 { | |
| 95 | - <section class="card"> | |
| 96 | - <form method="post" action="/settings/sessions/revoke-others" class="inline-form"> | |
| 97 | - <input type="hidden" name="csrf" value=(csrf)> | |
| 98 | - <button type="submit" class="danger">(t(lang, Key::RevokeAllOthers))</button> | |
| 99 | - </form> | |
| 100 | - </section> | |
| 101 | - } | |
| 102 | 100 | }) |
| 103 | 101 | } |
| 104 | 102 |
crates/forge-web/src/pages/settings_tokens.rsmodified+1 -1
| @@ -100,7 +100,7 @@ async fn tokens_view( | ||
| 100 | 100 | <p class="muted small">(t(lang, Key::UseAsPassword))</p> |
| 101 | 101 | </section> |
| 102 | 102 | } |
| 103 | - <section class="card"> | |
| 103 | + <section class="card fit-pane"> | |
| 104 | 104 | if tokens.is_empty() { |
| 105 | 105 | empty_state(title: t(lang, Key::NoAccessTokens), |
| 106 | 106 | <a class="button" href="#add-token">(t(lang, Key::NewToken))</a>) |
crates/forge-web/src/pages/snippets.rsmodified+53 -17
| @@ -305,7 +305,7 @@ async fn snippet_list_body( | ||
| 305 | 305 | <a class="button primary" href="/snippets/new">(g::t(lang, K::NewSnippet))</a> |
| 306 | 306 | } |
| 307 | 307 | </section> |
| 308 | - <section class="card"> | |
| 308 | + <section class="card list-pane fit-pane"> | |
| 309 | 309 | if rows.is_empty() { |
| 310 | 310 | empty_state(title: g::t(lang, K::NoSnippets), |
| 311 | 311 | if signed_in { |
| @@ -422,7 +422,7 @@ async fn snippet_form( | ||
| 422 | 422 | } |
| 423 | 423 | <form method="post" action=(action) class="snippet-form fit-pane"> |
| 424 | 424 | <input type="hidden" name="csrf" value=(csrf)> |
| 425 | - <header class="snippet-head"> | |
| 425 | + <header class="snippet-head page-head"> | |
| 426 | 426 | <h1>(heading)</h1> |
| 427 | 427 | <div class="snippet-head-actions"> |
| 428 | 428 | <fieldset class="snippet-visibility"> |
| @@ -535,7 +535,7 @@ async fn revisions_body( | ||
| 535 | 535 | <h1>(heading.as_str())</h1> |
| 536 | 536 | <a href=(back)>(g::t(lang, K::BackToSnippet))</a> |
| 537 | 537 | </section> |
| 538 | - <section class="card"> | |
| 538 | + <section class="card list-pane fit-pane"> | |
| 539 | 539 | if revisions.is_empty() { |
| 540 | 540 | <p class="muted">(g::t(lang, K::NoRevisions))</p> |
| 541 | 541 | } else { |
| @@ -589,10 +589,7 @@ async fn snippets_list(cx: &Cx) -> Result<impl View> { | ||
| 589 | 589 | .store |
| 590 | 590 | .list_snippets(viewer_id.as_deref()) |
| 591 | 591 | .await?; |
| 592 | - let rows: Vec<ListRow> = summaries | |
| 593 | - .into_iter() | |
| 594 | - .map(|s| list_row(lang, s)) | |
| 595 | - .collect(); | |
| 592 | + let rows: Vec<ListRow> = summaries.into_iter().map(|s| list_row(lang, s)).collect(); | |
| 596 | 593 | let signed_in = viewer.is_some(); |
| 597 | 594 | let title = g::t(lang, K::Snippets); |
| 598 | 595 | Ok(view! { |
| @@ -859,10 +856,17 @@ mod tests { | ||
| 859 | 856 | ("name_2", "b.rs"), |
| 860 | 857 | ("content_2", ""), |
| 861 | 858 | ])); |
| 862 | - assert_eq!(draft.files.len(), 3, "blank cards: every card is kept while editing"); | |
| 859 | + assert_eq!( | |
| 860 | + draft.files.len(), | |
| 861 | + 3, | |
| 862 | + "blank cards: every card is kept while editing" | |
| 863 | + ); | |
| 863 | 864 | let saved = draft.saved_files(); |
| 864 | 865 | assert_eq!(saved.len(), 2, "blank cards: a save drops the blank ones"); |
| 865 | - assert_eq!(saved[0].content, "one\ntwo", "blank cards: CRLF is normalised"); | |
| 866 | + assert_eq!( | |
| 867 | + saved[0].content, "one\ntwo", | |
| 868 | + "blank cards: CRLF is normalised" | |
| 869 | + ); | |
| 866 | 870 | assert_eq!(saved[1].name, "b.rs", "blank cards: the kept file"); |
| 867 | 871 | |
| 868 | 872 | // Case: a leading newline in a file survives the textarea. |
| @@ -913,7 +917,11 @@ mod tests { | ||
| 913 | 917 | draft.remove(0); |
| 914 | 918 | let numbers: Vec<usize> = draft.slots().iter().map(|s| s.number).collect(); |
| 915 | 919 | assert_eq!(numbers, vec![1, 2], "remove: numbers are kept"); |
| 916 | - assert_eq!(draft.slots()[0].name, "b.txt", "remove: the other card's name"); | |
| 920 | + assert_eq!( | |
| 921 | + draft.slots()[0].name, | |
| 922 | + "b.txt", | |
| 923 | + "remove: the other card's name" | |
| 924 | + ); | |
| 917 | 925 | |
| 918 | 926 | // Case: add and remove clicks are told apart from a save. |
| 919 | 927 | let add = form(&[("op", "add"), ("name_0", "a")]); |
| @@ -922,7 +930,11 @@ mod tests { | ||
| 922 | 930 | assert_eq!(draft.slots().len(), 2, "add click: two cards"); |
| 923 | 931 | let remove = form(&[("remove", "1"), ("name_0", "a"), ("name_1", "")]); |
| 924 | 932 | let mut draft = Draft::from_form(&remove); |
| 925 | - assert_eq!(apply_slot_step(&mut draft, &remove), Some(0), "remove click: tab"); | |
| 933 | + assert_eq!( | |
| 934 | + apply_slot_step(&mut draft, &remove), | |
| 935 | + Some(0), | |
| 936 | + "remove click: tab" | |
| 937 | + ); | |
| 926 | 938 | assert_eq!(draft.slots().len(), 1, "remove click: one card"); |
| 927 | 939 | assert_eq!( |
| 928 | 940 | apply_slot_step(&mut Draft::blank(), &form(&[("title", "t")])), |
| @@ -933,8 +945,16 @@ mod tests { | ||
| 933 | 945 | // Case: add shows the new last file. |
| 934 | 946 | let mut draft = Draft::blank(); |
| 935 | 947 | let add = form(&[("op", "add"), ("name_0", "a")]); |
| 936 | - assert_eq!(apply_slot_step(&mut draft, &add), Some(0), "add shows: first add"); | |
| 937 | - assert_eq!(apply_slot_step(&mut draft, &add), Some(1), "add shows: new last"); | |
| 948 | + assert_eq!( | |
| 949 | + apply_slot_step(&mut draft, &add), | |
| 950 | + Some(0), | |
| 951 | + "add shows: first add" | |
| 952 | + ); | |
| 953 | + assert_eq!( | |
| 954 | + apply_slot_step(&mut draft, &add), | |
| 955 | + Some(1), | |
| 956 | + "add shows: new last" | |
| 957 | + ); | |
| 938 | 958 | assert_eq!(draft.slots().len(), 2, "add shows: two cards"); |
| 939 | 959 | |
| 940 | 960 | // Case: removing a card shows the file before it, and the first one when it is first. |
| @@ -944,10 +964,18 @@ mod tests { | ||
| 944 | 964 | } |
| 945 | 965 | // Files 0..=2 at positions 0..=2; removing the file at position 2 shows position 1. |
| 946 | 966 | let remove = form(&[("remove", "2")]); |
| 947 | - assert_eq!(apply_slot_step(&mut draft, &remove), Some(1), "remove shows: before"); | |
| 967 | + assert_eq!( | |
| 968 | + apply_slot_step(&mut draft, &remove), | |
| 969 | + Some(1), | |
| 970 | + "remove shows: before" | |
| 971 | + ); | |
| 948 | 972 | // Removing the first file shows the new first one. |
| 949 | 973 | let remove = form(&[("remove", "0")]); |
| 950 | - assert_eq!(apply_slot_step(&mut draft, &remove), Some(0), "remove shows: first"); | |
| 974 | + assert_eq!( | |
| 975 | + apply_slot_step(&mut draft, &remove), | |
| 976 | + Some(0), | |
| 977 | + "remove shows: first" | |
| 978 | + ); | |
| 951 | 979 | |
| 952 | 980 | // Case: a failed save keeps the posted tab, and falls back to the first. |
| 953 | 981 | let mut draft = Draft::blank(); |
| @@ -956,8 +984,16 @@ mod tests { | ||
| 956 | 984 | } |
| 957 | 985 | let numbers: Vec<usize> = draft.slots().iter().map(|s| s.number).collect(); |
| 958 | 986 | assert_eq!(numbers, vec![0, 1, 2], "failed save: three cards"); |
| 959 | - assert_eq!(posted_tab(&draft, &form(&[("tab", "2")])), 2, "failed save: posted tab"); | |
| 960 | - assert_eq!(posted_tab(&draft, &form(&[("tab", "9")])), 0, "failed save: unknown tab"); | |
| 987 | + assert_eq!( | |
| 988 | + posted_tab(&draft, &form(&[("tab", "2")])), | |
| 989 | + 2, | |
| 990 | + "failed save: posted tab" | |
| 991 | + ); | |
| 992 | + assert_eq!( | |
| 993 | + posted_tab(&draft, &form(&[("tab", "9")])), | |
| 994 | + 0, | |
| 995 | + "failed save: unknown tab" | |
| 996 | + ); | |
| 961 | 997 | assert_eq!(posted_tab(&draft, &form(&[])), 0, "failed save: no tab"); |
| 962 | 998 | } |
| 963 | 999 | } |
crates/forge-web/src/pages/tree.rsmodified+2 -2
| @@ -422,7 +422,7 @@ pub async fn latest_commit_bar(bar: LatestBar, lang: Lang) -> Result<impl View> | ||
| 422 | 422 | <span>(author)</span> |
| 423 | 423 | } |
| 424 | 424 | </span> |
| 425 | - <a class="latest-subject" href=(last.href.as_str())>(last.summary)</a> | |
| 425 | + <a class="latest-subject" href=(last.href.as_str())>commit_line(subject: last.summary.clone())</a> | |
| 426 | 426 | <span class="latest-meta"> |
| 427 | 427 | <a class="mono latest-sha" href=(last.href.as_str())>(short)</a> |
| 428 | 428 | <time class="latest-age" data-rel="true" datetime=(last.iso.as_str()) title=(last.absolute.as_str())>(last.age)</time> |
| @@ -572,7 +572,7 @@ async fn tree_page(cx: &Cx) -> Result<impl View> { | ||
| 572 | 572 | Ok(view! { |
| 573 | 573 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 574 | 574 | repo_head(head: header) |
| 575 | - <div class="repo-grid repo-home"> | |
| 575 | + <div class="repo-grid repo-home tree-browse"> | |
| 576 | 576 | <div class="repo-main"> |
| 577 | 577 | <div class="browse-bar" data-live=(live.as_deref()) data-live-code=(live.is_some().then_some("true")) data-live-gone=(g::t(lang, K::LivePathGone))> |
| 578 | 578 | ref_selector(lang: lang, label: mi::t(lang, MK::RefLabel), current: ref_name.clone(), branches: branches, tags: tags, |
crates/forge-web/src/pages/wiki.rsmodified+8 -5
| @@ -26,6 +26,7 @@ use crate::i18n::{self, Lang}; | ||
| 26 | 26 | use crate::live::Topic; |
| 27 | 27 | use crate::pages::repo::repo_head; |
| 28 | 28 | use crate::pages::repo_ctx::{RepoCtx, load_repo}; |
| 29 | +use crate::pages::repo_settings::settings_frame; | |
| 29 | 30 | use crate::pages::wiki_live::{bump_wiki, page_live_url, wiki_live_url}; |
| 30 | 31 | use crate::render::markdown::render_markdown; |
| 31 | 32 | use crate::state::AppState; |
| @@ -204,7 +205,7 @@ fn page_links( | ||
| 204 | 205 | #[component] |
| 205 | 206 | async fn wiki_view_body(html: String) -> Result<impl View> { |
| 206 | 207 | Ok(view! { |
| 207 | - <section class="card wiki-page"> | |
| 208 | + <section class="card wiki-page fit-pane"> | |
| 208 | 209 | <div class="markdown-body">(Unescaped::new_unchecked(html))</div> |
| 209 | 210 | </section> |
| 210 | 211 | }) |
| @@ -219,7 +220,7 @@ async fn wiki_empty_body( | ||
| 219 | 220 | ) -> Result<impl View> { |
| 220 | 221 | let new = repo_href(&owner, &repo, "wiki", "-/new"); |
| 221 | 222 | Ok(view! { |
| 222 | - <section class="card wiki-page"> | |
| 223 | + <section class="card wiki-page fit-pane"> | |
| 223 | 224 | empty_state(title: g::t(lang, K::WikiNoPages), |
| 224 | 225 | if can_write { |
| 225 | 226 | <a class="button primary" href=(new.as_str())>(g::t(lang, K::CreateFirstPage))</a> |
| @@ -244,7 +245,7 @@ async fn wiki_list_body( | ||
| 244 | 245 | }) |
| 245 | 246 | .collect(); |
| 246 | 247 | Ok(view! { |
| 247 | - <section class="card wiki-page"> | |
| 248 | + <section class="card wiki-page fit-pane"> | |
| 248 | 249 | if rows.is_empty() { |
| 249 | 250 | empty_state(title: g::t(lang, K::NoPagesYet)) |
| 250 | 251 | } else { |
| @@ -261,7 +262,7 @@ async fn wiki_list_body( | ||
| 261 | 262 | #[component] |
| 262 | 263 | async fn wiki_history_body(lang: Lang, rows: Vec<RevisionRow>) -> Result<impl View> { |
| 263 | 264 | Ok(view! { |
| 264 | - <section class="card wiki-page"> | |
| 265 | + <section class="card wiki-page fit-pane"> | |
| 265 | 266 | if rows.is_empty() { |
| 266 | 267 | empty_state(title: g::t(lang, K::NoChangesYet)) |
| 267 | 268 | } else { |
| @@ -723,7 +724,9 @@ async fn wiki_settings_page(cx: &Cx) -> Result<impl View> { | ||
| 723 | 724 | Ok(view! { cx => |
| 724 | 725 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 725 | 726 | repo_head(head: header) |
| 726 | - wiki_settings_body(lang: lang, action: action, csrf: csrf, enabled: enabled) | |
| 727 | + settings_frame(lang: lang, title: format!("{}/{}", ctx.repo.owner_name, ctx.repo.name), current: "wiki", | |
| 728 | + wiki_settings_body(lang: lang, action: action, csrf: csrf, enabled: enabled) | |
| 729 | + ) | |
| 727 | 730 | ) |
| 728 | 731 | }) |
| 729 | 732 | } |
crates/forge-web/src/render/commit_message.rsmodified+4 -1
| @@ -150,7 +150,10 @@ fn strip_marker(clause: &str) -> &str { | ||
| 150 | 150 | fn split_type(clause: &str) -> Option<(&'static str, &str)> { |
| 151 | 151 | let rest = strip_marker(clause); |
| 152 | 152 | let word_len = rest.bytes().take_while(u8::is_ascii_lowercase).count(); |
| 153 | - let kind = KINDS.iter().copied().find(|kind| *kind == &rest[..word_len])?; | |
| 153 | + let kind = KINDS | |
| 154 | + .iter() | |
| 155 | + .copied() | |
| 156 | + .find(|kind| *kind == &rest[..word_len])?; | |
| 154 | 157 | let mut tail = &rest[word_len..]; |
| 155 | 158 | if let Some(after) = tail.strip_prefix('(') { |
| 156 | 159 | let close = after.find(')')?; |
crates/forge-web/src/repo_stats.rsmodified+8 -1
| @@ -109,7 +109,14 @@ const EXTENSIONS: &[(&str, &str)] = &[ | ||
| 109 | 109 | ]; |
| 110 | 110 | |
| 111 | 111 | /// Directory names whose contents are vendored or built, so they never count. |
| 112 | -const SKIPPED_SEGMENTS: &[&str] = &["vendor", "node_modules", "third_party", "dist", "target", ".git"]; | |
| 112 | +const SKIPPED_SEGMENTS: &[&str] = &[ | |
| 113 | + "vendor", | |
| 114 | + "node_modules", | |
| 115 | + "third_party", | |
| 116 | + "dist", | |
| 117 | + "target", | |
| 118 | + ".git", | |
| 119 | +]; | |
| 113 | 120 | |
| 114 | 121 | /// The language a path counts as, by its exact file name or its extension. None for anything |
| 115 | 122 | /// unknown, vendored, generated or prose. |
crates/forge-web/src/views/diff.rsmodified+1 -5
| @@ -110,11 +110,7 @@ impl DiffOpts { | ||
| 110 | 110 | let split = match current_user(cx).await? { |
| 111 | 111 | Some((user, _)) => { |
| 112 | 112 | let state = app_context::<AppState>(cx); |
| 113 | - let stored = state | |
| 114 | - .store | |
| 115 | - .user_prefs(&user.id) | |
| 116 | - .await? | |
| 117 | - .remove(DIFF_VIEW); | |
| 113 | + let stored = state.store.user_prefs(&user.id).await?.remove(DIFF_VIEW); | |
| 118 | 114 | match view_param.as_deref() { |
| 119 | 115 | Some(v @ ("split" | "unified")) => { |
| 120 | 116 | if stored.as_deref() != Some(v) { |
crates/forge-web/src/views/mod.rsmodified+117 -24
| @@ -32,11 +32,11 @@ use crate::i18n::authoring::{self as au, K as AuK}; | ||
| 32 | 32 | use crate::i18n::browse as br; |
| 33 | 33 | use crate::i18n::code::{self as g, K}; |
| 34 | 34 | use crate::i18n::community::{self as cm, K as CK}; |
| 35 | -use crate::i18n::packages::{self as pk, K as PK}; | |
| 36 | 35 | use crate::i18n::link::{self as lk, K as LinkKey}; |
| 37 | 36 | use crate::i18n::migrate::{self as mg, K as MGK}; |
| 38 | 37 | use crate::i18n::misc::{self as mi, K as MK}; |
| 39 | 38 | use crate::i18n::orgs::{self as o, K as OK}; |
| 39 | +use crate::i18n::packages::{self as pk, K as PK}; | |
| 40 | 40 | use crate::i18n::{self, Key, Lang, t}; |
| 41 | 41 | use crate::pages::assets::highlight_css_text; |
| 42 | 42 | use crate::pages::user_prefs::{CORNER_POS, TREE_WIDTH, clean_pref}; |
| @@ -156,7 +156,9 @@ fn path_segments(path: &str, title: &str) -> Vec<(String, Option<String>)> { | ||
| 156 | 156 | if let Some(repo) = parts.get(1) { |
| 157 | 157 | segments.push((repo.clone(), Some(repo_href(owner, repo, "", "")))); |
| 158 | 158 | match &parts[2..] { |
| 159 | - [kind, git_ref, prefix @ ..] if matches!(kind.as_str(), "tree" | "blob") && !prefix.is_empty() => { | |
| 159 | + [kind, git_ref, prefix @ ..] | |
| 160 | + if matches!(kind.as_str(), "tree" | "blob") && !prefix.is_empty() => | |
| 161 | + { | |
| 160 | 162 | let mut at = git_ref.clone(); |
| 161 | 163 | for part in prefix { |
| 162 | 164 | at.push('/'); |
| @@ -206,7 +208,15 @@ fn live_strip(lang: Lang, runs: &ActorRuns) -> LiveStrip { | ||
| 206 | 208 | let mut rows = Vec::new(); |
| 207 | 209 | for run in &runs.running { |
| 208 | 210 | let job = run.current_job.as_deref().unwrap_or(""); |
| 209 | - rows.push(strip_run("hot", run, if job.is_empty() { String::new() } else { format!(" {job}") })); | |
| 211 | + rows.push(strip_run( | |
| 212 | + "hot", | |
| 213 | + run, | |
| 214 | + if job.is_empty() { | |
| 215 | + String::new() | |
| 216 | + } else { | |
| 217 | + format!(" {job}") | |
| 218 | + }, | |
| 219 | + )); | |
| 210 | 220 | } |
| 211 | 221 | for run in &runs.finished { |
| 212 | 222 | let (state, word) = match run.state { |
| @@ -217,7 +227,9 @@ fn live_strip(lang: Lang, runs: &ActorRuns) -> LiveStrip { | ||
| 217 | 227 | }; |
| 218 | 228 | rows.push(strip_run(state, run, format!(" {word}"))); |
| 219 | 229 | } |
| 220 | - let count = |pred: fn(RunState) -> bool| runs.finished.iter().filter(|run| pred(run.state)).count() as u64; | |
| 230 | + let count = |pred: fn(RunState) -> bool| { | |
| 231 | + runs.finished.iter().filter(|run| pred(run.state)).count() as u64 | |
| 232 | + }; | |
| 221 | 233 | let running = runs.running.len() as u64; |
| 222 | 234 | let failed = count(|state| matches!(state, RunState::Failure | RunState::Error)); |
| 223 | 235 | let passed = count(|state| matches!(state, RunState::Success)); |
| @@ -304,20 +316,43 @@ struct ProfileCorner { | ||
| 304 | 316 | #[component] |
| 305 | 317 | async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> { |
| 306 | 318 | let review_chip = (corner.reviews > 0).then(|| { |
| 307 | - (corner.reviews.to_string(), mi::review_requests_count(lang, corner.reviews)) | |
| 319 | + ( | |
| 320 | + corner.reviews.to_string(), | |
| 321 | + mi::review_requests_count(lang, corner.reviews), | |
| 322 | + ) | |
| 323 | + }); | |
| 324 | + let mention_chip = (corner.mentions > 0).then(|| { | |
| 325 | + ( | |
| 326 | + corner.mentions.to_string(), | |
| 327 | + mi::mentions_count(lang, corner.mentions), | |
| 328 | + ) | |
| 329 | + }); | |
| 330 | + let failing_chip = (corner.failing > 0).then(|| { | |
| 331 | + ( | |
| 332 | + corner.failing.to_string(), | |
| 333 | + mi::failing_runs_count(lang, corner.failing), | |
| 334 | + ) | |
| 308 | 335 | }); |
| 309 | - let mention_chip = (corner.mentions > 0) | |
| 310 | - .then(|| (corner.mentions.to_string(), mi::mentions_count(lang, corner.mentions))); | |
| 311 | - let failing_chip = (corner.failing > 0) | |
| 312 | - .then(|| (corner.failing.to_string(), mi::failing_runs_count(lang, corner.failing))); | |
| 313 | 336 | let bell_label = mi::t(lang, MK::AllNotifications); |
| 314 | 337 | let theme_label = mi::t(lang, MK::ThemeLabel); |
| 315 | 338 | let match_label = mi::t(lang, MK::MatchSystem); |
| 316 | 339 | let light_label = mi::t(lang, MK::Light); |
| 317 | 340 | let dark_label = mi::t(lang, MK::Dark); |
| 318 | - let auto_pressed = if corner.theme == "auto" { "true" } else { "false" }; | |
| 319 | - let light_pressed = if corner.theme == "light" { "true" } else { "false" }; | |
| 320 | - let dark_pressed = if corner.theme == "dark" { "true" } else { "false" }; | |
| 341 | + let auto_pressed = if corner.theme == "auto" { | |
| 342 | + "true" | |
| 343 | + } else { | |
| 344 | + "false" | |
| 345 | + }; | |
| 346 | + let light_pressed = if corner.theme == "light" { | |
| 347 | + "true" | |
| 348 | + } else { | |
| 349 | + "false" | |
| 350 | + }; | |
| 351 | + let dark_pressed = if corner.theme == "dark" { | |
| 352 | + "true" | |
| 353 | + } else { | |
| 354 | + "false" | |
| 355 | + }; | |
| 321 | 356 | // The chips' titles as nav.js rebuilds them: the server's phrase with `{n}` for the count. The |
| 322 | 357 | // singular and plural forms are separate, as English puts "request" and "requests" apart. |
| 323 | 358 | let review_template = count_template(&mi::review_requests_count(lang, 2), 2); |
| @@ -464,6 +499,7 @@ pub async fn shell( | ||
| 464 | 499 | None |
| 465 | 500 | }; |
| 466 | 501 | let section_menu = section.clone(); |
| 502 | + let site_shell = section.as_ref().is_some_and(|s| s.site); | |
| 467 | 503 | let theme_attr = crate::theme::data_theme(__cx, viewer.map(|(user, _)| user)); |
| 468 | 504 | // The relative-time wording and the server's clock, for nav.js to keep `<time data-rel>` labels current. |
| 469 | 505 | let rel_words_attr = rel_words(lang); |
| @@ -538,7 +574,11 @@ pub async fn shell( | ||
| 538 | 574 | .into_iter() |
| 539 | 575 | .enumerate() |
| 540 | 576 | .map(|(i, (label, href))| PathCrumb { |
| 541 | - class: if i == 0 && href.is_some() { "pathbar-seg owner" } else { "pathbar-seg" }, | |
| 577 | + class: if i == 0 && href.is_some() { | |
| 578 | + "pathbar-seg owner" | |
| 579 | + } else { | |
| 580 | + "pathbar-seg" | |
| 581 | + }, | |
| 542 | 582 | label, |
| 543 | 583 | href, |
| 544 | 584 | }) |
| @@ -558,7 +598,10 @@ pub async fn shell( | ||
| 558 | 598 | waiting |
| 559 | 599 | .iter() |
| 560 | 600 | .find(|item| { |
| 561 | - matches!(item.reason, forge_core::notifications::Reason::ReviewRequested) == review | |
| 601 | + matches!( | |
| 602 | + item.reason, | |
| 603 | + forge_core::notifications::Reason::ReviewRequested | |
| 604 | + ) == review | |
| 562 | 605 | }) |
| 563 | 606 | .map_or_else( |
| 564 | 607 | || "/notifications".to_owned(), |
| @@ -575,7 +618,9 @@ pub async fn shell( | ||
| 575 | 618 | |(owner, repo, number)| repo_href(owner, repo, "ci", &format!("runs/{number}")), |
| 576 | 619 | ); |
| 577 | 620 | // The corner's drag saves its position with this token, the same one the page's forms send. |
| 578 | - let prefs_csrf = viewer.map(|(_, session)| session.csrf_token.clone()).unwrap_or_default(); | |
| 621 | + let prefs_csrf = viewer | |
| 622 | + .map(|(_, session)| session.csrf_token.clone()) | |
| 623 | + .unwrap_or_default(); | |
| 579 | 624 | let corner = viewer.map(|(user, session)| ProfileCorner { |
| 580 | 625 | username: user.username.clone(), |
| 581 | 626 | name: user |
| @@ -731,7 +776,7 @@ pub async fn shell( | ||
| 731 | 776 | </form> |
| 732 | 777 | </div> |
| 733 | 778 | } |
| 734 | - <div class="shell"> | |
| 779 | + <div class=(if site_shell { "shell shell-site" } else { "shell" })> | |
| 735 | 780 | if let Some(section) = section { |
| 736 | 781 | <aside class="shell-sidebar"> |
| 737 | 782 | section_nav(title: section.title.as_str(), back: section.back, back_href: section.back_href.as_str(), items: section.items, current: section.current, live: section.live) |
| @@ -792,6 +837,9 @@ pub struct Section { | ||
| 792 | 837 | pub current: &'static str, |
| 793 | 838 | /// The stream the section's pages follow, or empty when they follow none. |
| 794 | 839 | pub live: &'static str, |
| 840 | + /// True for the site-wide sections (admin and the user's settings), which lay their pages out | |
| 841 | + /// as panes across the window. An organization's settings keep their own layout. | |
| 842 | + pub site: bool, | |
| 795 | 843 | } |
| 796 | 844 | |
| 797 | 845 | pub fn admin_items(lang: Lang) -> Vec<NavItem> { |
| @@ -922,8 +970,16 @@ pub fn global_items(lang: Lang, can_create_org: bool) -> Vec<NavItem> { | ||
| 922 | 970 | }; |
| 923 | 971 | let mut items = vec![ |
| 924 | 972 | item("explore", "/explore", t(lang, Key::Explore)), |
| 925 | - item("notifications", "/notifications", t(lang, Key::Notifications)), | |
| 926 | - item("reviews", "/review-requests", au::t(lang, AuK::ReviewRequests)), | |
| 973 | + item( | |
| 974 | + "notifications", | |
| 975 | + "/notifications", | |
| 976 | + t(lang, Key::Notifications), | |
| 977 | + ), | |
| 978 | + item( | |
| 979 | + "reviews", | |
| 980 | + "/review-requests", | |
| 981 | + au::t(lang, AuK::ReviewRequests), | |
| 982 | + ), | |
| 927 | 983 | item( |
| 928 | 984 | "needs-you", |
| 929 | 985 | "/needs-you", |
| @@ -1028,6 +1084,7 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> { | ||
| 1028 | 1084 | items: org_items(lang, second), |
| 1029 | 1085 | current, |
| 1030 | 1086 | live: "", |
| 1087 | + site: false, | |
| 1031 | 1088 | }); |
| 1032 | 1089 | } |
| 1033 | 1090 | _ => return None, |
| @@ -1049,6 +1106,7 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> { | ||
| 1049 | 1106 | items, |
| 1050 | 1107 | current, |
| 1051 | 1108 | live, |
| 1109 | + site: true, | |
| 1052 | 1110 | }) |
| 1053 | 1111 | } |
| 1054 | 1112 | |
| @@ -1632,7 +1690,11 @@ async fn ref_group( | ||
| 1632 | 1690 | now: i64, |
| 1633 | 1691 | ) -> Result<impl View> { |
| 1634 | 1692 | let count = links.len(); |
| 1635 | - let icon = if kind == "tags" { TAG_ICON } else { BRANCH_ICON }; | |
| 1693 | + let icon = if kind == "tags" { | |
| 1694 | + TAG_ICON | |
| 1695 | + } else { | |
| 1696 | + BRANCH_ICON | |
| 1697 | + }; | |
| 1636 | 1698 | let head_id = format!("ref-head-{kind}"); |
| 1637 | 1699 | Ok(view! { |
| 1638 | 1700 | if count > 0 { |
| @@ -1779,7 +1841,10 @@ mod tests { | ||
| 1779 | 1841 | vec![ |
| 1780 | 1842 | ("tahinli".to_owned(), Some("/tahinli".to_owned())), |
| 1781 | 1843 | ("forge".to_owned(), Some("/tahinli/forge".to_owned())), |
| 1782 | - ("src".to_owned(), Some("/tahinli/forge/tree/main/src".to_owned())), | |
| 1844 | + ( | |
| 1845 | + "src".to_owned(), | |
| 1846 | + Some("/tahinli/forge/tree/main/src".to_owned()) | |
| 1847 | + ), | |
| 1783 | 1848 | ("main.rs".to_owned(), None), |
| 1784 | 1849 | ] |
| 1785 | 1850 | ); |
| @@ -2033,25 +2098,53 @@ mod shell_tests { | ||
| 2033 | 2098 | let store = state.store.clone(); |
| 2034 | 2099 | let router = crate::test_support::app_router(state); |
| 2035 | 2100 | |
| 2036 | - let tag = html_tag_for_colours(&router, &store, "tahinli", "colour-token", ["ocean", "plum", "ink", "dusk"]).await; | |
| 2101 | + let tag = html_tag_for_colours( | |
| 2102 | + &router, | |
| 2103 | + &store, | |
| 2104 | + "tahinli", | |
| 2105 | + "colour-token", | |
| 2106 | + ["ocean", "plum", "ink", "dusk"], | |
| 2107 | + ) | |
| 2108 | + .await; | |
| 2037 | 2109 | assert!(tag.contains("data-accent-light=\"ocean\""), "{tag}"); |
| 2038 | 2110 | assert!(tag.contains("data-accent-dark=\"plum\""), "{tag}"); |
| 2039 | 2111 | assert!(tag.contains("data-base-light=\"ink\""), "{tag}"); |
| 2040 | 2112 | assert!(tag.contains("data-base-dark=\"dusk\""), "{tag}"); |
| 2041 | 2113 | assert!(!tag.contains("data-accent="), "{tag}"); |
| 2042 | 2114 | // Stored ids that are no longer offered fall back to the defaults, never to nothing. |
| 2043 | - let removed = html_tag_for_colours(&router, &store, "removed", "removed-token", ["removed-palette", "removed-palette", "x", "x"]).await; | |
| 2115 | + let removed = html_tag_for_colours( | |
| 2116 | + &router, | |
| 2117 | + &store, | |
| 2118 | + "removed", | |
| 2119 | + "removed-token", | |
| 2120 | + ["removed-palette", "removed-palette", "x", "x"], | |
| 2121 | + ) | |
| 2122 | + .await; | |
| 2044 | 2123 | assert!(removed.contains("data-accent-light=\"sage\""), "{removed}"); |
| 2045 | 2124 | assert!(removed.contains("data-accent-dark=\"sage\""), "{removed}"); |
| 2046 | 2125 | assert!(removed.contains("data-base-light=\"fern\""), "{removed}"); |
| 2047 | 2126 | assert!(removed.contains("data-base-dark=\"fern\""), "{removed}"); |
| 2048 | 2127 | // A removed preset (`ochre`, `mist`) falls back too, and a hue passes through as itself. |
| 2049 | - let retired = html_tag_for_colours(&router, &store, "retired", "retired-token", ["ochre", "terracotta", "mist", "stone"]).await; | |
| 2128 | + let retired = html_tag_for_colours( | |
| 2129 | + &router, | |
| 2130 | + &store, | |
| 2131 | + "retired", | |
| 2132 | + "retired-token", | |
| 2133 | + ["ochre", "terracotta", "mist", "stone"], | |
| 2134 | + ) | |
| 2135 | + .await; | |
| 2050 | 2136 | assert!(retired.contains("data-accent-light=\"sage\""), "{retired}"); |
| 2051 | 2137 | assert!(retired.contains("data-accent-dark=\"sage\""), "{retired}"); |
| 2052 | 2138 | assert!(retired.contains("data-base-light=\"fern\""), "{retired}"); |
| 2053 | 2139 | assert!(retired.contains("data-base-dark=\"fern\""), "{retired}"); |
| 2054 | - let hued = html_tag_for_colours(&router, &store, "hued", "hued-token", ["hue-215", "hue-7", "hue-300", "spark"]).await; | |
| 2140 | + let hued = html_tag_for_colours( | |
| 2141 | + &router, | |
| 2142 | + &store, | |
| 2143 | + "hued", | |
| 2144 | + "hued-token", | |
| 2145 | + ["hue-215", "hue-7", "hue-300", "spark"], | |
| 2146 | + ) | |
| 2147 | + .await; | |
| 2055 | 2148 | assert!(hued.contains("data-accent-light=\"hue-215\""), "{hued}"); |
| 2056 | 2149 | assert!(hued.contains("data-accent-dark=\"hue-7\""), "{hued}"); |
| 2057 | 2150 | assert!(hued.contains("data-base-light=\"hue-300\""), "{hued}"); |
crates/forge-web/src/web_push/crypto.rsmodified+2 -3
| @@ -80,9 +80,8 @@ fn encrypt_body( | ||
| 80 | 80 | salt: &[u8; 16], |
| 81 | 81 | payload: &[u8], |
| 82 | 82 | ) -> Result<Vec<u8>> { |
| 83 | - let encryption_error = |e: &dyn std::fmt::Display| { | |
| 84 | - Error::Crypto(format!("web push encryption failed: {e}")) | |
| 85 | - }; | |
| 83 | + let encryption_error = | |
| 84 | + |e: &dyn std::fmt::Display| Error::Crypto(format!("web push encryption failed: {e}")); | |
| 86 | 85 | let as_public = as_secret.public_key().to_sec1_point(false); |
| 87 | 86 | let ua_point = ua_public.to_sec1_point(false); |
| 88 | 87 | let shared = p256::ecdh::diffie_hellman(as_secret.to_nonzero_scalar(), ua_public.as_affine()); |
crates/forge-web/src/web_push/mod.rsmodified+1 -2
| @@ -492,8 +492,7 @@ mod tests { | ||
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | fn device(endpoint: String) -> PushSubscription { |
| 495 | - let secret = p256::SecretKey::from_slice(&crypto::new_vapid_private()) | |
| 496 | - .expect("scalar"); | |
| 495 | + let secret = p256::SecretKey::from_slice(&crypto::new_vapid_private()).expect("scalar"); | |
| 497 | 496 | let point = secret.public_key().to_sec1_point(false); |
| 498 | 497 | PushSubscription { |
| 499 | 498 | id: endpoint.clone(), |
crates/forge-web/tests/e2e/orgs_ui_e2e.rsmodified+4 -1
| @@ -400,7 +400,10 @@ async fn org_settings_delete_and_audit_end_to_end() { | ||
| 400 | 400 | assert!(shown.body.contains("Settings saved."), "saved notice"); |
| 401 | 401 | assert!(shown.body.contains("Anvils and more"), "description saved"); |
| 402 | 402 | let profile = http.get("/acme", Some(&tahinli)).await; |
| 403 | - assert!(profile.body.contains("Acme Inc"), "display name on the profile"); | |
| 403 | + assert!( | |
| 404 | + profile.body.contains("Acme Inc"), | |
| 405 | + "display name on the profile" | |
| 406 | + ); | |
| 404 | 407 | assert_eq!( |
| 405 | 408 | selected_value(&shown.body, "default_repo_role").as_deref(), |
| 406 | 409 | Some("write"), |
crates/forge-web/tests/e2e/repo_settings_e2e.rsmodified+8 -2
| @@ -217,7 +217,10 @@ async fn repo_settings_end_to_end() { | ||
| 217 | 217 | ) |
| 218 | 218 | .await; |
| 219 | 219 | assert_eq!(deleted.status, 303, "owner delete: {}", deleted.body); |
| 220 | - assert_eq!(deleted.header(LOCATION).as_deref(), Some("/bob?tab=repositories")); | |
| 220 | + assert_eq!( | |
| 221 | + deleted.header(LOCATION).as_deref(), | |
| 222 | + Some("/bob?tab=repositories") | |
| 223 | + ); | |
| 221 | 224 | assert!( |
| 222 | 225 | cookie_named(&deleted, "forge_notice").is_some(), |
| 223 | 226 | "notice cookie" |
| @@ -338,7 +341,10 @@ async fn repo_settings_deletes_rows_when_repo_dir_is_missing() { | ||
| 338 | 341 | "delete with missing dir: {}", |
| 339 | 342 | deleted.body |
| 340 | 343 | ); |
| 341 | - assert_eq!(deleted.header(LOCATION).as_deref(), Some("/bob?tab=repositories")); | |
| 344 | + assert_eq!( | |
| 345 | + deleted.header(LOCATION).as_deref(), | |
| 346 | + Some("/bob?tab=repositories") | |
| 347 | + ); | |
| 342 | 348 | assert_eq!( |
| 343 | 349 | http.get("/bob/gone", Some(&bob)).await.status, |
| 344 | 350 | 404, |
crates/forge-web/tests/e2e/ui_prefs_e2e.rsmodified+2 -3
| @@ -95,9 +95,8 @@ fn theme_button(body: &str) -> (String, String) { | ||
| 95 | 95 | /// The theme the profile corner's three-way choice shows as pressed, for signed-in users. |
| 96 | 96 | fn pressed_theme(body: &str) -> Option<String> { |
| 97 | 97 | let doc = scraper::Html::parse_document(body); |
| 98 | - let selector = | |
| 99 | - scraper::Selector::parse("form.corner-theme-set button[aria-pressed=\"true\"]") | |
| 100 | - .expect("selector"); | |
| 98 | + let selector = scraper::Selector::parse("form.corner-theme-set button[aria-pressed=\"true\"]") | |
| 99 | + .expect("selector"); | |
| 101 | 100 | doc.select(&selector) |
| 102 | 101 | .next() |
| 103 | 102 | .and_then(|el| el.value().attr("value")) |
style/_continuity.scssmodified+57 -7
| @@ -1,21 +1,71 @@ | ||
| 1 | -// Continuity: a row grows into the title of the page it opens. nav.js names the clicked row and the new | |
| 2 | -// main heading `forge-row` for one transition; every other swap is a plain swap with no transition. | |
| 3 | -// The rest of the page does a short crossfade. Reduced motion turns the animations off. | |
| 4 | -::view-transition-group(forge-row) { | |
| 1 | +// Continuity: every navigation is the same calm transition (nav.js sets `html.is-navigating` for it). | |
| 2 | +// The top bar, the profile corner and the repo head stay where they are, the active tab slides to its | |
| 3 | +// new place, and the page body fades in with a small rise. A link from a row also grows into the new | |
| 4 | +// page's title (`forge-row`). Reduced motion turns all of it off. | |
| 5 | +html.is-navigating { | |
| 6 | + .topbar { | |
| 7 | + view-transition-name: forge-top; | |
| 8 | + } | |
| 9 | + | |
| 10 | + .repo-head-code { | |
| 11 | + view-transition-name: forge-head; | |
| 12 | + } | |
| 13 | + | |
| 14 | + .repo-tabs .tab.active { | |
| 15 | + view-transition-name: forge-tab; | |
| 16 | + } | |
| 17 | + | |
| 18 | + .shell-body > main { | |
| 19 | + view-transition-name: forge-main; | |
| 20 | + } | |
| 21 | +} | |
| 22 | + | |
| 23 | +::view-transition-group(forge-row), | |
| 24 | +::view-transition-group(forge-tab) { | |
| 5 | 25 | animation-duration: 220ms; |
| 6 | 26 | animation-timing-function: ease-out; |
| 7 | 27 | } |
| 8 | 28 | |
| 9 | 29 | ::view-transition-old(forge-row), |
| 10 | -::view-transition-new(forge-row) { | |
| 30 | +::view-transition-new(forge-row), | |
| 31 | +::view-transition-old(forge-tab), | |
| 32 | +::view-transition-new(forge-tab) { | |
| 11 | 33 | animation-duration: 220ms; |
| 12 | 34 | animation-timing-function: ease-out; |
| 13 | 35 | } |
| 14 | 36 | |
| 37 | +// The chrome does not fade: the same bar is on both pages. | |
| 38 | +::view-transition-old(forge-top), | |
| 39 | +::view-transition-new(forge-top), | |
| 15 | 40 | ::view-transition-old(root), |
| 16 | 41 | ::view-transition-new(root) { |
| 17 | - animation-duration: 160ms; | |
| 18 | - animation-timing-function: ease-out; | |
| 42 | + animation: none; | |
| 43 | +} | |
| 44 | + | |
| 45 | +::view-transition-old(forge-top), | |
| 46 | +::view-transition-old(root) { | |
| 47 | + display: none; | |
| 48 | +} | |
| 49 | + | |
| 50 | +::view-transition-old(forge-main) { | |
| 51 | + animation: forge-main-out 90ms ease-in both; | |
| 52 | +} | |
| 53 | + | |
| 54 | +::view-transition-new(forge-main) { | |
| 55 | + animation: forge-main-in 200ms ease-out both; | |
| 56 | +} | |
| 57 | + | |
| 58 | +@keyframes forge-main-out { | |
| 59 | + to { | |
| 60 | + opacity: 0; | |
| 61 | + } | |
| 62 | +} | |
| 63 | + | |
| 64 | +@keyframes forge-main-in { | |
| 65 | + from { | |
| 66 | + opacity: 0; | |
| 67 | + transform: translateY(6px); | |
| 68 | + } | |
| 19 | 69 | } |
| 20 | 70 | |
| 21 | 71 | @media (prefers-reduced-motion: reduce) { |
style/_empty.scssmodified+4 -4
| @@ -1,11 +1,11 @@ | ||
| 1 | -// An empty list (views::empty_state): a quiet centred block with the next step under it. | |
| 1 | +// An empty list (views::empty_state): a quiet left-aligned block with the next step under it. | |
| 2 | 2 | .empty-state { |
| 3 | 3 | display: flex; |
| 4 | 4 | flex-direction: column; |
| 5 | - align-items: center; | |
| 5 | + align-items: flex-start; | |
| 6 | 6 | gap: 6px; |
| 7 | 7 | padding: 28px 16px; |
| 8 | - text-align: center; | |
| 8 | + text-align: left; | |
| 9 | 9 | color: var(--muted); |
| 10 | 10 | |
| 11 | 11 | .empty-state-title { |
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | .empty-state-action { |
| 24 | 24 | display: flex; |
| 25 | 25 | flex-wrap: wrap; |
| 26 | - justify-content: center; | |
| 26 | + justify-content: flex-start; | |
| 27 | 27 | gap: 8px; |
| 28 | 28 | margin-top: 8px; |
| 29 | 29 |
style/_fit_code.scssmodified+0 -38
| @@ -30,44 +30,6 @@ | ||
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | -// Job page: the job card and the artifacts sit in a side column; the log card fills the right side, | |
| 34 | -// and its `pre` is the scroller (nav.js follows its scrollTop), so the log card itself never scrolls. | |
| 35 | -@media (min-width: 900px) { | |
| 36 | - .ci-job-grid.fit-pane { | |
| 37 | - display: grid; | |
| 38 | - grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); | |
| 39 | - grid-template-rows: auto minmax(0, 1fr); | |
| 40 | - gap: 16px; | |
| 41 | - | |
| 42 | - > .card:not(.ci-logcard) { | |
| 43 | - align-self: start; | |
| 44 | - min-width: 0; | |
| 45 | - margin: 0; | |
| 46 | - } | |
| 47 | - | |
| 48 | - > .ci-logcard { | |
| 49 | - grid-column: 2; | |
| 50 | - grid-row: 1 / span 2; | |
| 51 | - display: flex; | |
| 52 | - flex-direction: column; | |
| 53 | - min-width: 0; | |
| 54 | - min-height: 0; | |
| 55 | - margin: 0; | |
| 56 | - overflow: hidden; | |
| 57 | - | |
| 58 | - > *:not(.ci-log) { | |
| 59 | - flex: none; | |
| 60 | - } | |
| 61 | - | |
| 62 | - .ci-log { | |
| 63 | - flex: 1 1 auto; | |
| 64 | - min-height: 0; | |
| 65 | - max-height: none; | |
| 66 | - } | |
| 67 | - } | |
| 68 | - } | |
| 69 | -} | |
| 70 | - | |
| 71 | 33 | // Run page and runs list: the selected run (the right column of the split) is the pane. The runs |
| 72 | 34 | // list beside it (.ci-side, main.scss) uses the same height. |
| 73 | 35 | @media (min-width: 761px) { |
style/_lang_admin.scssadded+90 -0
| @@ -0,0 +1,90 @@ | ||
| 1 | +// Settings and admin pages: the pages behind the site section sidebar (`.shell-site`, see views/mod.rs). | |
| 2 | +// Main takes the window's full width. From 900px its direct children are panes that sit side by side | |
| 3 | +// across the window, and anything that is not a pane (the head, a notice) spans the row. Forms stop at | |
| 4 | +// 720px and stay left aligned. Repo, org and other pages are not affected. | |
| 5 | + | |
| 6 | +// The page's column: main itself, or the `data-live` wrapper that most admin pages put inside it. | |
| 7 | +$page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > main > [data-live]:not(.srv-page):not(.health-page):not(.user-page):not(.teams-page)"; | |
| 8 | + | |
| 9 | +#{$page-column} { | |
| 10 | + min-width: 0; | |
| 11 | + max-width: none; | |
| 12 | +} | |
| 13 | + | |
| 14 | +@media (min-width: 900px) { | |
| 15 | + #{$page-column} { | |
| 16 | + display: grid; | |
| 17 | + grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); | |
| 18 | + align-items: start; | |
| 19 | + gap: 16px; | |
| 20 | + | |
| 21 | + > :not(.card) { | |
| 22 | + grid-column: 1 / -1; | |
| 23 | + } | |
| 24 | + } | |
| 25 | +} | |
| 26 | + | |
| 27 | +// Settings pages wrap their sections in one `.settings-layout`; it fills main and takes no max width. | |
| 28 | +.shell-site .settings-layout { | |
| 29 | + width: 100%; | |
| 30 | + min-width: 0; | |
| 31 | + max-width: none; | |
| 32 | + box-sizing: border-box; | |
| 33 | +} | |
| 34 | + | |
| 35 | +// A form in a pane is a column of its own: 720px at most, left aligned. The mail form keeps its | |
| 36 | +// three-field row. | |
| 37 | +.shell-site main .card > form:not(.inline-form):not([action="/admin/mail"]), | |
| 38 | +.shell-site main .card > form.stack:not([action="/admin/mail"]) { | |
| 39 | + max-width: 720px; | |
| 40 | +} | |
| 41 | + | |
| 42 | +// Ledes that used to sit under a page's title: a muted line at the top of the page's first pane. | |
| 43 | +.page-lede { | |
| 44 | + margin: 0 0 12px; | |
| 45 | + font-size: 13.5px; | |
| 46 | +} | |
| 47 | + | |
| 48 | +// The head's action (Security's link to the log) sits at the right end of the one row. | |
| 49 | +@media (min-width: 900px) { | |
| 50 | + .page-head > .page-action { | |
| 51 | + flex: none; | |
| 52 | + margin: 0; | |
| 53 | + } | |
| 54 | +} | |
| 55 | + | |
| 56 | +// Server and health pages keep their own grids; their ledes span the row above the panes. | |
| 57 | +.srv-page > .page-lede, | |
| 58 | +.health-page > .page-lede, | |
| 59 | +.health-page > .health-summary { | |
| 60 | + grid-column: 1 / -1; | |
| 61 | +} | |
| 62 | + | |
| 63 | +// Rows inside a pane are hairlines, not cards in cards: a card nested in a pane drops its own tone and | |
| 64 | +// edge. | |
| 65 | +.shell-site main .card .card { | |
| 66 | + background: transparent; | |
| 67 | + box-shadow: none; | |
| 68 | +} | |
| 69 | + | |
| 70 | +// Section headings in a settings or admin pane read as labels (mono, uppercase, muted), not Archivo | |
| 71 | +// titles. Scoped to the settings frame, account settings and the site pages, so repo and org pages keep | |
| 72 | +// their titles. The user page's danger heading keeps its red. | |
| 73 | +.settings-layout .card > h2, | |
| 74 | +.settings-layout .fit-pane > h2, | |
| 75 | +.shell-site main .card > h2, | |
| 76 | +.shell-site main .fit-pane > h2 { | |
| 77 | + @extend %mono-label; | |
| 78 | +} | |
| 79 | + | |
| 80 | +.shell-site main .user-danger > h2 { | |
| 81 | + color: var(--danger); | |
| 82 | +} | |
| 83 | + | |
| 84 | +// Panes side by side end at the same height. A card's bottom margin would shorten a stretched pane | |
| 85 | +// by 16px, so the split's and the grids' cards drop it; the grid gap already spaces them. | |
| 86 | +.fit-split > .card, | |
| 87 | +.health-page > .card, | |
| 88 | +.user-page > .card { | |
| 89 | + margin-bottom: 0; | |
| 90 | +} |
style/_lang_browse.scssadded+124 -0
| @@ -0,0 +1,124 @@ | ||
| 1 | +// Page language for the browse pages (file, blame, code search, tree, wiki) and the repo settings. | |
| 2 | +// See the head and pane rules in _language.scss and the design notes in fit.scss. | |
| 3 | + | |
| 4 | +// Repo settings: the sections in a left pane and the page's content in a right pane, both filling the | |
| 5 | +// window below the repo head. The markup is settings_frame (pages/repo_settings.rs). Below 900px the | |
| 6 | +// sections are a row of links above the content, and the content stacks. | |
| 7 | +.settings-layout { | |
| 8 | + min-width: 0; | |
| 9 | +} | |
| 10 | + | |
| 11 | +.settings-main { | |
| 12 | + min-width: 0; | |
| 13 | +} | |
| 14 | + | |
| 15 | +@media (min-width: 900px) { | |
| 16 | + // The repo's frame only: account settings use the same class with the site sidebar around them. | |
| 17 | + .settings-layout:has(> .settings-nav) { | |
| 18 | + display: grid; | |
| 19 | + grid-template-columns: 200px minmax(0, 1fr); | |
| 20 | + gap: 16px; | |
| 21 | + height: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px))); | |
| 22 | + } | |
| 23 | + | |
| 24 | + // The section list: a pane of links, the current one takes the accent wash. | |
| 25 | + .settings-layout > .settings-nav { | |
| 26 | + flex-direction: column; | |
| 27 | + flex-wrap: nowrap; | |
| 28 | + align-content: flex-start; | |
| 29 | + gap: 2px; | |
| 30 | + min-height: 0; | |
| 31 | + margin: 0; | |
| 32 | + padding: 8px; | |
| 33 | + overflow-y: auto; | |
| 34 | + background: var(--surface); | |
| 35 | + border: 1px solid var(--border); | |
| 36 | + border-radius: var(--radius-lg); | |
| 37 | + | |
| 38 | + a { | |
| 39 | + display: flex; | |
| 40 | + align-items: center; | |
| 41 | + min-height: 36px; | |
| 42 | + margin-bottom: 0; | |
| 43 | + padding: 0 12px; | |
| 44 | + border-bottom: 0; | |
| 45 | + border-radius: var(--radius-md); | |
| 46 | + font-weight: 500; | |
| 47 | + } | |
| 48 | + | |
| 49 | + a[aria-current="page"] { | |
| 50 | + background: var(--accent-soft); | |
| 51 | + color: var(--accent-ink); | |
| 52 | + border-bottom: 0; | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + // The content pane: its cards stack, and the page's split of cards (or a long list) scrolls inside | |
| 57 | + // the pane rather than making the page scroll. | |
| 58 | + .settings-layout > .settings-main { | |
| 59 | + display: flex; | |
| 60 | + flex-direction: column; | |
| 61 | + gap: 16px; | |
| 62 | + min-height: 0; | |
| 63 | + overflow-y: auto; | |
| 64 | + overscroll-behavior: contain; | |
| 65 | + | |
| 66 | + > .fit-pane { | |
| 67 | + flex: 1 1 auto; | |
| 68 | + height: auto; | |
| 69 | + min-height: 0; | |
| 70 | + } | |
| 71 | + } | |
| 72 | +} | |
| 73 | + | |
| 74 | +// Settings forms stand left aligned at a readable width; the split cards keep their own widths. | |
| 75 | +.settings-main form.stack:not(.webhook-form) { | |
| 76 | + max-width: 720px; | |
| 77 | +} | |
| 78 | + | |
| 79 | +// Tree pages: the repo home's grid without the bottom dock (only the repo home shows the dock), so the | |
| 80 | +// listing and the README fill the window. | |
| 81 | +@media (min-width: 900px) { | |
| 82 | + .tree-browse { | |
| 83 | + --repo-home-h: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px))); | |
| 84 | + } | |
| 85 | +} | |
| 86 | + | |
| 87 | +// Code search: the search form and the results are one pane that fills the window. The results scroll | |
| 88 | +// inside it, and take the full width. | |
| 89 | +@media (min-width: 900px) { | |
| 90 | + .search-page.fit-pane { | |
| 91 | + display: flex; | |
| 92 | + flex-direction: column; | |
| 93 | + gap: 12px; | |
| 94 | + overflow: hidden; | |
| 95 | + | |
| 96 | + > :not(.search-results) { | |
| 97 | + flex: none; | |
| 98 | + } | |
| 99 | + | |
| 100 | + > .search-results { | |
| 101 | + flex: 1 1 auto; | |
| 102 | + min-height: 0; | |
| 103 | + overflow-y: auto; | |
| 104 | + overscroll-behavior: contain; | |
| 105 | + } | |
| 106 | + } | |
| 107 | +} | |
| 108 | + | |
| 109 | +.search-page .search-form, | |
| 110 | +.search-page .search-results { | |
| 111 | + width: 100%; | |
| 112 | + max-width: none; | |
| 113 | +} | |
| 114 | + | |
| 115 | +// Wiki: an empty list or page is left aligned in its pane, with the next step under the message. | |
| 116 | +.wiki-page .empty-state { | |
| 117 | + align-items: flex-start; | |
| 118 | + padding: 0; | |
| 119 | + text-align: left; | |
| 120 | + | |
| 121 | + .empty-state-action { | |
| 122 | + justify-content: flex-start; | |
| 123 | + } | |
| 124 | +} |
style/_lang_ci.scssadded+85 -0
| @@ -0,0 +1,85 @@ | ||
| 1 | +// The CI list and the job page in the page language (LANGUAGE.md): both fill the window under the head, | |
| 2 | +// each pane scrolls inside itself, and nothing is a centred column. Imported last, so it wins over the | |
| 3 | +// older split and job rules in main.scss and _fit_code.scss. | |
| 4 | + | |
| 5 | +// The timeline is drawn in 640 units: past this width its text would grow with the pane. | |
| 6 | +.ci-gantt { | |
| 7 | + max-width: 800px; | |
| 8 | + overflow: visible; | |
| 9 | +} | |
| 10 | + | |
| 11 | +// The runs list (about 380px) and the selected run fill the window down to the footer. | |
| 12 | +@media (min-width: 900px) { | |
| 13 | + .ci-split.fit-pane { | |
| 14 | + grid-template-columns: minmax(0, 380px) minmax(0, 1fr); | |
| 15 | + align-items: stretch; | |
| 16 | + gap: 12px; | |
| 17 | + padding: 0; | |
| 18 | + overflow: hidden; | |
| 19 | + } | |
| 20 | + | |
| 21 | + .ci-split > .ci-side, | |
| 22 | + .ci-split > .ci-main { | |
| 23 | + position: static; | |
| 24 | + min-height: 0; | |
| 25 | + max-height: none; | |
| 26 | + margin: 0; | |
| 27 | + } | |
| 28 | + | |
| 29 | + .ci-split > .ci-side { | |
| 30 | + display: flex; | |
| 31 | + flex-direction: column; | |
| 32 | + overflow: hidden; | |
| 33 | + } | |
| 34 | + | |
| 35 | + // One row of controls: the count, Run workflow and Status badge stay on one line. | |
| 36 | + .ci-split > .ci-side .ci-side-head, | |
| 37 | + .ci-split > .ci-side .ci-tools { | |
| 38 | + flex-wrap: nowrap; | |
| 39 | + } | |
| 40 | + | |
| 41 | + .ci-split > .ci-side .ci-run-list { | |
| 42 | + flex: 1 1 auto; | |
| 43 | + min-height: 0; | |
| 44 | + overflow-y: auto; | |
| 45 | + overscroll-behavior: contain; | |
| 46 | + } | |
| 47 | + | |
| 48 | + .ci-split > .ci-main { | |
| 49 | + overflow-y: auto; | |
| 50 | + overscroll-behavior: contain; | |
| 51 | + } | |
| 52 | +} | |
| 53 | + | |
| 54 | +// Between phone and desktop the panes stack, as the rest of the site does. | |
| 55 | +@media (max-width: 899px) { | |
| 56 | + .ci-split { | |
| 57 | + grid-template-columns: minmax(0, 1fr); | |
| 58 | + } | |
| 59 | +} | |
| 60 | + | |
| 61 | +// The detail's empty state reads from the left, inside its pane. | |
| 62 | +.ci-split .empty-state { | |
| 63 | + align-items: flex-start; | |
| 64 | + padding: 16px 0; | |
| 65 | + text-align: left; | |
| 66 | + | |
| 67 | + .empty-state-hint { | |
| 68 | + max-width: none; | |
| 69 | + } | |
| 70 | +} | |
| 71 | + | |
| 72 | +// The job page: the head and the log fill the window, the log pane takes the rest. | |
| 73 | +@media (min-width: 900px) { | |
| 74 | + .ci-job.fit-pane { | |
| 75 | + display: flex; | |
| 76 | + flex-direction: column; | |
| 77 | + gap: 12px; | |
| 78 | + padding: 0; | |
| 79 | + overflow: hidden; | |
| 80 | + } | |
| 81 | + | |
| 82 | + .ci-job .ci-tl-no a { | |
| 83 | + color: inherit; | |
| 84 | + } | |
| 85 | +} |
style/_lang_issues.scssadded+274 -0
| @@ -0,0 +1,274 @@ | ||
| 1 | +// Issues, pull requests and discussions in the page language (style/_language.scss, LANGUAGE.md). | |
| 2 | +// Lists are one pane: a toolbar row, then hairline rows with the metadata at the right end. Issue, | |
| 3 | +// pull and discussion pages are a conversation pane and a 300px sidebar pane, each scrolling inside | |
| 4 | +// itself. Forms are 720px and left aligned. Markup: `.issue-pane` wraps a list page's body. | |
| 5 | + | |
| 6 | +// Lists: one pane that fills the window. The toolbar stays at the top, the rows scroll under it, | |
| 7 | +// and the pager stays at the foot. | |
| 8 | +@media (min-width: 900px) { | |
| 9 | + .issue-pane.fit-pane { | |
| 10 | + display: flex; | |
| 11 | + flex-direction: column; | |
| 12 | + margin: 0; | |
| 13 | + padding: 0; | |
| 14 | + overflow: hidden; | |
| 15 | + border: 1px solid var(--border); | |
| 16 | + border-radius: var(--radius-lg); | |
| 17 | + background: var(--surface); | |
| 18 | + | |
| 19 | + > .issue-toolbar, | |
| 20 | + > .pinned-issues, | |
| 21 | + > .pager { | |
| 22 | + flex: none; | |
| 23 | + } | |
| 24 | + | |
| 25 | + > .issue-list, | |
| 26 | + > .commit-list, | |
| 27 | + > .issue-timeline { | |
| 28 | + flex: 1 1 auto; | |
| 29 | + min-height: 0; | |
| 30 | + overflow: auto; | |
| 31 | + overscroll-behavior: contain; | |
| 32 | + } | |
| 33 | + | |
| 34 | + > .issue-list { | |
| 35 | + border: 0; | |
| 36 | + border-radius: 0; | |
| 37 | + background: none; | |
| 38 | + } | |
| 39 | + } | |
| 40 | +} | |
| 41 | + | |
| 42 | +// Toolbar: tabs, search and filters, and the buttons on one row. | |
| 43 | +.issue-pane > .issue-toolbar { | |
| 44 | + display: flex; | |
| 45 | + flex-wrap: wrap; | |
| 46 | + align-items: center; | |
| 47 | + gap: 8px 12px; | |
| 48 | + margin: 0; | |
| 49 | + padding: 10px 14px; | |
| 50 | + border-bottom: 1px solid var(--border); | |
| 51 | + | |
| 52 | + > .issue-tabs { | |
| 53 | + flex: none; | |
| 54 | + gap: 2px; | |
| 55 | + | |
| 56 | + a { | |
| 57 | + padding: 4px 10px; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | + > .issue-search { | |
| 62 | + flex: 1 1 16rem; | |
| 63 | + min-width: 0; | |
| 64 | + margin: 0; | |
| 65 | + flex-wrap: nowrap; | |
| 66 | + | |
| 67 | + input[type="search"] { | |
| 68 | + flex: 1 1 10rem; | |
| 69 | + min-width: 8rem; | |
| 70 | + max-width: none; | |
| 71 | + height: 32px; | |
| 72 | + } | |
| 73 | + | |
| 74 | + select, | |
| 75 | + button { | |
| 76 | + height: 32px; | |
| 77 | + padding: 0 10px; | |
| 78 | + font-size: 13px; | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + > .issue-tools { | |
| 83 | + display: flex; | |
| 84 | + flex: none; | |
| 85 | + align-items: center; | |
| 86 | + gap: 8px; | |
| 87 | + | |
| 88 | + nav { | |
| 89 | + display: flex; | |
| 90 | + gap: 8px; | |
| 91 | + } | |
| 92 | + | |
| 93 | + .button { | |
| 94 | + height: 32px; | |
| 95 | + padding: 0 12px; | |
| 96 | + font-size: 13px; | |
| 97 | + line-height: 30px; | |
| 98 | + box-sizing: border-box; | |
| 99 | + } | |
| 100 | + } | |
| 101 | +} | |
| 102 | + | |
| 103 | +.issue-pane > .pinned-issues { | |
| 104 | + margin: 0; | |
| 105 | + padding: 10px 14px; | |
| 106 | + border-bottom: 1px solid var(--border); | |
| 107 | +} | |
| 108 | + | |
| 109 | +// Rows: a hairline between them, the title and metadata on the left, the assignees and the | |
| 110 | +// comment count right aligned at the far end of the row. | |
| 111 | +.issue-pane .issue-list .issue-row { | |
| 112 | + display: grid; | |
| 113 | + grid-template-columns: 14px minmax(0, 1fr) minmax(7rem, auto); | |
| 114 | + align-items: center; | |
| 115 | + gap: 12px; | |
| 116 | + padding: 10px 14px; | |
| 117 | + border-top: 1px solid var(--border); | |
| 118 | + | |
| 119 | + > .issue-state { | |
| 120 | + grid-column: 1; | |
| 121 | + margin: 0; | |
| 122 | + align-self: center; | |
| 123 | + } | |
| 124 | + | |
| 125 | + > .issue-main { | |
| 126 | + grid-column: 2; | |
| 127 | + min-width: 0; | |
| 128 | + } | |
| 129 | + | |
| 130 | + > .issue-aside { | |
| 131 | + grid-column: 3; | |
| 132 | + justify-content: flex-end; | |
| 133 | + min-width: 0; | |
| 134 | + } | |
| 135 | + | |
| 136 | + // A row without a state dot (discussions, the template chooser): two columns. | |
| 137 | + &:not(:has(> .issue-state)) { | |
| 138 | + grid-template-columns: minmax(0, 1fr) minmax(7rem, auto); | |
| 139 | + | |
| 140 | + > .issue-main { | |
| 141 | + grid-column: 1; | |
| 142 | + } | |
| 143 | + | |
| 144 | + > .issue-aside { | |
| 145 | + grid-column: 2; | |
| 146 | + } | |
| 147 | + } | |
| 148 | +} | |
| 149 | + | |
| 150 | +.issue-pane .issue-list .issue-row:first-child { | |
| 151 | + border-top: 0; | |
| 152 | +} | |
| 153 | + | |
| 154 | +.issue-pane .issue-row .issue-meta { | |
| 155 | + margin-top: 2px; | |
| 156 | +} | |
| 157 | + | |
| 158 | +.issue-pane .issue-row .issue-title-line { | |
| 159 | + gap: 6px; | |
| 160 | +} | |
| 161 | + | |
| 162 | +.issue-pane > .pager { | |
| 163 | + margin: 0; | |
| 164 | + padding: 8px 14px; | |
| 165 | + border-top: 1px solid var(--border); | |
| 166 | +} | |
| 167 | + | |
| 168 | +// Issue, pull request and discussion pages: the title in one line, then state and meta on one line. | |
| 169 | +.issue-heading { | |
| 170 | + overflow: hidden; | |
| 171 | + margin: 0; | |
| 172 | + font-size: 20px; | |
| 173 | + line-height: 1.25; | |
| 174 | + white-space: nowrap; | |
| 175 | + text-overflow: ellipsis; | |
| 176 | +} | |
| 177 | + | |
| 178 | +.issue-head { | |
| 179 | + margin-bottom: 0; | |
| 180 | +} | |
| 181 | + | |
| 182 | +.issue-byline { | |
| 183 | + margin: 4px 0 0; | |
| 184 | + font-size: 13px; | |
| 185 | + line-height: 1.4; | |
| 186 | +} | |
| 187 | + | |
| 188 | +@media (min-width: 900px) { | |
| 189 | + // The conversation is the left pane, the sidebar a 300px right pane. Both scroll inside. | |
| 190 | + .issue-layout { | |
| 191 | + grid-template-columns: minmax(0, 1fr) 300px; | |
| 192 | + gap: 16px; | |
| 193 | + height: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px))); | |
| 194 | + } | |
| 195 | + | |
| 196 | + .issue-layout > .issue-column.fit-pane, | |
| 197 | + .issue-layout > .issue-sidebar.fit-pane { | |
| 198 | + height: 100%; | |
| 199 | + margin: 0; | |
| 200 | + padding: 12px; | |
| 201 | + border: 1px solid var(--border); | |
| 202 | + border-radius: var(--radius-lg); | |
| 203 | + background: var(--surface); | |
| 204 | + } | |
| 205 | + | |
| 206 | + .issue-layout > .issue-column.fit-pane { | |
| 207 | + gap: 12px; | |
| 208 | + } | |
| 209 | + | |
| 210 | + // Sidebar: the sections stack with a hairline, so the labels and assignees fit one screen. | |
| 211 | + .issue-layout > .issue-sidebar.fit-pane { | |
| 212 | + gap: 0; | |
| 213 | + | |
| 214 | + > .issue-side-section:last-child { | |
| 215 | + border-bottom: 0; | |
| 216 | + } | |
| 217 | + } | |
| 218 | +} | |
| 219 | + | |
| 220 | +// Label checklist: compact chips in a wrapping row instead of one tall list. | |
| 221 | +.issue-side-section form.stack:has(> .issue-check) { | |
| 222 | + display: flex; | |
| 223 | + flex-direction: row; | |
| 224 | + flex-wrap: wrap; | |
| 225 | + align-items: center; | |
| 226 | + justify-content: flex-start; | |
| 227 | + gap: 6px; | |
| 228 | + | |
| 229 | + > * { | |
| 230 | + grid-column: auto; | |
| 231 | + } | |
| 232 | + | |
| 233 | + > .issue-check { | |
| 234 | + display: inline-flex; | |
| 235 | + align-items: center; | |
| 236 | + gap: 4px; | |
| 237 | + height: 26px; | |
| 238 | + margin: 0; | |
| 239 | + padding: 0 8px 0 6px; | |
| 240 | + border: 1px solid var(--border); | |
| 241 | + border-radius: var(--radius-full); | |
| 242 | + font-size: 12px; | |
| 243 | + white-space: nowrap; | |
| 244 | + | |
| 245 | + .label-chip { | |
| 246 | + padding: 0 4px; | |
| 247 | + font-size: 12px; | |
| 248 | + } | |
| 249 | + } | |
| 250 | + | |
| 251 | + > div { | |
| 252 | + flex: 1 0 100%; | |
| 253 | + } | |
| 254 | +} | |
| 255 | + | |
| 256 | +.issue-side-section .issue-chips { | |
| 257 | + display: flex; | |
| 258 | + flex-wrap: wrap; | |
| 259 | + gap: 6px; | |
| 260 | +} | |
| 261 | + | |
| 262 | +// Forms: 720px, left aligned. They do not stretch across a wide window. | |
| 263 | +.issue-new, | |
| 264 | +.issue-edit.card { | |
| 265 | + max-width: 720px; | |
| 266 | +} | |
| 267 | + | |
| 268 | +// Comment history: the versions scroll inside their pane. | |
| 269 | +.issue-timeline.fit-pane { | |
| 270 | + padding: 12px; | |
| 271 | + border: 1px solid var(--border); | |
| 272 | + border-radius: var(--radius-lg); | |
| 273 | + background: var(--surface); | |
| 274 | +} |
style/_lang_lists.scssadded+181 -0
| @@ -0,0 +1,181 @@ | ||
| 1 | +// Page language for the repo list and form pages: commits, branches, tags, releases, compare, labels, | |
| 2 | +// milestones, merge queue and security. See _language.scss and LANGUAGE.md. Markup keeps its strings and | |
| 3 | +// the classes tests read; this file gives the wrappers their one-screen shape. Headings are styled by | |
| 4 | +// selector because tests read them as plain h2 elements. | |
| 5 | + | |
| 6 | +// A list pane: one surface pane that fills the window. Its toolbar row stays at the top, its rows | |
| 7 | +// scroll inside `.list-scroll`, and the pager or a footnote sits at its foot. Below 900px it is as tall | |
| 8 | +// as its content. | |
| 9 | +@media (min-width: 900px) { | |
| 10 | + .lang-list.fit-pane { | |
| 11 | + display: flex; | |
| 12 | + flex-direction: column; | |
| 13 | + overflow: hidden; | |
| 14 | + margin-bottom: 0; | |
| 15 | + padding: 0; | |
| 16 | + background: var(--surface); | |
| 17 | + border-radius: var(--radius-lg); | |
| 18 | + box-shadow: inset 0 0 0 1px var(--border); | |
| 19 | + } | |
| 20 | +} | |
| 21 | + | |
| 22 | +.lang-list { | |
| 23 | + > .list-bar { | |
| 24 | + flex: none; | |
| 25 | + display: flex; | |
| 26 | + flex-wrap: wrap; | |
| 27 | + align-items: center; | |
| 28 | + gap: 8px 16px; | |
| 29 | + min-height: 44px; | |
| 30 | + padding: 8px 16px; | |
| 31 | + border-bottom: 1px solid var(--border); | |
| 32 | + | |
| 33 | + > h2 { | |
| 34 | + @extend %mono-label; | |
| 35 | + margin: 0; | |
| 36 | + } | |
| 37 | + | |
| 38 | + > p { | |
| 39 | + margin: 0; | |
| 40 | + } | |
| 41 | + } | |
| 42 | + | |
| 43 | + > .list-scroll, | |
| 44 | + > .fit-scroll { | |
| 45 | + flex: 1 1 auto; | |
| 46 | + min-height: 0; | |
| 47 | + padding: 0 16px; | |
| 48 | + overflow: auto; | |
| 49 | + overscroll-behavior: contain; | |
| 50 | + | |
| 51 | + > .table-wrap { | |
| 52 | + margin: 0; | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + > .pager, | |
| 57 | + > .list-foot { | |
| 58 | + flex: none; | |
| 59 | + margin: 0; | |
| 60 | + padding: 8px 16px; | |
| 61 | + border-top: 1px solid var(--border); | |
| 62 | + } | |
| 63 | + | |
| 64 | + > .list-foot { | |
| 65 | + margin: 0; | |
| 66 | + } | |
| 67 | +} | |
| 68 | + | |
| 69 | +// Commits and compare lists keep their own cap only where they are not a pane. | |
| 70 | +.lang-list .compare-commits { | |
| 71 | + max-height: none; | |
| 72 | +} | |
| 73 | + | |
| 74 | +// The branches create form opens under the toolbar, right aligned when closed. | |
| 75 | +.lang-list > .list-bar > .new-branch { | |
| 76 | + margin: 0 0 0 auto; | |
| 77 | +} | |
| 78 | + | |
| 79 | +.lang-list > .list-bar > .new-branch[open] { | |
| 80 | + flex-basis: 100%; | |
| 81 | + margin-left: 0; | |
| 82 | +} | |
| 83 | + | |
| 84 | +// Releases: the toolbar holds the heading and the new button, cards stack with hairlines. | |
| 85 | +.lang-list > .release-list-head { | |
| 86 | + justify-content: space-between; | |
| 87 | +} | |
| 88 | + | |
| 89 | +// Forms sit left aligned at 720px, never in a centred page column. | |
| 90 | +.lang-form { | |
| 91 | + max-width: 720px; | |
| 92 | + | |
| 93 | + > h2 { | |
| 94 | + @extend %mono-label; | |
| 95 | + margin: 0 0 12px; | |
| 96 | + } | |
| 97 | +} | |
| 98 | + | |
| 99 | +// The release form was 960px wide; forms are 720px, left aligned. | |
| 100 | +.release-form { | |
| 101 | + max-width: 720px; | |
| 102 | +} | |
| 103 | + | |
| 104 | +// Two panes side by side from 900px: a main pane and a side pane (380px). A list first when the | |
| 105 | +// left pane is a list. A lone pane takes the whole row. | |
| 106 | +.lang-split { | |
| 107 | + display: grid; | |
| 108 | + gap: 16px; | |
| 109 | + align-items: stretch; | |
| 110 | + | |
| 111 | + > * { | |
| 112 | + min-width: 0; | |
| 113 | + } | |
| 114 | +} | |
| 115 | + | |
| 116 | +.lang-pane { | |
| 117 | + padding: 16px; | |
| 118 | + background: var(--surface); | |
| 119 | + border-radius: var(--radius-lg); | |
| 120 | + box-shadow: inset 0 0 0 1px var(--border); | |
| 121 | + | |
| 122 | + > h2 { | |
| 123 | + @extend %mono-label; | |
| 124 | + margin: 0 0 12px; | |
| 125 | + } | |
| 126 | + | |
| 127 | + // A second section in the same pane (edit page: assets, then delete) gets room above it. | |
| 128 | + > h2:not(:first-child) { | |
| 129 | + margin-top: 24px; | |
| 130 | + } | |
| 131 | +} | |
| 132 | + | |
| 133 | +// The create form beside a list: a section heading in the same label style. | |
| 134 | +.lang-side > h2 { | |
| 135 | + @extend %mono-label; | |
| 136 | + margin: 0 0 12px; | |
| 137 | +} | |
| 138 | + | |
| 139 | +@media (min-width: 900px) { | |
| 140 | + .lang-split { | |
| 141 | + grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); | |
| 142 | + } | |
| 143 | + | |
| 144 | + .lang-split.is-list { | |
| 145 | + grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); | |
| 146 | + } | |
| 147 | + | |
| 148 | + .lang-split > .lang-pane.fit-pane, | |
| 149 | + .lang-split > .lang-list.fit-pane { | |
| 150 | + height: max(360px, calc(100dvh - var(--pane-top, 288px) - var(--pane-foot, 78px))); | |
| 151 | + } | |
| 152 | + | |
| 153 | + .lang-split > .lang-pane:only-child { | |
| 154 | + grid-column: 1 / -1; | |
| 155 | + } | |
| 156 | +} | |
| 157 | + | |
| 158 | +// Compare: the detail pane holds the open-request form and the diff, and scrolls inside itself. | |
| 159 | +.compare-open { | |
| 160 | + max-width: 720px; | |
| 161 | + margin-bottom: 16px; | |
| 162 | + | |
| 163 | + > h2 { | |
| 164 | + @extend %mono-label; | |
| 165 | + margin: 0 0 12px; | |
| 166 | + } | |
| 167 | +} | |
| 168 | + | |
| 169 | +// Security: the toolbar holds the heading and the counts; the alerts table scrolls below it. | |
| 170 | +.lang-list > .list-bar > .muted { | |
| 171 | + margin: 0; | |
| 172 | +} | |
| 173 | + | |
| 174 | +// Branches table and tags table fill the pane width; the action column sits at the right. | |
| 175 | +.lang-list .branch-table { | |
| 176 | + width: 100%; | |
| 177 | +} | |
| 178 | + | |
| 179 | +.lang-list .branch-actions { | |
| 180 | + text-align: right; | |
| 181 | +} |
style/_lang_people.scssadded+152 -0
| @@ -0,0 +1,152 @@ | ||
| 1 | +// Page language for the profile, organization, list and form pages (memory design/LANGUAGE.md). | |
| 2 | +// Imported after _language.scss. Tokens only, so both themes follow main.scss. | |
| 3 | + | |
| 4 | +// Forms are left aligned at 720px: no page column is centred, and the help sits beside the form. | |
| 5 | +.newrepo-form { | |
| 6 | + max-width: 720px; | |
| 7 | +} | |
| 8 | + | |
| 9 | +.newrepo-head { | |
| 10 | + text-align: left; | |
| 11 | +} | |
| 12 | + | |
| 13 | +// The import pages' tab strip and cards run to the width of the page, not 960px. | |
| 14 | +.import-tabs, | |
| 15 | +.import-tabs + .alert, | |
| 16 | +.import-recent, | |
| 17 | +.import-job, | |
| 18 | +.export-page { | |
| 19 | + max-width: none; | |
| 20 | +} | |
| 21 | + | |
| 22 | +// New organization: the form is left aligned at 720px, not a centred 440px card. | |
| 23 | +.org-new { | |
| 24 | + max-width: 720px; | |
| 25 | +} | |
| 26 | + | |
| 27 | +// Organization pages: the name and the description share the head row. | |
| 28 | +.org-head .org-head-text { | |
| 29 | + display: flex; | |
| 30 | + flex-wrap: wrap; | |
| 31 | + align-items: baseline; | |
| 32 | + gap: 4px 16px; | |
| 33 | + | |
| 34 | + p { | |
| 35 | + margin: 0; | |
| 36 | + } | |
| 37 | +} | |
| 38 | + | |
| 39 | +// A list page's pane: one surface, the rows full width, hairlines between them. | |
| 40 | +.list-pane { | |
| 41 | + padding: 4px 16px; | |
| 42 | +} | |
| 43 | + | |
| 44 | +// The head's side note (Explore's intro): a small line at the right, out of the h1's row flow. | |
| 45 | +@media (min-width: 900px) { | |
| 46 | + .page-head > .page-note { | |
| 47 | + flex: 0 1 auto; | |
| 48 | + margin: 0 0 0 auto; | |
| 49 | + text-align: right; | |
| 50 | + } | |
| 51 | +} | |
| 52 | + | |
| 53 | +// Home: the name, the tagline and the buttons share the head row. | |
| 54 | +.home-head .actions { | |
| 55 | + margin: 0; | |
| 56 | +} | |
| 57 | + | |
| 58 | +// Needs you: sections are columns on a wide window. One section takes the whole width. | |
| 59 | +@media (min-width: 900px) { | |
| 60 | + .needs-grid { | |
| 61 | + grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); | |
| 62 | + } | |
| 63 | +} | |
| 64 | + | |
| 65 | +// Review requests: wide rows with the metadata at the right, not stacked under the title. | |
| 66 | +@media (min-width: 900px) { | |
| 67 | + .review-request-list li { | |
| 68 | + display: grid; | |
| 69 | + grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) minmax(0, 12rem) 9rem; | |
| 70 | + align-items: center; | |
| 71 | + gap: 0 16px; | |
| 72 | + padding: 10px 0; | |
| 73 | + border-bottom: 1px solid var(--border); | |
| 74 | + | |
| 75 | + &:last-child { | |
| 76 | + border-bottom: 0; | |
| 77 | + } | |
| 78 | + } | |
| 79 | +} | |
| 80 | + | |
| 81 | +// Profile: a left pane (avatar, name, bio, local time, buttons) about 300px wide, and a right pane | |
| 82 | +// with the tabs and the content, which takes the rest of the width. Below 900px the page stacks. | |
| 83 | +@media (min-width: 900px) { | |
| 84 | + .profile-page { | |
| 85 | + position: relative; | |
| 86 | + min-height: 340px; | |
| 87 | + padding-left: 324px; | |
| 88 | + | |
| 89 | + > * { | |
| 90 | + min-width: 0; | |
| 91 | + } | |
| 92 | + | |
| 93 | + > * + *, | |
| 94 | + > .profile-overview > * + * { | |
| 95 | + margin-top: 16px; | |
| 96 | + } | |
| 97 | + | |
| 98 | + > :nth-child(2) { | |
| 99 | + margin-top: 0; | |
| 100 | + } | |
| 101 | + | |
| 102 | + > .profile-head { | |
| 103 | + position: absolute; | |
| 104 | + top: 0; | |
| 105 | + left: 0; | |
| 106 | + box-sizing: border-box; | |
| 107 | + width: 300px; | |
| 108 | + flex-direction: column; | |
| 109 | + align-items: flex-start; | |
| 110 | + flex-wrap: nowrap; | |
| 111 | + gap: 12px; | |
| 112 | + padding: 20px; | |
| 113 | + background: var(--surface); | |
| 114 | + border: 1px solid var(--border); | |
| 115 | + border-radius: var(--radius-lg); | |
| 116 | + } | |
| 117 | + | |
| 118 | + .profile-head .profile-about { | |
| 119 | + padding: 0; | |
| 120 | + background: none; | |
| 121 | + border: 0; | |
| 122 | + } | |
| 123 | + | |
| 124 | + .profile-head .profile-avatar { | |
| 125 | + width: 160px; | |
| 126 | + height: 160px; | |
| 127 | + } | |
| 128 | + | |
| 129 | + .profile-head .profile-org-actions { | |
| 130 | + margin-top: 0; | |
| 131 | + } | |
| 132 | + } | |
| 133 | +} | |
| 134 | + | |
| 135 | +// The profile's tab row sits where every other page's head row sits. | |
| 136 | +@media (min-width: 900px) { | |
| 137 | + .profile-page > .profile-tabs, | |
| 138 | + .profile-page > nav { | |
| 139 | + margin-top: -8px; | |
| 140 | + } | |
| 141 | +} | |
| 142 | + | |
| 143 | +// Profile section titles are labels, like every section under a head. | |
| 144 | +.profile-section-head h2 { | |
| 145 | + margin: 0; | |
| 146 | + color: var(--muted); | |
| 147 | + font-family: var(--mono); | |
| 148 | + font-size: 12px; | |
| 149 | + font-weight: 500; | |
| 150 | + letter-spacing: 0.08em; | |
| 151 | + text-transform: uppercase; | |
| 152 | +} |
style/_language.scssadded+16 -0
| @@ -0,0 +1,16 @@ | ||
| 1 | +// The page language shared by every page (see the head rules): one head row of one height with one | |
| 2 | +// rule under it, so nothing jumps between pages. Imported after the page partials. | |
| 3 | +@media (min-width: 900px) { | |
| 4 | + .page-head { | |
| 5 | + align-items: center; | |
| 6 | + min-height: 40px; | |
| 7 | + margin-bottom: 16px; | |
| 8 | + border-bottom: 1px solid var(--border); | |
| 9 | + | |
| 10 | + h1 { | |
| 11 | + margin: 0; | |
| 12 | + font-size: 20px; | |
| 13 | + line-height: 1.2; | |
| 14 | + } | |
| 15 | + } | |
| 16 | +} |
style/_look.scssmodified+0 -1
| @@ -22,7 +22,6 @@ h1 { | ||
| 22 | 22 | |
| 23 | 23 | .repo-title, |
| 24 | 24 | .issue-heading, |
| 25 | -.ci-run-title, | |
| 26 | 25 | .import-job-title { |
| 27 | 26 | font-family: var(--display); |
| 28 | 27 | font-weight: 700; |
style/_pull.scssmodified+5 -0
| @@ -461,6 +461,11 @@ | ||
| 461 | 461 | font-size: 13.5px; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | +// Inside a pane the pane scrolls, not the page, so the header sticks to the pane's own top edge. | |
| 465 | +.fit-pane .diff-file-header { | |
| 466 | + top: 0; | |
| 467 | +} | |
| 468 | + | |
| 464 | 469 | // Path on the left; status and counts grouped on the right. |
| 465 | 470 | .diff-path { |
| 466 | 471 | min-width: 0; |
style/_repo.scssmodified+2 -5
| @@ -263,10 +263,6 @@ | ||
| 263 | 263 | |
| 264 | 264 | // The repo home takes the whole width of the page column instead of the 1280px other pages keep: |
| 265 | 265 | // the README gets the room the tree column leaves. |
| 266 | -.shell-body > main:has(.repo-home) { | |
| 267 | - max-width: none; | |
| 268 | -} | |
| 269 | - | |
| 270 | 266 | .repo-home { |
| 271 | 267 | // The grid fills the window below the repo header and above the footer, so the page does not |
| 272 | 268 | // scroll; each column scrolls on its own. nav.js measures both ends (syncShellTop). |
| @@ -361,7 +357,8 @@ | ||
| 361 | 357 | |
| 362 | 358 | // Lines stay a readable length however wide the column gets; the scroll area keeps the width. |
| 363 | 359 | .markdown-body > * { |
| 364 | - max-width: 900px; | |
| 360 | + max-width: 860px; | |
| 361 | + margin-inline: auto; | |
| 365 | 362 | } |
| 366 | 363 | } |
| 367 | 364 |
style/_shell.scssmodified+3 -4
| @@ -1089,9 +1089,8 @@ button.corner-link.link-button { | ||
| 1089 | 1089 | box-sizing: border-box; |
| 1090 | 1090 | width: 100%; |
| 1091 | 1091 | min-width: 0; |
| 1092 | - max-width: 1280px; | |
| 1093 | - margin: 0 auto; | |
| 1094 | - padding: 24px 16px 24px; | |
| 1092 | + margin: 0; | |
| 1093 | + padding: 20px 16px 24px; | |
| 1095 | 1094 | } |
| 1096 | 1095 | |
| 1097 | 1096 | .site-footer { |
| @@ -1171,7 +1170,7 @@ body[data-signed-in] .shell:not(:has(> .shell-sidebar)) .site-footer { | ||
| 1171 | 1170 | |
| 1172 | 1171 | @media (min-width: 700px) { |
| 1173 | 1172 | .shell-body > main { |
| 1174 | - padding: 28px 28px 24px; | |
| 1173 | + padding: 20px 28px 24px; | |
| 1175 | 1174 | } |
| 1176 | 1175 | |
| 1177 | 1176 | .site-footer { |
style/_timeline.scssmodified+63 -45
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | // history strip itself. The dock is always shown under the panes; the panes give it room. |
| 3 | 3 | |
| 4 | 4 | :root { |
| 5 | - --dock-h: 150px; | |
| 5 | + --dock-h: 52px; | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | // The panes fill the window above the dock: the dock's height comes off the pane height that |
| @@ -94,26 +94,44 @@ body:has(.repo-home) .site-footer { | ||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -// The search entry stays on one line beside Go to file. | |
| 97 | +// Search code is in the palette and the path bar's search; the toolbar keeps the branch, Go to file | |
| 98 | +// and Clone. | |
| 98 | 99 | .repo-home .repo-search-link { |
| 99 | - flex: none; | |
| 100 | - white-space: nowrap; | |
| 100 | + display: none; | |
| 101 | +} | |
| 102 | + | |
| 103 | +// The tree column is name and age; the commit subject column comes back when the pane is dragged | |
| 104 | +// wide enough to read it. | |
| 105 | +.repo-home .repo-main { | |
| 106 | + container-type: inline-size; | |
| 107 | +} | |
| 108 | + | |
| 109 | +@container (max-width: 639px) { | |
| 110 | + .tree-table th:nth-child(2), | |
| 111 | + .tree-table .tree-commit { | |
| 112 | + display: none; | |
| 113 | + } | |
| 114 | +} | |
| 115 | + | |
| 116 | +// The README pane has one header row: its file name, with the licence, size and top language laid | |
| 117 | +// over the right end of that row. | |
| 118 | +.repo-readme { | |
| 119 | + position: relative; | |
| 101 | 120 | } |
| 102 | 121 | |
| 103 | -// The README pane's header: the licence, size and top language at the right end. | |
| 104 | 122 | .readme-head { |
| 123 | + position: absolute; | |
| 124 | + top: 0; | |
| 125 | + right: 0; | |
| 126 | + z-index: 1; | |
| 105 | 127 | display: flex; |
| 106 | - justify-content: flex-end; | |
| 107 | 128 | align-items: center; |
| 108 | - flex: none; | |
| 109 | - min-height: 36px; | |
| 129 | + height: 36px; | |
| 110 | 130 | padding: 0 14px; |
| 111 | - border-bottom: 1px solid var(--border); | |
| 112 | 131 | font-family: var(--mono); |
| 113 | 132 | font-size: 12px; |
| 114 | 133 | color: var(--muted); |
| 115 | 134 | white-space: nowrap; |
| 116 | - overflow: hidden; | |
| 117 | 135 | } |
| 118 | 136 | |
| 119 | 137 | // The tree pane's latest commit: one line, the subject first, then the short sha and the age. |
| @@ -136,20 +154,27 @@ body:has(.repo-home) .site-footer { | ||
| 136 | 154 | display: none; |
| 137 | 155 | } |
| 138 | 156 | |
| 157 | + // Only the avatar: the column has no room for the name beside the subject. | |
| 139 | 158 | .latest-author { |
| 140 | - max-width: 9rem; | |
| 141 | - overflow: hidden; | |
| 142 | - white-space: nowrap; | |
| 159 | + flex: none; | |
| 160 | + | |
| 161 | + > a, | |
| 162 | + > span:not(.avatar) { | |
| 163 | + display: none; | |
| 164 | + } | |
| 143 | 165 | } |
| 144 | 166 | } |
| 145 | 167 | |
| 168 | +// One thin row at the foot of the page: the newest CI run at the left, clear of the floating profile | |
| 169 | +// panel, then the commit strip, then the commit count and All runs. | |
| 146 | 170 | .repo-dock { |
| 147 | 171 | display: flex; |
| 148 | - flex-direction: column; | |
| 149 | - gap: 12px; | |
| 172 | + align-items: center; | |
| 173 | + gap: 16px; | |
| 174 | + box-sizing: border-box; | |
| 150 | 175 | height: var(--dock-h); |
| 151 | 176 | margin-top: 12px; |
| 152 | - padding: 14px 16px; | |
| 177 | + padding: 0 16px 0 260px; | |
| 153 | 178 | min-width: 0; |
| 154 | 179 | overflow: hidden; |
| 155 | 180 | background: var(--surface); |
| @@ -158,25 +183,13 @@ body:has(.repo-home) .site-footer { | ||
| 158 | 183 | font-size: 13px; |
| 159 | 184 | } |
| 160 | 185 | |
| 161 | -// The CI line: the run's dot, number, state, sha and subject, with the commit count and All runs | |
| 162 | -// at the right end. The subject takes the free width and truncates. | |
| 186 | +// The CI words: the run's dot, number, state and sha, then the strip, then the count and All runs. | |
| 163 | 187 | .dock-info { |
| 164 | - display: flex; | |
| 165 | - align-items: center; | |
| 166 | - gap: 10px; | |
| 167 | - min-width: 0; | |
| 168 | - height: 28px; | |
| 169 | - white-space: nowrap; | |
| 188 | + display: contents; | |
| 170 | 189 | |
| 171 | 190 | > * { |
| 172 | 191 | flex: none; |
| 173 | - } | |
| 174 | - | |
| 175 | - .dock-subject { | |
| 176 | - flex: 1 1 auto; | |
| 177 | - min-width: 0; | |
| 178 | - overflow: hidden; | |
| 179 | - text-overflow: ellipsis; | |
| 192 | + white-space: nowrap; | |
| 180 | 193 | } |
| 181 | 194 | |
| 182 | 195 | .dock-run { |
| @@ -192,40 +205,45 @@ body:has(.repo-home) .site-footer { | ||
| 192 | 205 | color: var(--text-2); |
| 193 | 206 | } |
| 194 | 207 | |
| 208 | + .dock-count, | |
| 209 | + .dock-all { | |
| 210 | + order: 2; | |
| 211 | + } | |
| 212 | + | |
| 195 | 213 | .dock-all { |
| 196 | 214 | font-weight: 600; |
| 197 | 215 | color: var(--text); |
| 198 | 216 | } |
| 199 | 217 | } |
| 200 | 218 | |
| 201 | -// The strip: the label in the left 254px column, which the floating profile panel covers by | |
| 202 | -// default, then the bars. | |
| 219 | +// The strip takes the rest of the row; its label is for screen readers. | |
| 203 | 220 | .dock-history { |
| 221 | + order: 1; | |
| 204 | 222 | display: flex; |
| 205 | - flex: 1 1 auto; | |
| 206 | - min-height: 0; | |
| 223 | + flex: 1 1 0; | |
| 224 | + align-items: flex-end; | |
| 225 | + min-width: 0; | |
| 226 | + height: 100%; | |
| 207 | 227 | } |
| 208 | 228 | |
| 209 | 229 | .history-strip { |
| 210 | - display: grid; | |
| 211 | - grid-template-columns: 254px minmax(0, 1fr); | |
| 212 | - column-gap: 16px; | |
| 213 | - align-items: start; | |
| 230 | + flex: 1 1 auto; | |
| 214 | 231 | min-width: 0; |
| 215 | - width: 100%; | |
| 216 | - min-height: 0; | |
| 217 | 232 | } |
| 218 | 233 | |
| 219 | 234 | .history-label { |
| 220 | - margin: 0; | |
| 221 | - padding-top: 2px; | |
| 235 | + position: absolute; | |
| 236 | + width: 1px; | |
| 237 | + height: 1px; | |
| 238 | + overflow: hidden; | |
| 239 | + clip-path: inset(50%); | |
| 222 | 240 | } |
| 223 | 241 | |
| 224 | 242 | .history-bars { |
| 225 | 243 | display: flex; |
| 226 | 244 | align-items: flex-end; |
| 227 | - gap: 3px; | |
| 228 | - height: 80px; | |
| 245 | + gap: 2px; | |
| 246 | + height: 28px; | |
| 229 | 247 | min-width: 0; |
| 230 | 248 | overflow: hidden; |
| 231 | 249 |
style/_timeline_ci.scssmodified+2 -11
| @@ -307,23 +307,14 @@ | ||
| 307 | 307 | overscroll-behavior: contain; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | -// The dock is the repo page's `.repo-dock` pane (_timeline.scss), without its CI line: the run page | |
| 311 | -// already says that, so the dock is only as tall as the strip. | |
| 312 | -.ci-run { | |
| 313 | - --dock-h: 110px; | |
| 314 | -} | |
| 315 | - | |
| 310 | +// The dock is the repo page's `.repo-dock` pane (_timeline.scss), without its CI words: the run page | |
| 311 | +// already says that. | |
| 316 | 312 | @media (min-width: 900px) { |
| 317 | 313 | .ci-run .repo-dock { |
| 318 | 314 | margin-top: 0; |
| 319 | 315 | } |
| 320 | 316 | } |
| 321 | 317 | |
| 322 | -// The run page takes the whole width of the window, as the repo home does. | |
| 323 | -.shell-body > main:has(.ci-run) { | |
| 324 | - max-width: none; | |
| 325 | -} | |
| 326 | - | |
| 327 | 318 | // Phone and narrow windows: the panes stack and the page grows, as the rest of the site does. |
| 328 | 319 | @media (max-width: 899px) { |
| 329 | 320 | .ci-tl-main { |
style/main.scssmodified+7 -8
| @@ -6370,14 +6370,6 @@ button.ci-stopping { | ||
| 6370 | 6370 | color: var(--muted); |
| 6371 | 6371 | } |
| 6372 | 6372 | |
| 6373 | -.ci-run-title { | |
| 6374 | - margin: 0 0 8px; | |
| 6375 | - font-size: 1.25rem; | |
| 6376 | - font-weight: 600; | |
| 6377 | - letter-spacing: -0.01em; | |
| 6378 | - overflow-wrap: anywhere; | |
| 6379 | -} | |
| 6380 | - | |
| 6381 | 6373 | .ci-run-top { |
| 6382 | 6374 | display: flex; |
| 6383 | 6375 | flex-wrap: wrap; |
| @@ -8068,3 +8060,10 @@ button.ci-job-last { | ||
| 8068 | 8060 | // Last on purpose: the look pass (Archivo titles, mono labels, tone depth, page wash) restyles |
| 8069 | 8061 | // shared classes above it. |
| 8070 | 8062 | @import "look"; |
| 8063 | +@import "language"; | |
| 8064 | +@import "lang_browse"; | |
| 8065 | +@import "lang_people"; | |
| 8066 | +@import "lang_issues"; | |
| 8067 | +@import "lang_ci"; | |
| 8068 | +@import "lang_admin"; | |
| 8069 | +@import "lang_lists"; |