forge
Explore
Log in

Don't you dare go Hollow

iz-web: cached family probes, per-page titles, casing-in-CSS, width unify

Browse files at this commit

6b832791b9bb94aa4f34b098674bfe9421178188Ahmet Kaan GümüşParent: 7a08c56
- health.rs: shared LazyLock reqwest client + 30s TTL probe_family cache;
  unit test proves cache-hit path; switcher test made hermetic (dead ports)
- per-page translated <title> from request path; soft-nav swap updates
  document.title (family parity with in)
- i18n: ~40 ALL-CAPS label strings normalized to normal case; uppercase now
  via CSS text-transform at .detail-label/.field-label/.member-table th/
  .person-field dt; rules.rs placeholder via new SubjectPlaceholder key
- admin pages unified on plain .settings-stage; dead .stage-wide rule deleted
- detail.rs: mail_rule dedupe per distinct rule (columns_cache pattern)
- server.rs: message_in doc corrected; health.rs escape() maps ';
  avatar/files header unwraps -> fallbacks
crates/iz-web/src/avatar.rsmodified+6 -1
@@ -68,7 +68,12 @@ async fn avatar(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {
68 // means a stale row, never a lie about freshness.68 // means a stale row, never a lie about freshness.
69 let etag = format!("\"p{}\"", row.photo_version);69 let etag = format!("\"p{}\"", row.photo_version);
70 let mut headers = HeaderMap::new();70 let mut headers = HeaderMap::new();
71- headers.insert(header::ETAG, HeaderValue::from_str(&etag).unwrap());71+ // A u64 version formats to ASCII, so the fallback never fires; an
72+ // unreadable etag means revalidation, never a wrong face.
73+ headers.insert(
74+ header::ETAG,
75+ HeaderValue::from_str(&etag).unwrap_or(HeaderValue::from_static("\"p0\"")),
76+ );
72 // A `?v` that agrees with the row means this exact face is pinned to a77 // A `?v` that agrees with the row means this exact face is pinned to a
73 // URL that changes the day the face does, so the browser may keep it78 // URL that changes the day the face does, so the browser may keep it
74 // for a year. Every other spelling — including no stamp at all —79 // for a year. Every other spelling — including no stamp at all —
crates/iz-web/src/detail.rsmodified+12 -1
@@ -367,9 +367,20 @@ async fn load_snapshot(
367 let sends = store.sends_for_task(&detail.id, 50).await?;367 let sends = store.sends_for_task(&detail.id, 50).await?;
368 let mut columns_cache: std::collections::HashMap<String, Vec<iz_core::board::Column>> =368 let mut columns_cache: std::collections::HashMap<String, Vec<iz_core::board::Column>> =
369 std::collections::HashMap::new();369 std::collections::HashMap::new();
370+ let mut rules_cache: std::collections::HashMap<String, Option<iz_core::store::MailRule>> =
371+ std::collections::HashMap::new();
370 let mut notifications = Vec::with_capacity(decisions.len());372 let mut notifications = Vec::with_capacity(decisions.len());
371 for decision in decisions {373 for decision in decisions {
372- let rule = store.mail_rule(&decision.rule_id).await?;374+ // One read per rule, not per decision: a rule that decided ten
375+ // mails is ten decisions naming the same sentence.
376+ let rule = match rules_cache.get(decision.rule_id.as_str()) {
377+ Some(rule) => rule,
378+ None => {
379+ let rule = store.mail_rule(&decision.rule_id).await?;
380+ rules_cache.insert(decision.rule_id.clone(), rule);
381+ rules_cache.get(decision.rule_id.as_str()).expect("just inserted")
382+ }
383+ };
373 let rule_name = may_administer.then(|| {384 let rule_name = may_administer.then(|| {
374 rule.as_ref()385 rule.as_ref()
375 .map(|rule| rule.subject.clone())386 .map(|rule| rule.subject.clone())
crates/iz-web/src/files.rsmodified+4 -2
@@ -590,14 +590,16 @@ async fn download(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)>
590 let slice = bytes[start as usize..=end as usize].to_vec();590 let slice = bytes[start as usize..=end as usize].to_vec();
591 headers.insert(591 headers.insert(
592 header::CONTENT_RANGE,592 header::CONTENT_RANGE,
593- HeaderValue::from_str(&format!("bytes {start}-{end}/{total}")).unwrap(),593+ HeaderValue::from_str(&format!("bytes {start}-{end}/{total}"))
594+ .unwrap_or(HeaderValue::from_static("bytes */0")),
594 );595 );
595 Ok((StatusCode::PARTIAL_CONTENT, headers, slice))596 Ok((StatusCode::PARTIAL_CONTENT, headers, slice))
596 }597 }
597 Some(Err(())) => {598 Some(Err(())) => {
598 headers.insert(599 headers.insert(
599 header::CONTENT_RANGE,600 header::CONTENT_RANGE,
600- HeaderValue::from_str(&format!("bytes */{total}")).unwrap(),601+ HeaderValue::from_str(&format!("bytes */{total}"))
602+ .unwrap_or(HeaderValue::from_static("bytes */0")),
601 );603 );
602 Ok((StatusCode::RANGE_NOT_SATISFIABLE, headers, Vec::new()))604 Ok((StatusCode::RANGE_NOT_SATISFIABLE, headers, Vec::new()))
603 }605 }
crates/iz-web/src/health.rsmodified+106 -5
@@ -1,15 +1,18 @@
1 //! The one family-health probe, ported from im's `health.rs`: a sibling is1 //! The one family-health probe, ported from im's `health.rs`: a sibling is
2 //! asked `GET {url}/healthz` where it stands — no credentials, two seconds2 //! asked `GET {url}/healthz` where it stands — no credentials, two seconds
3-//! to answer — and the callers fan the probes out concurrently, so a family3+//! to answer — and [`probe_family`] fans the probes out concurrently, so a
4-//! member that is down costs its two seconds, not two seconds each. iz has4+//! family member that is down costs its two seconds, not two seconds each.
5-//! no admin health table: the wordmark's flyout is the only reader, so the5+//! The readings are cached for [`PROBE_TTL`], so a page render inside the
6-//! probe's body and latency ride the enum ([`Probe::Up`]) but only the6+//! window reuses the last round instead of stalling on every sibling
7-//! on/off dot ever renders.7+//! again. iz has no admin health table: the wordmark's flyout is the only
8+//! reader, so the probe's body and latency ride the enum ([`Probe::Up`])
9+//! but only the on/off dot ever renders.
8 10
9 /// One `/healthz` reading. `Up` carries the body — the deploy contract's11 /// One `/healthz` reading. `Up` carries the body — the deploy contract's
10 /// `ok <build sha>` — and the answer's latency; everything else, refused12 /// `ok <build sha>` — and the answer's latency; everything else, refused
11 /// or wrong status or a body that does not begin ok or the two-second13 /// or wrong status or a body that does not begin ok or the two-second
12 /// ceiling, is `Down`.14 /// ceiling, is `Down`.
15+#[derive(Clone)]
13 pub enum Probe {16 pub enum Probe {
14 Up { body: String, ms: u128 },17 Up { body: String, ms: u128 },
15 Down,18 Down,
@@ -40,6 +43,52 @@ pub async fn probe_healthz(http: &reqwest::Client, url: &str) -> Probe {
40 }43 }
41 }44 }
42 45
46+/// One shared client for the app's lifetime: a fresh pool per render would
47+/// tear down and re-handshake every socket it touched.
48+static PROBE_HTTP: std::sync::LazyLock<reqwest::Client> =
49+ std::sync::LazyLock::new(reqwest::Client::new);
50+
51+/// The last family-wide round of readings and when it landed, keyed by the
52+/// probed urls: a family that changed shape misses the cache and probes
53+/// fresh instead of wearing a stranger's dot.
54+static PROBES: parking_lot::Mutex<Option<(std::time::Instant, Vec<(String, Probe)>)>> =
55+ parking_lot::Mutex::new(None);
56+
57+/// How long one round of readings stands in for the live siblings.
58+const PROBE_TTL: std::time::Duration = std::time::Duration::from_secs(30);
59+
60+/// Every url probed at once — a family member that is down costs its two
61+/// seconds, not two seconds each — but at most one round per [`PROBE_TTL`]:
62+/// a render inside the window reuses the last reading instead of stalling
63+/// on every sibling again.
64+pub(crate) async fn probe_family(urls: Vec<String>) -> Vec<Probe> {
65+ {
66+ let cache = PROBES.lock();
67+ if let Some((at, readings)) = cache.as_ref() {
68+ let same = readings
69+ .iter()
70+ .map(|(url, _)| url.as_str())
71+ .eq(urls.iter().map(String::as_str));
72+ if at.elapsed() < PROBE_TTL && same {
73+ return readings.iter().map(|(_, probe)| probe.clone()).collect();
74+ }
75+ }
76+ }
77+ let mut probes = Vec::new();
78+ for url in &urls {
79+ let http = PROBE_HTTP.clone();
80+ let url = url.clone();
81+ probes.push(tokio::spawn(async move { probe_healthz(&http, &url).await }));
82+ }
83+ let mut readings: Vec<(String, Probe)> = Vec::with_capacity(urls.len());
84+ for (url, probe) in urls.into_iter().zip(probes) {
85+ let probe = probe.await.unwrap_or(Probe::Down);
86+ readings.push((url, probe));
87+ }
88+ *PROBES.lock() = Some((std::time::Instant::now(), readings.clone()));
89+ readings.into_iter().map(|(_, probe)| probe).collect()
90+}
91+
43 /// The flyout's marks as final HTML, pure over resolved probes: this app's92 /// The flyout's marks as final HTML, pure over resolved probes: this app's
44 /// own row filtered out, every sibling a plain link carrying its probe's93 /// own row filtered out, every sibling a plain link carrying its probe's
45 /// dot — `health-on` while it answers `ok`, `health-off` while it does not94 /// dot — `health-on` while it answers `ok`, `health-off` while it does not
@@ -77,4 +126,56 @@ fn escape(raw: &str) -> String {
77 .replace('<', "&lt;")126 .replace('<', "&lt;")
78 .replace('>', "&gt;")127 .replace('>', "&gt;")
79 .replace('"', "&quot;")128 .replace('"', "&quot;")
129+ .replace('\'', "&#39;")
130+}
131+
132+#[cfg(test)]
133+mod tests {
134+ use super::*;
135+
136+ /// The cache is the point of [`probe_family`]: the same family probed
137+ /// twice inside the window dials the sibling once, and a family that
138+ /// changed shape misses the cache and dials the newcomer fresh.
139+ #[tokio::test]
140+ async fn a_render_inside_the_window_reuses_the_last_round() {
141+ use std::sync::Arc;
142+ use std::sync::atomic::{AtomicUsize, Ordering};
143+ use tokio::io::AsyncWriteExt as _;
144+
145+ async fn stand_in() -> (std::net::SocketAddr, Arc<AtomicUsize>) {
146+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
147+ let addr = listener.local_addr().unwrap();
148+ let hits = Arc::new(AtomicUsize::new(0));
149+ let counted = hits.clone();
150+ tokio::spawn(async move {
151+ loop {
152+ let Ok((mut socket, _)) = listener.accept().await else {
153+ break;
154+ };
155+ counted.fetch_add(1, Ordering::SeqCst);
156+ let _ = socket
157+ .write_all(b"HTTP/1.1 200 OK\r\ncontent-length: 2\r\n\r\nok")
158+ .await;
159+ }
160+ });
161+ (addr, hits)
162+ }
163+
164+ let (a, a_hits) = stand_in().await;
165+ let (b, b_hits) = stand_in().await;
166+ let urls = |addr: std::net::SocketAddr| vec![format!("http://{addr}/healthz")];
167+ probe_family(urls(a)).await;
168+ probe_family(urls(a)).await;
169+ assert_eq!(
170+ a_hits.load(Ordering::SeqCst),
171+ 1,
172+ "the second render inside the window dialled the sibling again"
173+ );
174+ probe_family(urls(b)).await;
175+ assert_eq!(
176+ b_hits.load(Ordering::SeqCst),
177+ 1,
178+ "a changed family did not probe the newcomer fresh"
179+ );
180+ }
80 }181 }
crates/iz-web/src/i18n.rsmodified+81 -78
@@ -221,6 +221,7 @@ pub enum Key {
221 SendLabel,221 SendLabel,
222 ToLabel,222 ToLabel,
223 BodyLabel,223 BodyLabel,
224+ SubjectPlaceholder,
224 TaskDetails,225 TaskDetails,
225 AddRule,226 AddRule,
226 SaveRule,227 SaveRule,
@@ -389,8 +390,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
389 match (key, lang) {390 match (key, lang) {
390 (NewTask, En) => "New task",391 (NewTask, En) => "New task",
391 (NewTask, Tr) => "Yeni görev",392 (NewTask, Tr) => "Yeni görev",
392- (Title, En) => "TITLE",393+ (Title, En) => "Title",
393- (Title, Tr) => "BAŞLIK",394+ (Title, Tr) => "Başlık",
394 (Cancel, En) => "Cancel",395 (Cancel, En) => "Cancel",
395 (Cancel, Tr) => "Vazgeç",396 (Cancel, Tr) => "Vazgeç",
396 (SomethingWentWrong, En) => "Something went wrong.",397 (SomethingWentWrong, En) => "Something went wrong.",
@@ -433,8 +434,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
433 (LinkAnotherTask, Tr) => "Başka bir görevi bağla",434 (LinkAnotherTask, Tr) => "Başka bir görevi bağla",
434 (LinkATask, En) => "Link a task",435 (LinkATask, En) => "Link a task",
435 (LinkATask, Tr) => "Görev bağla",436 (LinkATask, Tr) => "Görev bağla",
436- (Direction, En) => "DIRECTION",437+ (Direction, En) => "Direction",
437- (Direction, Tr) => "YÖN",438+ (Direction, Tr) => "Yön",
438 (BlocksThisTask, En) => "blocks this task",439 (BlocksThisTask, En) => "blocks this task",
439 (BlocksThisTask, Tr) => "bu görevi engelliyor",440 (BlocksThisTask, Tr) => "bu görevi engelliyor",
440 (WaitsOnThisTask, En) => "waits on this task",441 (WaitsOnThisTask, En) => "waits on this task",
@@ -467,36 +468,36 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
467 (Esc, Tr) => "esc",468 (Esc, Tr) => "esc",
468 (CloseThisTask, En) => "Close this task",469 (CloseThisTask, En) => "Close this task",
469 (CloseThisTask, Tr) => "Bu görevi kapat",470 (CloseThisTask, Tr) => "Bu görevi kapat",
470- (Status, En) => "STATUS",471+ (Status, En) => "Status",
471- (Status, Tr) => "DURUM",472+ (Status, Tr) => "Durum",
472- (Assignees, En) => "ASSIGNEES",473+ (Assignees, En) => "Assignees",
473- (Assignees, Tr) => "ATANANLAR",474+ (Assignees, Tr) => "Atananlar",
474- (Deadline, En) => "DEADLINE",475+ (Deadline, En) => "Deadline",
475- (Deadline, Tr) => "SON TARİH",476+ (Deadline, Tr) => "Son tarih",
476- (Description, En) => "DESCRIPTION",477+ (Description, En) => "Description",
477- (Description, Tr) => "AÇIKLAMA",478+ (Description, Tr) => "Açıklama",
478- (Dependencies, En) => "DEPENDENCIES",479+ (Dependencies, En) => "Dependencies",
479- (Dependencies, Tr) => "BAĞIMLILIKLAR",480+ (Dependencies, Tr) => "Bağımlılıklar",
480 (TabTask, En) => "Task",481 (TabTask, En) => "Task",
481 (TabTask, Tr) => "Görev",482 (TabTask, Tr) => "Görev",
482- (Files, En) => "FILES",483+ (Files, En) => "Files",
483- (Files, Tr) => "DOSYALAR",484+ (Files, Tr) => "Dosyalar",
484 (File, En) => "File",485 (File, En) => "File",
485 (File, Tr) => "Dosya",486 (File, Tr) => "Dosya",
486- (Comments, En) => "COMMENTS",487+ (Comments, En) => "Comments",
487- (Comments, Tr) => "YORUMLAR",488+ (Comments, Tr) => "Yorumlar",
488 (TabMail, En) => "Mail",489 (TabMail, En) => "Mail",
489 (TabMail, Tr) => "Posta",490 (TabMail, Tr) => "Posta",
490 (WriteAComment, En) => "Write a comment…",491 (WriteAComment, En) => "Write a comment…",
491 (WriteAComment, Tr) => "Bir yorum yaz…",492 (WriteAComment, Tr) => "Bir yorum yaz…",
492 (Comment, En) => "Comment",493 (Comment, En) => "Comment",
493 (Comment, Tr) => "Yorum yap",494 (Comment, Tr) => "Yorum yap",
494- (Notifications, En) => "NOTIFICATIONS",495+ (Notifications, En) => "Notifications",
495- (Notifications, Tr) => "BİLDİRİMLER",496+ (Notifications, Tr) => "Bildirimler",
496 (Retry, En) => "Retry",497 (Retry, En) => "Retry",
497 (Retry, Tr) => "Yeniden dene",498 (Retry, Tr) => "Yeniden dene",
498- (Activity, En) => "ACTIVITY",499+ (Activity, En) => "Activity",
499- (Activity, Tr) => "ETKİNLİK",500+ (Activity, Tr) => "Etkinlik",
500 (DeleteTask, En) => "Delete task",501 (DeleteTask, En) => "Delete task",
501 (DeleteTask, Tr) => "Görevi sil",502 (DeleteTask, Tr) => "Görevi sil",
502 (CommentGoesWithIt, En) => "1 comment goes with it",503 (CommentGoesWithIt, En) => "1 comment goes with it",
@@ -537,8 +538,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
537 (NavTags, Tr) => "Etiketler",538 (NavTags, Tr) => "Etiketler",
538 (NewTag, En) => "New tag",539 (NewTag, En) => "New tag",
539 (NewTag, Tr) => "Yeni etiket",540 (NewTag, Tr) => "Yeni etiket",
540- (NameLabel, En) => "NAME",541+ (NameLabel, En) => "Name",
541- (NameLabel, Tr) => "İSİM",542+ (NameLabel, Tr) => "İsim",
542 (AddTag, En) => "Add tag",543 (AddTag, En) => "Add tag",
543 (AddTag, Tr) => "Etiket ekle",544 (AddTag, Tr) => "Etiket ekle",
544 (SaveTag, En) => "Save tag",545 (SaveTag, En) => "Save tag",
@@ -598,18 +599,18 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
598 (StorageLastProblem, Tr) => "Son sorun",599 (StorageLastProblem, Tr) => "Son sorun",
599 (StorageAbsent, En) => "Not in the family",600 (StorageAbsent, En) => "Not in the family",
600 (StorageAbsent, Tr) => "Ailede değil",601 (StorageAbsent, Tr) => "Ailede değil",
601- (EmailLabel, En) => "EMAIL",602+ (EmailLabel, En) => "Email",
602- (EmailLabel, Tr) => "E-POSTA",603+ (EmailLabel, Tr) => "E-posta",
603- (ThemeLabel, En) => "THEME",604+ (ThemeLabel, En) => "Theme",
604- (ThemeLabel, Tr) => "TEMA",605+ (ThemeLabel, Tr) => "Tema",
605- (UiLabel, En) => "INTERFACE",606+ (UiLabel, En) => "Interface",
606- (UiLabel, Tr) => "ARAYÜZ",607+ (UiLabel, Tr) => "Arayüz",
607 (LightOption, En) => "Light",608 (LightOption, En) => "Light",
608 (LightOption, Tr) => "Açık",609 (LightOption, Tr) => "Açık",
609 (DarkOption, En) => "Dark",610 (DarkOption, En) => "Dark",
610 (DarkOption, Tr) => "Koyu",611 (DarkOption, Tr) => "Koyu",
611- (LanguageLabel, En) => "LANGUAGE",612+ (LanguageLabel, En) => "Language",
612- (LanguageLabel, Tr) => "DİL",613+ (LanguageLabel, Tr) => "Dil",
613 (Saved, En) => "Saved.",614 (Saved, En) => "Saved.",
614 (Saved, Tr) => "Kaydedildi.",615 (Saved, Tr) => "Kaydedildi.",
615 (SignOut, En) => "Sign out",616 (SignOut, En) => "Sign out",
@@ -644,52 +645,52 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
644 (CheckConnection, Tr) => "Bağlantıyı dene",645 (CheckConnection, Tr) => "Bağlantıyı dene",
645 (NotConnectedNote, En) => "Not connected.",646 (NotConnectedNote, En) => "Not connected.",
646 (NotConnectedNote, Tr) => "Bağlı değil.",647 (NotConnectedNote, Tr) => "Bağlı değil.",
647- (SmtpHostLabel, En) => "SMTP HOST",648+ (SmtpHostLabel, En) => "SMTP host",
648- (SmtpHostLabel, Tr) => "SMTP SUNUCUSU",649+ (SmtpHostLabel, Tr) => "SMTP sunucusu",
649- (PortLabel, En) => "PORT",650+ (PortLabel, En) => "Port",
650- (PortLabel, Tr) => "PORT",651+ (PortLabel, Tr) => "Port",
651- (UsernameLabel, En) => "USERNAME",652+ (UsernameLabel, En) => "Username",
652- (UsernameLabel, Tr) => "KULLANICI ADI",653+ (UsernameLabel, Tr) => "Kullanıcı adı",
653- (PasswordLabel, En) => "PASSWORD",654+ (PasswordLabel, En) => "Password",
654- (PasswordLabel, Tr) => "PAROLA",655+ (PasswordLabel, Tr) => "Parola",
655 (PasswordSetPlaceholder, En) => "Unchanged",656 (PasswordSetPlaceholder, En) => "Unchanged",
656 (PasswordSetPlaceholder, Tr) => "Değişmedi",657 (PasswordSetPlaceholder, Tr) => "Değişmedi",
657 (PasswordNeededPlaceholder, En) => "Required",658 (PasswordNeededPlaceholder, En) => "Required",
658 (PasswordNeededPlaceholder, Tr) => "Gerekli",659 (PasswordNeededPlaceholder, Tr) => "Gerekli",
659- (FromNameLabel, En) => "FROM NAME",660+ (FromNameLabel, En) => "From name",
660- (FromNameLabel, Tr) => "GÖNDEREN ADI",661+ (FromNameLabel, Tr) => "Gönderen adı",
661- (FromAddressLabel, En) => "FROM ADDRESS",662+ (FromAddressLabel, En) => "From address",
662- (FromAddressLabel, Tr) => "GÖNDEREN ADRESİ",663+ (FromAddressLabel, Tr) => "Gönderen adresi",
663 (SendTestMail, En) => "Send test mail to myself",664 (SendTestMail, En) => "Send test mail to myself",
664 (SendTestMail, Tr) => "Kendime test postası gönder",665 (SendTestMail, Tr) => "Kendime test postası gönder",
665 (WorkspaceLimits, En) => "Workspace limits",666 (WorkspaceLimits, En) => "Workspace limits",
666 (WorkspaceLimits, Tr) => "Çalışma alanı limitleri",667 (WorkspaceLimits, Tr) => "Çalışma alanı limitleri",
667- (AttachmentLimitLabel, En) => "ATTACHMENT LIMIT (MB)",668+ (AttachmentLimitLabel, En) => "Attachment limit (MB)",
668- (AttachmentLimitLabel, Tr) => "EK LİMİTİ (MB)",669+ (AttachmentLimitLabel, Tr) => "Ek limiti (MB)",
669- (AllowedFileTypesLabel, En) => "ALLOWED FILE TYPES",670+ (AllowedFileTypesLabel, En) => "Allowed file types",
670- (AllowedFileTypesLabel, Tr) => "İZİN VERİLEN DOSYA TÜRLERİ",671+ (AllowedFileTypesLabel, Tr) => "İzin verilen dosya türleri",
671 (Members, En) => "Members",672 (Members, En) => "Members",
672 (Members, Tr) => "Üyeler",673 (Members, Tr) => "Üyeler",
673 (Message, En) => "Message",674 (Message, En) => "Message",
674 (Message, Tr) => "Mesaj",675 (Message, Tr) => "Mesaj",
675 (Everyone, En) => "Everyone",676 (Everyone, En) => "Everyone",
676 (Everyone, Tr) => "Herkes",677 (Everyone, Tr) => "Herkes",
677- (Recipient, En) => "RECIPIENT",678+ (Recipient, En) => "Recipient",
678- (Recipient, Tr) => "ALICI",679+ (Recipient, Tr) => "Alıcı",
679- (Subject, En) => "SUBJECT",680+ (Subject, En) => "Subject",
680- (Subject, Tr) => "KONU",681+ (Subject, Tr) => "Konu",
681- (Body, En) => "BODY",682+ (Body, En) => "Body",
682- (Body, Tr) => "İÇERİK",683+ (Body, Tr) => "İçerik",
683 (Send, En) => "Send",684 (Send, En) => "Send",
684 (Send, Tr) => "Gönder",685 (Send, Tr) => "Gönder",
685- (NameCol, En) => "NAME",686+ (NameCol, En) => "Name",
686- (NameCol, Tr) => "AD",687+ (NameCol, Tr) => "Ad",
687- (AddressCol, En) => "ADDRESS",688+ (AddressCol, En) => "Address",
688- (AddressCol, Tr) => "ADRES",689+ (AddressCol, Tr) => "Adres",
689- (RoleCol, En) => "ROLE",690+ (RoleCol, En) => "Role",
690- (RoleCol, Tr) => "ROL",691+ (RoleCol, Tr) => "Rol",
691- (AccountCol, En) => "ACCOUNT",692+ (AccountCol, En) => "Account",
692- (AccountCol, Tr) => "HESAP",693+ (AccountCol, Tr) => "Hesap",
693 (OwnerStatus, En) => "owner",694 (OwnerStatus, En) => "owner",
694 (OwnerStatus, Tr) => "kurucu",695 (OwnerStatus, Tr) => "kurucu",
695 (InvitedStatus, En) => "invited",696 (InvitedStatus, En) => "invited",
@@ -746,16 +747,18 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
746 (NoSenderConnectedPrefix, Tr) => "Bağlı gönderen yok.",747 (NoSenderConnectedPrefix, Tr) => "Bağlı gönderen yok.",
747 (NewRule, En) => "New rule",748 (NewRule, En) => "New rule",
748 (NewRule, Tr) => "Yeni kural",749 (NewRule, Tr) => "Yeni kural",
749- (WhenLabel, En) => "WHEN",750+ (WhenLabel, En) => "When",
750- (WhenLabel, Tr) => "NE ZAMAN",751+ (WhenLabel, Tr) => "Ne zaman",
751- (ColumnLabel, En) => "COLUMN",752+ (ColumnLabel, En) => "Column",
752- (ColumnLabel, Tr) => "SÜTUN",753+ (ColumnLabel, Tr) => "Sütun",
753- (SendLabel, En) => "SEND",754+ (SendLabel, En) => "Send",
754- (SendLabel, Tr) => "GÖNDER",755+ (SendLabel, Tr) => "Gönder",
755- (ToLabel, En) => "TO",756+ (ToLabel, En) => "To",
756- (ToLabel, Tr) => "KİME",757+ (ToLabel, Tr) => "Kime",
757- (BodyLabel, En) => "BODY",758+ (BodyLabel, En) => "Body",
758- (BodyLabel, Tr) => "İÇERİK",759+ (BodyLabel, Tr) => "İçerik",
760+ (SubjectPlaceholder, En) => "Task completed",
761+ (SubjectPlaceholder, Tr) => "Görev tamamlandı",
759 (TaskDetails, En) => "Task details",762 (TaskDetails, En) => "Task details",
760 (TaskDetails, Tr) => "Görev ayrıntıları",763 (TaskDetails, Tr) => "Görev ayrıntıları",
761 (AddRule, En) => "Add rule",764 (AddRule, En) => "Add rule",
@@ -953,8 +956,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
953 (SubtaskGoesWithIt, Tr) => "alt görevi de silinir",956 (SubtaskGoesWithIt, Tr) => "alt görevi de silinir",
954 (SubtasksGoWithIt, En) => "subtasks go with it",957 (SubtasksGoWithIt, En) => "subtasks go with it",
955 (SubtasksGoWithIt, Tr) => "alt görevi de silinir",958 (SubtasksGoWithIt, Tr) => "alt görevi de silinir",
956- (Subtasks, En) => "SUBTASKS",959+ (Subtasks, En) => "Subtasks",
957- (Subtasks, Tr) => "ALT GÖREVLER",960+ (Subtasks, Tr) => "Alt görevler",
958 (NoSubtasks, En) => "no subtasks",961 (NoSubtasks, En) => "no subtasks",
959 (NoSubtasks, Tr) => "alt görev yok",962 (NoSubtasks, Tr) => "alt görev yok",
960 (NewSubtask, En) => "Subtask",963 (NewSubtask, En) => "Subtask",
@@ -1025,10 +1028,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
1025 (CommentsLabel, Tr) => "Yorumlar",1028 (CommentsLabel, Tr) => "Yorumlar",
1026 (RecentActivity, En) => "Recent activity",1029 (RecentActivity, En) => "Recent activity",
1027 (RecentActivity, Tr) => "Son etkinlik",1030 (RecentActivity, Tr) => "Son etkinlik",
1028- (JoinedLabel, En) => "JOINED",1031+ (JoinedLabel, En) => "Joined",
1029- (JoinedLabel, Tr) => "KATILDI",1032+ (JoinedLabel, Tr) => "Katıldı",
1030- (LastSeenLabel, En) => "LAST SEEN",1033+ (LastSeenLabel, En) => "Last seen",
1031- (LastSeenLabel, Tr) => "SON GÖRÜLME",1034+ (LastSeenLabel, Tr) => "Son görülme",
1032 (MailBatchLabel, En) => "Mail delay (minutes)",1035 (MailBatchLabel, En) => "Mail delay (minutes)",
1033 (MailBatchLabel, Tr) => "Posta gecikmesi (dakika)",1036 (MailBatchLabel, Tr) => "Posta gecikmesi (dakika)",
1034 (ReminderMinutesLabel, En) => "Reminder (minutes)",1037 (ReminderMinutesLabel, En) => "Reminder (minutes)",
crates/iz-web/src/layout.rsmodified+40 -21
@@ -13,7 +13,7 @@ use topcoat::{
13 view::{BoxView, Unescaped, View, ViewExt, error_boundary, view},13 view::{BoxView, Unescaped, View, ViewExt, error_boundary, view},
14 };14 };
15 15
16-use crate::health::{Probe, probe_healthz, switcher_marks};16+use crate::health::{probe_family, switcher_marks};
17 use crate::i18n::{Key, Lang, t};17 use crate::i18n::{Key, Lang, t};
18 use crate::server::{FAMILY_KEY, current_user, store};18 use crate::server::{FAMILY_KEY, current_user, store};
19 19
@@ -284,25 +284,26 @@ pub(crate) async fn family_mark<'a>(cx: &'a Cx) -> Result<impl View + 'a> {
284 if siblings.is_empty() {284 if siblings.is_empty() {
285 return mark(cx).await.map(|v| v.boxed());285 return mark(cx).await.map(|v| v.boxed());
286 }286 }
287- // Every probe at once: a family member that is down costs its two287+ // Every probe at once, at most one family-wide round per TTL
288- // seconds, not two seconds each.288+ // ([`crate::health::probe_family`]): a sibling that is down costs its
289- let http = reqwest::Client::new();289+ // two seconds once, not once per page render.
290- let mut probes = Vec::new();290+ let urls: Vec<String> = siblings
291- for service in &siblings {291+ .iter()
292- let http = http.clone();292+ .map(|service| format!("{}/healthz", service.url.trim_end_matches('/')))
293- let url = format!("{}/healthz", service.url.trim_end_matches('/'));293+ .collect();
294- probes.push(tokio::spawn(async move { probe_healthz(&http, &url).await }));294+ let probes = probe_family(urls).await;
295- }295+ let rows: Vec<_> = siblings
296- let mut rows = Vec::new();296+ .iter()
297- for (service, probe) in siblings.iter().zip(probes) {297+ .zip(probes)
298- let probe = probe.await.unwrap_or(Probe::Down);298+ .map(|(service, probe)| {
299- rows.push((299+ (
300- service.key.as_str(),300+ service.key.as_str(),
301- service.name.as_str(),301+ service.name.as_str(),
302- service.url.as_str(),302+ service.url.as_str(),
303- probe,303+ probe,
304- ));304+ )
305- }305+ })
306+ .collect();
306 let marks = switcher_marks(rows);307 let marks = switcher_marks(rows);
307 Ok(view! {308 Ok(view! {
308 cx =>309 cx =>
@@ -543,6 +544,8 @@ pub async fn soft_nav_script<'a>(cx: &'a Cx) -> Result<impl View + 'a> {
543 else { document.documentElement.removeAttribute('data-theme'); } \544 else { document.documentElement.removeAttribute('data-theme'); } \
544 if (root.hasAttribute('data-ui')) { document.documentElement.setAttribute('data-ui', root.getAttribute('data-ui')); } \545 if (root.hasAttribute('data-ui')) { document.documentElement.setAttribute('data-ui', root.getAttribute('data-ui')); } \
545 else { document.documentElement.removeAttribute('data-ui'); } \546 else { document.documentElement.removeAttribute('data-ui'); } \
547+ var freshTitle = doc.querySelector('title'); \
548+ if (freshTitle && freshTitle.textContent) { document.title = freshTitle.textContent; } \
546 if (url) { history[push ? 'pushState' : 'replaceState'](null, '', url); } \549 if (url) { history[push ? 'pushState' : 'replaceState'](null, '', url); } \
547 if (morphing) { \550 if (morphing) { \
548 morph(document.body, doc.body); \551 morph(document.body, doc.body); \
@@ -1018,6 +1021,22 @@ async fn root_layout(cx: &Cx, slot: topcoat::view::Child<'_>) -> Result<impl Vie
1018 let lang = asking.map_or(Lang::En, |user| Lang::from_code(&user.language));1021 let lang = asking.map_or(Lang::En, |user| Lang::from_code(&user.language));
1019 1022
1020 let nothing = t(lang, Key::NothingAtThisAddress).to_string();1023 let nothing = t(lang, Key::NothingAtThisAddress).to_string();
1024+ // The tab title a page wears, read off its address: the shell is
1025+ // paired around pages by path prefix, so a page cannot hand its name
1026+ // up — the router's own address decides. The signed-out front door is
1027+ // the sign-in card, not the board. Anything unmatched — the catch-all
1028+ // 404 among it — reads as the app's bare name.
1029+ let path = topcoat::router::request::uri(cx).path();
1030+ let title = match path {
1031+ "/" if asking.is_none() => t(lang, Key::SignIn).to_string(),
1032+ "/" => t(lang, Key::NavBoard).to_string(),
1033+ p if p.starts_with("/rules") => t(lang, Key::NavMailRules).to_string(),
1034+ p if p.starts_with("/logs") => t(lang, Key::NavLogs).to_string(),
1035+ p if p.starts_with("/tags") => t(lang, Key::NavTags).to_string(),
1036+ p if p.starts_with("/settings") => t(lang, Key::NavSettings).to_string(),
1037+ p if p.starts_with("/people") => t(lang, Key::Members).to_string(),
1038+ _ => "iz".to_string(),
1039+ };
1021 Ok(view! {1040 Ok(view! {
1022 cx =>1041 cx =>
1023 <!DOCTYPE html>1042 <!DOCTYPE html>
@@ -1031,7 +1050,7 @@ async fn root_layout(cx: &Cx, slot: topcoat::view::Child<'_>) -> Result<impl Vie
1031 rel="stylesheet"1050 rel="stylesheet"
1032 href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Newsreader:ital,wght@0,400;0,600;1,400;1,600&display=swap"1051 href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Newsreader:ital,wght@0,400;0,600;1,400;1,600&display=swap"
1033 >1052 >
1034- <title>"iz"</title>1053+ <title>(title)</title>
1035 <link rel="icon" href=(FAVICON)>1054 <link rel="icon" href=(FAVICON)>
1036 <link rel="stylesheet" href=(STYLE)>1055 <link rel="stylesheet" href=(STYLE)>
1037 topcoat::runtime::script()1056 topcoat::runtime::script()
crates/iz-web/src/logs.rsmodified+1 -1
@@ -1031,7 +1031,7 @@ async fn logs_screen<'a>(
1031 <a class=(rail_class(section, Section::Decisions)) href="/logs?section=decisions">(t(lang, Key::MailDecisions))</a>1031 <a class=(rail_class(section, Section::Decisions)) href="/logs?section=decisions">(t(lang, Key::MailDecisions))</a>
1032 <a class=(rail_class(section, Section::Activity)) href="/logs?section=activity">(t(lang, Key::WorkspaceActivity))</a>1032 <a class=(rail_class(section, Section::Activity)) href="/logs?section=activity">(t(lang, Key::WorkspaceActivity))</a>
1033 </nav>1033 </nav>
1034- <main class="settings-stage stage-wide">1034+ <main class="settings-stage">
1035 <div class="settings-head">1035 <div class="settings-head">
1036 <h1 class="settings-title">(t(lang, Key::Logs))</h1>1036 <h1 class="settings-title">(t(lang, Key::Logs))</h1>
1037 <span class="chip chip-admin">(t(lang, Key::AdminOnly))</span>1037 <span class="chip chip-admin">(t(lang, Key::AdminOnly))</span>
crates/iz-web/src/rules.rsmodified+1 -1
@@ -710,7 +710,7 @@ async fn rule_form<'a>(
710 class="field-input"710 class="field-input"
711 type="text"711 type="text"
712 name="subject"712 name="subject"
713- placeholder="Task completed"713+ placeholder=(t(lang, Key::SubjectPlaceholder))
714 maxlength="120"714 maxlength="120"
715 required=""715 required=""
716 value=(subject)716 value=(subject)
crates/iz-web/src/server.rsmodified+5 -4
@@ -482,10 +482,11 @@ impl Refusal {
482 }482 }
483 }483 }
484 484
485- /// `message()`, in a user's language, for the handful of refusals485+ /// `message()`, in a user's language. English is the canonical
486- /// `board.rs`/`detail.rs` render — those two pages' only refusal variants.486+ /// sentence; the Turkish match arms every variant — the compiler holds
487- /// Everything else falls back to the English `message()`: the rest of the487+ /// it exhaustive, so a refusal cannot land untranslated — and
488- /// app's pages have not been translated yet.488+ /// `BadSender` falls back to English because its sentence is built
489+ /// where the complaint is decided, already in the caller's language.
489 pub fn message_in(&self, lang: crate::i18n::Lang) -> String {490 pub fn message_in(&self, lang: crate::i18n::Lang) -> String {
490 use crate::i18n::Lang::Tr;491 use crate::i18n::Lang::Tr;
491 if lang != Tr {492 if lang != Tr {
crates/iz-web/tests/http.rsmodified+9 -9
@@ -6501,7 +6501,7 @@ async fn a_task_with_no_mail_shows_the_quiet_notifications_line() {
6501 .get(&format!("/?task={task}&tab=mail"), Some(&admin_cookie))6501 .get(&format!("/?task={task}&tab=mail"), Some(&admin_cookie))
6502 .await;6502 .await;
6503 let html = String::from_utf8_lossy(&page.bytes);6503 let html = String::from_utf8_lossy(&page.bytes);
6504- assert!(html.contains("NOTIFICATIONS"), "{html}");6504+ assert!(html.contains("Notifications"), "{html}");
6505 assert!(html.contains("Nothing yet."), "{html}");6505 assert!(html.contains("Nothing yet."), "{html}");
6506 }6506 }
6507 6507
@@ -6941,7 +6941,7 @@ async fn each_tab_renders_only_its_own_region() {
6941 .await;6941 .await;
6942 let mail_html = String::from_utf8_lossy(&mail.bytes);6942 let mail_html = String::from_utf8_lossy(&mail.bytes);
6943 assert!(6943 assert!(
6944- mail_html.contains("NOTIFICATIONS"),6944+ mail_html.contains("Notifications"),
6945 "no notifications heading: {mail_html}"6945 "no notifications heading: {mail_html}"
6946 );6946 );
6947 }6947 }
@@ -8188,7 +8188,7 @@ async fn a_profile_names_its_fields() {
8188 .await;8188 .await;
8189 assert_eq!(page.status.as_u16(), 200);8189 assert_eq!(page.status.as_u16(), 200);
8190 let html = String::from_utf8(page.bytes).unwrap();8190 let html = String::from_utf8(page.bytes).unwrap();
8191- for label in ["EMAIL", "JOINED", "LAST SEEN"] {8191+ for label in ["Email", "Joined", "Last seen"] {
8192 assert!(8192 assert!(
8193 html.contains(label),8193 html.contains(label),
8194 "the {label} field is not on the page: {html}"8194 "the {label} field is not on the page: {html}"
@@ -9795,9 +9795,9 @@ async fn a_sign_out_hands_the_browser_to_the_providers_logout_pointed_home() {
9795 #[tokio::test]9795 #[tokio::test]
9796 async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_configured() {9796 async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_configured() {
9797 let family = "\9797 let family = "\
9798- [{\"key\":\"in\",\"name\":\"Files\",\"url\":\"http://127.0.0.1:7655\"},\9798+ [{\"key\":\"in\",\"name\":\"Files\",\"url\":\"http://127.0.0.1:9655\"},\
9799- {\"key\":\"iz\",\"name\":\"Board\",\"url\":\"http://127.0.0.1:7654\"},\9799+ {\"key\":\"iz\",\"name\":\"Board\",\"url\":\"http://127.0.0.1:9654\"},\
9800- {\"key\":\"im\",\"name\":\"Account\",\"url\":\"http://127.0.0.1:7650\"}]"9800+ {\"key\":\"im\",\"name\":\"Account\",\"url\":\"http://127.0.0.1:9650\"}]"
9801 .to_string();9801 .to_string();
9802 let app = App::build_with(Mail::silent(), Some(family), "", None).await;9802 let app = App::build_with(Mail::silent(), Some(family), "", None).await;
9803 let board_admin = admin(&app).await;9803 let board_admin = admin(&app).await;
@@ -9806,9 +9806,9 @@ async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_confi
9806 assert!(html.contains("service-switcher"), "{html}");9806 assert!(html.contains("service-switcher"), "{html}");
9807 // This app has no door back into itself: only the siblings hang there,9807 // This app has no door back into itself: only the siblings hang there,
9808 // in the order im served them.9808 // in the order im served them.
9809- assert!(!html.contains("href=\"http://127.0.0.1:7654\""), "{html}");9809+ assert!(!html.contains("href=\"http://127.0.0.1:9654\""), "{html}");
9810- let in_at = html.find("href=\"http://127.0.0.1:7655\"").unwrap();9810+ let in_at = html.find("href=\"http://127.0.0.1:9655\"").unwrap();
9811- let im_at = html.find("href=\"http://127.0.0.1:7650\"").unwrap();9811+ let im_at = html.find("href=\"http://127.0.0.1:9650\"").unwrap();
9812 assert!(in_at < im_at, "marks out of order: {html}");9812 assert!(in_at < im_at, "marks out of order: {html}");
9813 9813
9814 // The dots ride along: the fixture's ports answer nobody, so the9814 // The dots ride along: the fixture's ports answer nobody, so the
style/main.scssmodified+4 -2
@@ -2064,6 +2064,7 @@ img.avatar {
2064 font-family: var(--font-mono);2064 font-family: var(--font-mono);
2065 font-size: 10px;2065 font-size: 10px;
2066 letter-spacing: 0.08em;2066 letter-spacing: 0.08em;
2067+ text-transform: uppercase;
2067 color: var(--muted-soft);2068 color: var(--muted-soft);
2068 }2069 }
2069 2070
@@ -3028,8 +3029,6 @@ img.avatar {
3028 scrollbar-width: none;3029 scrollbar-width: none;
3029 &::-webkit-scrollbar { display: none; }3030 &::-webkit-scrollbar { display: none; }
3030 3031
3031- &.stage-wide { max-width: 1200px; }
3032-
3033 // A panel's own `overflow: hidden` (the corner clip) zeroes its flex3032 // A panel's own `overflow: hidden` (the corner clip) zeroes its flex
3034 // min-height, so the column would compress it to the viewport and clip the3033 // min-height, so the column would compress it to the viewport and clip the
3035 // rows invisibly. Panels keep natural height; the stage is what pans.3034 // rows invisibly. Panels keep natural height; the stage is what pans.
@@ -3157,6 +3156,7 @@ img.avatar {
3157 font-family: var(--font-mono);3156 font-family: var(--font-mono);
3158 font-size: 10px;3157 font-size: 10px;
3159 letter-spacing: 0.08em;3158 letter-spacing: 0.08em;
3159+ text-transform: uppercase;
3160 color: var(--muted-soft);3160 color: var(--muted-soft);
3161 }3161 }
3162 3162
@@ -3412,6 +3412,7 @@ input[type="radio"] {
3412 font-family: var(--font-mono);3412 font-family: var(--font-mono);
3413 font-size: 10px;3413 font-size: 10px;
3414 letter-spacing: 0.08em;3414 letter-spacing: 0.08em;
3415+ text-transform: uppercase;
3415 font-weight: 400;3416 font-weight: 400;
3416 color: var(--muted-soft);3417 color: var(--muted-soft);
3417 border-bottom: 1px solid var(--border);3418 border-bottom: 1px solid var(--border);
@@ -4046,6 +4047,7 @@ input[type="radio"] {
4046 dt {4047 dt {
4047 font-size: 10px;4048 font-size: 10px;
4048 letter-spacing: 0.09em;4049 letter-spacing: 0.09em;
4050+ text-transform: uppercase;
4049 color: var(--muted);4051 color: var(--muted);
4050 }4052 }
4051 4053