Compare commits

...

11 Commits

Author SHA1 Message Date
f988cf0f26 docs: Fixed some typos found in the README
Check / stable / fmt (push) Successful in 9m57s
Check / beta / clippy (push) Successful in 11m0s
Check / stable / clippy (push) Successful in 10m59s
Check / nightly / doc (push) Successful in 1m2s
Check / 1.89.0 / check (push) Successful in 1m9s
Test Suite / ubuntu / beta (push) Successful in 1m47s
Test Suite / ubuntu / stable (push) Successful in 1m43s
Test Suite / ubuntu / stable / coverage (push) Successful in 12m52s
Test Suite / macos-latest / stable (push) Has been cancelled
Test Suite / windows-latest / stable (push) Has been cancelled
2026-02-05 18:50:42 -07:00
ff82dc2012 style: Upgraded rustfmt edition to 2024
Check / stable / fmt (push) Successful in 9m57s
Check / beta / clippy (push) Successful in 11m0s
Check / stable / clippy (push) Successful in 10m59s
Check / nightly / doc (push) Successful in 57s
Check / 1.89.0 / check (push) Successful in 1m1s
Test Suite / ubuntu / beta (push) Successful in 1m43s
Test Suite / ubuntu / stable (push) Successful in 1m42s
Test Suite / ubuntu / stable / coverage (push) Successful in 12m52s
Test Suite / macos-latest / stable (push) Has been cancelled
Test Suite / windows-latest / stable (push) Has been cancelled
2026-02-05 10:47:35 -07:00
github-actions[bot]
89a692ad90 chore: bump Cargo.toml to 0.7.1
Check / stable / fmt (push) Successful in 9m55s
Check / beta / clippy (push) Successful in 10m59s
Check / stable / clippy (push) Successful in 10m59s
Check / nightly / doc (push) Successful in 59s
Check / 1.89.0 / check (push) Successful in 1m2s
Test Suite / ubuntu / beta (push) Successful in 1m42s
Test Suite / ubuntu / stable (push) Successful in 1m42s
Test Suite / ubuntu / stable / coverage (push) Successful in 12m51s
Test Suite / macos-latest / stable (push) Has been cancelled
Test Suite / windows-latest / stable (push) Has been cancelled
2026-02-04 18:01:02 +00:00
github-actions[bot]
d77ec5fb34 bump: version 0.7.0 → 0.7.1 [skip ci] 2026-02-04 18:01:00 +00:00
Alex Clarke
ec90e2dca7 Merge pull request #56 from Dark-Alex-17/develop
Check / stable / fmt (push) Successful in 9m53s
Check / beta / clippy (push) Has been cancelled
Check / stable / clippy (push) Has been cancelled
Check / nightly / doc (push) Has been cancelled
Check / 1.89.0 / check (push) Has been cancelled
Test Suite / ubuntu / beta (push) Has been cancelled
Test Suite / ubuntu / stable (push) Has been cancelled
Test Suite / macos-latest / stable (push) Has been cancelled
Test Suite / windows-latest / stable (push) Has been cancelled
Test Suite / ubuntu / stable / coverage (push) Has been cancelled
Hotfix and feature adds for some new issues
2026-02-04 10:38:58 -07:00
5a4e6c9623 style: Addressed CR comments about adding an explicit Command::ConfigPath to the main command match statement 2026-02-04 10:24:59 -07:00
9a6a06ee20 build: Updated all dependencies to resolve dependabot security issues 2026-02-04 09:51:57 -07:00
5556e48fc0 fix: Improved the system notification feature so it can persist between modals 2026-02-04 08:18:04 -07:00
af573cac2a feat: Added support for a system-wide notification popup mechanism that works across Servarrs 2026-02-03 17:03:12 -07:00
447cf6a2b4 style: Applied formatting to the artist_details_ui 2026-02-03 08:10:02 -07:00
203bf9cb66 fix: Sonarr API updated to somtimes allow either seeders or leechers to be null 2026-02-03 08:00:31 -07:00
26 changed files with 708 additions and 99 deletions
+23
View File
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.7.1 (2026-02-04)
### Feat
- Added support for a system-wide notification popup mechanism that works across Servarrs
- Implemented a 'config-path' command to print out the default Managarr configuration file path to help address #54
- Full support for filtering disks and aggregating root folders in the UI's 'Stats' block
- proper collapsing of root folder paths in the stats layer of the UI
- Added config option to filter for specific disk space paths to display in the UI (CLI is unaffected)
- Improved disk-space UI and CLI that shows the actual path being monitored instead of just a disk number
- Implemented the forgotten lidarr list disk-space command
### Fix
- Improved the system notification feature so it can persist between modals
- Sonarr API updated to somtimes allow either seeders or leechers to be null
- Improved the first-time run behavior so that it outputs the default configuration file it tries to load to help users locate the file on first-runs
- 'managarr config-path' should work without a pre-existing config already in place [#54]
### Refactor
- Removed the filtering of monitored_storage_paths from the networking module and migrated all of it to the UI
## v0.7.0 (2026-01-21)
### Feat
Generated
+35 -36
View File
@@ -99,9 +99,9 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "arc-swap"
version = "1.8.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d03449bb8ca2cc2ef70869af31463d1ae5ccc8fa3e334b307203fbf815207e"
checksum = "9ded5f9a03ac8f24d1b8a25101ee812cd32cdc8c50a4c50237de2c4915850e73"
dependencies = [
"rustversion",
]
@@ -278,15 +278,15 @@ checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"
[[package]]
name = "bytemuck"
version = "1.24.0"
version = "1.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
[[package]]
name = "bytes"
version = "1.11.0"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]]
name = "cargo-husky"
@@ -341,9 +341,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.56"
version = "4.5.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e"
checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a"
dependencies = [
"clap_builder",
"clap_derive",
@@ -351,9 +351,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.56"
version = "4.5.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0"
checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238"
dependencies = [
"anstream",
"anstyle",
@@ -1263,14 +1263,13 @@ dependencies = [
[[package]]
name = "hyper-util"
version = "0.1.19"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f"
checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
dependencies = [
"base64",
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"http",
"http-body",
@@ -1453,9 +1452,9 @@ dependencies = [
[[package]]
name = "insta"
version = "1.46.1"
version = "1.46.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248b42847813a1550dafd15296fd9748c651d0c32194559dbc05d804d54b21e8"
checksum = "e82db8c87c7f1ccecb34ce0c24399b8a73081427f3c7c50a5d597925356115e4"
dependencies = [
"console",
"once_cell",
@@ -1669,7 +1668,7 @@ dependencies = [
[[package]]
name = "managarr"
version = "0.7.0"
version = "0.7.1"
dependencies = [
"anyhow",
"assert_cmd",
@@ -1818,9 +1817,9 @@ dependencies = [
[[package]]
name = "mockito"
version = "1.7.1"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e0603425789b4a70fcc4ac4f5a46a566c116ee3e2a6b768dc623f7719c611de"
checksum = "90820618712cab19cfc46b274c6c22546a82affcb3c3bdf0f29e3db8e1bb92c0"
dependencies = [
"assert-json-diff",
"bytes",
@@ -2214,9 +2213,9 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
[[package]]
name = "portable-atomic"
version = "1.13.0"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950"
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
[[package]]
name = "potential_utf"
@@ -2497,9 +2496,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.12.2"
version = "1.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
dependencies = [
"aho-corasick",
"memchr",
@@ -2509,9 +2508,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.13"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
dependencies = [
"aho-corasick",
"memchr",
@@ -2520,9 +2519,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.8"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
[[package]]
name = "relative-path"
@@ -2946,9 +2945,9 @@ checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
[[package]]
name = "slab"
version = "0.4.11"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "smallvec"
@@ -3091,9 +3090,9 @@ dependencies = [
[[package]]
name = "system-configuration"
version = "0.6.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
dependencies = [
"bitflags 2.10.0",
"core-foundation",
@@ -4230,18 +4229,18 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.8.37"
version = "0.8.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac"
checksum = "57cf3aa6855b23711ee9852dfc97dfaa51c45feaba5b645d0c777414d494a961"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.37"
version = "0.8.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0"
checksum = "8a616990af1a287837c4fe6596ad77ef57948f787e46ce28e166facc0cc1cb75"
dependencies = [
"proc-macro2",
"quote",
@@ -4310,6 +4309,6 @@ dependencies = [
[[package]]
name = "zmij"
version = "1.0.17"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439"
checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445"
+34 -34
View File
@@ -1,6 +1,6 @@
[package]
name = "managarr"
version = "0.7.0"
version = "0.7.1"
authors = ["Alex Clarke <alex.j.tusa@gmail.com>"]
description = "A TUI and CLI to manage your Servarrs"
keywords = ["managarr", "ratatui", "dashboard", "servarr", "tui"]
@@ -20,67 +20,67 @@ members = [
]
[dependencies]
anyhow = "1.0.68"
backtrace = "0.3.74"
anyhow = "1.0.100"
backtrace = "0.3.76"
bimap = { version = "0.6.3", features = ["serde"] }
chrono = { version = "0.4.38", features = ["serde"] }
chrono = { version = "0.4.43", features = ["serde"] }
confy = { version = "2.0.0", default-features = false, features = [
"yaml_conf",
] }
crossterm = "0.28.1"
derivative = "2.2.0"
human-panic = "2.0.2"
indoc = "2.0.0"
log = "0.4.17"
log4rs = { version = "1.2.0", features = ["file_appender"] }
regex = "1.11.1"
reqwest = { version = "0.12.9", features = ["json"] }
serde_yaml = "0.9.16"
serde_json = "1.0.91"
serde = { version = "1.0.214", features = ["derive"] }
human-panic = "2.0.6"
indoc = "2.0.7"
log = "0.4.29"
log4rs = { version = "1.4.0", features = ["file_appender"] }
regex = "1.12.2"
reqwest = { version = "0.12.28", features = ["json"] }
serde_yaml = "0.9.34"
serde_json = "1.0.149"
serde = { version = "1.0.228", features = ["derive"] }
strum = { version = "0.26.3", features = ["derive"] }
strum_macros = "0.26.4"
tokio = { version = "1.44.2", features = ["full"] }
tokio-util = "0.7.8"
tokio = { version = "1.49.0", features = ["full"] }
tokio-util = "0.7.18"
ratatui = { version = "0.30.0", features = [
"all-widgets",
"unstable-widget-ref",
] }
urlencoding = "2.1.2"
clap = { version = "4.5.20", features = [
urlencoding = "2.1.3"
clap = { version = "4.5.56", features = [
"derive",
"cargo",
"env",
"wrap_help",
] }
clap_complete = "4.5.33"
clap_complete = "4.5.65"
itertools = "0.14.0"
ctrlc = "3.4.5"
colored = "3.0.0"
async-trait = "0.1.83"
ctrlc = "3.5.1"
colored = "3.1.1"
async-trait = "0.1.89"
dirs-next = "2.0.0"
managarr-tree-widget = "0.25.0"
indicatif = "0.17.9"
derive_setters = "0.1.6"
deunicode = "1.6.0"
openssl = { version = "0.10.70", features = ["vendored"] }
indicatif = "0.17.11"
derive_setters = "0.1.9"
deunicode = "1.6.2"
openssl = { version = "0.10.75", features = ["vendored"] }
veil = "0.2.0"
validate_theme_derive = "0.1.0"
enum_display_style_derive = "0.1.0"
[dev-dependencies]
assert_cmd = "2.0.16"
mockall = "0.13.0"
mockito = "1.0.0"
pretty_assertions = "1.3.0"
proptest = "1.6.0"
assert_cmd = "2.1.2"
mockall = "0.13.1"
mockito = "1.7.1"
pretty_assertions = "1.4.1"
proptest = "1.9.0"
rstest = "0.25.0"
serial_test = "3.2.0"
assertables = "9.8.2"
insta = "1.41.1"
serial_test = "3.3.1"
assertables = "9.8.4"
insta = "1.46.1"
[dev-dependencies.cargo-husky]
version = "1"
version = "1.5.0"
default-features = false
features = ["user-hooks"]
+2 -2
View File
@@ -55,9 +55,9 @@ Run Managarr as a docker container by mounting your `config.yml` file to `/root/
docker run --rm -it -v /home/aclarke/.config/managarr/config.yml:/root/.config/managarr/config.yml darkalex17/managarr:latest
```
You can also clone this repo and run `make docker` to build a docker image locally and run it using the above command.
You can also clone this repo and run `just build-docker` to build a docker image locally and run it using the above command.
Please note that you will need to create and popular your configuration file first before starting the container. Otherwise, the container will fail to start.
Please note that you will need to create and populate your configuration file first before starting the container. Otherwise, the container will fail to start.
**Note:** If you run into errors using relative file paths when mounting the volume with the configuration file, try using an absolute path.
+1 -1
View File
@@ -1,5 +1,5 @@
tab_spaces=2
edition = "2021"
edition = "2024"
reorder_imports = true
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
+3
View File
@@ -13,6 +13,7 @@ use tokio_util::sync::CancellationToken;
use veil::Redact;
use crate::cli::Command;
use crate::models::servarr_data::Notification;
use crate::models::servarr_data::lidarr::lidarr_data::{ActiveLidarrBlock, LidarrData};
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, RadarrData};
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, SonarrData};
@@ -38,6 +39,7 @@ pub struct App<'a> {
pub server_tabs: TabState,
pub keymapping_table: Option<StatefulTable<KeybindingItem>>,
pub error: HorizontallyScrollableText,
pub notification: Option<Notification>,
pub tick_until_poll: u64,
pub ticks_until_scroll: u64,
pub tick_count: u64,
@@ -254,6 +256,7 @@ impl Default for App<'_> {
cancellation_token: CancellationToken::new(),
keymapping_table: None,
error: HorizontallyScrollableText::default(),
notification: None,
is_first_render: true,
server_tabs: TabState::new(Vec::new()),
tick_until_poll: 400,
+54 -1
View File
@@ -20,10 +20,10 @@ mod tests {
use crate::handlers::{handle_events, populate_keymapping_table};
use crate::models::HorizontallyScrollableText;
use crate::models::Route;
use crate::models::servarr_data::ActiveKeybindingBlock;
use crate::models::servarr_data::lidarr::lidarr_data::ActiveLidarrBlock;
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, RadarrData};
use crate::models::servarr_data::sonarr::sonarr_data::ActiveSonarrBlock;
use crate::models::servarr_data::{ActiveKeybindingBlock, Notification};
use crate::models::servarr_models::KeybindingItem;
use crate::models::stateful_table::StatefulTable;
@@ -174,6 +174,26 @@ mod tests {
);
}
#[test]
fn test_handle_clear_notification() {
let mut app = App::test_default();
app.notification = Some(Notification::new(
"Test".to_owned(),
"Test".to_owned(),
true,
));
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
app.push_navigation_stack(ActiveRadarrBlock::MovieDetails.into());
handle_events(DEFAULT_KEYBINDINGS.esc.key, &mut app);
assert_none!(app.notification);
assert_eq!(
app.get_current_route(),
ActiveRadarrBlock::MovieDetails.into()
);
}
#[rstest]
fn test_handle_prompt_toggle_left_right_radarr(#[values(Key::Left, Key::Right)] key: Key) {
let mut app = App::test_default();
@@ -284,6 +304,39 @@ mod tests {
);
}
#[test]
fn test_handle_events_esc_clears_notification() {
let mut app = App::test_default();
app.notification = Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
));
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
handle_events(DEFAULT_KEYBINDINGS.esc.key, &mut app);
assert_none!(app.notification);
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
}
#[test]
fn test_handle_events_esc_does_not_clear_notification_when_none() {
let mut app = App::test_default();
app
.data
.radarr_data
.movies
.set_items(vec![Movie::default()]);
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
app.push_navigation_stack(ActiveRadarrBlock::SearchMovie.into());
handle_events(DEFAULT_KEYBINDINGS.esc.key, &mut app);
assert_none!(app.notification);
assert_navigation_popped!(app, ActiveRadarrBlock::Movies.into());
}
fn context_clue_to_keybinding_item(key: &KeyBinding, desc: &&str) -> KeybindingItem {
let (key, alt_key) = if key.alt.is_some() {
(key.key.to_string(), key.alt.as_ref().unwrap().to_string())
+2
View File
@@ -116,6 +116,8 @@ pub fn handle_events(key: Key, app: &mut App<'_>) {
} else {
app.keymapping_table = None;
}
} else if matches_key!(esc, key) && app.notification.is_some() {
app.notification.take();
} else {
match app.get_current_route() {
_ if app.keymapping_table.is_some() => {
+5 -1
View File
@@ -185,7 +185,11 @@ async fn main() -> Result<()> {
generate(shell, &mut cli, "managarr", &mut io::stdout())
}
Command::TailLogs { no_color } => tail_logs(no_color).await?,
_ => {}
Command::ConfigPath => {
unreachable!(
"ConfigPath command is handled before this match and should be unreachable here"
);
}
},
None => {
let app_nw = Arc::clone(&app);
+17
View File
@@ -10,6 +10,23 @@ pub(in crate::models::servarr_data) mod data_test_utils;
#[cfg(test)]
mod servarr_data_tests;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Notification {
pub title: String,
pub message: String,
pub success: bool,
}
impl Notification {
pub fn new(title: String, message: String, success: bool) -> Self {
Self {
title,
message,
success,
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub enum ActiveKeybindingBlock {
#[default]
@@ -1,8 +1,10 @@
#[cfg(test)]
mod tests {
use crate::models::lidarr_models::LidarrReleaseDownloadBody;
use crate::models::servarr_data::Notification;
use crate::network::lidarr_network::LidarrEvent;
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
use pretty_assertions::assert_eq;
use serde_json::json;
#[tokio::test]
@@ -30,5 +32,51 @@ mod tests {
mock.assert_async().await;
assert_ok!(result);
assert_eq!(
app.lock().await.notification,
Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
))
);
}
#[tokio::test]
async fn test_handle_download_lidarr_release_event_sets_failure_notification_on_error() {
let params = LidarrReleaseDownloadBody {
guid: "1234".to_owned(),
indexer_id: 2,
};
let (mock, app, _server) = MockServarrApi::post()
.with_request_body(json!({
"guid": "1234",
"indexerId": 2,
}))
.returns(json!({}))
.status(500)
.build_for(LidarrEvent::DownloadRelease(params.clone()))
.await;
app.lock().await.server_tabs.set_index(2);
let mut network = test_network(&app);
let result = network
.handle_lidarr_event(LidarrEvent::DownloadRelease(params))
.await;
mock.assert_async().await;
assert_err!(result);
let app = app.lock().await;
assert_is_empty!(app.error.text);
assert_some_eq_x!(
&app.notification,
&Notification::new(
"Download Failed".to_owned(),
"Download request failed. Check the logs for more details.".to_owned(),
false,
)
);
}
}
+22 -3
View File
@@ -1,4 +1,5 @@
use crate::models::lidarr_models::LidarrReleaseDownloadBody;
use crate::models::servarr_data::Notification;
use crate::network::lidarr_network::LidarrEvent;
use crate::network::{Network, RequestMethod};
use anyhow::Result;
@@ -31,8 +32,26 @@ impl Network<'_, '_> {
)
.await;
self
.handle_request::<LidarrReleaseDownloadBody, Value>(request_props, |_, _| ())
.await
let result = self
.handle_request::<LidarrReleaseDownloadBody, Value>(request_props, |_, mut app| {
app.notification = Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
));
})
.await;
if result.is_err() {
let mut app = self.app.lock().await;
std::mem::take(&mut app.error.text);
app.notification = Some(Notification::new(
"Download Failed".to_owned(),
"Download request failed. Check the logs for more details.".to_owned(),
false,
));
}
result
}
}
+22 -3
View File
@@ -3,6 +3,7 @@ use crate::models::radarr_models::{
EditMovieParams, Movie, MovieCommandBody, MovieHistoryItem, RadarrRelease,
RadarrReleaseDownloadBody,
};
use crate::models::servarr_data::Notification;
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
use crate::models::stateful_table::StatefulTable;
@@ -85,9 +86,27 @@ impl Network<'_, '_> {
.request_props_from(event, RequestMethod::Post, Some(params), None, None)
.await;
self
.handle_request::<RadarrReleaseDownloadBody, Value>(request_props, |_, _| ())
.await
let result = self
.handle_request::<RadarrReleaseDownloadBody, Value>(request_props, |_, mut app| {
app.notification = Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
));
})
.await;
if result.is_err() {
let mut app = self.app.lock().await;
std::mem::take(&mut app.error.text);
app.notification = Some(Notification::new(
"Download Failed".to_owned(),
"Download request failed. Check the logs for more details.".to_owned(),
false,
));
}
result
}
pub(in crate::network::radarr_network) async fn edit_movie(
@@ -4,6 +4,7 @@ mod tests {
AddMovieBody, AddMovieOptions, Credit, DeleteMovieParams, DownloadRecord, EditMovieParams,
MinimumAvailability, Movie, MovieHistoryItem, MovieMonitor, RadarrReleaseDownloadBody,
};
use crate::models::servarr_data::Notification;
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
use crate::models::stateful_table::SortOption;
@@ -164,14 +165,58 @@ mod tests {
.await;
let mut network = test_network(&app);
assert!(
network
.handle_radarr_event(RadarrEvent::DownloadRelease(expected_body))
.await
.is_ok()
);
let result = network
.handle_radarr_event(RadarrEvent::DownloadRelease(expected_body))
.await;
mock.assert_async().await;
assert_ok!(result);
assert_some_eq_x!(
&app.lock().await.notification,
&Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
)
);
}
#[tokio::test]
async fn test_handle_download_radarr_release_event_sets_failure_notification_on_error() {
let expected_body = RadarrReleaseDownloadBody {
guid: "1234".to_owned(),
indexer_id: 2,
movie_id: 1,
};
let body = json!({
"guid": "1234",
"indexerId": 2,
"movieId": 1
});
let (mock, app, _server) = MockServarrApi::post()
.with_request_body(body)
.returns(json!({}))
.status(500)
.build_for(RadarrEvent::DownloadRelease(expected_body.clone()))
.await;
let mut network = test_network(&app);
let result = network
.handle_radarr_event(RadarrEvent::DownloadRelease(expected_body))
.await;
mock.assert_async().await;
assert_err!(result);
let app = app.lock().await;
assert_is_empty!(app.error.text);
assert_some_eq_x!(
&app.notification,
&Notification::new(
"Download Failed".to_owned(),
"Download request failed. Check the logs for more details.".to_owned(),
false,
)
);
}
#[tokio::test]
+22 -3
View File
@@ -1,3 +1,4 @@
use crate::models::servarr_data::Notification;
use crate::models::sonarr_models::SonarrReleaseDownloadBody;
use crate::network::sonarr_network::SonarrEvent;
use crate::network::{Network, RequestMethod};
@@ -31,8 +32,26 @@ impl Network<'_, '_> {
)
.await;
self
.handle_request::<SonarrReleaseDownloadBody, Value>(request_props, |_, _| ())
.await
let result = self
.handle_request::<SonarrReleaseDownloadBody, Value>(request_props, |_, mut app| {
app.notification = Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
));
})
.await;
if result.is_err() {
let mut app = self.app.lock().await;
std::mem::take(&mut app.error.text);
app.notification = Some(Notification::new(
"Download Failed".to_owned(),
"Download request failed. Check the logs for more details.".to_owned(),
false,
));
}
result
}
}
@@ -1,8 +1,10 @@
#[cfg(test)]
mod tests {
use crate::models::servarr_data::Notification;
use crate::models::sonarr_models::SonarrReleaseDownloadBody;
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
use crate::network::sonarr_network::SonarrEvent;
use pretty_assertions::assert_eq;
use serde_json::json;
#[tokio::test]
@@ -33,5 +35,54 @@ mod tests {
mock.assert_async().await;
assert_ok!(result);
assert_eq!(
app.lock().await.notification,
Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
))
);
}
#[tokio::test]
async fn test_handle_download_sonarr_release_event_sets_failure_notification_on_error() {
let params = SonarrReleaseDownloadBody {
guid: "1234".to_owned(),
indexer_id: 2,
series_id: Some(1),
..SonarrReleaseDownloadBody::default()
};
let (mock, app, _server) = MockServarrApi::post()
.with_request_body(json!({
"guid": "1234",
"indexerId": 2,
"seriesId": 1,
}))
.returns(json!({}))
.status(500)
.build_for(SonarrEvent::DownloadRelease(params.clone()))
.await;
app.lock().await.server_tabs.next();
let mut network = test_network(&app);
let result = network
.handle_sonarr_event(SonarrEvent::DownloadRelease(params))
.await;
mock.assert_async().await;
assert_err!(result);
let app = app.lock().await;
assert_is_empty!(app.error.text);
assert_some_eq_x!(
&app.notification,
&Notification::new(
"Download Failed".to_owned(),
"Download request failed. Check the logs for more details.".to_owned(),
false,
)
);
}
}
+2 -2
View File
@@ -356,12 +356,12 @@ fn draw_album_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
let leechers = leechers
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
decorate_peer_style(
seeders,
@@ -501,12 +501,12 @@ fn draw_artist_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
let leechers = leechers
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
decorate_peer_style(
seeders,
+23 -1
View File
@@ -14,6 +14,7 @@ use sonarr_ui::SonarrUi;
use utils::layout_block;
use crate::app::App;
use crate::models::servarr_data::Notification;
use crate::models::servarr_models::KeybindingItem;
use crate::models::{HorizontallyScrollableText, Route, TabState};
use crate::ui::radarr_ui::RadarrUi;
@@ -25,7 +26,8 @@ use crate::ui::utils::{
};
use crate::ui::widgets::input_box::InputBox;
use crate::ui::widgets::managarr_table::ManagarrTable;
use crate::ui::widgets::popup::Size;
use crate::ui::widgets::message::Message;
use crate::ui::widgets::popup::{Popup, Size};
mod builtin_themes;
mod lidarr_ui;
@@ -95,6 +97,10 @@ pub fn ui(f: &mut Frame<'_>, app: &mut App<'_>) {
_ => (),
}
if let Some(notification) = &app.notification {
draw_notification_popup(f, notification);
}
if app.keymapping_table.is_some() {
draw_help_popup(f, app);
}
@@ -183,6 +189,22 @@ pub fn draw_help_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
f.render_widget(keymapping_table, table_area);
}
fn draw_notification_popup(f: &mut Frame<'_>, notification: &Notification) {
let style = if notification.success {
styles::success_style().bold()
} else {
styles::failure_style().bold()
};
let popup = Popup::new(
Message::new(notification.message.as_str())
.title(notification.title.as_str())
.style(style),
)
.size(Size::Message);
f.render_widget(popup, f.area());
}
fn draw_tabs(f: &mut Frame<'_>, area: Rect, title: &str, tab_state: &TabState) -> Rect {
if title.is_empty() {
f.render_widget(layout_block().default_color(), area);
@@ -0,0 +1,54 @@
---
source: src/ui/ui_tests.rs
expression: output
---
╭ Managarr - A Servarr management TUI ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Radarr │ Sonarr │ Lidarr <?> to open help│
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭ Stats ──────────────────────────────────────────────────────────────╮╭ Downloads ─────────────────────────────────────────────────────────╮╭──────────────────╮
│Lidarr Version: 1.2.3.4 ││Test download title ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
│Storage: ││ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
│Root Folders: ││ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
│/nfs: 204800.00 GB free ││ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
│ ││ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
│ ││ ││ ⠀⠀⠀⠉⠻⠿⢿⡆⡾⠿⠟⠉⠀⠀⠀ │
╰───────────────────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────────────────╯╰──────────────────╯
╭ Artists ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Library │ Downloads │ Blocklist │ History │ Root Folders │ Indexers │ System │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ Name ▼ Type Status Quality Profile Metadata Profile Albums Tracks Size Monitored Tags │
│=> Alex Person Continuing Lossless Standard 1 15/15 0.00 GB 🏷 alex │
│ │
│ │
│ │
│ │
│ │
│ ╭────────── Download Result ──────────╮ │
│ │ Download request sent successfully │ │
│ │ │ │
│ ╰───────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,54 @@
---
source: src/ui/ui_tests.rs
expression: output
---
╭ Managarr - A Servarr management TUI ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Radarr │ Sonarr │ Lidarr <?> to open help│
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭ Stats ──────────────────────────────────────────────────────────────╮╭ Downloads ─────────────────────────────────────────────────────────╮╭──────────────────╮
│Radarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
│/nfs: 204800.00 GB free ││ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
│ ││ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
│ ││ ││ │
╰───────────────────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────────────────╯╰──────────────────╯
╭ Movies ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Library │ Collections │ Downloads │ Blocklist │ History │ Root Folders │ Indexers │ System │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ Title ▼ Year Studio Runtime Rating Language Size Quality Profile Monitored Tags │
│=> Test 2023 21st Century Alex 2h 0m R English 3.30 GB HD - 1080p 🏷 alex │
│ │
│ │
│ │
│ │
│ │
│ ╭────────── Download Failed ──────────╮ │
│ │ Request failed. Received 500 response │ │
│ │ code │ │
│ ╰───────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,54 @@
---
source: src/ui/ui_tests.rs
expression: output
---
╭ Managarr - A Servarr management TUI ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Radarr │ Sonarr │ Lidarr <?> to open help│
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭ Stats ──────────────────────────────────────────────────────────────╮╭ Downloads ─────────────────────────────────────────────────────────╮╭──────────────────╮
│Radarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
│/nfs: 204800.00 GB free ││ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
│ ││ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
│ ││ ││ │
╰───────────────────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────────────────╯╰──────────────────╯
╭ Movies ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Library │ Collections │ Downloads │ Blocklist │ History │ Root Folders │ Indexers │ System │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ Title ▼ Year Studio Runtime Rating Language Size Quality Profile Monitored Tags │
│=> Test 2023 21st Century Alex 2h 0m R English 3.30 GB HD - 1080p 🏷 alex │
│ │
│ │
│ │
│ │
│ │
│ ╭────────── Download Result ──────────╮ │
│ │ Download request sent successfully │ │
│ │ │ │
│ ╰───────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,54 @@
---
source: src/ui/ui_tests.rs
expression: output
---
╭ Managarr - A Servarr management TUI ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Radarr │ Sonarr │ Lidarr <?> to open help│
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭ Stats ──────────────────────────────────────────────────────────────╮╭ Downloads ─────────────────────────────────────────────────────────╮╭──────────────────╮
│Sonarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
│Storage: ││ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
│Root Folders: ││ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
│/nfs: 204800.00 GB free ││ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
│ ││ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
│ ││ ││ ⠀⠀⠀⠘⠻⠿⣿⣿⣿⣿⠿⠟⠋⠀⠀⠀ │
╰───────────────────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────────────────╯╰──────────────────╯
╭ Series ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Library │ Downloads │ Blocklist │ History │ Root Folders │ Indexers │ System │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ Title ▼ Year Network Status Rating Type Quality Profile Language Size Monitored Tags │
│=> Test 2022 HBO Continuin TV-MA Standard Bluray-1080p English 59.51 GB 🏷 │
│ │
│ │
│ │
│ │
│ │
│ ╭────────── Download Result ──────────╮ │
│ │ Download request sent successfully │ │
│ │ │ │
│ ╰───────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -425,12 +425,12 @@ fn draw_episode_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
let leechers = leechers
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
decorate_peer_style(
seeders,
@@ -388,12 +388,12 @@ fn draw_season_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
let leechers = leechers
.clone()
.unwrap_or(Number::from(0u64))
.as_u64()
.unwrap();
.unwrap_or_default();
decorate_peer_style(
seeders,
+69
View File
@@ -2,6 +2,7 @@
mod snapshot_tests {
use crate::app::App;
use crate::handlers::populate_keymapping_table;
use crate::models::servarr_data::Notification;
use crate::models::servarr_data::lidarr::lidarr_data::ActiveLidarrBlock;
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
use crate::models::servarr_data::sonarr::sonarr_data::ActiveSonarrBlock;
@@ -46,6 +47,40 @@ mod snapshot_tests {
insta::assert_snapshot!(output);
}
#[test]
fn test_radarr_ui_renders_notification_success_popup() {
let mut app = App::test_default_fully_populated();
app.notification = Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
));
app.push_navigation_stack(ActiveRadarrBlock::default().into());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
ui(f, app);
});
insta::assert_snapshot!(output);
}
#[test]
fn test_radarr_ui_renders_notification_failure_popup() {
let mut app = App::test_default_fully_populated();
app.notification = Some(Notification::new(
"Download Failed".to_owned(),
"Request failed. Received 500 response code".to_owned(),
false,
));
app.push_navigation_stack(ActiveRadarrBlock::default().into());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
ui(f, app);
});
insta::assert_snapshot!(output);
}
#[test]
fn test_sonarr_ui_renders_library_tab() {
let mut app = App::test_default_fully_populated();
@@ -84,6 +119,23 @@ mod snapshot_tests {
insta::assert_snapshot!(output);
}
#[test]
fn test_sonarr_ui_renders_notification_success_popup() {
let mut app = App::test_default_fully_populated();
app.notification = Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
));
app.push_navigation_stack(ActiveSonarrBlock::default().into());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
ui(f, app);
});
insta::assert_snapshot!(output);
}
#[test]
fn test_lidarr_ui_renders_library_tab() {
let mut app = App::test_default_fully_populated();
@@ -109,6 +161,23 @@ mod snapshot_tests {
insta::assert_snapshot!(output);
}
#[test]
fn test_lidarr_ui_renders_notification_success_popup() {
let mut app = App::test_default_fully_populated();
app.notification = Some(Notification::new(
"Download Result".to_owned(),
"Download request sent successfully".to_owned(),
true,
));
app.push_navigation_stack(ActiveLidarrBlock::default().into());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
ui(f, app);
});
insta::assert_snapshot!(output);
}
#[test]
fn test_lidarr_ui_renders_library_tab_error_popup() {
let mut app = App::test_default_fully_populated();