diff --git a/crates/forge-web-base/src/i18n/repo_admin.rs b/crates/forge-web-base/src/i18n/repo_admin.rs
index d0f7e13..cb41e0f 100644
--- a/crates/forge-web-base/src/i18n/repo_admin.rs
+++ b/crates/forge-web-base/src/i18n/repo_admin.rs
@@ -174,10 +174,10 @@ pub fn t(lang: Lang, key: K) -> &'static str {
(AlreadyOwner, En) => "The repository already belongs to that user.",
(AlreadyOwner, Tr) => "Depo zaten bu kullanıcıya ait.",
(ApprovalsHelp, En) => {
- "Approvals count only from reviewers with Write access or higher, using each reviewer's latest review."
+ "How many a pull needs, 0 to 20. They count only from reviewers with Write access or higher, using each reviewer's latest review."
}
(ApprovalsHelp, Tr) => {
- "Onaylar yalnızca yazma veya daha yüksek erişimi olan inceleyicilerden, her inceleyicinin en son incelemesine göre sayılır."
+ "Bir çekme isteğinin gereken onay sayısı, 0 ile 20 arası. Onaylar yalnızca yazma veya daha yüksek erişimi olan inceleyicilerden, her inceleyicinin en son incelemesine göre sayılır."
}
(ApprovalsRange, En) => "required approvals must be a whole number from 0 to 20",
(ApprovalsRange, Tr) => "Gerekli onay sayısı 0 ile 20 arasında bir tam sayı olmalıdır.",
@@ -403,8 +403,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
(RequireUpToDate, Tr) => {
"Çekme isteğinin kaynak dalı, hedef dalın en son hâlini içermelidir"
}
- (RequiredApprovals, En) => "Required approvals (0 to 20)",
- (RequiredApprovals, Tr) => "Gerekli onay sayısı (0 ile 20 arası)",
+ (RequiredApprovals, En) => "Approvals",
+ (RequiredApprovals, Tr) => "Onaylar",
(RestrictPushDesc, En) => "Direct pushes are limited to repo admins.",
(RestrictPushTitle, En) => "Only accept changes through pull requests",
(Role, En) => "Role",
diff --git a/crates/forge-web/build.rs b/crates/forge-web/build.rs
index 4cd00ed..98aeb21 100644
--- a/crates/forge-web/build.rs
+++ b/crates/forge-web/build.rs
@@ -122,9 +122,34 @@ fn base_rules(css: &mut String, base: &Base) {
);
}
+/// A base's tint made plain enough to see on a chip: the hue of its muted text, with its
+/// saturation raised five times (at most 55%) at a middle lightness. The neutrals themselves are
+/// too close to grey to tell apart at 30px.
+fn base_tint(hex: &str) -> String {
+ let channel = |i: usize| u8::from_str_radix(&hex[i..i + 2], 16).unwrap_or(0) as f64 / 255.0;
+ let (r, g, b) = (channel(1), channel(3), channel(5));
+ let (max, min) = (r.max(g).max(b), r.min(g).min(b));
+ let l = (max + min) / 2.0;
+ let d = max - min;
+ let (h, s) = if d == 0.0 {
+ (0.0, 0.0)
+ } else {
+ let s = d / (1.0 - (2.0 * l - 1.0).abs());
+ let h = if max == r {
+ ((g - b) / d).rem_euclid(6.0)
+ } else if max == g {
+ (b - r) / d + 2.0
+ } else {
+ (r - g) / d + 4.0
+ };
+ (h * 60.0, s)
+ };
+ format!("hsl({:.0} {:.0}% 52%)", h, (s * 5.0).min(0.55) * 100.0)
+}
+
/// The swatch chips for the settings picker. They show fixed colours, so they do not depend on
-/// the current theme: an accent chip is the accent itself, a base chip is its background and text
-/// split diagonally.
+/// the current theme: an accent chip is the accent itself, a base chip is its background and its
+/// tint split diagonally.
fn swatch_rules(css: &mut String) {
for palette in PALETTES {
css.push_str(&format!(
@@ -139,11 +164,11 @@ fn swatch_rules(css: &mut String) {
for base in BASES {
css.push_str(&format!(
".base-swatch[data-base-light-swatch=\"{}\"] {{ background: linear-gradient(135deg, {} 0 50%, {} 50% 100%); }}\n",
- base.id, base.light.bg, base.light.text
+ base.id, base.light.bg, base_tint(base.light.muted)
));
css.push_str(&format!(
".base-swatch[data-base-dark-swatch=\"{}\"] {{ background: linear-gradient(135deg, {} 0 50%, {} 50% 100%); }}\n",
- base.id, base.dark.bg, base.dark.text
+ base.id, base.dark.bg, base_tint(base.dark.muted)
));
}
}
diff --git a/crates/forge-web/src/pages/admin_health.rs b/crates/forge-web/src/pages/admin_health.rs
index c0222d8..b9f94bf 100644
--- a/crates/forge-web/src/pages/admin_health.rs
+++ b/crates/forge-web/src/pages/admin_health.rs
@@ -496,19 +496,24 @@ async fn health_view(
} = health;
// An active alert needs attention as much as a failing service does.
let attention = attention + count;
- let summary_dot = if attention > 0 { Dot::Bad } else { Dot::Ok };
+ // The verdict leads the head's line, with its dot, so the page says how things are first.
let summary = if attention > 0 {
- needs_attention(lang, attention)
+ SubPart {
+ text: needs_attention(lang, attention),
+ href: None,
+ class: "b health-sum bad",
+ }
} else {
- at(lang, A::Fine).to_owned()
+ SubPart {
+ text: at(lang, A::Fine).to_owned(),
+ href: None,
+ class: "b health-sum ok",
+ }
};
+ let sub = vec![summary, SubPart::text(at(lang, A::HealthIntro))];
Ok(view! {
- head(title: at(lang, A::Health), sub: vec![SubPart::text(at(lang, A::HealthIntro))], live: Some("/admin/health/events"))
-
diff --git a/crates/forge-web/src/pages/admin_runners.rs b/crates/forge-web/src/pages/admin_runners.rs
index dd8b41f..44b111a 100644
--- a/crates/forge-web/src/pages/admin_runners.rs
+++ b/crates/forge-web/src/pages/admin_runners.rs
@@ -1140,8 +1140,9 @@ struct RunnerJobRow {
/// `#` and the run's number.
run_text: String,
state_text: String,
- /// `ci-state ci-`, the class the runs list colours the state with.
- state_class: String,
+ /// The classes of the tick the CI list colours a job's state with: `tick` and `ok`, `bad`, `live`
+ /// or `skip`, or `tick` alone for a waiting job.
+ state_class: &'static str,
/// The run time so far for a running job, the whole run time for a finished one. `-` when unknown.
duration: String,
/// The time from queued to started. `-` when it never started.
@@ -1162,7 +1163,13 @@ fn runner_job_row(lang: Lang, job: &RunnerJob) -> RunnerJobRow {
repo,
run_text: format!("#{}", job.run_number),
state_text: state_text(lang, j.state.as_str()),
- state_class: format!("ci-state ci-{}", j.state.as_str()),
+ state_class: match j.state {
+ JobState::Success => "tick ok",
+ JobState::Failure | JobState::Error => "tick bad",
+ JobState::Running => "tick live",
+ JobState::Cancelled | JobState::Skipped => "tick skip",
+ JobState::Blocked | JobState::Queued => "tick",
+ },
duration: or_dash(duration_text(
lang,
j.started_at.as_deref(),
@@ -1743,7 +1750,7 @@ async fn runner_detail_view(
(s(lang, "Not running any job.", "Hiçbir iş çalıştırmıyor."))
- })
-}
-
-/// The control of one setting, labelled for the viewer, with its hints under it. A switch carries
-/// its own label, and its hints sit under the switch.
-#[component]
-async fn srv_control(lang: Lang, row: &Row, input: &str) -> Result {
- Ok(view! {
-
})
}
-/// What a setting says under its control: its help, its kind, a secret's rule and its override.
+/// What a setting says after its control, one sentence after another: its help, its kind, a
+/// secret's rule and its override.
#[component]
async fn srv_hints(lang: Lang, row: &Row) -> Result {
Ok(view! {
-
+
})
}
@@ -377,16 +417,15 @@ async fn srv_hints(lang: Lang, row: &Row) -> Result {
async fn server_view(
lang: Lang,
csrf: String,
- group: Group,
+ page: &'static SrvPage,
rows: Vec,
q: String,
search: Option>,
notice: Option,
restart: Restart,
) -> Result {
- let tab = group.slug();
+ let tab = page.slug;
let any_editable = rows.iter().any(|r| !r.fixed);
- let blocks = into_blocks(rows);
let search_label = s(lang, "Search server settings", "Sunucu ayarlarında ara");
// A pending restart names the boot id it waits for: the stream then sends at once when a new
// process answers, and the page re-renders.
@@ -397,13 +436,13 @@ async fn server_view(
),
_ => "/admin/server/events".to_owned(),
};
- let items: Vec = Group::ALL
- .into_iter()
- .map(|g_tab| RailItem {
- name: tab_label(lang, g_tab).to_owned(),
+ let items: Vec = PAGES
+ .iter()
+ .map(|item| RailItem {
+ name: item.label(lang).to_owned(),
val: String::new(),
- href: format!("/admin/server?cat={}", g_tab.slug()),
- current: g_tab == group,
+ href: format!("/admin/server?cat={}", item.slug),
+ current: search.is_none() && item.slug == page.slug,
})
.collect();
let sub = vec![
@@ -414,8 +453,14 @@ async fn server_view(
forge_ci::build::display()
)),
];
+ let restart_label = s(lang, "Restart server", "Sunucuyu yeniden başlat");
+ let restart_note = s(lang, "Restart the server now? Requests in flight finish first, and the site is unavailable for a few seconds. Settings marked restart needed take effect, and so does a newly installed binary. Needs a supervisor such as systemd to start it again.", "Sunucu şimdi yeniden başlatılsın mı? Süren istekler önce biter, site birkaç saniye kullanılamaz. \"Yeniden başlatma gerekli\" işaretli ayarlar ve yeni kurulan ikili devreye girer. Yeniden başlatmak için systemd gibi bir gözetmen gerekir.");
Ok(view! {
- head(title: g::t(lang, K::ServerSettings), sub: sub)
+ head(title: g::t(lang, K::ServerSettings), sub: sub,
+ if restart != Restart::Pending {
+ confirm_act(lang: lang, label: restart_label, action: "/admin/server/restart", csrf: csrf.as_str(), fields: vec![("tab".to_owned(), tab.to_owned())], note: Some(restart_note.to_owned()))
+ }
+ )
if restart == Restart::Pending {
(s(lang, "Restarting...", "Yeniden başlatılıyor...")) " " (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."))
@@ -433,7 +478,7 @@ async fn server_view(
)
-
+
if let Some(hits) = search {
(s(lang, "Results", "Sonuçlar"))
@@ -441,53 +486,30 @@ async fn server_view(
(s(lang, "No setting matches.", "Eşleşen ayar yok."))
(s(lang, "Restart server", "Sunucuyu yeniden başlat"))
-
(s(lang, "Stops gracefully and starts again, so a newly installed binary and every setting marked restart needed take effect. Needs a supervisor such as systemd to start it again.", "Düzgünce durdurup yeniden başlatır; böylece yeni kurulan ikili ve \"yeniden başlatma gerekli\" işaretli her ayar devreye girer. Yeniden başlatmak için systemd gibi bir gözetmen gerekir."))
- if restart == Restart::Pending {
-
(s(lang, "A restart is in progress.", "Yeniden başlatma sürüyor."))
- }
- if restart != Restart::Pending {
-
- confirm_act(lang: lang, label: s(lang, "Restart server", "Sunucuyu yeniden başlat"), action: "/admin/server/restart", csrf: csrf.as_str(), fields: vec![("tab".to_owned(), tab.to_owned())], note: Some(s(lang, "Restart the server now? Requests in flight finish first, and the site is unavailable for a few seconds.", "Sunucu şimdi yeniden başlatılsın mı? Süren istekler önce biter, site birkaç saniye kullanılamaz.").to_owned()))
-
- }
-
@@ -500,23 +522,23 @@ async fn server_page(cx: &Cx) -> Result {
let query = query_params::(cx)?;
let state = app_context::(cx);
let lang = i18n::lang(cx, Some(&viewer.0));
- let group = query
+ let page = query
.cat
.as_deref()
.or(query.tab.as_deref())
- .and_then(Group::parse)
- .unwrap_or(Group::General);
+ .and_then(page_by_slug)
+ .unwrap_or(&PAGES[0]);
let q = query.q.clone().unwrap_or_default();
let needle = q.trim().to_lowercase();
let (rows, search) = if needle.is_empty() {
- (rows_for(state, lang, group).await?, None)
+ (rows_for(state, lang, page).await?, None)
} else {
(Vec::new(), Some(search_hits(state, lang, &needle).await?))
};
let csrf = viewer.1.csrf_token.clone();
let title = g::t(lang, K::ServerSettings);
Ok(view! {
- shell(title: title, viewer: Some(&viewer), server_view(lang: lang, csrf: csrf, group: group, rows: rows, q: q, search: search, notice: query.notice.clone(), restart: restart_state(query.restarting.as_deref())))
+ shell(title: title, viewer: Some(&viewer), server_view(lang: lang, csrf: csrf, page: page, rows: rows, q: q, search: search, notice: query.notice.clone(), restart: restart_state(query.restarting.as_deref())))
})
}
@@ -528,15 +550,15 @@ async fn server_save(cx: &Cx, Form(mut form): Form>) ->
}
let lang = i18n::lang(cx, Some(&viewer.0));
let state = app_context::(cx);
- let group = form
+ let page = form
.get("tab")
- .and_then(|t| Group::parse(t))
- .unwrap_or(Group::General);
- // An unchecked box is absent from the post.
- for field in ss::FIELDS
- .iter()
- .filter(|f| f.group == group && f.ty == Ty::Bool && f.kind != Kind::ReadOnly)
- {
+ .and_then(|t| page_by_slug(t))
+ .unwrap_or(&PAGES[0]);
+ let group = page.group;
+ // An unchecked box is absent from the post. Only the page's own switches were on the form.
+ for field in ss::FIELDS.iter().filter(|f| {
+ page.keys.contains(&f.key) && f.ty == Ty::Bool && f.kind != Kind::ReadOnly
+ }) {
form.entry(field.key.to_owned())
.or_insert_with(|| "false".to_owned());
}
@@ -550,7 +572,7 @@ async fn server_save(cx: &Cx, Form(mut form): Form>) ->
};
Err(see_other(format!(
"/admin/server?cat={}¬ice={}",
- group.slug(),
+ page.slug,
enc(¬ice)
))
.into())
@@ -874,10 +896,10 @@ mod tests {
assert_eq!(fx.state.live().ci.max_log_mb, 16);
// A read-only field is shown but cannot be posted.
- let page = admin_get(&fx, "/admin/server?tab=general").await;
+ let page = admin_get(&fx, "/admin/server?tab=addresses").await;
assert!(page.contains("127.0.0.1:7660"));
assert!(!page.contains("name=\"listen\""));
- save(&fx, "general", "listen=0.0.0.0%3A1").await;
+ save(&fx, "addresses", "listen=0.0.0.0%3A1").await;
assert!(fx.state.store.server_overrides().await.unwrap().is_empty());
// Out-of-range, wrong-kind and unknown-storage values are rejected, and nothing is stored.
@@ -945,7 +967,7 @@ mod tests {
let fx = fixture().await;
// A restart field is stored, the live value stays, and the page says so.
- save(&fx, "general", "base_url=https%3A%2F%2Fnew.example").await;
+ save(&fx, "addresses", "base_url=https%3A%2F%2Fnew.example").await;
assert_eq!(
fx.state
.store
@@ -957,7 +979,7 @@ mod tests {
Some("https://new.example")
);
assert_eq!(fx.state.live().base_url, "https://forge.test/");
- let page = admin_get(&fx, "/admin/server?tab=general").await;
+ let page = admin_get(&fx, "/admin/server?tab=addresses").await;
assert!(page.contains("restart needed"));
assert!(page.contains("https://new.example"));
diff --git a/crates/forge-web/src/pages/admin_users.rs b/crates/forge-web/src/pages/admin_users.rs
index 3861dba..4a89883 100644
--- a/crates/forge-web/src/pages/admin_users.rs
+++ b/crates/forge-web/src/pages/admin_users.rs
@@ -208,7 +208,7 @@ async fn users_view(
let (links, prev, next) = pager_links(page, pages, |n| users_href(&q, kind, n));
let empty = rows.is_empty();
let open = error.is_some();
- let search_label = s(lang, "Search users", "Kullanıcılarda ara");
+ let search_label = s(lang, "Search users and organizations", "Kullanıcı ve kuruluşlarda ara");
let filter_label = s(lang, "Filter", "Filtre");
let all_label = format!("{} {}", s(lang, "All", "Tümü"), all_count);
let people_label = format!(
diff --git a/crates/forge-web/src/pages/blame.rs b/crates/forge-web/src/pages/blame.rs
index b237791..d402343 100644
--- a/crates/forge-web/src/pages/blame.rs
+++ b/crates/forge-web/src/pages/blame.rs
@@ -197,6 +197,16 @@ async fn blame_page(cx: &Cx) -> Result {
"blob",
&format!("{ref_name}/{file}"),
);
+ // Blame sits beside the file's source: a markdown file's plain view, any other file's own page.
+ let markdown = matches!(
+ file_name.rsplit_once('.').map(|(_, ext)| ext.to_ascii_lowercase()).as_deref(),
+ Some("md" | "markdown")
+ );
+ let source_href = if markdown {
+ format!("{blob_href}?plain=1")
+ } else {
+ blob_href.clone()
+ };
let history = repo_href(
&repo.owner_name,
&repo.name,
@@ -227,7 +237,10 @@ async fn blame_page(cx: &Cx) -> Result {
(crate::pages::passkeys::s(lang, "bar height is lines changed", "çubuk yüksekliği değişen satır sayısıdır"))
+
(crate::pages::passkeys::s(lang, "a bar's height is its lines changed, its colour its CI result", "çubuğun yüksekliği değişen satır sayısı, rengi CI sonucudur"))
(crate::pages::passkeys::s(lang, "bar height is lines changed", "çubuk yüksekliği değişen satır sayısıdır"))
+
(crate::pages::passkeys::s(lang, "a bar's height is its lines changed, its colour its CI result", "çubuğun yüksekliği değişen satır sayısı, rengi CI sonucudur"))