Compare commits
28 Commits
lidarr
...
f988cf0f26
| Author | SHA1 | Date | |
|---|---|---|---|
|
f988cf0f26
|
|||
|
ff82dc2012
|
|||
|
|
89a692ad90 | ||
|
|
d77ec5fb34 | ||
|
|
ec90e2dca7 | ||
|
5a4e6c9623
|
|||
|
9a6a06ee20
|
|||
|
5556e48fc0
|
|||
|
af573cac2a
|
|||
|
447cf6a2b4
|
|||
|
203bf9cb66
|
|||
|
4f9bc34d23
|
|||
|
a2aa9507a9
|
|||
|
c791b985f0
|
|||
|
5c517a748c
|
|||
|
892c687077
|
|||
|
c6d5b98e86
|
|||
|
67e5114ec2
|
|||
|
fdc331865e
|
|||
|
f388dccc08
|
|||
|
64fad3b9bc
|
|||
|
3be7b09da8
|
|||
|
5f3123cd79
|
|||
|
d8f7febfe1
|
|||
|
0bfbb44e3e
|
|||
|
|
c5161f828d | ||
|
|
71c64167f0 | ||
|
|
4d3e00fd94 |
+100
@@ -5,6 +5,106 @@ 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
|
||||
|
||||
- Blocklist support in Lidarr in both the CLI and TUI
|
||||
- CLI and TUI support for track history and track details in Lidarr
|
||||
- Lidarr UI support for album details popup
|
||||
- Implemented TUI handler support for the Album Details popup in Lidarr
|
||||
- Bulk added CLI support for tracks and album functionalities in Lidarr
|
||||
- Implemented the manual artist discography search tab in Lidarr's artist details UI
|
||||
- Lidarr CLI support for downloading a release
|
||||
- CLI support for searching for discography releases in Lidarr
|
||||
- Added TUI and CLI support for viewing Artist history in Lidarr
|
||||
- Full Lidarr system support for both the CLI and TUI
|
||||
- Full CLI and TUI support for the Lidarr Indexers tab
|
||||
- Full support for adding a root folder in Lidarr from both the CLI and TUI
|
||||
- naive lidarr root folder tab implementation. Needs improved add logic
|
||||
- Downloads tab support in Lidarr
|
||||
- Created a History tab in the Radarr UI and created a list history command and mark-history-item-as-failed command for Radarr
|
||||
- Implemented the Lidarr History tab and CLI support
|
||||
- TUI support for deleting a Lidarr album from the artist details popup
|
||||
- CLI support for deleting an album from Lidarr
|
||||
- Completed support for viewing Lidarr artist details
|
||||
- Full CLI and TUI support for adding an artist to Lidarr
|
||||
- Include the Lidarr artist disambiguation in the title of the Edit Artist popup
|
||||
- Initial Lidarr support for searching for new artists
|
||||
- Lidarr CLI commands to list quality profiles and metadata profiles
|
||||
- Improved CLI readability by creating a separate Global Options section for global flags
|
||||
- CLI support for deleting a tag in Lidarr
|
||||
- Lidarr CLI support for listing and adding tags
|
||||
- Added CLI and TUI support for editing Lidarr artists
|
||||
- Support for updating all Lidarr artists in both the CLI and TUI
|
||||
- Added Lidarr CLI support for fetching the host config and the security config
|
||||
- Created Lidarr commands: 'get artist-details' and 'get system-status'
|
||||
- Fetch the artist members as part of the artist details query
|
||||
- Support for toggling the monitoring of a given artist via the CLI and TUI
|
||||
- Full support for deleting an artist via CLI and TUI
|
||||
- TUI support for Lidarr library
|
||||
- CLI support for listing artists
|
||||
- Improved UI speed and responsiveness
|
||||
|
||||
### Fix
|
||||
|
||||
- Sonarr network wasn't checking for the user to be using the sorting block when populating season details
|
||||
- Sonarr CLI was not properly filtering out episode and season releases when manually searching for releases
|
||||
- Sonarr manual search TUI and CLI incorrectly displaying the same unfiltered results for both season and episode searches
|
||||
- Slowed down the automatic text scrolling in tables so the text is readable
|
||||
- Expanded the history item details size so that it can include all the available information for a given item; was previously being cut off on some screens
|
||||
- Bug in submitting the update series prompt in the series details UI in Sonarr
|
||||
- Don't include Lidarr artist disambiguation in Edit popup title when it is empty
|
||||
- Refactored how quality profiles, language profiles, and metadata profiles are populated for each servarr so they sort using the ID to mimic the web UI better
|
||||
- Added the correct keybinding context to the Lidarr edit artist popup
|
||||
- Improved fault tolerance for search result tables and test all indexer results tables
|
||||
- Prevented additional empty slice errors in indexer tables
|
||||
- Fixed a bug in all Servarr implementations to not try to get the current selection of a search table when an error is returned from the API
|
||||
- Fixed an issue with the Managarr table that would incorrectly try to display things before is_loading was ready
|
||||
- Fixed a bug where the edit collection popup would not display when opening it from collection details
|
||||
|
||||
### Refactor
|
||||
|
||||
- Refactored the SonarrEvent enum to not unnecessarily wrap dual series_id and season_number values in a tuple when both values can be passed directly
|
||||
- Improved and simplified the implementation of history details for both Sonarr and Lidarr
|
||||
- Let serde serialize Add Series and Add Movie enums instead of calling to_string up front
|
||||
- Use is_multiple_of for the tick counter in the UI module
|
||||
- Updated all model tests to use purpose-built assertions to improve readability and maintainability
|
||||
- Updated all handler tests to use purpose built assertions to improve readability and maintainability
|
||||
- Used is_multiple_of to make life easier and cleaner in the app module
|
||||
- Refactored all cli tests to use purpose-built assertions
|
||||
- Improved test assertions in the app module
|
||||
- Created dedicated proptests and assertions to clean up the handler unit tests
|
||||
- Migrated the handle_table_events macro into a trait for better IDE support, created a TableEventAdapter wrapper for the KeyEventHandlers to make it so that the trait can be used properly and a simple function to replace the previous call to the handle_table_events macro
|
||||
- Simplified both the table_handler macro and the stateful_table implementation
|
||||
- Improved error handling for the tail-logs subcommand to propagate errors up the stack instead of exiting there.
|
||||
- Added accessor methods to servarr_data structs, replaced for loops with functional iterator chains, eliminated mutable state tracking, and updated network module to use get_or_insert_default() for modal options
|
||||
- Improved error handling project-wide and cleaned up some regexes with unnecessary escapes (tail_logs and interpolate_env_vars)
|
||||
- Refactored to use more idiomatic let-else statements where applicable
|
||||
|
||||
## v0.6.3 (2025-12-13)
|
||||
|
||||
### Fix
|
||||
|
||||
Generated
+198
-244
File diff suppressed because it is too large
Load Diff
+35
-35
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "managarr"
|
||||
version = "0.6.3"
|
||||
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"] }
|
||||
confy = { version = "0.6.0", default-features = false, features = [
|
||||
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"]
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -259,6 +259,8 @@ Commands:
|
||||
lidarr Commands for manging your Lidarr instance
|
||||
completions Generate shell completions for the Managarr CLI
|
||||
tail-logs Tail Managarr logs
|
||||
config-path Print the full path to the default configuration file.
|
||||
This file can be changed to another location using the '--config-file' flag
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
@@ -266,14 +268,23 @@ Options:
|
||||
-V, --version Print version
|
||||
|
||||
Global Options:
|
||||
--disable-spinner Disable the spinner (can sometimes make parsing output challenging) [env: MANAGARR_DISABLE_SPINNER=]
|
||||
--config-file <CONFIG_FILE> The Managarr configuration file to use [env: MANAGARR_CONFIG_FILE=]
|
||||
--themes-file <THEMES_FILE> The Managarr themes file to use [env: MANAGARR_THEMES_FILE=]
|
||||
--theme <THEME> The name of the Managarr theme to use [env: MANAGARR_THEME=]
|
||||
--servarr-name <SERVARR_NAME> For multi-instance configurations, you need to specify the name of the instance configuration that you want to use.
|
||||
--disable-spinner Disable the spinner (can sometimes make parsing output
|
||||
challenging) [env: MANAGARR_DISABLE_SPINNER=]
|
||||
--config-file <CONFIG_FILE> The Managarr configuration file to use; defaults to the
|
||||
path shown by 'managarr config-path' [env:
|
||||
MANAGARR_CONFIG_FILE=]
|
||||
--themes-file <THEMES_FILE> The Managarr themes file to use [env:
|
||||
MANAGARR_THEMES_FILE=]
|
||||
--theme <THEME> The name of the Managarr theme to use [env:
|
||||
MANAGARR_THEME=]
|
||||
--servarr-name <SERVARR_NAME> For multi-instance configurations, you need to specify
|
||||
the name of the instance configuration that you want to
|
||||
use.
|
||||
|
||||
This is useful when you have multiple instances of the same Servarr defined in your config file.
|
||||
By default, if left empty, the first configured Servarr instance listed in the config file will be used.
|
||||
This is useful when you have multiple instances of the
|
||||
same Servarr defined in your config file.
|
||||
By default, if left empty, the first configured Servarr
|
||||
instance listed in the config file will be used.
|
||||
```
|
||||
|
||||
All subcommands also have detailed help menus to show you how to use them. For example, to see all available commands for Sonarr, you would run:
|
||||
@@ -330,21 +341,11 @@ $ managarr radarr list movies | jq '.[] | select(.title == "Ad Astra") | .id'
|
||||
Managarr assumes reasonable defaults to connect to each service (i.e. Radarr is on localhost:7878),
|
||||
but all servers will require you to input the API token.
|
||||
|
||||
The configuration file is located somewhere different for each OS.
|
||||
The configuration file is located somewhere different for each OS, so run the following command to print out the default
|
||||
location of the `managarr` configuration file for your system:
|
||||
|
||||
### Linux
|
||||
```
|
||||
$HOME/.config/managarr/config.yml
|
||||
```
|
||||
|
||||
### Mac
|
||||
```
|
||||
$HOME/Library/Application Support/managarr/config.yml
|
||||
```
|
||||
|
||||
### Windows
|
||||
```
|
||||
%APPDATA%/Roaming/managarr/config.yml
|
||||
```shell
|
||||
managarr config-path
|
||||
```
|
||||
|
||||
## Specify Which Configuration File to Use
|
||||
@@ -364,42 +365,39 @@ radarr:
|
||||
port: 7878
|
||||
api_token: someApiToken1234567890
|
||||
ssl_cert_path: /path/to/radarr.crt # Required to enable SSL
|
||||
sonarr:
|
||||
- uri: http://htpc.local/sonarr # Example of using the 'uri' key instead of 'host' and 'port'
|
||||
api_token: someApiToken1234567890
|
||||
|
||||
- uri: http://htpc.local/radarr # Example of using the 'uri' key instead of 'host' and 'port'
|
||||
api_token: someApiToken1234567890
|
||||
|
||||
sonarr:
|
||||
- host: 192.168.0.89
|
||||
port: 8989
|
||||
api_token_file: /root/.config/sonarr_api_token # Example of loading the API token from a file instead of hardcoding it in the configuration file
|
||||
|
||||
- name: Anime Sonarr # An example of a custom name for a secondary Sonarr instance
|
||||
host: 192.168.0.89
|
||||
host: 192.168.1.89
|
||||
port: 8989
|
||||
api_token: someApiToken1234567890
|
||||
readarr:
|
||||
- host: 192.168.0.87
|
||||
port: 8787
|
||||
api_token_file: /root/.config/readarr_api_token # Example of loading the API token from a file instead of hardcoding it in the configuration file
|
||||
|
||||
lidarr:
|
||||
- host: 192.168.0.86
|
||||
port: 8686
|
||||
api_token: ${MY_LIDARR_API_TOKEN} # Example of configuring using environment variables
|
||||
whisparr:
|
||||
- host: 192.168.0.69
|
||||
port: 6969
|
||||
monitored_storage_paths: # Filter which Root Folders or Disk Storage you want displayed in the UI's 'Stats' block
|
||||
# Note: Setting these values does not affect what shows up in the 'Root Folders' tab of the UI.
|
||||
- /nfs # An example disk (i.e. '<servarr> list disk-space' command) you want displayed in the UI under 'Storage:'
|
||||
- /media # An example root folder you want displayed in the UI
|
||||
# Root folders collapse up to the super-directory to reduce duplication in the UI. For example:
|
||||
# if you have root folders '/media/tv', '/media/cartoons' and '/media/reality', and you set this
|
||||
# monitored path, the UI will show '/media/[tv,cartoons,reality]' under Root Folders
|
||||
|
||||
- host: 192.168.1.86
|
||||
port: 8686
|
||||
api_token: someApiToken1234567890
|
||||
ssl_cert_path: /path/to/whisparr.crt
|
||||
ssl_cert_path: /path/to/lidarr_1.crt
|
||||
custom_headers: # Example of adding custom headers to all requests to the Servarr instance
|
||||
traefik-auth-bypass-key: someBypassKey1234567890
|
||||
SOME-OTHER-CUSTOM-HEADER: ${MY_CUSTOM_HEADER_VALUE}
|
||||
bazarr:
|
||||
- host: 192.168.0.67
|
||||
port: 6767
|
||||
api_token: someApiToken1234567890
|
||||
prowlarr:
|
||||
- host: 192.168.0.96
|
||||
port: 9696
|
||||
api_token: someApiToken1234567890
|
||||
tautulli:
|
||||
- host: 192.168.0.81
|
||||
port: 8181
|
||||
api_token: someApiToken1234567890
|
||||
```
|
||||
|
||||
### Example Multi-Instance Configuration:
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
tab_spaces=2
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
reorder_imports = true
|
||||
imports_granularity = "Crate"
|
||||
group_imports = "StdExternalCrate"
|
||||
|
||||
+53
-1
@@ -507,6 +507,56 @@ mod tests {
|
||||
assert_none!(config.custom_headers);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_deserialize_optional_env_var_string_vec_is_present() {
|
||||
unsafe { std::env::set_var("TEST_VAR_DESERIALIZE_STRING_VEC_OPTION", "/path1") };
|
||||
let expected_monitored_paths = ["/path1", "/path2"];
|
||||
let yaml_data = r#"
|
||||
monitored_storage_paths:
|
||||
- ${TEST_VAR_DESERIALIZE_STRING_VEC_OPTION}
|
||||
- /path2
|
||||
"#;
|
||||
|
||||
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||
|
||||
assert_some_eq_x!(&config.monitored_storage_paths, &expected_monitored_paths);
|
||||
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_STRING_VEC_OPTION") };
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_deserialize_optional_env_var_string_vec_does_not_overwrite_non_env_value() {
|
||||
unsafe {
|
||||
std::env::set_var(
|
||||
"TEST_VAR_DESERIALIZE_STRING_VEC_OPTION_NO_OVERWRITE",
|
||||
"/path3",
|
||||
)
|
||||
};
|
||||
let expected_monitored_paths = ["/path1", "/path2"];
|
||||
let yaml_data = r#"
|
||||
monitored_storage_paths:
|
||||
- /path1
|
||||
- /path2
|
||||
"#;
|
||||
|
||||
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||
|
||||
assert_some_eq_x!(&config.monitored_storage_paths, &expected_monitored_paths);
|
||||
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_STRING_VEC_OPTION_NO_OVERWRITE") };
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_optional_env_var_string_vec_empty() {
|
||||
let yaml_data = r#"
|
||||
api_token: "test123"
|
||||
"#;
|
||||
|
||||
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||
|
||||
assert_none!(config.monitored_storage_paths);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_deserialize_optional_u16_env_var_is_present() {
|
||||
@@ -620,10 +670,11 @@ mod tests {
|
||||
let api_token = "thisisatest".to_owned();
|
||||
let api_token_file = "/root/.config/api_token".to_owned();
|
||||
let ssl_cert_path = "/some/path".to_owned();
|
||||
let monitored_storage = vec!["/path1".to_owned(), "/path2".to_owned()];
|
||||
let mut custom_headers = HeaderMap::new();
|
||||
custom_headers.insert("X-Custom-Header", "value".parse().unwrap());
|
||||
let expected_str = format!(
|
||||
"ServarrConfig {{ name: Some(\"{name}\"), host: Some(\"{host}\"), port: Some({port}), uri: Some(\"{uri}\"), weight: Some({weight}), api_token: Some(\"***********\"), api_token_file: Some(\"{api_token_file}\"), ssl_cert_path: Some(\"{ssl_cert_path}\"), custom_headers: Some({{\"x-custom-header\": \"value\"}}) }}"
|
||||
"ServarrConfig {{ name: Some(\"{name}\"), host: Some(\"{host}\"), port: Some({port}), uri: Some(\"{uri}\"), weight: Some({weight}), api_token: Some(\"***********\"), api_token_file: Some(\"{api_token_file}\"), ssl_cert_path: Some(\"{ssl_cert_path}\"), custom_headers: Some({{\"x-custom-header\": \"value\"}}), monitored_storage_paths: Some([\"/path1\", \"/path2\"]) }}"
|
||||
);
|
||||
let servarr_config = ServarrConfig {
|
||||
name: Some(name),
|
||||
@@ -635,6 +686,7 @@ mod tests {
|
||||
api_token_file: Some(api_token_file),
|
||||
ssl_cert_path: Some(ssl_cert_path),
|
||||
custom_headers: Some(custom_headers),
|
||||
monitored_storage_paths: Some(monitored_storage),
|
||||
};
|
||||
|
||||
assert_str_eq!(format!("{servarr_config:?}"), expected_str);
|
||||
|
||||
+28
-4
@@ -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,
|
||||
@@ -346,11 +349,11 @@ pub struct AppConfig {
|
||||
}
|
||||
|
||||
impl AppConfig {
|
||||
pub fn validate(&self) {
|
||||
pub fn validate(&self, config_path: &str) {
|
||||
if self.lidarr.is_none() && self.radarr.is_none() && self.sonarr.is_none() {
|
||||
log_and_print_error(
|
||||
"No Servarr configuration provided in the specified configuration file".to_owned(),
|
||||
);
|
||||
log_and_print_error(format!(
|
||||
"No Servarrs are configured in the file: {config_path}"
|
||||
));
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
@@ -436,6 +439,8 @@ pub struct ServarrConfig {
|
||||
serialize_with = "serialize_header_map"
|
||||
)]
|
||||
pub custom_headers: Option<HeaderMap>,
|
||||
#[serde(default, deserialize_with = "deserialize_optional_env_var_string_vec")]
|
||||
pub monitored_storage_paths: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
impl ServarrConfig {
|
||||
@@ -482,6 +487,7 @@ impl Default for ServarrConfig {
|
||||
api_token_file: None,
|
||||
ssl_cert_path: None,
|
||||
custom_headers: None,
|
||||
monitored_storage_paths: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -548,6 +554,24 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn deserialize_optional_env_var_string_vec<'de, D>(
|
||||
deserializer: D,
|
||||
) -> Result<Option<Vec<String>>, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
let opt: Option<Vec<String>> = Option::deserialize(deserializer)?;
|
||||
match opt {
|
||||
Some(vec) => Ok(Some(
|
||||
vec
|
||||
.into_iter()
|
||||
.map(|it| interpolate_env_vars(&it))
|
||||
.collect(),
|
||||
)),
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
fn deserialize_u16_env_var<'de, D>(deserializer: D) -> Result<Option<u16>, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
|
||||
@@ -59,6 +59,8 @@ pub enum LidarrListCommand {
|
||||
Artists,
|
||||
#[command(about = "List all items in the Lidarr blocklist")]
|
||||
Blocklist,
|
||||
#[command(about = "List disk space details for all provisioned root folders in Lidarr")]
|
||||
DiskSpace,
|
||||
#[command(about = "List all active downloads in Lidarr")]
|
||||
Downloads {
|
||||
#[arg(long, help = "How many downloads to fetch", default_value_t = 500)]
|
||||
@@ -209,6 +211,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, LidarrListCommand> for LidarrListCommandH
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
LidarrListCommand::DiskSpace => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event(LidarrEvent::GetDiskSpace.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
LidarrListCommand::Downloads { count } => {
|
||||
let resp = self
|
||||
.network
|
||||
|
||||
@@ -28,6 +28,7 @@ mod tests {
|
||||
#[values(
|
||||
"artists",
|
||||
"blocklist",
|
||||
"disk-space",
|
||||
"indexers",
|
||||
"metadata-profiles",
|
||||
"quality-profiles",
|
||||
@@ -435,6 +436,7 @@ mod tests {
|
||||
#[rstest]
|
||||
#[case(LidarrListCommand::Artists, LidarrEvent::ListArtists)]
|
||||
#[case(LidarrListCommand::Blocklist, LidarrEvent::GetBlocklist)]
|
||||
#[case(LidarrListCommand::DiskSpace, LidarrEvent::GetDiskSpace)]
|
||||
#[case(LidarrListCommand::Indexers, LidarrEvent::GetIndexers)]
|
||||
#[case(LidarrListCommand::MetadataProfiles, LidarrEvent::GetMetadataProfiles)]
|
||||
#[case(LidarrListCommand::QualityProfiles, LidarrEvent::GetQualityProfiles)]
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::sync::Arc;
|
||||
use anyhow::Result;
|
||||
use clap::{Subcommand, command};
|
||||
use clap_complete::Shell;
|
||||
use indoc::indoc;
|
||||
use lidarr::{LidarrCliHandler, LidarrCommand};
|
||||
use radarr::{RadarrCliHandler, RadarrCommand};
|
||||
use sonarr::{SonarrCliHandler, SonarrCommand};
|
||||
@@ -43,6 +44,12 @@ pub enum Command {
|
||||
#[arg(long, help = "Disable colored log output")]
|
||||
no_color: bool,
|
||||
},
|
||||
|
||||
#[command(about = indoc!{"
|
||||
Print the full path to the default configuration file.
|
||||
This file can be changed to another location using the '--config-file' flag
|
||||
"})]
|
||||
ConfigPath,
|
||||
}
|
||||
|
||||
pub trait CliCommandHandler<'a, 'b, T: Into<Command>> {
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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() => {
|
||||
|
||||
@@ -36,8 +36,6 @@ pub const READARR_LOGO: &str = "⠀⠀⠀⠀⠀⣀⣠⣤⣄⣀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠈⠳⣬⣙⠻⠿⠟⣋⣥⠞⠁⠀⠀
|
||||
⠀⠀⠀⠀⠀⠉⠙⠛⠋⠉⠀⠀⠀⠀⠀
|
||||
";
|
||||
// Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then
|
||||
#[allow(dead_code)]
|
||||
pub const LIDARR_LOGO: &str = "⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀
|
||||
⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀
|
||||
⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄
|
||||
|
||||
+26
-6
@@ -2,7 +2,7 @@
|
||||
#[macro_use]
|
||||
extern crate assertables;
|
||||
|
||||
use anyhow::Result;
|
||||
use anyhow::{Context, Result};
|
||||
use clap::{
|
||||
Args, CommandFactory, Parser, crate_authors, crate_description, crate_name, crate_version,
|
||||
};
|
||||
@@ -86,7 +86,7 @@ struct GlobalOpts {
|
||||
global = true,
|
||||
value_parser,
|
||||
env = "MANAGARR_CONFIG_FILE",
|
||||
help = "The Managarr configuration file to use"
|
||||
help = "The Managarr configuration file to use; defaults to the path shown by 'managarr config-path'"
|
||||
)]
|
||||
config_file: Option<PathBuf>,
|
||||
#[arg(
|
||||
@@ -127,15 +127,30 @@ async fn main() -> Result<()> {
|
||||
let running = Arc::new(AtomicBool::new(true));
|
||||
let r = running.clone();
|
||||
let args = Cli::parse();
|
||||
let mut config = if let Some(ref config_file) = args.global.config_file {
|
||||
load_config(config_file.to_str().expect("Invalid config file specified"))?
|
||||
let config_file_path = confy::get_configuration_file_path("managarr", "config")?;
|
||||
let default_config_path = config_file_path.display().to_string();
|
||||
|
||||
if matches!(args.command, Some(Command::ConfigPath)) {
|
||||
println!("{default_config_path}");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let (mut config, config_path) = if let Some(ref config_file) = args.global.config_file {
|
||||
(
|
||||
load_config(config_file.to_str().expect("Invalid config file specified"))?,
|
||||
config_file.display().to_string(),
|
||||
)
|
||||
} else {
|
||||
confy::load("managarr", "config")?
|
||||
(
|
||||
confy::load("managarr", "config")
|
||||
.with_context(|| format!("Config file at '{default_config_path}' is invalid"))?,
|
||||
default_config_path,
|
||||
)
|
||||
};
|
||||
let theme_name = config.theme.clone();
|
||||
let spinner_disabled = args.global.disable_spinner;
|
||||
debug!("Managarr loaded using config: {config:?}");
|
||||
config.validate();
|
||||
config.validate(&config_path);
|
||||
config.post_process_initialization();
|
||||
|
||||
let reqwest_client = build_network_client(&config);
|
||||
@@ -170,6 +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);
|
||||
|
||||
@@ -296,6 +296,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_lidarr_serdeable_from_disk_spaces() {
|
||||
let disk_spaces = vec![DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 1,
|
||||
total_space: 1,
|
||||
}];
|
||||
|
||||
@@ -233,6 +233,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_radarr_serdeable_from_disk_spaces() {
|
||||
let disk_spaces = vec![DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 1,
|
||||
total_space: 1,
|
||||
}];
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -83,6 +83,7 @@ pub struct CommandBody {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DiskSpace {
|
||||
pub path: Option<String>,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub free_space: i64,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
|
||||
@@ -427,6 +427,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_sonarr_serdeable_from_disk_spaces() {
|
||||
let disk_spaces = vec![DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 1,
|
||||
total_space: 1,
|
||||
}];
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,21 +16,34 @@ mod tests {
|
||||
async fn test_handle_get_diskspace_event() {
|
||||
let diskspace_json = json!([
|
||||
{
|
||||
"path": "/path1",
|
||||
"freeSpace": 1111,
|
||||
"totalSpace": 2222,
|
||||
},
|
||||
{
|
||||
"path": "/path2",
|
||||
"freeSpace": 3333,
|
||||
"totalSpace": 4444
|
||||
}
|
||||
]);
|
||||
let response: Vec<DiskSpace> = serde_json::from_value(diskspace_json.clone()).unwrap();
|
||||
let (mock, app, _server) = MockServarrApi::get()
|
||||
.returns(diskspace_json)
|
||||
.build_for(LidarrEvent::GetDiskSpace)
|
||||
.await;
|
||||
app.lock().await.server_tabs.set_index(2);
|
||||
let mut network = test_network(&app);
|
||||
let disk_space_vec = vec![
|
||||
DiskSpace {
|
||||
path: Some("/path1".to_owned()),
|
||||
free_space: 1111,
|
||||
total_space: 2222,
|
||||
},
|
||||
DiskSpace {
|
||||
path: Some("/path2".to_owned()),
|
||||
free_space: 3333,
|
||||
total_space: 4444,
|
||||
},
|
||||
];
|
||||
|
||||
let result = network.handle_lidarr_event(LidarrEvent::GetDiskSpace).await;
|
||||
|
||||
@@ -40,8 +53,11 @@ mod tests {
|
||||
panic!("Expected DiskSpaces");
|
||||
};
|
||||
|
||||
assert_eq!(disk_spaces, response);
|
||||
assert!(!app.lock().await.data.lidarr_data.disk_space_vec.is_empty());
|
||||
assert_eq!(
|
||||
app.lock().await.data.lidarr_data.disk_space_vec,
|
||||
disk_space_vec
|
||||
);
|
||||
assert_eq!(disk_spaces, disk_space_vec);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -862,6 +862,7 @@ pub(in crate::network) mod test_utils {
|
||||
host,
|
||||
port,
|
||||
api_token: Some("test1234".to_owned()),
|
||||
monitored_storage_paths: Some(vec!["/path1".to_owned()]),
|
||||
..ServarrConfig::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -17,10 +17,12 @@ mod tests {
|
||||
let (mock, app, _server) = MockServarrApi::get()
|
||||
.returns(json!([
|
||||
{
|
||||
"path": "/path1",
|
||||
"freeSpace": 1111,
|
||||
"totalSpace": 2222,
|
||||
},
|
||||
{
|
||||
"path": "/path2",
|
||||
"freeSpace": 3333,
|
||||
"totalSpace": 4444
|
||||
}
|
||||
@@ -30,10 +32,12 @@ mod tests {
|
||||
let mut network = test_network(&app);
|
||||
let disk_space_vec = vec![
|
||||
DiskSpace {
|
||||
path: Some("/path1".to_owned()),
|
||||
free_space: 1111,
|
||||
total_space: 2222,
|
||||
},
|
||||
DiskSpace {
|
||||
path: Some("/path2".to_owned()),
|
||||
free_space: 3333,
|
||||
total_space: 4444,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ use chrono::DateTime;
|
||||
|
||||
pub fn diskspace() -> DiskSpace {
|
||||
DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 6500,
|
||||
total_space: 8675309,
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,10 +113,12 @@ mod tests {
|
||||
let (mock, app, _server) = MockServarrApi::get()
|
||||
.returns(json!([
|
||||
{
|
||||
"path": "/path1",
|
||||
"freeSpace": 1111,
|
||||
"totalSpace": 2222,
|
||||
},
|
||||
{
|
||||
"path": "/path2",
|
||||
"freeSpace": 3333,
|
||||
"totalSpace": 4444
|
||||
}
|
||||
@@ -127,10 +129,12 @@ mod tests {
|
||||
let mut network = test_network(&app);
|
||||
let disk_space_vec = vec![
|
||||
DiskSpace {
|
||||
path: Some("/path1".to_owned()),
|
||||
free_space: 1111,
|
||||
total_space: 2222,
|
||||
},
|
||||
DiskSpace {
|
||||
path: Some("/path2".to_owned()),
|
||||
free_space: 3333,
|
||||
total_space: 4444,
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
+17
-10
@@ -1,5 +1,3 @@
|
||||
use std::{cmp, iter};
|
||||
|
||||
#[cfg(test)]
|
||||
use crate::ui::ui_test_utils::test_utils::Utc;
|
||||
use chrono::Duration;
|
||||
@@ -14,6 +12,7 @@ use ratatui::{
|
||||
text::Text,
|
||||
widgets::Paragraph,
|
||||
};
|
||||
use std::{cmp, iter};
|
||||
|
||||
use super::{
|
||||
DrawUi, draw_tabs,
|
||||
@@ -28,6 +27,7 @@ use crate::ui::lidarr_ui::downloads::DownloadsUi;
|
||||
use crate::ui::lidarr_ui::indexers::IndexersUi;
|
||||
use crate::ui::lidarr_ui::root_folders::RootFoldersUi;
|
||||
use crate::ui::lidarr_ui::system::SystemUi;
|
||||
use crate::ui::utils::{extract_monitored_disk_space_vec, extract_monitored_root_folders};
|
||||
use crate::{
|
||||
app::App,
|
||||
logos::LIDARR_LOGO,
|
||||
@@ -100,6 +100,8 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
start_time,
|
||||
..
|
||||
} = &app.data.lidarr_data;
|
||||
let monitored_disk_space_vec = extract_monitored_disk_space_vec(app, disk_space_vec.clone());
|
||||
let monitored_root_folders = extract_monitored_root_folders(app, root_folders.items.clone());
|
||||
|
||||
let mut constraints = vec![
|
||||
Constraint::Length(1),
|
||||
@@ -110,7 +112,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
constraints.append(
|
||||
&mut iter::repeat_n(
|
||||
Constraint::Length(1),
|
||||
disk_space_vec.len() + root_folders.items.len() + 1,
|
||||
monitored_disk_space_vec.len() + monitored_root_folders.len() + 1,
|
||||
)
|
||||
.collect(),
|
||||
);
|
||||
@@ -146,12 +148,17 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
f.render_widget(uptime_paragraph, stat_item_areas[1]);
|
||||
f.render_widget(storage, stat_item_areas[2]);
|
||||
|
||||
for i in 0..disk_space_vec.len() {
|
||||
for i in 0..monitored_disk_space_vec.len() {
|
||||
let DiskSpace {
|
||||
path,
|
||||
free_space,
|
||||
total_space,
|
||||
} = &disk_space_vec[i];
|
||||
let title = format!("Disk {}", i + 1);
|
||||
} = &monitored_disk_space_vec[i];
|
||||
let title = if let Some(path) = path {
|
||||
path
|
||||
} else {
|
||||
&format!("Disk {}", i + 1)
|
||||
};
|
||||
let ratio = if *total_space == 0 {
|
||||
0f64
|
||||
} else {
|
||||
@@ -163,12 +170,12 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
f.render_widget(space_gauge, stat_item_areas[i + 3]);
|
||||
}
|
||||
|
||||
f.render_widget(folders, stat_item_areas[disk_space_vec.len() + 3]);
|
||||
f.render_widget(folders, stat_item_areas[monitored_disk_space_vec.len() + 3]);
|
||||
|
||||
for i in 0..root_folders.items.len() {
|
||||
for i in 0..monitored_root_folders.len() {
|
||||
let RootFolder {
|
||||
path, free_space, ..
|
||||
} = &root_folders.items[i];
|
||||
} = &monitored_root_folders[i];
|
||||
let space: f64 = convert_to_gb(*free_space);
|
||||
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
||||
.block(borderless_block())
|
||||
@@ -176,7 +183,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
|
||||
f.render_widget(
|
||||
root_folder_space,
|
||||
stat_item_areas[i + disk_space_vec.len() + 4],
|
||||
stat_item_areas[i + monitored_disk_space_vec.len() + 4],
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
||||
+23
-1
@@ -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);
|
||||
|
||||
+29
-21
@@ -1,15 +1,3 @@
|
||||
#[cfg(test)]
|
||||
use crate::ui::ui_test_utils::test_utils::Utc;
|
||||
use chrono::Duration;
|
||||
#[cfg(not(test))]
|
||||
use chrono::Utc;
|
||||
use ratatui::Frame;
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
use ratatui::prelude::Stylize;
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::{Paragraph, Row};
|
||||
use std::{cmp, iter};
|
||||
|
||||
use crate::app::App;
|
||||
use crate::logos::RADARR_LOGO;
|
||||
use crate::models::Route;
|
||||
@@ -27,11 +15,23 @@ use crate::ui::radarr_ui::library::LibraryUi;
|
||||
use crate::ui::radarr_ui::root_folders::RootFoldersUi;
|
||||
use crate::ui::radarr_ui::system::SystemUi;
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
#[cfg(test)]
|
||||
use crate::ui::ui_test_utils::test_utils::Utc;
|
||||
use crate::ui::utils::{
|
||||
borderless_block, layout_block, line_gauge_with_label, line_gauge_with_title, title_block,
|
||||
borderless_block, extract_monitored_disk_space_vec, extract_monitored_root_folders, layout_block,
|
||||
line_gauge_with_label, line_gauge_with_title, title_block,
|
||||
};
|
||||
use crate::ui::widgets::loading_block::LoadingBlock;
|
||||
use crate::utils::convert_to_gb;
|
||||
use chrono::Duration;
|
||||
#[cfg(not(test))]
|
||||
use chrono::Utc;
|
||||
use ratatui::Frame;
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
use ratatui::prelude::Stylize;
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::{Paragraph, Row};
|
||||
use std::{cmp, iter};
|
||||
|
||||
mod blocklist;
|
||||
mod collections;
|
||||
@@ -93,6 +93,8 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
start_time,
|
||||
..
|
||||
} = &app.data.radarr_data;
|
||||
let monitored_disk_space_vec = extract_monitored_disk_space_vec(app, disk_space_vec.clone());
|
||||
let monitored_root_folders = extract_monitored_root_folders(app, root_folders.items.clone());
|
||||
|
||||
let mut constraints = vec![
|
||||
Constraint::Length(1),
|
||||
@@ -103,7 +105,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
constraints.append(
|
||||
&mut iter::repeat_n(
|
||||
Constraint::Length(1),
|
||||
disk_space_vec.len() + root_folders.items.len() + 1,
|
||||
monitored_disk_space_vec.len() + monitored_root_folders.len() + 1,
|
||||
)
|
||||
.collect(),
|
||||
);
|
||||
@@ -139,12 +141,17 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
f.render_widget(uptime_paragraph, stat_item_areas[1]);
|
||||
f.render_widget(storage, stat_item_areas[2]);
|
||||
|
||||
for i in 0..disk_space_vec.len() {
|
||||
for i in 0..monitored_disk_space_vec.len() {
|
||||
let DiskSpace {
|
||||
path,
|
||||
free_space,
|
||||
total_space,
|
||||
} = &disk_space_vec[i];
|
||||
let title = format!("Disk {}", i + 1);
|
||||
} = &monitored_disk_space_vec[i];
|
||||
let title = if let Some(path) = path {
|
||||
path
|
||||
} else {
|
||||
&format!("Disk {}", i + 1)
|
||||
};
|
||||
let ratio = if *total_space == 0 {
|
||||
0f64
|
||||
} else {
|
||||
@@ -156,12 +163,13 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
f.render_widget(space_gauge, stat_item_areas[i + 3]);
|
||||
}
|
||||
|
||||
f.render_widget(folders, stat_item_areas[disk_space_vec.len() + 3]);
|
||||
f.render_widget(folders, stat_item_areas[monitored_disk_space_vec.len() + 3]);
|
||||
|
||||
for i in 0..root_folders.items.len() {
|
||||
let monitored_root_folders = extract_monitored_root_folders(app, root_folders.items.clone());
|
||||
for i in 0..monitored_root_folders.len() {
|
||||
let RootFolder {
|
||||
path, free_space, ..
|
||||
} = &root_folders.items[i];
|
||||
} = &monitored_root_folders[i];
|
||||
let space: f64 = convert_to_gb(*free_space);
|
||||
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
||||
.block(borderless_block())
|
||||
@@ -169,7 +177,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
|
||||
f.render_widget(
|
||||
root_folder_space,
|
||||
stat_item_areas[i + disk_space_vec.len() + 4],
|
||||
stat_item_areas[i + monitored_disk_space_vec.len() + 4],
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
||||
│Lidarr Version: 1.2.3.4 ││Test download title ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
||||
│Storage: ││ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||
│Root Folders: ││ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
||||
│/nfs: 204800.00 GB free ││ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
||||
│ ││ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
||||
│Lidarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
||||
│Storage: │=> a add │ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||
│Root Folders: │ m toggle monitoring │ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
||||
│/nfs: 204800.00 GB free │ o sort │ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
||||
│ │ del delete │ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ expression: output
|
||||
│Lidarr Version: 1.2.3.4 ││Test download title ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
||||
│Storage: ││ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||
│Root Folders: ││ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
||||
│/nfs: 204800.00 GB free ││ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
||||
│ ││ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
|
||||
|
||||
+54
@@ -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 │ │
|
||||
│ │ │ │
|
||||
│ ╰───────────────────────────────────────╯ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
||||
│Radarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
||||
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
||||
│/nfs: 204800.00 GB free ││ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
||||
│ ││ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
||||
│Radarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
||||
│Storage: │=> a add │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||
│Root Folders: │ m toggle monitoring │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
||||
│/nfs: 204800.00 GB free │ o sort │ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
||||
│ │ del delete │ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ expression: output
|
||||
│Radarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
||||
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
||||
│/nfs: 204800.00 GB free ││ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
||||
│ ││ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
|
||||
|
||||
+54
@@ -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 │ │
|
||||
│ ╰───────────────────────────────────────╯ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
+54
@@ -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 │ │
|
||||
│ │ │ │
|
||||
│ ╰───────────────────────────────────────╯ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
||||
│Sonarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
||||
│Storage: ││ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||
│Root Folders: ││ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
||||
│/nfs: 204800.00 GB free ││ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
||||
│ ││ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
||||
│Sonarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
||||
│Storage: │=> a add │ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||
│Root Folders: │ m toggle monitoring │ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
||||
│/nfs: 204800.00 GB free │ o sort │ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
||||
│ │ del delete │ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ expression: output
|
||||
│Sonarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
||||
│Storage: ││ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||
│Root Folders: ││ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
||||
│/nfs: 204800.00 GB free ││ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
||||
│ ││ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
|
||||
|
||||
+54
@@ -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,
|
||||
|
||||
+26
-19
@@ -1,5 +1,3 @@
|
||||
use std::{cmp, iter};
|
||||
|
||||
#[cfg(test)]
|
||||
use crate::ui::ui_test_utils::test_utils::Utc;
|
||||
use blocklist::BlocklistUi;
|
||||
@@ -18,8 +16,18 @@ use ratatui::{
|
||||
widgets::Paragraph,
|
||||
};
|
||||
use root_folders::RootFoldersUi;
|
||||
use std::{cmp, iter};
|
||||
use system::SystemUi;
|
||||
|
||||
use super::{
|
||||
DrawUi, draw_tabs,
|
||||
styles::ManagarrStyle,
|
||||
utils::{
|
||||
borderless_block, layout_block, line_gauge_with_label, line_gauge_with_title, title_block,
|
||||
},
|
||||
widgets::loading_block::LoadingBlock,
|
||||
};
|
||||
use crate::ui::utils::{extract_monitored_disk_space_vec, extract_monitored_root_folders};
|
||||
use crate::{
|
||||
app::App,
|
||||
logos::SONARR_LOGO,
|
||||
@@ -32,15 +40,6 @@ use crate::{
|
||||
utils::convert_to_gb,
|
||||
};
|
||||
|
||||
use super::{
|
||||
DrawUi, draw_tabs,
|
||||
styles::ManagarrStyle,
|
||||
utils::{
|
||||
borderless_block, layout_block, line_gauge_with_label, line_gauge_with_title, title_block,
|
||||
},
|
||||
widgets::loading_block::LoadingBlock,
|
||||
};
|
||||
|
||||
mod blocklist;
|
||||
mod downloads;
|
||||
mod history;
|
||||
@@ -101,6 +100,8 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
start_time,
|
||||
..
|
||||
} = &app.data.sonarr_data;
|
||||
let monitored_disk_space_vec = extract_monitored_disk_space_vec(app, disk_space_vec.clone());
|
||||
let monitored_root_folders = extract_monitored_root_folders(app, root_folders.items.clone());
|
||||
|
||||
let mut constraints = vec![
|
||||
Constraint::Length(1),
|
||||
@@ -111,7 +112,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
constraints.append(
|
||||
&mut iter::repeat_n(
|
||||
Constraint::Length(1),
|
||||
disk_space_vec.len() + root_folders.items.len() + 1,
|
||||
monitored_disk_space_vec.len() + monitored_root_folders.len() + 1,
|
||||
)
|
||||
.collect(),
|
||||
);
|
||||
@@ -147,12 +148,18 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
f.render_widget(uptime_paragraph, stat_item_areas[1]);
|
||||
f.render_widget(storage, stat_item_areas[2]);
|
||||
|
||||
for i in 0..disk_space_vec.len() {
|
||||
for i in 0..monitored_disk_space_vec.len() {
|
||||
let DiskSpace {
|
||||
path,
|
||||
free_space,
|
||||
total_space,
|
||||
} = &disk_space_vec[i];
|
||||
let title = format!("Disk {}", i + 1);
|
||||
..
|
||||
} = &monitored_disk_space_vec[i];
|
||||
let title = if let Some(path) = path {
|
||||
path
|
||||
} else {
|
||||
&format!("Disk {}", i + 1)
|
||||
};
|
||||
let ratio = if *total_space == 0 {
|
||||
0f64
|
||||
} else {
|
||||
@@ -164,12 +171,12 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
f.render_widget(space_gauge, stat_item_areas[i + 3]);
|
||||
}
|
||||
|
||||
f.render_widget(folders, stat_item_areas[disk_space_vec.len() + 3]);
|
||||
f.render_widget(folders, stat_item_areas[monitored_disk_space_vec.len() + 3]);
|
||||
|
||||
for i in 0..root_folders.items.len() {
|
||||
for i in 0..monitored_root_folders.len() {
|
||||
let RootFolder {
|
||||
path, free_space, ..
|
||||
} = &root_folders.items[i];
|
||||
} = &monitored_root_folders[i];
|
||||
let space: f64 = convert_to_gb(*free_space);
|
||||
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
||||
.block(borderless_block())
|
||||
@@ -177,7 +184,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
|
||||
f.render_widget(
|
||||
root_folder_space,
|
||||
stat_item_areas[i + disk_space_vec.len() + 4],
|
||||
stat_item_areas[i + monitored_disk_space_vec.len() + 4],
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -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();
|
||||
|
||||
+121
@@ -1,3 +1,5 @@
|
||||
use crate::app::App;
|
||||
use crate::models::servarr_models::{DiskSpace, RootFolder};
|
||||
use crate::ui::THEME;
|
||||
use crate::ui::styles::{
|
||||
ManagarrStyle, default_style, failure_style, primary_style, secondary_style,
|
||||
@@ -7,6 +9,8 @@ use ratatui::layout::{Alignment, Constraint, Layout, Rect};
|
||||
use ratatui::style::{Style, Stylize};
|
||||
use ratatui::text::{Line, Span, Text};
|
||||
use ratatui::widgets::{Block, BorderType, Borders, LineGauge, ListItem, Paragraph, Wrap};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "utils_tests.rs"]
|
||||
@@ -179,3 +183,120 @@ pub(super) fn decorate_peer_style(seeders: u64, leechers: u64, text: Text<'_>) -
|
||||
text.success()
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn extract_monitored_root_folders(
|
||||
app: &App<'_>,
|
||||
root_folders: Vec<RootFolder>,
|
||||
) -> Vec<RootFolder> {
|
||||
let monitored_paths = app
|
||||
.server_tabs
|
||||
.get_active_config()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.monitored_storage_paths
|
||||
.as_ref();
|
||||
|
||||
if let Some(monitored_paths) = monitored_paths
|
||||
&& !monitored_paths.is_empty()
|
||||
{
|
||||
let monitored_paths: Vec<PathBuf> = monitored_paths.iter().map(PathBuf::from).collect();
|
||||
|
||||
let mut collapsed_folders: HashMap<PathBuf, (RootFolder, Vec<String>)> = HashMap::new();
|
||||
let mut unmatched_folders: Vec<RootFolder> = Vec::new();
|
||||
|
||||
for root_folder in root_folders {
|
||||
let root_path = Path::new(&root_folder.path);
|
||||
|
||||
let matching_monitored_path = monitored_paths
|
||||
.iter()
|
||||
.filter(|mp| root_path.starts_with(mp))
|
||||
.max_by_key(|mp| mp.components().count());
|
||||
|
||||
if let Some(monitored_path) = matching_monitored_path {
|
||||
let subfolder_name = root_path
|
||||
.strip_prefix(monitored_path)
|
||||
.ok()
|
||||
.and_then(|p| p.components().next())
|
||||
.map(|c| c.as_os_str().to_string_lossy().to_string())
|
||||
.unwrap_or_default();
|
||||
|
||||
collapsed_folders
|
||||
.entry(monitored_path.clone())
|
||||
.and_modify(|(_, subfolders)| {
|
||||
if !subfolder_name.is_empty() && !subfolders.contains(&subfolder_name) {
|
||||
subfolders.push(subfolder_name.clone());
|
||||
}
|
||||
})
|
||||
.or_insert_with(|| {
|
||||
let subfolders = if subfolder_name.is_empty() {
|
||||
vec![]
|
||||
} else {
|
||||
vec![subfolder_name]
|
||||
};
|
||||
(root_folder.clone(), subfolders)
|
||||
});
|
||||
} else {
|
||||
unmatched_folders.push(root_folder);
|
||||
}
|
||||
}
|
||||
|
||||
let mut result: Vec<RootFolder> = collapsed_folders
|
||||
.into_iter()
|
||||
.map(|(monitored_path, (mut root_folder, mut subfolders))| {
|
||||
subfolders.sort();
|
||||
let path_str = monitored_path.to_string_lossy();
|
||||
root_folder.path = if subfolders.is_empty() {
|
||||
path_str.to_string()
|
||||
} else {
|
||||
format!(
|
||||
"{}/[{}]",
|
||||
path_str.trim_end_matches('/'),
|
||||
subfolders.join(",")
|
||||
)
|
||||
};
|
||||
root_folder
|
||||
})
|
||||
.collect();
|
||||
|
||||
result.extend(unmatched_folders);
|
||||
result.sort_by(|a, b| a.path.cmp(&b.path));
|
||||
result
|
||||
} else {
|
||||
root_folders
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn extract_monitored_disk_space_vec(
|
||||
app: &App<'_>,
|
||||
disk_space_vec: Vec<DiskSpace>,
|
||||
) -> Vec<DiskSpace> {
|
||||
let monitored_paths = app
|
||||
.server_tabs
|
||||
.get_active_config()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.monitored_storage_paths
|
||||
.as_ref();
|
||||
if let Some(monitored_paths) = monitored_paths
|
||||
&& !monitored_paths.is_empty()
|
||||
{
|
||||
let monitored: HashSet<&str> = monitored_paths.iter().map(|s| s.as_str()).collect();
|
||||
let mut seen_paths = HashSet::new();
|
||||
let mut filtered_disk_space_vec = Vec::with_capacity(disk_space_vec.len());
|
||||
|
||||
for ds in disk_space_vec {
|
||||
match ds.path.as_deref() {
|
||||
None => filtered_disk_space_vec.push(ds),
|
||||
Some(p) => {
|
||||
if monitored.contains(p) && seen_paths.insert(p.to_owned()) {
|
||||
filtered_disk_space_vec.push(ds)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filtered_disk_space_vec
|
||||
} else {
|
||||
disk_space_vec
|
||||
}
|
||||
}
|
||||
|
||||
+285
-1
@@ -1,9 +1,12 @@
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::app::{App, ServarrConfig};
|
||||
use crate::models::servarr_models::{DiskSpace, RootFolder};
|
||||
use crate::ui::styles::{ManagarrStyle, default_style, failure_style, secondary_style};
|
||||
use crate::ui::utils::{
|
||||
borderless_block, centered_rect, convert_to_minutes_hours_days, decorate_peer_style,
|
||||
get_width_from_percentage, layout_block, layout_block_bottom_border, layout_block_top_border,
|
||||
extract_monitored_disk_space_vec, extract_monitored_root_folders, get_width_from_percentage,
|
||||
layout_block, layout_block_bottom_border, layout_block_top_border,
|
||||
layout_block_top_border_with_title, layout_block_with_title, logo_block, style_block_highlight,
|
||||
style_log_list_item, title_block, title_block_centered, title_style, unstyled_title_block,
|
||||
};
|
||||
@@ -278,6 +281,287 @@ mod test {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_root_folders_collapses_subfolders() {
|
||||
let mut app = App::test_default();
|
||||
app.server_tabs.tabs[0].config = Some(ServarrConfig {
|
||||
monitored_storage_paths: Some(vec!["/nfs".to_owned()]),
|
||||
..ServarrConfig::default()
|
||||
});
|
||||
let root_folders = vec![
|
||||
RootFolder {
|
||||
id: 1,
|
||||
path: "/nfs/cartoons".to_string(),
|
||||
accessible: true,
|
||||
free_space: 100,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
RootFolder {
|
||||
id: 2,
|
||||
path: "/nfs/tv".to_string(),
|
||||
accessible: true,
|
||||
free_space: 100,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
RootFolder {
|
||||
id: 3,
|
||||
path: "/nfs/reality".to_string(),
|
||||
accessible: true,
|
||||
free_space: 100,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
];
|
||||
|
||||
let monitored_root_folders = extract_monitored_root_folders(&app, root_folders);
|
||||
|
||||
assert_eq!(monitored_root_folders.len(), 1);
|
||||
assert_eq!(monitored_root_folders[0].path, "/nfs/[cartoons,reality,tv]");
|
||||
assert_eq!(monitored_root_folders[0].free_space, 100);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_root_folders_uses_most_specific_monitored_path() {
|
||||
let mut app = App::test_default();
|
||||
app.server_tabs.tabs[0].config = Some(ServarrConfig {
|
||||
monitored_storage_paths: Some(vec!["/nfs".to_owned(), "/".to_owned()]),
|
||||
..ServarrConfig::default()
|
||||
});
|
||||
let root_folders = vec![
|
||||
RootFolder {
|
||||
id: 1,
|
||||
path: "/nfs/cartoons".to_string(),
|
||||
accessible: true,
|
||||
free_space: 100,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
RootFolder {
|
||||
id: 2,
|
||||
path: "/nfs/tv".to_string(),
|
||||
accessible: true,
|
||||
free_space: 100,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
RootFolder {
|
||||
id: 3,
|
||||
path: "/other/movies".to_string(),
|
||||
accessible: true,
|
||||
free_space: 200,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
];
|
||||
|
||||
let monitored_root_folders = extract_monitored_root_folders(&app, root_folders);
|
||||
|
||||
assert_eq!(monitored_root_folders.len(), 2);
|
||||
assert_eq!(monitored_root_folders[0].path, "/[other]");
|
||||
assert_eq!(monitored_root_folders[0].free_space, 200);
|
||||
assert_eq!(monitored_root_folders[1].path, "/nfs/[cartoons,tv]");
|
||||
assert_eq!(monitored_root_folders[1].free_space, 100);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_root_folders_preserves_unmatched_folders() {
|
||||
let mut app = App::test_default();
|
||||
app.server_tabs.tabs[0].config = Some(ServarrConfig {
|
||||
monitored_storage_paths: Some(vec!["/nfs".to_owned()]),
|
||||
..ServarrConfig::default()
|
||||
});
|
||||
let root_folders = vec![
|
||||
RootFolder {
|
||||
id: 1,
|
||||
path: "/nfs/tv".to_string(),
|
||||
accessible: true,
|
||||
free_space: 100,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
RootFolder {
|
||||
id: 2,
|
||||
path: "/other/movies".to_string(),
|
||||
accessible: true,
|
||||
free_space: 200,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
];
|
||||
|
||||
let monitored_root_folders = extract_monitored_root_folders(&app, root_folders);
|
||||
|
||||
assert_eq!(monitored_root_folders.len(), 2);
|
||||
assert_eq!(monitored_root_folders[0].path, "/nfs/[tv]");
|
||||
assert_eq!(monitored_root_folders[1].path, "/other/movies");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_root_folders_returns_all_when_monitored_storage_paths_is_empty() {
|
||||
let mut app = App::test_default();
|
||||
app.server_tabs.tabs[0].config = Some(ServarrConfig {
|
||||
monitored_storage_paths: Some(vec![]),
|
||||
..ServarrConfig::default()
|
||||
});
|
||||
let root_folders = vec![
|
||||
RootFolder {
|
||||
id: 1,
|
||||
path: "/nfs".to_string(),
|
||||
accessible: true,
|
||||
free_space: 10,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
RootFolder {
|
||||
id: 2,
|
||||
path: "/nfs/some/subpath".to_string(),
|
||||
accessible: true,
|
||||
free_space: 10,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
];
|
||||
|
||||
let monitored_root_folders = extract_monitored_root_folders(&app, root_folders.clone());
|
||||
|
||||
assert_eq!(monitored_root_folders, root_folders);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_root_folders_returns_all_when_monitored_storage_paths_is_none() {
|
||||
let app = App::test_default();
|
||||
let root_folders = vec![
|
||||
RootFolder {
|
||||
id: 1,
|
||||
path: "/nfs".to_string(),
|
||||
accessible: true,
|
||||
free_space: 10,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
RootFolder {
|
||||
id: 2,
|
||||
path: "/nfs/some/subpath".to_string(),
|
||||
accessible: true,
|
||||
free_space: 10,
|
||||
unmapped_folders: None,
|
||||
},
|
||||
];
|
||||
|
||||
let monitored_root_folders = extract_monitored_root_folders(&app, root_folders.clone());
|
||||
|
||||
assert_eq!(monitored_root_folders, root_folders);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_root_folders_exact_match_shows_no_brackets() {
|
||||
let mut app = App::test_default();
|
||||
app.server_tabs.tabs[0].config = Some(ServarrConfig {
|
||||
monitored_storage_paths: Some(vec!["/nfs/tv".to_owned()]),
|
||||
..ServarrConfig::default()
|
||||
});
|
||||
let root_folders = vec![RootFolder {
|
||||
id: 1,
|
||||
path: "/nfs/tv".to_string(),
|
||||
accessible: true,
|
||||
free_space: 100,
|
||||
unmapped_folders: None,
|
||||
}];
|
||||
|
||||
let monitored_root_folders = extract_monitored_root_folders(&app, root_folders);
|
||||
|
||||
assert_eq!(monitored_root_folders.len(), 1);
|
||||
assert_eq!(monitored_root_folders[0].path, "/nfs/tv");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_disk_space_vec() {
|
||||
let mut app = App::test_default();
|
||||
app.server_tabs.tabs[0].config = Some(ServarrConfig {
|
||||
monitored_storage_paths: Some(vec!["/data".to_owned(), "/downloads".to_owned()]),
|
||||
..ServarrConfig::default()
|
||||
});
|
||||
let disk_space = DiskSpace {
|
||||
path: Some("/data".to_string()),
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
};
|
||||
let disk_space_2 = DiskSpace {
|
||||
path: Some("/downloads".to_string()),
|
||||
free_space: 100,
|
||||
total_space: 10000,
|
||||
};
|
||||
let disk_space_with_empty_path = DiskSpace {
|
||||
path: None,
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
};
|
||||
let disk_spaces = vec![
|
||||
disk_space.clone(),
|
||||
disk_space_with_empty_path.clone(),
|
||||
DiskSpace {
|
||||
path: Some("/downloads/".to_string()),
|
||||
free_space: 100,
|
||||
total_space: 10000,
|
||||
},
|
||||
disk_space_2.clone(),
|
||||
];
|
||||
|
||||
let monitored_disk_space = extract_monitored_disk_space_vec(&app, disk_spaces);
|
||||
|
||||
assert_eq!(
|
||||
monitored_disk_space,
|
||||
vec![disk_space, disk_space_with_empty_path, disk_space_2]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_disk_space_vec_returns_all_when_monitored_storage_paths_is_empty() {
|
||||
let mut app = App::test_default();
|
||||
app.server_tabs.tabs[0].config = Some(ServarrConfig {
|
||||
monitored_storage_paths: Some(Vec::new()),
|
||||
..ServarrConfig::default()
|
||||
});
|
||||
let disk_spaces = vec![
|
||||
DiskSpace {
|
||||
path: Some("/nfs".to_string()),
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
},
|
||||
DiskSpace {
|
||||
path: None,
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
},
|
||||
DiskSpace {
|
||||
path: Some("/nfs/some/subpath".to_string()),
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
},
|
||||
];
|
||||
|
||||
let monitored_disk_space = extract_monitored_disk_space_vec(&app, disk_spaces.clone());
|
||||
|
||||
assert_eq!(monitored_disk_space, disk_spaces);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_monitored_disk_space_vec_returns_all_when_monitored_storage_paths_is_none() {
|
||||
let app = App::test_default();
|
||||
let disk_spaces = vec![
|
||||
DiskSpace {
|
||||
path: Some("/nfs".to_string()),
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
},
|
||||
DiskSpace {
|
||||
path: None,
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
},
|
||||
DiskSpace {
|
||||
path: Some("/nfs/some/subpath".to_string()),
|
||||
free_space: 10,
|
||||
total_space: 1000,
|
||||
},
|
||||
];
|
||||
|
||||
let monitored_disk_space = extract_monitored_disk_space_vec(&app, disk_spaces.clone());
|
||||
|
||||
assert_eq!(monitored_disk_space, disk_spaces);
|
||||
}
|
||||
|
||||
enum PeerStyle {
|
||||
Failure,
|
||||
Warning,
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ pub(super) fn load_config(path: &str) -> Result<AppConfig> {
|
||||
Ok(config)
|
||||
}
|
||||
Err(e) => {
|
||||
log_and_print_error(format!("Unable to open config file: {e:?}"));
|
||||
log_and_print_error(format!("Unable to open config file '{path}': {e:?}"));
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user