Admin tables stack into labelled cards on phones, and the commit hash stays on one line
Browse files at this commitcf9a9ccd9b85bd92fddb6c21b9b8082fd17fba5aParent: 3d093a6- fix
- admin tables stack into labelled cards on phones, and the commit hash stays on one line
8 changed files +69 -36
- crates/forge-web/src/pages/admin_backups.rs +7 -7
- crates/forge-web/src/pages/admin_mail.rs +9 -9
- crates/forge-web/src/pages/admin_replication.rs +5 -5
- crates/forge-web/src/pages/admin_users.rs +5 -5
- crates/forge-web/src/pages/audit_log.rs +7 -7
- crates/forge-web/src/pages/commit.rs +9 -2
- style/_repo.scss +24 -0
- style/main.scss +3 -1
crates/forge-web/src/pages/admin_backups.rsmodified+7 -7
| @@ -182,7 +182,7 @@ async fn backups_view( | |||
| 182 | <p class="muted">(g::t(lang, K::NoRunsYet))</p> | 182 | <p class="muted">(g::t(lang, K::NoRunsYet))</p> |
| 183 | } else { | 183 | } else { |
| 184 | <div class="table-wrap"> | 184 | <div class="table-wrap"> |
| 185 | - <table class="table"> | 185 | + <table class="table queue-table"> |
| 186 | <thead> | 186 | <thead> |
| 187 | <tr> | 187 | <tr> |
| 188 | <th>(g::t(lang, K::TableKind))</th> | 188 | <th>(g::t(lang, K::TableKind))</th> |
| @@ -196,12 +196,12 @@ async fn backups_view( | |||
| 196 | <tbody> | 196 | <tbody> |
| 197 | for row in rows.into_iter() { | 197 | for row in rows.into_iter() { |
| 198 | <tr> | 198 | <tr> |
| 199 | - <td>(row.kind.as_str())</td> | 199 | + <td data-label=(g::t(lang, K::TableKind))>(row.kind.as_str())</td> |
| 200 | - <td>(row.trigger.as_str())</td> | 200 | + <td data-label=(g::t(lang, K::TableTrigger))>(row.trigger.as_str())</td> |
| 201 | - <td class="small">(row.started.as_str())</td> | 201 | + <td class="small" data-label=(g::t(lang, K::TableStarted))>(row.started.as_str())</td> |
| 202 | - <td class="small">(row.duration.as_str())</td> | 202 | + <td class="small" data-label=(g::t(lang, K::TableDuration))>(row.duration.as_str())</td> |
| 203 | - <td class="small">(row.size.as_str())</td> | 203 | + <td class="small" data-label=(g::t(lang, K::TableSize))>(row.size.as_str())</td> |
| 204 | - <td> | 204 | + <td data-label=(g::t(lang, K::TableResult))> |
| 205 | (row.status.as_str()) | 205 | (row.status.as_str()) |
| 206 | if !row.detail.is_empty() { | 206 | if !row.detail.is_empty() { |
| 207 | <div class="small muted">(row.detail.as_str())</div> | 207 | <div class="small muted">(row.detail.as_str())</div> |
crates/forge-web/src/pages/admin_mail.rsmodified+9 -9
| @@ -299,7 +299,7 @@ async fn mail_view( | |||
| 299 | <p class="muted">(g::t(lang, K::MailNothingMatches))</p> | 299 | <p class="muted">(g::t(lang, K::MailNothingMatches))</p> |
| 300 | } else { | 300 | } else { |
| 301 | <div class="table-wrap"> | 301 | <div class="table-wrap"> |
| 302 | - <table class="table mail-queue"> | 302 | + <table class="table mail-queue queue-table"> |
| 303 | <thead> | 303 | <thead> |
| 304 | <tr> | 304 | <tr> |
| 305 | <th>(g::t(lang, K::TableQueued))</th> | 305 | <th>(g::t(lang, K::TableQueued))</th> |
| @@ -316,14 +316,14 @@ async fn mail_view( | |||
| 316 | <tbody> | 316 | <tbody> |
| 317 | for row in queue.rows.into_iter() { | 317 | for row in queue.rows.into_iter() { |
| 318 | <tr> | 318 | <tr> |
| 319 | - <td class="small">(row.created.as_str())</td> | 319 | + <td class="small" data-label=(g::t(lang, K::TableQueued))>(row.created.as_str())</td> |
| 320 | - <td>(row.to.as_str())</td> | 320 | + <td data-label=(g::t(lang, K::TableTo))>(row.to.as_str())</td> |
| 321 | - <td>(row.kind)</td> | 321 | + <td data-label=(g::t(lang, K::TableKind))>(row.kind)</td> |
| 322 | - <td>(row.subject.as_str())</td> | 322 | + <td data-label=(g::t(lang, K::TableSubject))>(row.subject.as_str())</td> |
| 323 | - <td><span class=(row.state_class)>(row.state)</span></td> | 323 | + <td data-label=(g::t(lang, K::TableState))><span class=(row.state_class)>(row.state)</span></td> |
| 324 | - <td>(row.attempts)</td> | 324 | + <td data-label=(g::t(lang, K::TableTries))>(row.attempts)</td> |
| 325 | - <td class="small">(row.sent.as_str())</td> | 325 | + <td class="small" data-label=(g::t(lang, K::MailSentAt))>(row.sent.as_str())</td> |
| 326 | - <td class="small">(row.error.as_str())</td> | 326 | + <td class="small" data-label=(g::t(lang, K::TableLastError))>(row.error.as_str())</td> |
| 327 | <td class="mail-actions"> | 327 | <td class="mail-actions"> |
| 328 | if row.failed { | 328 | if row.failed { |
| 329 | <form method="post" action="/admin/mail/queue/retry"> | 329 | <form method="post" action="/admin/mail/queue/retry"> |
crates/forge-web/src/pages/admin_replication.rsmodified+5 -5
| @@ -207,7 +207,7 @@ async fn replication_view( | |||
| 207 | <p class="muted">(g::t(lang, K::NoReposYet))</p> | 207 | <p class="muted">(g::t(lang, K::NoReposYet))</p> |
| 208 | } else { | 208 | } else { |
| 209 | <div class="table-wrap"> | 209 | <div class="table-wrap"> |
| 210 | - <table class="table"> | 210 | + <table class="table queue-table"> |
| 211 | <thead> | 211 | <thead> |
| 212 | <tr> | 212 | <tr> |
| 213 | <th>(g::t(lang, K::TableRepo))</th> | 213 | <th>(g::t(lang, K::TableRepo))</th> |
| @@ -219,10 +219,10 @@ async fn replication_view( | |||
| 219 | <tbody> | 219 | <tbody> |
| 220 | for row in data.repos.into_iter() { | 220 | for row in data.repos.into_iter() { |
| 221 | <tr> | 221 | <tr> |
| 222 | - <td>(row.name.as_str())</td> | 222 | + <td data-label=(g::t(lang, K::TableRepo))>(row.name.as_str())</td> |
| 223 | - <td>(row.health)</td> | 223 | + <td data-label=(g::t(lang, K::TableStatus))>(row.health)</td> |
| 224 | - <td class="small">(row.last_ok.as_str())</td> | 224 | + <td class="small" data-label=(g::t(lang, K::LastSuccess))>(row.last_ok.as_str())</td> |
| 225 | - <td class="small">(row.error.as_str())</td> | 225 | + <td class="small" data-label=(g::t(lang, K::TableError))>(row.error.as_str())</td> |
| 226 | </tr> | 226 | </tr> |
| 227 | } | 227 | } |
| 228 | </tbody> | 228 | </tbody> |
crates/forge-web/src/pages/admin_users.rsmodified+5 -5
| @@ -69,23 +69,23 @@ async fn users_view( | |||
| 69 | </section> | 69 | </section> |
| 70 | <section class="card"> | 70 | <section class="card"> |
| 71 | <div class="table-wrap"> | 71 | <div class="table-wrap"> |
| 72 | - <table class="table"> | 72 | + <table class="table queue-table"> |
| 73 | <thead> | 73 | <thead> |
| 74 | <tr><th>(i18n::t(lang, Key::Username))</th><th>(i18n::t(lang, Key::Email))</th><th>(g::t(lang, K::Role))</th><th>(i18n::t(lang, Key::Created))</th><th></th></tr> | 74 | <tr><th>(i18n::t(lang, Key::Username))</th><th>(i18n::t(lang, Key::Email))</th><th>(g::t(lang, K::Role))</th><th>(i18n::t(lang, Key::Created))</th><th></th></tr> |
| 75 | </thead> | 75 | </thead> |
| 76 | <tbody> | 76 | <tbody> |
| 77 | for user in users.into_iter() { | 77 | for user in users.into_iter() { |
| 78 | <tr> | 78 | <tr> |
| 79 | - <td class="nowrap"> | 79 | + <td class="nowrap" data-label=(i18n::t(lang, Key::Username))> |
| 80 | if user.is_org() || is_ghost(&user) { | 80 | if user.is_org() || is_ghost(&user) { |
| 81 | (user.username.clone()) | 81 | (user.username.clone()) |
| 82 | } else { | 82 | } else { |
| 83 | <a href=(format!("/admin/users/{}", enc(&user.id)))>(user.username.clone())</a> | 83 | <a href=(format!("/admin/users/{}", enc(&user.id)))>(user.username.clone())</a> |
| 84 | } | 84 | } |
| 85 | </td> | 85 | </td> |
| 86 | - <td>(user.email.clone().unwrap_or_default())</td> | 86 | + <td data-label=(i18n::t(lang, Key::Email))>(user.email.clone().unwrap_or_default())</td> |
| 87 | - <td>(if user.is_org() { g::t(lang, K::RoleOrganization) } else if user.is_admin { g::t(lang, K::RoleAdmin) } else { g::t(lang, K::RoleUser) })</td> | 87 | + <td data-label=(g::t(lang, K::Role))>(if user.is_org() { g::t(lang, K::RoleOrganization) } else if user.is_admin { g::t(lang, K::RoleAdmin) } else { g::t(lang, K::RoleUser) })</td> |
| 88 | - <td class="small nowrap">(format_in_tz(stamp_unix(&user.created_at), tz))</td> | 88 | + <td class="small nowrap" data-label=(i18n::t(lang, Key::Created))>(format_in_tz(stamp_unix(&user.created_at), tz))</td> |
| 89 | <td> | 89 | <td> |
| 90 | if user.id != viewer_id && !is_ghost(&user) { | 90 | if user.id != viewer_id && !is_ghost(&user) { |
| 91 | <a class="danger" href=(format!("/admin/users/{}/delete", enc(&user.id)))>(i18n::t(lang, Key::Delete))</a> | 91 | <a class="danger" href=(format!("/admin/users/{}/delete", enc(&user.id)))>(i18n::t(lang, Key::Delete))</a> |
crates/forge-web/src/pages/audit_log.rsmodified+7 -7
| @@ -97,7 +97,7 @@ async fn audit_table(lang: Lang, rows: Vec<RowView>, show_actor: bool) -> Result | |||
| 97 | <p class="muted">(g::t(lang, K::NoEntries))</p> | 97 | <p class="muted">(g::t(lang, K::NoEntries))</p> |
| 98 | } else { | 98 | } else { |
| 99 | <div class="table-wrap"> | 99 | <div class="table-wrap"> |
| 100 | - <table class="table audit-table"> | 100 | + <table class="table audit-table queue-table"> |
| 101 | <thead> | 101 | <thead> |
| 102 | <tr> | 102 | <tr> |
| 103 | <th>(g::t(lang, K::TableWhen))</th> | 103 | <th>(g::t(lang, K::TableWhen))</th> |
| @@ -113,14 +113,14 @@ async fn audit_table(lang: Lang, rows: Vec<RowView>, show_actor: bool) -> Result | |||
| 113 | <tbody> | 113 | <tbody> |
| 114 | for row in rows.into_iter() { | 114 | for row in rows.into_iter() { |
| 115 | <tr> | 115 | <tr> |
| 116 | - <td class="small nowrap">(row.when.as_str())</td> | 116 | + <td class="small nowrap" data-label=(g::t(lang, K::TableWhen))>(row.when.as_str())</td> |
| 117 | if show_actor { | 117 | if show_actor { |
| 118 | - <td>(row.actor.as_str())</td> | 118 | + <td data-label=(g::t(lang, K::TableActor))>(row.actor.as_str())</td> |
| 119 | } | 119 | } |
| 120 | - <td><code>(row.action.as_str())</code></td> | 120 | + <td data-label=(g::t(lang, K::ActionLabel))><code>(row.action.as_str())</code></td> |
| 121 | - <td>(row.target.as_str())</td> | 121 | + <td data-label=(g::t(lang, K::TableTarget))>(row.target.as_str())</td> |
| 122 | - <td class="small nowrap">(row.ip.as_str())</td> | 122 | + <td class="small nowrap" data-label="IP">(row.ip.as_str())</td> |
| 123 | - <td class="small">(row.details.as_str())</td> | 123 | + <td class="small" data-label=(g::t(lang, K::TableDetails))>(row.details.as_str())</td> |
| 124 | </tr> | 124 | </tr> |
| 125 | } | 125 | } |
| 126 | </tbody> | 126 | </tbody> |
crates/forge-web/src/pages/commit.rsmodified+9 -2
| @@ -169,6 +169,10 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | |||
| 169 | .get(&full_oid) | 169 | .get(&full_oid) |
| 170 | .map(|badge| SigBadgeView::from_badge(badge, lang)); | 170 | .map(|badge| SigBadgeView::from_badge(badge, lang)); |
| 171 | 171 | ||
| 172 | + let (copy, copied, copy_failed) = match lang { | ||
| 173 | + i18n::Lang::En => ("Copy", "Copied", "Failed"), | ||
| 174 | + i18n::Lang::Tr => ("Kopyala", "Kopyalandı", "Başarısız"), | ||
| 175 | + }; | ||
| 172 | let mut header = ctx.head(state, "commits").await?; | 176 | let mut header = ctx.head(state, "commits").await?; |
| 173 | header.live = ref_live::live_url(&owner_name, &repo_name); | 177 | header.live = ref_live::live_url(&owner_name, &repo_name); |
| 174 | Ok(view! { | 178 | Ok(view! { |
| @@ -177,8 +181,11 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | |||
| 177 | <h2 class="commit-summary-title">(summary.as_str())</h2> | 181 | <h2 class="commit-summary-title">(summary.as_str())</h2> |
| 178 | <p class="muted small"><a href=(repo_href.as_str())>(title.as_str())</a></p> | 182 | <p class="muted small"><a href=(repo_href.as_str())>(title.as_str())</a></p> |
| 179 | <section class="card commit-info"> | 183 | <section class="card commit-info"> |
| 180 | - <p> | 184 | + <p class="commit-full-oid"> |
| 181 | - <code>(full_oid.as_str())</code> | 185 | + <span class="copy-box"> |
| 186 | + <code id="commit-oid" title=(full_oid.as_str())>(full_oid.as_str())</code> | ||
| 187 | + <button type="button" data-copy="commit-oid" data-copied=(copied) data-failed=(copy_failed)>(copy)</button> | ||
| 188 | + </span> | ||
| 182 | if let Some(badge) = sig { | 189 | if let Some(badge) = sig { |
| 183 | <span class=(badge.class) title=(badge.title.as_str())>(badge.label)</span> | 190 | <span class=(badge.class) title=(badge.title.as_str())>(badge.label)</span> |
| 184 | } | 191 | } |
style/_repo.scssmodified+24 -0
| @@ -863,6 +863,30 @@ | |||
| 863 | } | 863 | } |
| 864 | } | 864 | } |
| 865 | 865 | ||
| 866 | +// The full commit hash in its copy box: one line, truncated with an ellipsis when the screen is | ||
| 867 | +// narrow, so the hash never breaks in the middle. The Copy button always copies the whole hash. | ||
| 868 | +.commit-info .commit-full-oid { | ||
| 869 | + display: flex; | ||
| 870 | + flex-wrap: wrap; | ||
| 871 | + align-items: center; | ||
| 872 | + gap: 10px; | ||
| 873 | + min-width: 0; | ||
| 874 | + | ||
| 875 | + .copy-box { | ||
| 876 | + flex: 1 1 auto; | ||
| 877 | + min-width: 0; | ||
| 878 | + margin: 0; | ||
| 879 | + align-items: center; | ||
| 880 | + } | ||
| 881 | + | ||
| 882 | + code { | ||
| 883 | + overflow: hidden; | ||
| 884 | + text-overflow: ellipsis; | ||
| 885 | + white-space: nowrap; | ||
| 886 | + overflow-wrap: normal; | ||
| 887 | + } | ||
| 888 | +} | ||
| 889 | + | ||
| 866 | // Settings forms: every field in a form shares the form width (urls and secrets no longer stop short). | 890 | // Settings forms: every field in a form shares the form width (urls and secrets no longer stop short). |
| 867 | .mirror-form, | 891 | .mirror-form, |
| 868 | .webhook-form { | 892 | .webhook-form { |
style/main.scssmodified+3 -1
| @@ -4534,7 +4534,8 @@ $ansi-colours: ( | |||
| 4534 | } | 4534 | } |
| 4535 | } | 4535 | } |
| 4536 | 4536 | ||
| 4537 | -// Phone: each queue row is a card, every cell a label and value row (the runners' layout). | 4537 | +// Phone: each row of a queue-table (the merge queue and the admin tables) is a card, every cell a |
| 4538 | +// label and value row (the runners' layout). Cells without data-label sit as they are. | ||
| 4538 | @media (max-width: 720px) { | 4539 | @media (max-width: 720px) { |
| 4539 | .queue-table { | 4540 | .queue-table { |
| 4540 | display: block; | 4541 | display: block; |
| @@ -4568,6 +4569,7 @@ $ansi-colours: ( | |||
| 4568 | gap: 12px; | 4569 | gap: 12px; |
| 4569 | min-height: 36px; | 4570 | min-height: 36px; |
| 4570 | min-width: 0; | 4571 | min-width: 0; |
| 4572 | + overflow-wrap: anywhere; | ||
| 4571 | 4573 | ||
| 4572 | &::before { | 4574 | &::before { |
| 4573 | content: attr(data-label); | 4575 | content: attr(data-label); |