the Migration fact grows its meter: the count now carries the family's own quota bar beneath it — the same sunken track and accent fill in's settings panel draws for a quota, here reading the moved share of the drain, so a migration reads as a level at a glance instead of two numbers to subtract. The bar is the one markup addition; the percent helper mirrors in's quota_percent discipline (an empty total stands at zero), the row appears and disappears exactly as before, and the card test pins the meter's presence, its width at two-of-five, and — as ever — the key's absence.
Browse files at this commit3303c3f2324595b9165c2337c0bf7de253fb4935Parent: 7a6cd0c3 changed files +120 -83
- crates/iz-web/src/settings.rs +34 -19
- crates/iz-web/tests/http.rs +68 -64
- style/main.scss +18 -0
crates/iz-web/src/settings.rsmodified+34 -19
| @@ -465,11 +465,7 @@ async fn save_sender( | |||
| 465 | // about a server that is no longer configured. Ask again at once, | 465 | // about a server that is no longer configured. Ask again at once, |
| 466 | // rather than leaving the panel unchecked until somebody presses a | 466 | // rather than leaving the panel unchecked until somebody presses a |
| 467 | // button. | 467 | // button. |
| 468 | - probe_sender( | 468 | + probe_sender(mail(cx), store.clone(), admin.workspace_id.clone()); |
| 469 | - mail(cx), | ||
| 470 | - store.clone(), | ||
| 471 | - admin.workspace_id.clone(), | ||
| 472 | - ); | ||
| 473 | } | 469 | } |
| 474 | let refusal = match outcome { | 470 | let refusal = match outcome { |
| 475 | Ok(()) => { | 471 | Ok(()) => { |
| @@ -585,7 +581,10 @@ async fn save_public_url( | |||
| 585 | // stored `https://iz.sh//` is a handoff that works by luck. | 581 | // stored `https://iz.sh//` is a handoff that works by luck. |
| 586 | let public_url = input.public_url.trim().trim_end_matches('/').to_string(); | 582 | let public_url = input.public_url.trim().trim_end_matches('/').to_string(); |
| 587 | if !public_url.is_empty() && !is_origin(&public_url) { | 583 | if !public_url.is_empty() && !is_origin(&public_url) { |
| 588 | - return Ok(saved_or_refused("save_public_url", Some(Refusal::BadOrigin))); | 584 | + return Ok(saved_or_refused( |
| 585 | + "save_public_url", | ||
| 586 | + Some(Refusal::BadOrigin), | ||
| 587 | + )); | ||
| 589 | } | 588 | } |
| 590 | let refusal = match store(cx).set_setting(PUBLIC_URL_KEY, &public_url).await { | 589 | let refusal = match store(cx).set_setting(PUBLIC_URL_KEY, &public_url).await { |
| 591 | Ok(()) => None, | 590 | Ok(()) => None, |
| @@ -952,7 +951,6 @@ async fn send_message( | |||
| 952 | // Page | 951 | // Page |
| 953 | // --------------------------------------------------------------------------- | 952 | // --------------------------------------------------------------------------- |
| 954 | 953 | ||
| 955 | - | ||
| 956 | /// The Connection card's body: who im is, as whom iz introduces itself, | 954 | /// The Connection card's body: who im is, as whom iz introduces itself, |
| 957 | /// and whether the live identity feed is open at this moment. Read from | 955 | /// and whether the live identity feed is open at this moment. Read from |
| 958 | /// the config and the mirror's health only — the client secret is not | 956 | /// the config and the mirror's health only — the client secret is not |
| @@ -973,7 +971,11 @@ async fn connection_card(cx: &Cx, lang: Lang) -> Result { | |||
| 973 | } else { | 971 | } else { |
| 974 | format!("{event_age} ago") | 972 | format!("{event_age} ago") |
| 975 | }; | 973 | }; |
| 976 | - let pass_line = if pass_age.is_empty() { never } else { format!("{pass_age} ago") }; | 974 | + let pass_line = if pass_age.is_empty() { |
| 975 | + never | ||
| 976 | + } else { | ||
| 977 | + format!("{pass_age} ago") | ||
| 978 | + }; | ||
| 977 | view! { | 979 | view! { |
| 978 | cx => | 980 | cx => |
| 979 | <dl class="connection-facts"> | 981 | <dl class="connection-facts"> |
| @@ -994,6 +996,16 @@ async fn connection_card(cx: &Cx, lang: Lang) -> Result { | |||
| 994 | } | 996 | } |
| 995 | } | 997 | } |
| 996 | 998 | ||
| 999 | +/// The share of a migration already moved, for the bar's width. An empty | ||
| 1000 | +/// total stands at zero — the row only renders while rows remain, but a | ||
| 1001 | +/// meter that could divide by nothing is a meter that never renders wrong. | ||
| 1002 | +fn migration_percent(moved: u64, total: u64) -> u8 { | ||
| 1003 | + if total == 0 { | ||
| 1004 | + return 0; | ||
| 1005 | + } | ||
| 1006 | + (moved.saturating_mul(100) / total).min(100) as u8 | ||
| 1007 | +} | ||
| 1008 | + | ||
| 997 | /// The Storage card's body: where the family says the Files service is, | 1009 | /// The Storage card's body: where the family says the Files service is, |
| 998 | /// whether it answered the last beat, how full the account im limits | 1010 | /// whether it answered the last beat, how full the account im limits |
| 999 | /// stands, and — while rows still move — how far the drain has come. | 1011 | /// stands, and — while rows still move — how far the drain has come. |
| @@ -1045,7 +1057,12 @@ async fn storage_card( | |||
| 1045 | <dd class="connection-fact">(limit_line)</dd> | 1057 | <dd class="connection-fact">(limit_line)</dd> |
| 1046 | if backend == StorageBackend::In && let Some((moved, total)) = snap.migrating { | 1058 | if backend == StorageBackend::In && let Some((moved, total)) = snap.migrating { |
| 1047 | <dt>(t(lang, Key::StorageMigration))</dt> | 1059 | <dt>(t(lang, Key::StorageMigration))</dt> |
| 1048 | - <dd class="connection-fact">(format!("{moved} of {total}"))</dd> | 1060 | + <dd class="connection-fact"> |
| 1061 | + (format!("{moved} of {total}")) | ||
| 1062 | + <div class="quota-bar" role="progressbar" aria-valuenow=(migration_percent(moved, total).to_string()) aria-valuemin="0" aria-valuemax="100"> | ||
| 1063 | + <div class="quota-fill" style=(format!("width: {}%", migration_percent(moved, total)))></div> | ||
| 1064 | + </div> | ||
| 1065 | + </dd> | ||
| 1049 | } | 1066 | } |
| 1050 | <dt>(t(lang, Key::StorageLastProblem))</dt> | 1067 | <dt>(t(lang, Key::StorageLastProblem))</dt> |
| 1051 | <dd class="connection-fact">(problem_line)</dd> | 1068 | <dd class="connection-fact">(problem_line)</dd> |
| @@ -1271,7 +1288,6 @@ fn call_state<'q>(query: &'q str, call: &str) -> (Option<Refusal>, bool) { | |||
| 1271 | (refusal, saved) | 1288 | (refusal, saved) |
| 1272 | } | 1289 | } |
| 1273 | 1290 | ||
| 1274 | - | ||
| 1275 | fn query_value<'q>(query: &'q str, key: &str) -> Option<&'q str> { | 1291 | fn query_value<'q>(query: &'q str, key: &str) -> Option<&'q str> { |
| 1276 | query.split('&').find_map(|pair| { | 1292 | query.split('&').find_map(|pair| { |
| 1277 | pair.split_once('=') | 1293 | pair.split_once('=') |
| @@ -1341,8 +1357,7 @@ async fn settings_page(cx: &Cx) -> Result { | |||
| 1341 | None | 1357 | None |
| 1342 | }; | 1358 | }; |
| 1343 | let (limits, allowed_types) = if administers { | 1359 | let (limits, allowed_types) = if administers { |
| 1344 | - let (attachment, types, batch, reminder) = | 1360 | + let (attachment, types, batch, reminder) = limits_now(cx, &user.workspace_id).await?; |
| 1345 | - limits_now(cx, &user.workspace_id).await?; | ||
| 1346 | (Some((attachment, batch, reminder)), types) | 1361 | (Some((attachment, batch, reminder)), types) |
| 1347 | } else { | 1362 | } else { |
| 1348 | (None, Vec::new()) | 1363 | (None, Vec::new()) |
| @@ -1364,14 +1379,14 @@ async fn settings_page(cx: &Cx) -> Result { | |||
| 1364 | let (profile_refusal, profile_saved) = call_state(query, "save_profile"); | 1379 | let (profile_refusal, profile_saved) = call_state(query, "save_profile"); |
| 1365 | let (sender_refusal, sender_saved) = call_state(query, "save_sender"); | 1380 | let (sender_refusal, sender_saved) = call_state(query, "save_sender"); |
| 1366 | let (test_refusal, _) = call_state(query, "send_test_mail"); | 1381 | let (test_refusal, _) = call_state(query, "send_test_mail"); |
| 1367 | - let (limits_refusal, limits_saved) = call_state(query, "save_limits"); | 1382 | + let (limits_refusal, limits_saved) = call_state(query, "save_limits"); |
| 1368 | let (storage_refusal, storage_saved) = call_state(query, "save_storage"); | 1383 | let (storage_refusal, storage_saved) = call_state(query, "save_storage"); |
| 1369 | - let (server_refusal, server_saved) = call_state(query, "save_public_url"); | 1384 | + let (server_refusal, server_saved) = call_state(query, "save_public_url"); |
| 1370 | - let (role_refusal, _) = call_state(query, "set_role"); | 1385 | + let (role_refusal, _) = call_state(query, "set_role"); |
| 1371 | - let (disabled_refusal, _) = call_state(query, "set_disabled"); | 1386 | + let (disabled_refusal, _) = call_state(query, "set_disabled"); |
| 1372 | - let (add_refusal, add_saved) = call_state(query, "add_member"); | 1387 | + let (add_refusal, add_saved) = call_state(query, "add_member"); |
| 1373 | - let member_refusal = role_refusal.or(disabled_refusal).or(add_refusal); | 1388 | + let member_refusal = role_refusal.or(disabled_refusal).or(add_refusal); |
| 1374 | - let (message_refusal, message_saved) = call_state(query, "send_message"); | 1389 | + let (message_refusal, message_saved) = call_state(query, "send_message"); |
| 1375 | 1390 | ||
| 1376 | // What the Storage panel renders: the surface the workspace currently | 1391 | // What the Storage panel renders: the surface the workspace currently |
| 1377 | // keeps its bytes on, where the family mirror says the Files service | 1392 | // keeps its bytes on, where the family mirror says the Files service |
crates/iz-web/tests/http.rsmodified+68 -64
| @@ -290,12 +290,12 @@ impl App { | |||
| 290 | async fn build(mail: Mail) -> Self { | 290 | async fn build(mail: Mail) -> Self { |
| 291 | Self::build_with(mail, None, "", None).await | 291 | Self::build_with(mail, None, "", None).await |
| 292 | } | 292 | } |
| 293 | - | 293 | + |
| 294 | /// Like `build`, but with the knobs a configured deployment has: the | 294 | /// Like `build`, but with the knobs a configured deployment has: the |
| 295 | - /// family list mirrored from im — passed as the raw JSON the `setting` | 295 | + /// family list mirrored from im — passed as the raw JSON the `setting` |
| 296 | - /// row holds, so a test can also feed it a body that will not parse — | 296 | + /// row holds, so a test can also feed it a body that will not parse — |
| 297 | - /// and the configured `base_url`. Building them in is what lets the | 297 | + /// and the configured `base_url`. Building them in is what lets the |
| 298 | - /// switcher and the sign-out handoff be asserted over real HTTP. | 298 | + /// switcher and the sign-out handoff be asserted over real HTTP. |
| 299 | /// | 299 | /// |
| 300 | /// `storage_in` is the `[storage.in]` token, when the deployment | 300 | /// `storage_in` is the `[storage.in]` token, when the deployment |
| 301 | /// under test has one. | 301 | /// under test has one. |
| @@ -338,8 +338,7 @@ impl App { | |||
| 338 | redirect_uri: "http://127.0.0.1:7655/auth/callback".to_string(), | 338 | redirect_uri: "http://127.0.0.1:7655/auth/callback".to_string(), |
| 339 | }, | 339 | }, |
| 340 | ignored: Vec::new(), | 340 | ignored: Vec::new(), |
| 341 | - storage_in: storage_in | 341 | + storage_in: storage_in.map(|token| iz_core::config::InStorage { token }), |
| 342 | - .map(|token| iz_core::config::InStorage { token }), | ||
| 343 | defaulted: false, | 342 | defaulted: false, |
| 344 | }; | 343 | }; |
| 345 | // The fallback half of the chain, built exactly as `main.rs` builds | 344 | // The fallback half of the chain, built exactly as `main.rs` builds |
| @@ -375,28 +374,26 @@ impl App { | |||
| 375 | "iz-test", | 374 | "iz-test", |
| 376 | "s3cr3t", | 375 | "s3cr3t", |
| 377 | )) | 376 | )) |
| 378 | - .app_context(health.clone()) | 377 | + .app_context(health.clone()) |
| 379 | .app_context(storage_client.clone()) | 378 | .app_context(storage_client.clone()) |
| 380 | .app_context(storage_health.clone()) | 379 | .app_context(storage_health.clone()) |
| 381 | - .app_context(iz_client::LogoutBack(Arc::new( | 380 | + .app_context(iz_client::LogoutBack(Arc::new(iz_web::server::logout_back))) |
| 382 | - iz_web::server::logout_back, | ||
| 383 | - ))) | ||
| 384 | .app_context(config.clone()) | 381 | .app_context(config.clone()) |
| 385 | .app_context(TEST_LIVE_WINDOW) | 382 | .app_context(TEST_LIVE_WINDOW) |
| 386 | .app_context(iz_web::live::Shutdown(stopping)) | 383 | .app_context(iz_web::live::Shutdown(stopping)) |
| 387 | .app_context(mail) | 384 | .app_context(mail) |
| 388 | .build(); | 385 | .build(); |
| 389 | - Self { | 386 | + Self { |
| 390 | - dir, | 387 | + dir, |
| 391 | - router, | 388 | + router, |
| 392 | - store, | 389 | + store, |
| 393 | - client, | 390 | + client, |
| 394 | - fake, | 391 | + fake, |
| 395 | storage_client, | 392 | storage_client, |
| 396 | storage_health, | 393 | storage_health, |
| 397 | - health, | 394 | + health, |
| 398 | - stop, | 395 | + stop, |
| 399 | - } | 396 | + } |
| 400 | } | 397 | } |
| 401 | 398 | ||
| 402 | async fn open() -> Self { | 399 | async fn open() -> Self { |
| @@ -473,28 +470,26 @@ impl App { | |||
| 473 | "iz-test", | 470 | "iz-test", |
| 474 | "s3cr3t", | 471 | "s3cr3t", |
| 475 | )) | 472 | )) |
| 476 | - .app_context(health.clone()) | 473 | + .app_context(health.clone()) |
| 477 | .app_context(storage_client.clone()) | 474 | .app_context(storage_client.clone()) |
| 478 | .app_context(storage_health.clone()) | 475 | .app_context(storage_health.clone()) |
| 479 | - .app_context(iz_client::LogoutBack(Arc::new( | 476 | + .app_context(iz_client::LogoutBack(Arc::new(iz_web::server::logout_back))) |
| 480 | - iz_web::server::logout_back, | ||
| 481 | - ))) | ||
| 482 | .app_context(config.clone()) | 477 | .app_context(config.clone()) |
| 483 | .app_context(TEST_LIVE_WINDOW) | 478 | .app_context(TEST_LIVE_WINDOW) |
| 484 | .app_context(iz_web::live::Shutdown(stopping)) | 479 | .app_context(iz_web::live::Shutdown(stopping)) |
| 485 | .app_context(Mail::sending(engine)) | 480 | .app_context(Mail::sending(engine)) |
| 486 | .build(); | 481 | .build(); |
| 487 | - Self { | 482 | + Self { |
| 488 | - dir, | 483 | + dir, |
| 489 | - router, | 484 | + router, |
| 490 | - store, | 485 | + store, |
| 491 | - client, | 486 | + client, |
| 492 | - fake, | 487 | + fake, |
| 493 | storage_client, | 488 | storage_client, |
| 494 | storage_health, | 489 | storage_health, |
| 495 | - health, | 490 | + health, |
| 496 | - stop, | 491 | + stop, |
| 497 | - } | 492 | + } |
| 498 | } | 493 | } |
| 499 | /// Mints a session cookie for an im identity, registering its claims on | 494 | /// Mints a session cookie for an im identity, registering its claims on |
| 500 | /// the fake — exactly what `/auth/callback` seals, without the browser | 495 | /// the fake — exactly what `/auth/callback` seals, without the browser |
| @@ -4975,7 +4970,8 @@ async fn a_synced_member_is_listed_and_assignable_before_their_first_sign_in() { | |||
| 4975 | .unwrap(); | 4970 | .unwrap(); |
| 4976 | 4971 | ||
| 4977 | let sync = app | 4972 | let sync = app |
| 4978 | - .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0, "UTC+03:00") | 4973 | + .store |
| 4974 | + .sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0, "UTC+03:00") | ||
| 4979 | .await | 4975 | .await |
| 4980 | .unwrap(); | 4976 | .unwrap(); |
| 4981 | assert_eq!(sync, iz_core::store::MemberSync::Inserted); | 4977 | assert_eq!(sync, iz_core::store::MemberSync::Inserted); |
| @@ -5253,10 +5249,12 @@ async fn a_matching_version_stamp_is_immutable_and_a_new_one_moves_it() { | |||
| 5253 | let member_id = user_id(&app, "emre@iz.sh").await; | 5249 | let member_id = user_id(&app, "emre@iz.sh").await; |
| 5254 | // The directory pass finds the row by its sub — the same subject the | 5250 | // The directory pass finds the row by its sub — the same subject the |
| 5255 | // sign-in provisions — and reports the face's third revision. | 5251 | // sign-in provisions — and reports the face's third revision. |
| 5256 | - app.store.sync_member("im-emre@iz.sh", "emre@iz.sh", "Emre", false, 3, "UTC+03:00") | 5252 | + app.store |
| 5253 | + .sync_member("im-emre@iz.sh", "emre@iz.sh", "Emre", false, 3, "UTC+03:00") | ||
| 5257 | .await | 5254 | .await |
| 5258 | .unwrap(); | 5255 | .unwrap(); |
| 5259 | - app.fake.set_photo("im-emre@iz.sh", PNG.to_vec(), "image/png"); | 5256 | + app.fake |
| 5257 | + .set_photo("im-emre@iz.sh", PNG.to_vec(), "image/png"); | ||
| 5260 | 5258 | ||
| 5261 | let stamped = app | 5259 | let stamped = app |
| 5262 | .get(&format!("/avatar/{member_id}?v=3"), Some(&member)) | 5260 | .get(&format!("/avatar/{member_id}?v=3"), Some(&member)) |
| @@ -5278,7 +5276,8 @@ async fn a_matching_version_stamp_is_immutable_and_a_new_one_moves_it() { | |||
| 5278 | 5276 | ||
| 5279 | // im's count moves; the next sync (the stream's event, or the beat) | 5277 | // im's count moves; the next sync (the stream's event, or the beat) |
| 5280 | // carries it onto the row, and the old stamp stops being true. | 5278 | // carries it onto the row, and the old stamp stops being true. |
| 5281 | - app.store.sync_member("im-emre@iz.sh", "emre@iz.sh", "Emre", false, 4, "UTC+03:00") | 5279 | + app.store |
| 5280 | + .sync_member("im-emre@iz.sh", "emre@iz.sh", "Emre", false, 4, "UTC+03:00") | ||
| 5282 | .await | 5281 | .await |
| 5283 | .unwrap(); | 5282 | .unwrap(); |
| 5284 | let moved = app | 5283 | let moved = app |
| @@ -5375,7 +5374,10 @@ async fn the_connection_card_names_its_provider_without_its_secret() { | |||
| 5375 | let page = app.get("/settings", Some(&admin)).await; | 5374 | let page = app.get("/settings", Some(&admin)).await; |
| 5376 | assert_eq!(page.status.as_u16(), 200); | 5375 | assert_eq!(page.status.as_u16(), 200); |
| 5377 | let html = String::from_utf8(page.bytes).unwrap(); | 5376 | let html = String::from_utf8(page.bytes).unwrap(); |
| 5378 | - assert!(html.contains("id=\"connection\""), "no Connection card: {html}"); | 5377 | + assert!( |
| 5378 | + html.contains("id=\"connection\""), | ||
| 5379 | + "no Connection card: {html}" | ||
| 5380 | + ); | ||
| 5379 | assert!( | 5381 | assert!( |
| 5380 | html.contains("iz-test:s3cr3t") == false, | 5382 | html.contains("iz-test:s3cr3t") == false, |
| 5381 | "the client secret leaked onto the page: {html}" | 5383 | "the client secret leaked onto the page: {html}" |
| @@ -9750,8 +9752,7 @@ async fn a_sign_out_hands_the_browser_to_the_providers_logout_pointed_home() { | |||
| 9750 | 9752 | ||
| 9751 | // A configured `base_url` is what the fallback says when nothing is | 9753 | // A configured `base_url` is what the fallback says when nothing is |
| 9752 | // stored — a deployment behind a proxy says its name once, in the file. | 9754 | // stored — a deployment behind a proxy says its name once, in the file. |
| 9753 | - let configured = | 9755 | + let configured = App::build_with(Mail::silent(), None, "https://board.example", None).await; |
| 9754 | - App::build_with(Mail::silent(), None, "https://board.example", None).await; | ||
| 9755 | let raw = configured.get("/auth/logout", None).await; | 9756 | let raw = configured.get("/auth/logout", None).await; |
| 9756 | let expected = format!( | 9757 | let expected = format!( |
| 9757 | "{}/logout?back={}", | 9758 | "{}/logout?back={}", |
| @@ -9952,8 +9953,7 @@ impl FakeIn { | |||
| 9952 | /// Stops answering — accepts and drops, which reads to the client as | 9953 | /// Stops answering — accepts and drops, which reads to the client as |
| 9953 | /// the connection the storage ceilings are for. | 9954 | /// the connection the storage ceilings are for. |
| 9954 | fn set_down(&self) { | 9955 | fn set_down(&self) { |
| 9955 | - self.down | 9956 | + self.down.store(true, std::sync::atomic::Ordering::SeqCst); |
| 9956 | - .store(true, std::sync::atomic::Ordering::SeqCst); | ||
| 9957 | } | 9957 | } |
| 9958 | } | 9958 | } |
| 9959 | 9959 | ||
| @@ -10020,7 +10020,11 @@ fn storage_answer( | |||
| 10020 | let bytes = multipart_file(body, head); | 10020 | let bytes = multipart_file(body, head); |
| 10021 | files.lock().insert(id.clone(), bytes); | 10021 | files.lock().insert(id.clone(), bytes); |
| 10022 | let answer = format!("{{\"ok\":\"{id}\"}}"); | 10022 | let answer = format!("{{\"ok\":\"{id}\"}}"); |
| 10023 | - ("200 OK", "application/json".to_string(), answer.into_bytes()) | 10023 | + ( |
| 10024 | + "200 OK", | ||
| 10025 | + "application/json".to_string(), | ||
| 10026 | + answer.into_bytes(), | ||
| 10027 | + ) | ||
| 10024 | } | 10028 | } |
| 10025 | ("GET", path) => match path.strip_prefix("/api/service/file/") { | 10029 | ("GET", path) => match path.strip_prefix("/api/service/file/") { |
| 10026 | Some(id) if !id.is_empty() => match files.lock().get(id) { | 10030 | Some(id) if !id.is_empty() => match files.lock().get(id) { |
| @@ -10051,11 +10055,7 @@ fn storage_answer( | |||
| 10051 | br#"{"ok":true}"#.to_vec(), | 10055 | br#"{"ok":true}"#.to_vec(), |
| 10052 | ) | 10056 | ) |
| 10053 | } | 10057 | } |
| 10054 | - _ => ( | 10058 | + _ => ("404 Not Found", "text/plain".to_string(), Vec::new()), |
| 10055 | - "404 Not Found", | ||
| 10056 | - "text/plain".to_string(), | ||
| 10057 | - Vec::new(), | ||
| 10058 | - ), | ||
| 10059 | } | 10059 | } |
| 10060 | } | 10060 | } |
| 10061 | /// One text field out of a multipart body, by `name`. The parts are read | 10061 | /// One text field out of a multipart body, by `name`. The parts are read |
| @@ -10194,7 +10194,9 @@ async fn an_upload_in_in_mode_lands_on_the_service_and_serves_from_it() { | |||
| 10194 | Some(format!("/?task={task}&tab=files").as_str()) | 10194 | Some(format!("/?task={task}&tab=files").as_str()) |
| 10195 | ); | 10195 | ); |
| 10196 | assert!( | 10196 | assert!( |
| 10197 | - fake.calls().iter().any(|call| call == "POST /api/service/files"), | 10197 | + fake.calls() |
| 10198 | + .iter() | ||
| 10199 | + .any(|call| call == "POST /api/service/files"), | ||
| 10198 | "the push never happened: {:?}", | 10200 | "the push never happened: {:?}", |
| 10199 | fake.calls() | 10201 | fake.calls() |
| 10200 | ); | 10202 | ); |
| @@ -10284,7 +10286,9 @@ async fn a_down_files_service_refuses_uploads_downloads_and_deletes() { | |||
| 10284 | ); | 10286 | ); |
| 10285 | assert_eq!(app.store.attachments(&task).await.unwrap().len(), 1); | 10287 | assert_eq!(app.store.attachments(&task).await.unwrap().len(), 1); |
| 10286 | 10288 | ||
| 10287 | - let download = app.get(&format!("/files/{stored}"), Some(&admin_cookie)).await; | 10289 | + let download = app |
| 10290 | + .get(&format!("/files/{stored}"), Some(&admin_cookie)) | ||
| 10291 | + .await; | ||
| 10288 | assert_eq!(download.status, StatusCode::SERVICE_UNAVAILABLE); | 10292 | assert_eq!(download.status, StatusCode::SERVICE_UNAVAILABLE); |
| 10289 | 10293 | ||
| 10290 | let delete = app | 10294 | let delete = app |
| @@ -10398,13 +10402,8 @@ async fn save_storage_is_admin_only_and_refuses_a_road_that_is_not_there() { | |||
| 10398 | 10402 | ||
| 10399 | // No `[storage.in]` token: `in` is not a road this deployment can | 10403 | // No `[storage.in]` token: `in` is not a road this deployment can |
| 10400 | // take, no matter what the family says. | 10404 | // take, no matter what the family says. |
| 10401 | - let keyless = App::build_with( | 10405 | + let keyless = |
| 10402 | - Mail::silent(), | 10406 | + App::build_with(Mail::silent(), Some(family_with_in(&fake.url())), "", None).await; |
| 10403 | - Some(family_with_in(&fake.url())), | ||
| 10404 | - "", | ||
| 10405 | - None, | ||
| 10406 | - ) | ||
| 10407 | - .await; | ||
| 10408 | let keyless_admin = admin(&keyless).await; | 10407 | let keyless_admin = admin(&keyless).await; |
| 10409 | let answer = keyless | 10408 | let answer = keyless |
| 10410 | .post( | 10409 | .post( |
| @@ -10436,8 +10435,7 @@ async fn save_storage_is_admin_only_and_refuses_a_road_that_is_not_there() { | |||
| 10436 | let unlisted = App::build_with( | 10435 | let unlisted = App::build_with( |
| 10437 | Mail::silent(), | 10436 | Mail::silent(), |
| 10438 | Some( | 10437 | Some( |
| 10439 | - "[{\"key\":\"im\",\"name\":\"Account\",\"url\":\"http://127.0.0.1:7650\"}]" | 10438 | + "[{\"key\":\"im\",\"name\":\"Account\",\"url\":\"http://127.0.0.1:7650\"}]".to_string(), |
| 10440 | - .to_string(), | ||
| 10441 | ), | 10439 | ), |
| 10442 | "", | 10440 | "", |
| 10443 | Some(STORAGE_TOKEN.to_string()), | 10441 | Some(STORAGE_TOKEN.to_string()), |
| @@ -10511,8 +10509,7 @@ async fn the_storage_card_shows_the_beats_facts_without_the_key() { | |||
| 10511 | app.storage_health | 10509 | app.storage_health |
| 10512 | .reachable(Some(1024 * 1024 * 1024), Some(10 * 1024 * 1024 * 1024)); | 10510 | .reachable(Some(1024 * 1024 * 1024), Some(10 * 1024 * 1024 * 1024)); |
| 10513 | let html = String::from_utf8_lossy( | 10511 | let html = String::from_utf8_lossy( |
| 10514 | - &app | 10512 | + &app.get("/settings?section=limits", Some(&admin_cookie)) |
| 10515 | - .get("/settings?section=limits", Some(&admin_cookie)) | ||
| 10516 | .await | 10513 | .await |
| 10517 | .bytes, | 10514 | .bytes, |
| 10518 | ) | 10515 | ) |
| @@ -10535,13 +10532,16 @@ async fn the_storage_card_shows_the_beats_facts_without_the_key() { | |||
| 10535 | app.storage_health.problem("quota"); | 10532 | app.storage_health.problem("quota"); |
| 10536 | app.storage_health.migrating(2, 5); | 10533 | app.storage_health.migrating(2, 5); |
| 10537 | let html = String::from_utf8_lossy( | 10534 | let html = String::from_utf8_lossy( |
| 10538 | - &app | 10535 | + &app.get("/settings?section=limits", Some(&admin_cookie)) |
| 10539 | - .get("/settings?section=limits", Some(&admin_cookie)) | ||
| 10540 | .await | 10536 | .await |
| 10541 | .bytes, | 10537 | .bytes, |
| 10542 | ) | 10538 | ) |
| 10543 | .to_string(); | 10539 | .to_string(); |
| 10544 | assert!(html.contains("2 of 5"), "{html}"); | 10540 | assert!(html.contains("2 of 5"), "{html}"); |
| 10541 | + // The meter under the count: the family's quota bar, at the moved | ||
| 10542 | + // share, and only while a migration stands. | ||
| 10543 | + assert!(html.contains("quota-bar\" role=\"progressbar\""), "{html}"); | ||
| 10544 | + assert!(html.contains("width: 40%"), "{html}"); | ||
| 10545 | assert!(html.contains("quota"), "{html}"); | 10545 | assert!(html.contains("quota"), "{html}"); |
| 10546 | assert!(html.contains("connection-wait"), "{html}"); | 10546 | assert!(html.contains("connection-wait"), "{html}"); |
| 10547 | assert!(html.contains("Unreachable"), "{html}"); | 10547 | assert!(html.contains("Unreachable"), "{html}"); |
| @@ -10589,7 +10589,11 @@ async fn the_storage_beat_drains_local_rows_into_the_service() { | |||
| 10589 | .all(|row| row.remote == iz_core::store::AttachmentWhere::Stored), | 10589 | .all(|row| row.remote == iz_core::store::AttachmentWhere::Stored), |
| 10590 | "not every row drained" | 10590 | "not every row drained" |
| 10591 | ); | 10591 | ); |
| 10592 | - assert_eq!(local_file_count(&app), 0, "the local files survived the drain"); | 10592 | + assert_eq!( |
| 10593 | + local_file_count(&app), | ||
| 10594 | + 0, | ||
| 10595 | + "the local files survived the drain" | ||
| 10596 | + ); | ||
| 10593 | assert!(rows.iter().all(|row| fake.holds(&row.id))); | 10597 | assert!(rows.iter().all(|row| fake.holds(&row.id))); |
| 10594 | let snap = app.storage_health.snapshot(); | 10598 | let snap = app.storage_health.snapshot(); |
| 10595 | assert!(snap.connected); | 10599 | assert!(snap.connected); |
style/main.scssmodified+18 -0
| @@ -4397,3 +4397,21 @@ input[type="radio"] { | |||
| 4397 | background: #d99a26; | 4397 | background: #d99a26; |
| 4398 | } | 4398 | } |
| 4399 | } | 4399 | } |
| 4400 | + | ||
| 4401 | +// The migration meter on the Storage card's Migration fact: a sunken track | ||
| 4402 | +// with an accent fill, the same meter in's settings panel draws for quota — | ||
| 4403 | +// the family renders a level one way. Read-only: the level rides the fill's | ||
| 4404 | +// inline width. | ||
| 4405 | +.quota-bar { | ||
| 4406 | + height: 8px; | ||
| 4407 | + margin-top: 0.45rem; | ||
| 4408 | + background: var(--panel-sunken); | ||
| 4409 | + border: 1px solid var(--border-soft); | ||
| 4410 | + border-radius: var(--radius); | ||
| 4411 | + overflow: hidden; | ||
| 4412 | +} | ||
| 4413 | + | ||
| 4414 | +.quota-fill { | ||
| 4415 | + height: 100%; | ||
| 4416 | + background: var(--accent); | ||
| 4417 | +} | ||