Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
ba1cf0182b
|
|||
|
5cccec88c9
|
|||
|
bbcd3f00a9
|
|||
| 2e339dd73b | |||
|
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 |
@@ -0,0 +1,11 @@
|
|||||||
|
### AI assistance (if any):
|
||||||
|
- List tools here and files touched by them
|
||||||
|
|
||||||
|
### Authorship & Understanding
|
||||||
|
|
||||||
|
- [ ] I wrote or heavily modified this code myself
|
||||||
|
- [ ] I understand how it works end-to-end
|
||||||
|
- [ ] I can maintain this code in the future
|
||||||
|
- [ ] No undisclosed AI-generated code was used
|
||||||
|
- [ ] If AI assistance was used, it is documented below
|
||||||
|
|
||||||
+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/),
|
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).
|
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)
|
## v0.6.3 (2025-12-13)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|||||||
@@ -91,5 +91,12 @@ Then, you can run workflows locally without having to commit and see if the GitH
|
|||||||
act -W .github/workflows/release.yml --input_type bump=minor
|
act -W .github/workflows/release.yml --input_type bump=minor
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Authorship Policy
|
||||||
|
|
||||||
|
All code in this repository is written and reviewed by humans. AI-generated code (e.g., Copilot, ChatGPT,
|
||||||
|
Claude, etc.) is not permitted unless explicitly disclosed and approved.
|
||||||
|
|
||||||
|
Submissions must certify that the contributor understands and can maintain the code they submit.
|
||||||
|
|
||||||
## Questions? Reach out to me!
|
## Questions? Reach out to me!
|
||||||
If you encounter any questions while developing Managarr, please don't hesitate to reach out to me at alex.j.tusa@gmail.com. I'm happy to help contributors, new and experienced in any way I can!
|
If you encounter any questions while developing Managarr, please don't hesitate to reach out to me at alex.j.tusa@gmail.com. I'm happy to help contributors, new and experienced in any way I can!
|
||||||
|
|||||||
Generated
+198
-244
File diff suppressed because it is too large
Load Diff
+35
-35
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "managarr"
|
name = "managarr"
|
||||||
version = "0.6.3"
|
version = "0.7.1"
|
||||||
authors = ["Alex Clarke <alex.j.tusa@gmail.com>"]
|
authors = ["Alex Clarke <alex.j.tusa@gmail.com>"]
|
||||||
description = "A TUI and CLI to manage your Servarrs"
|
description = "A TUI and CLI to manage your Servarrs"
|
||||||
keywords = ["managarr", "ratatui", "dashboard", "servarr", "tui"]
|
keywords = ["managarr", "ratatui", "dashboard", "servarr", "tui"]
|
||||||
@@ -20,67 +20,67 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.68"
|
anyhow = "1.0.100"
|
||||||
backtrace = "0.3.74"
|
backtrace = "0.3.76"
|
||||||
bimap = { version = "0.6.3", features = ["serde"] }
|
bimap = { version = "0.6.3", features = ["serde"] }
|
||||||
chrono = { version = "0.4.38", features = ["serde"] }
|
chrono = { version = "0.4.43", features = ["serde"] }
|
||||||
confy = { version = "0.6.0", default-features = false, features = [
|
confy = { version = "2.0.0", default-features = false, features = [
|
||||||
"yaml_conf",
|
"yaml_conf",
|
||||||
] }
|
] }
|
||||||
crossterm = "0.28.1"
|
crossterm = "0.28.1"
|
||||||
derivative = "2.2.0"
|
derivative = "2.2.0"
|
||||||
human-panic = "2.0.2"
|
human-panic = "2.0.6"
|
||||||
indoc = "2.0.0"
|
indoc = "2.0.7"
|
||||||
log = "0.4.17"
|
log = "0.4.29"
|
||||||
log4rs = { version = "1.2.0", features = ["file_appender"] }
|
log4rs = { version = "1.4.0", features = ["file_appender"] }
|
||||||
regex = "1.11.1"
|
regex = "1.12.2"
|
||||||
reqwest = { version = "0.12.9", features = ["json"] }
|
reqwest = { version = "0.12.28", features = ["json"] }
|
||||||
serde_yaml = "0.9.16"
|
serde_yaml = "0.9.34"
|
||||||
serde_json = "1.0.91"
|
serde_json = "1.0.149"
|
||||||
serde = { version = "1.0.214", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
strum = { version = "0.26.3", features = ["derive"] }
|
strum = { version = "0.26.3", features = ["derive"] }
|
||||||
strum_macros = "0.26.4"
|
strum_macros = "0.26.4"
|
||||||
tokio = { version = "1.44.2", features = ["full"] }
|
tokio = { version = "1.49.0", features = ["full"] }
|
||||||
tokio-util = "0.7.8"
|
tokio-util = "0.7.18"
|
||||||
ratatui = { version = "0.30.0", features = [
|
ratatui = { version = "0.30.0", features = [
|
||||||
"all-widgets",
|
"all-widgets",
|
||||||
"unstable-widget-ref",
|
"unstable-widget-ref",
|
||||||
] }
|
] }
|
||||||
urlencoding = "2.1.2"
|
urlencoding = "2.1.3"
|
||||||
clap = { version = "4.5.20", features = [
|
clap = { version = "4.5.56", features = [
|
||||||
"derive",
|
"derive",
|
||||||
"cargo",
|
"cargo",
|
||||||
"env",
|
"env",
|
||||||
"wrap_help",
|
"wrap_help",
|
||||||
] }
|
] }
|
||||||
clap_complete = "4.5.33"
|
clap_complete = "4.5.65"
|
||||||
itertools = "0.14.0"
|
itertools = "0.14.0"
|
||||||
ctrlc = "3.4.5"
|
ctrlc = "3.5.1"
|
||||||
colored = "3.0.0"
|
colored = "3.1.1"
|
||||||
async-trait = "0.1.83"
|
async-trait = "0.1.89"
|
||||||
dirs-next = "2.0.0"
|
dirs-next = "2.0.0"
|
||||||
managarr-tree-widget = "0.25.0"
|
managarr-tree-widget = "0.25.0"
|
||||||
indicatif = "0.17.9"
|
indicatif = "0.17.11"
|
||||||
derive_setters = "0.1.6"
|
derive_setters = "0.1.9"
|
||||||
deunicode = "1.6.0"
|
deunicode = "1.6.2"
|
||||||
openssl = { version = "0.10.70", features = ["vendored"] }
|
openssl = { version = "0.10.75", features = ["vendored"] }
|
||||||
veil = "0.2.0"
|
veil = "0.2.0"
|
||||||
validate_theme_derive = "0.1.0"
|
validate_theme_derive = "0.1.0"
|
||||||
enum_display_style_derive = "0.1.0"
|
enum_display_style_derive = "0.1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = "2.0.16"
|
assert_cmd = "2.1.2"
|
||||||
mockall = "0.13.0"
|
mockall = "0.13.1"
|
||||||
mockito = "1.0.0"
|
mockito = "1.7.1"
|
||||||
pretty_assertions = "1.3.0"
|
pretty_assertions = "1.4.1"
|
||||||
proptest = "1.6.0"
|
proptest = "1.9.0"
|
||||||
rstest = "0.25.0"
|
rstest = "0.25.0"
|
||||||
serial_test = "3.2.0"
|
serial_test = "3.3.1"
|
||||||
assertables = "9.8.2"
|
assertables = "9.8.4"
|
||||||
insta = "1.41.1"
|
insta = "1.46.1"
|
||||||
|
|
||||||
[dev-dependencies.cargo-husky]
|
[dev-dependencies.cargo-husky]
|
||||||
version = "1"
|
version = "1.5.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["user-hooks"]
|
features = ["user-hooks"]
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ RUN mv target/release/managarr .
|
|||||||
|
|
||||||
FROM debian:stable-slim
|
FROM debian:stable-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy the compiled binary from the builder container
|
# Copy the compiled binary from the builder container
|
||||||
COPY --from=builder --chown=nonroot:nonroot /usr/src/managarr-temp/managarr /usr/local/bin
|
COPY --from=builder --chown=nonroot:nonroot /usr/src/managarr-temp/managarr /usr/local/bin
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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.
|
**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
|
lidarr Commands for manging your Lidarr instance
|
||||||
completions Generate shell completions for the Managarr CLI
|
completions Generate shell completions for the Managarr CLI
|
||||||
tail-logs Tail Managarr logs
|
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)
|
help Print this message or the help of the given subcommand(s)
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@@ -266,14 +268,23 @@ Options:
|
|||||||
-V, --version Print version
|
-V, --version Print version
|
||||||
|
|
||||||
Global Options:
|
Global Options:
|
||||||
--disable-spinner Disable the spinner (can sometimes make parsing output challenging) [env: MANAGARR_DISABLE_SPINNER=]
|
--disable-spinner Disable the spinner (can sometimes make parsing output
|
||||||
--config-file <CONFIG_FILE> The Managarr configuration file to use [env: MANAGARR_CONFIG_FILE=]
|
challenging) [env: MANAGARR_DISABLE_SPINNER=]
|
||||||
--themes-file <THEMES_FILE> The Managarr themes file to use [env: MANAGARR_THEMES_FILE=]
|
--config-file <CONFIG_FILE> The Managarr configuration file to use; defaults to the
|
||||||
--theme <THEME> The name of the Managarr theme to use [env: MANAGARR_THEME=]
|
path shown by 'managarr config-path' [env:
|
||||||
--servarr-name <SERVARR_NAME> For multi-instance configurations, you need to specify the name of the instance configuration that you want to use.
|
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.
|
This is useful when you have multiple instances of the
|
||||||
By default, if left empty, the first configured Servarr instance listed in the config file will be used.
|
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:
|
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),
|
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.
|
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
|
```shell
|
||||||
```
|
managarr config-path
|
||||||
$HOME/.config/managarr/config.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mac
|
|
||||||
```
|
|
||||||
$HOME/Library/Application Support/managarr/config.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
```
|
|
||||||
%APPDATA%/Roaming/managarr/config.yml
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Specify Which Configuration File to Use
|
## Specify Which Configuration File to Use
|
||||||
@@ -363,43 +364,102 @@ radarr:
|
|||||||
- host: 192.168.0.78
|
- host: 192.168.0.78
|
||||||
port: 7878
|
port: 7878
|
||||||
api_token: someApiToken1234567890
|
api_token: someApiToken1234567890
|
||||||
ssl_cert_path: /path/to/radarr.crt # Required to enable SSL
|
ssl_cert_path: /path/to/radarr.crt # Use the specified SSL certificate to connect to this Servarr
|
||||||
sonarr:
|
# Enables SSL regardless of the value of the 'ssl'
|
||||||
- uri: http://htpc.local/sonarr # Example of using the 'uri' key instead of 'host' and 'port'
|
# See the SSL Configuration section below for more information
|
||||||
|
|
||||||
|
- host: 192.168.0.79
|
||||||
|
port: 7878
|
||||||
api_token: someApiToken1234567890
|
api_token: someApiToken1234567890
|
||||||
|
ssl: true # Use SSL to connect to this Servarr
|
||||||
|
# This will assume that you have the SSL certificate installed to your system trust store
|
||||||
|
# See the SSL Configuration section below for more information
|
||||||
|
|
||||||
|
- 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
|
- 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
|
port: 8989
|
||||||
api_token: someApiToken1234567890
|
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:
|
lidarr:
|
||||||
- host: 192.168.0.86
|
- host: 192.168.0.86
|
||||||
port: 8686
|
port: 8686
|
||||||
api_token: ${MY_LIDARR_API_TOKEN} # Example of configuring using environment variables
|
api_token: ${MY_LIDARR_API_TOKEN} # Example of configuring using environment variables
|
||||||
whisparr:
|
monitored_storage_paths: # Filter which Root Folders or Disk Storage you want displayed in the UI's 'Stats' block
|
||||||
- host: 192.168.0.69
|
# Note: Setting these values does not affect what shows up in the 'Root Folders' tab of the UI.
|
||||||
port: 6969
|
- /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
|
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
|
custom_headers: # Example of adding custom headers to all requests to the Servarr instance
|
||||||
traefik-auth-bypass-key: someBypassKey1234567890
|
traefik-auth-bypass-key: someBypassKey1234567890
|
||||||
SOME-OTHER-CUSTOM-HEADER: ${MY_CUSTOM_HEADER_VALUE}
|
SOME-OTHER-CUSTOM-HEADER: ${MY_CUSTOM_HEADER_VALUE}
|
||||||
bazarr:
|
```
|
||||||
- host: 192.168.0.67
|
|
||||||
port: 6767
|
### SSL Configuration
|
||||||
api_token: someApiToken1234567890
|
If your Servarr is using SSL or self-signed certificates, you may need to specify additional configuration options to connect without issues.
|
||||||
prowlarr:
|
|
||||||
- host: 192.168.0.96
|
|
||||||
port: 9696
|
**If your Servarr's domain CA is installed in the system's trust store:**
|
||||||
api_token: someApiToken1234567890
|
Then you can simply specify `ssl: true` and Managarr will be able to connect to your Servarr:
|
||||||
tautulli:
|
|
||||||
- host: 192.168.0.81
|
```yaml
|
||||||
port: 8181
|
radarr:
|
||||||
api_token: someApiToken1234567890
|
- host: 192.168.0.78
|
||||||
|
port: 7878
|
||||||
|
api_token: yourApiTokenHere
|
||||||
|
ssl: true
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
**If your Servarr's domain CA is not installed:**
|
||||||
|
You'll either need to specify the path to the certificate via the `ssl_cert_path` property, or you'll need to install the certificate into your system store.
|
||||||
|
|
||||||
|
To acquire the cert for your Servarr's domain, you can use the following command:
|
||||||
|
```shell
|
||||||
|
openssl s_client -show-certs -connect <your-servarr-domain.com>:<port> </dev/null |\
|
||||||
|
sed -n -e '/-.BEGIN/,/-.END/ p' > /path/to/your/servarr.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, you can either specify `ssl_cert_path: /path/to/your/servarr.pem`:
|
||||||
|
|
||||||
|
Example configuration with a certificate that's not installed to the system trust store:
|
||||||
|
```yaml
|
||||||
|
radarr:
|
||||||
|
- host: 192.168.0.78
|
||||||
|
port: 7878
|
||||||
|
api_token: yourApiTokenHere
|
||||||
|
ssl_cert_path: /path/to/your/certificate.crt
|
||||||
|
```
|
||||||
|
|
||||||
|
Or install the certificate into your system's trust store.
|
||||||
|
|
||||||
|
For example, if you're on a Debian-based system and have `ca-certificates` installed (`sudo apt install ca-certificates`):
|
||||||
|
```shell
|
||||||
|
sudo mv /path/to/your/servarr.pem /usr/local/share/ca-certificates/servarr.pem
|
||||||
|
sudo update-ca-certificates
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with a certificate that is installed to the system trust store:
|
||||||
|
```yaml
|
||||||
|
radarr:
|
||||||
|
- host: 192.168.0.78
|
||||||
|
port: 7878
|
||||||
|
api_token: yourApiTokenHere
|
||||||
|
ssl: true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example Multi-Instance Configuration:
|
### Example Multi-Instance Configuration:
|
||||||
|
|||||||
@@ -85,5 +85,5 @@ build build_type='debug':
|
|||||||
|
|
||||||
# Build the docker image
|
# Build the docker image
|
||||||
[group: 'build']
|
[group: 'build']
|
||||||
build-docker:
|
build-docker version=VERSION:
|
||||||
@DOCKER_BUILDKIT=1 docker build --rm -t {{IMG_NAME}}:{{VERSION}} .
|
@DOCKER_BUILDKIT=1 docker build --rm -t {{IMG_NAME}}:{{version}} .
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
tab_spaces=2
|
tab_spaces=2
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
reorder_imports = true
|
reorder_imports = true
|
||||||
imports_granularity = "Crate"
|
imports_granularity = "Crate"
|
||||||
group_imports = "StdExternalCrate"
|
group_imports = "StdExternalCrate"
|
||||||
|
|||||||
+126
-1
@@ -447,6 +447,78 @@ mod tests {
|
|||||||
assert_none!(config.port);
|
assert_none!(config.port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[serial]
|
||||||
|
fn test_deserialize_optional_env_var_bool_is_bool() {
|
||||||
|
let yaml_data = r#"
|
||||||
|
host: localhost
|
||||||
|
api_token: "test123"
|
||||||
|
ssl: true
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||||
|
|
||||||
|
assert_some_eq_x!(&config.ssl, &true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[serial]
|
||||||
|
fn test_deserialize_optional_env_var_bool_is_string() {
|
||||||
|
let yaml_data = r#"
|
||||||
|
host: localhost
|
||||||
|
api_token: "test123"
|
||||||
|
ssl: "true"
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||||
|
|
||||||
|
assert_some_eq_x!(&config.ssl, &true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[serial]
|
||||||
|
fn test_deserialize_optional_env_var_bool_is_present() {
|
||||||
|
unsafe { std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_BOOL", "true") };
|
||||||
|
let yaml_data = r#"
|
||||||
|
host: localhost
|
||||||
|
api_token: "test123"
|
||||||
|
ssl: ${TEST_VAR_DESERIALIZE_OPTION_BOOL}
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||||
|
|
||||||
|
assert_some_eq_x!(&config.ssl, &true);
|
||||||
|
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_BOOL") };
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[serial]
|
||||||
|
fn test_deserialize_optional_env_var_bool_defaults_to_false() {
|
||||||
|
unsafe { std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_BOOL_FALSEY", "test") };
|
||||||
|
let yaml_data = r#"
|
||||||
|
host: localhost
|
||||||
|
api_token: "test123"
|
||||||
|
ssl: ${TEST_VAR_DESERIALIZE_OPTION_BOOL_FALSEY}
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||||
|
|
||||||
|
assert_some_eq_x!(&config.ssl, &false);
|
||||||
|
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_BOOL_FALSEY") };
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_deserialize_optional_env_var_bool_empty() {
|
||||||
|
let yaml_data = r#"
|
||||||
|
host: localhost
|
||||||
|
api_token: "test123"
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
|
||||||
|
|
||||||
|
assert_none!(config.ssl);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[serial]
|
#[serial]
|
||||||
fn test_deserialize_optional_env_var_header_map_is_present() {
|
fn test_deserialize_optional_env_var_header_map_is_present() {
|
||||||
@@ -507,6 +579,56 @@ mod tests {
|
|||||||
assert_none!(config.custom_headers);
|
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]
|
#[test]
|
||||||
#[serial]
|
#[serial]
|
||||||
fn test_deserialize_optional_u16_env_var_is_present() {
|
fn test_deserialize_optional_u16_env_var_is_present() {
|
||||||
@@ -620,10 +742,11 @@ mod tests {
|
|||||||
let api_token = "thisisatest".to_owned();
|
let api_token = "thisisatest".to_owned();
|
||||||
let api_token_file = "/root/.config/api_token".to_owned();
|
let api_token_file = "/root/.config/api_token".to_owned();
|
||||||
let ssl_cert_path = "/some/path".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();
|
let mut custom_headers = HeaderMap::new();
|
||||||
custom_headers.insert("X-Custom-Header", "value".parse().unwrap());
|
custom_headers.insert("X-Custom-Header", "value".parse().unwrap());
|
||||||
let expected_str = format!(
|
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: Some(true), ssl_cert_path: Some(\"{ssl_cert_path}\"), custom_headers: Some({{\"x-custom-header\": \"value\"}}), monitored_storage_paths: Some([\"/path1\", \"/path2\"]) }}"
|
||||||
);
|
);
|
||||||
let servarr_config = ServarrConfig {
|
let servarr_config = ServarrConfig {
|
||||||
name: Some(name),
|
name: Some(name),
|
||||||
@@ -634,7 +757,9 @@ mod tests {
|
|||||||
api_token: Some(api_token),
|
api_token: Some(api_token),
|
||||||
api_token_file: Some(api_token_file),
|
api_token_file: Some(api_token_file),
|
||||||
ssl_cert_path: Some(ssl_cert_path),
|
ssl_cert_path: Some(ssl_cert_path),
|
||||||
|
ssl: Some(true),
|
||||||
custom_headers: Some(custom_headers),
|
custom_headers: Some(custom_headers),
|
||||||
|
monitored_storage_paths: Some(monitored_storage),
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_str_eq!(format!("{servarr_config:?}"), expected_str);
|
assert_str_eq!(format!("{servarr_config:?}"), expected_str);
|
||||||
|
|||||||
+54
-4
@@ -13,6 +13,7 @@ use tokio_util::sync::CancellationToken;
|
|||||||
use veil::Redact;
|
use veil::Redact;
|
||||||
|
|
||||||
use crate::cli::Command;
|
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::lidarr::lidarr_data::{ActiveLidarrBlock, LidarrData};
|
||||||
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, RadarrData};
|
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, RadarrData};
|
||||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, SonarrData};
|
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, SonarrData};
|
||||||
@@ -38,6 +39,7 @@ pub struct App<'a> {
|
|||||||
pub server_tabs: TabState,
|
pub server_tabs: TabState,
|
||||||
pub keymapping_table: Option<StatefulTable<KeybindingItem>>,
|
pub keymapping_table: Option<StatefulTable<KeybindingItem>>,
|
||||||
pub error: HorizontallyScrollableText,
|
pub error: HorizontallyScrollableText,
|
||||||
|
pub notification: Option<Notification>,
|
||||||
pub tick_until_poll: u64,
|
pub tick_until_poll: u64,
|
||||||
pub ticks_until_scroll: u64,
|
pub ticks_until_scroll: u64,
|
||||||
pub tick_count: u64,
|
pub tick_count: u64,
|
||||||
@@ -254,6 +256,7 @@ impl Default for App<'_> {
|
|||||||
cancellation_token: CancellationToken::new(),
|
cancellation_token: CancellationToken::new(),
|
||||||
keymapping_table: None,
|
keymapping_table: None,
|
||||||
error: HorizontallyScrollableText::default(),
|
error: HorizontallyScrollableText::default(),
|
||||||
|
notification: None,
|
||||||
is_first_render: true,
|
is_first_render: true,
|
||||||
server_tabs: TabState::new(Vec::new()),
|
server_tabs: TabState::new(Vec::new()),
|
||||||
tick_until_poll: 400,
|
tick_until_poll: 400,
|
||||||
@@ -346,11 +349,11 @@ pub struct AppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl 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() {
|
if self.lidarr.is_none() && self.radarr.is_none() && self.sonarr.is_none() {
|
||||||
log_and_print_error(
|
log_and_print_error(format!(
|
||||||
"No Servarr configuration provided in the specified configuration file".to_owned(),
|
"No Servarrs are configured in the file: {config_path}"
|
||||||
);
|
));
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,6 +431,8 @@ pub struct ServarrConfig {
|
|||||||
pub api_token: Option<String>,
|
pub api_token: Option<String>,
|
||||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||||
pub api_token_file: Option<String>,
|
pub api_token_file: Option<String>,
|
||||||
|
#[serde(default, deserialize_with = "deserialize_optional_env_var_bool")]
|
||||||
|
pub ssl: Option<bool>,
|
||||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||||
pub ssl_cert_path: Option<String>,
|
pub ssl_cert_path: Option<String>,
|
||||||
#[serde(
|
#[serde(
|
||||||
@@ -436,6 +441,8 @@ pub struct ServarrConfig {
|
|||||||
serialize_with = "serialize_header_map"
|
serialize_with = "serialize_header_map"
|
||||||
)]
|
)]
|
||||||
pub custom_headers: Option<HeaderMap>,
|
pub custom_headers: Option<HeaderMap>,
|
||||||
|
#[serde(default, deserialize_with = "deserialize_optional_env_var_string_vec")]
|
||||||
|
pub monitored_storage_paths: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServarrConfig {
|
impl ServarrConfig {
|
||||||
@@ -481,7 +488,9 @@ impl Default for ServarrConfig {
|
|||||||
api_token: Some(String::new()),
|
api_token: Some(String::new()),
|
||||||
api_token_file: None,
|
api_token_file: None,
|
||||||
ssl_cert_path: None,
|
ssl_cert_path: None,
|
||||||
|
ssl: None,
|
||||||
custom_headers: None,
|
custom_headers: None,
|
||||||
|
monitored_storage_paths: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,6 +535,29 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn deserialize_optional_env_var_bool<'de, D>(deserializer: D) -> Result<Option<bool>, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
enum StringOrBool {
|
||||||
|
Bool(bool),
|
||||||
|
String(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
match StringOrBool::deserialize(deserializer)? {
|
||||||
|
StringOrBool::Bool(b) => Ok(Some(b)),
|
||||||
|
StringOrBool::String(s) => {
|
||||||
|
let val = interpolate_env_vars(&s)
|
||||||
|
.to_lowercase()
|
||||||
|
.parse()
|
||||||
|
.unwrap_or(false);
|
||||||
|
Ok(Some(val))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn deserialize_optional_env_var_header_map<'de, D>(
|
fn deserialize_optional_env_var_header_map<'de, D>(
|
||||||
deserializer: D,
|
deserializer: D,
|
||||||
) -> Result<Option<HeaderMap>, D::Error>
|
) -> Result<Option<HeaderMap>, D::Error>
|
||||||
@@ -548,6 +580,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>
|
fn deserialize_u16_env_var<'de, D>(deserializer: D) -> Result<Option<u16>, D::Error>
|
||||||
where
|
where
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{ArgAction, Subcommand, arg};
|
use clap::{ArgAction, Subcommand};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use super::LidarrCommand;
|
use super::LidarrCommand;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Subcommand, arg};
|
use clap::Subcommand;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
@@ -59,6 +59,8 @@ pub enum LidarrListCommand {
|
|||||||
Artists,
|
Artists,
|
||||||
#[command(about = "List all items in the Lidarr blocklist")]
|
#[command(about = "List all items in the Lidarr blocklist")]
|
||||||
Blocklist,
|
Blocklist,
|
||||||
|
#[command(about = "List disk space details for all provisioned root folders in Lidarr")]
|
||||||
|
DiskSpace,
|
||||||
#[command(about = "List all active downloads in Lidarr")]
|
#[command(about = "List all active downloads in Lidarr")]
|
||||||
Downloads {
|
Downloads {
|
||||||
#[arg(long, help = "How many downloads to fetch", default_value_t = 500)]
|
#[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?;
|
.await?;
|
||||||
serde_json::to_string_pretty(&resp)?
|
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 } => {
|
LidarrListCommand::Downloads { count } => {
|
||||||
let resp = self
|
let resp = self
|
||||||
.network
|
.network
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ mod tests {
|
|||||||
#[values(
|
#[values(
|
||||||
"artists",
|
"artists",
|
||||||
"blocklist",
|
"blocklist",
|
||||||
|
"disk-space",
|
||||||
"indexers",
|
"indexers",
|
||||||
"metadata-profiles",
|
"metadata-profiles",
|
||||||
"quality-profiles",
|
"quality-profiles",
|
||||||
@@ -435,6 +436,7 @@ mod tests {
|
|||||||
#[rstest]
|
#[rstest]
|
||||||
#[case(LidarrListCommand::Artists, LidarrEvent::ListArtists)]
|
#[case(LidarrListCommand::Artists, LidarrEvent::ListArtists)]
|
||||||
#[case(LidarrListCommand::Blocklist, LidarrEvent::GetBlocklist)]
|
#[case(LidarrListCommand::Blocklist, LidarrEvent::GetBlocklist)]
|
||||||
|
#[case(LidarrListCommand::DiskSpace, LidarrEvent::GetDiskSpace)]
|
||||||
#[case(LidarrListCommand::Indexers, LidarrEvent::GetIndexers)]
|
#[case(LidarrListCommand::Indexers, LidarrEvent::GetIndexers)]
|
||||||
#[case(LidarrListCommand::MetadataProfiles, LidarrEvent::GetMetadataProfiles)]
|
#[case(LidarrListCommand::MetadataProfiles, LidarrEvent::GetMetadataProfiles)]
|
||||||
#[case(LidarrListCommand::QualityProfiles, LidarrEvent::GetQualityProfiles)]
|
#[case(LidarrListCommand::QualityProfiles, LidarrEvent::GetQualityProfiles)]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use add_command_handler::{LidarrAddCommand, LidarrAddCommandHandler};
|
use add_command_handler::{LidarrAddCommand, LidarrAddCommandHandler};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Subcommand, arg};
|
use clap::Subcommand;
|
||||||
use delete_command_handler::{LidarrDeleteCommand, LidarrDeleteCommandHandler};
|
use delete_command_handler::{LidarrDeleteCommand, LidarrDeleteCommandHandler};
|
||||||
use edit_command_handler::{LidarrEditCommand, LidarrEditCommandHandler};
|
use edit_command_handler::{LidarrEditCommand, LidarrEditCommandHandler};
|
||||||
use get_command_handler::{LidarrGetCommand, LidarrGetCommandHandler};
|
use get_command_handler::{LidarrGetCommand, LidarrGetCommandHandler};
|
||||||
|
|||||||
+8
-1
@@ -1,8 +1,9 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Subcommand, command};
|
use clap::Subcommand;
|
||||||
use clap_complete::Shell;
|
use clap_complete::Shell;
|
||||||
|
use indoc::indoc;
|
||||||
use lidarr::{LidarrCliHandler, LidarrCommand};
|
use lidarr::{LidarrCliHandler, LidarrCommand};
|
||||||
use radarr::{RadarrCliHandler, RadarrCommand};
|
use radarr::{RadarrCliHandler, RadarrCommand};
|
||||||
use sonarr::{SonarrCliHandler, SonarrCommand};
|
use sonarr::{SonarrCliHandler, SonarrCommand};
|
||||||
@@ -43,6 +44,12 @@ pub enum Command {
|
|||||||
#[arg(long, help = "Disable colored log output")]
|
#[arg(long, help = "Disable colored log output")]
|
||||||
no_color: bool,
|
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>> {
|
pub trait CliCommandHandler<'a, 'b, T: Into<Command>> {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{ArgAction, Subcommand, arg, command};
|
use clap::{ArgAction, Subcommand};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use super::RadarrCommand;
|
use super::RadarrCommand;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Subcommand, command};
|
use clap::Subcommand;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Subcommand, command};
|
use clap::Subcommand;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ mod tests {
|
|||||||
use crate::handlers::{handle_events, populate_keymapping_table};
|
use crate::handlers::{handle_events, populate_keymapping_table};
|
||||||
use crate::models::HorizontallyScrollableText;
|
use crate::models::HorizontallyScrollableText;
|
||||||
use crate::models::Route;
|
use crate::models::Route;
|
||||||
use crate::models::servarr_data::ActiveKeybindingBlock;
|
|
||||||
use crate::models::servarr_data::lidarr::lidarr_data::ActiveLidarrBlock;
|
use crate::models::servarr_data::lidarr::lidarr_data::ActiveLidarrBlock;
|
||||||
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, RadarrData};
|
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, RadarrData};
|
||||||
use crate::models::servarr_data::sonarr::sonarr_data::ActiveSonarrBlock;
|
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::servarr_models::KeybindingItem;
|
||||||
use crate::models::stateful_table::StatefulTable;
|
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]
|
#[rstest]
|
||||||
fn test_handle_prompt_toggle_left_right_radarr(#[values(Key::Left, Key::Right)] key: Key) {
|
fn test_handle_prompt_toggle_left_right_radarr(#[values(Key::Left, Key::Right)] key: Key) {
|
||||||
let mut app = App::test_default();
|
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 {
|
fn context_clue_to_keybinding_item(key: &KeyBinding, desc: &&str) -> KeybindingItem {
|
||||||
let (key, alt_key) = if key.alt.is_some() {
|
let (key, alt_key) = if key.alt.is_some() {
|
||||||
(key.key.to_string(), key.alt.as_ref().unwrap().to_string())
|
(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 {
|
} else {
|
||||||
app.keymapping_table = None;
|
app.keymapping_table = None;
|
||||||
}
|
}
|
||||||
|
} else if matches_key!(esc, key) && app.notification.is_some() {
|
||||||
|
app.notification.take();
|
||||||
} else {
|
} else {
|
||||||
match app.get_current_route() {
|
match app.get_current_route() {
|
||||||
_ if app.keymapping_table.is_some() => {
|
_ 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 = "⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀
|
pub const LIDARR_LOGO: &str = "⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀
|
||||||
⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀
|
⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀
|
||||||
⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄
|
⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄
|
||||||
|
|||||||
+26
-6
@@ -2,7 +2,7 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate assertables;
|
extern crate assertables;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::{Context, Result};
|
||||||
use clap::{
|
use clap::{
|
||||||
Args, CommandFactory, Parser, crate_authors, crate_description, crate_name, crate_version,
|
Args, CommandFactory, Parser, crate_authors, crate_description, crate_name, crate_version,
|
||||||
};
|
};
|
||||||
@@ -86,7 +86,7 @@ struct GlobalOpts {
|
|||||||
global = true,
|
global = true,
|
||||||
value_parser,
|
value_parser,
|
||||||
env = "MANAGARR_CONFIG_FILE",
|
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>,
|
config_file: Option<PathBuf>,
|
||||||
#[arg(
|
#[arg(
|
||||||
@@ -127,15 +127,30 @@ async fn main() -> Result<()> {
|
|||||||
let running = Arc::new(AtomicBool::new(true));
|
let running = Arc::new(AtomicBool::new(true));
|
||||||
let r = running.clone();
|
let r = running.clone();
|
||||||
let args = Cli::parse();
|
let args = Cli::parse();
|
||||||
let mut config = if let Some(ref config_file) = args.global.config_file {
|
let config_file_path = confy::get_configuration_file_path("managarr", "config")?;
|
||||||
load_config(config_file.to_str().expect("Invalid config file specified"))?
|
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 {
|
} 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 theme_name = config.theme.clone();
|
||||||
let spinner_disabled = args.global.disable_spinner;
|
let spinner_disabled = args.global.disable_spinner;
|
||||||
debug!("Managarr loaded using config: {config:?}");
|
debug!("Managarr loaded using config: {config:?}");
|
||||||
config.validate();
|
config.validate(&config_path);
|
||||||
config.post_process_initialization();
|
config.post_process_initialization();
|
||||||
|
|
||||||
let reqwest_client = build_network_client(&config);
|
let reqwest_client = build_network_client(&config);
|
||||||
@@ -170,6 +185,11 @@ async fn main() -> Result<()> {
|
|||||||
generate(shell, &mut cli, "managarr", &mut io::stdout())
|
generate(shell, &mut cli, "managarr", &mut io::stdout())
|
||||||
}
|
}
|
||||||
Command::TailLogs { no_color } => tail_logs(no_color).await?,
|
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 => {
|
None => {
|
||||||
let app_nw = Arc::clone(&app);
|
let app_nw = Arc::clone(&app);
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_lidarr_serdeable_from_disk_spaces() {
|
fn test_lidarr_serdeable_from_disk_spaces() {
|
||||||
let disk_spaces = vec![DiskSpace {
|
let disk_spaces = vec![DiskSpace {
|
||||||
|
path: Some("/path".to_owned()),
|
||||||
free_space: 1,
|
free_space: 1,
|
||||||
total_space: 1,
|
total_space: 1,
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_radarr_serdeable_from_disk_spaces() {
|
fn test_radarr_serdeable_from_disk_spaces() {
|
||||||
let disk_spaces = vec![DiskSpace {
|
let disk_spaces = vec![DiskSpace {
|
||||||
|
path: Some("/path".to_owned()),
|
||||||
free_space: 1,
|
free_space: 1,
|
||||||
total_space: 1,
|
total_space: 1,
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -10,6 +10,23 @@ pub(in crate::models::servarr_data) mod data_test_utils;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod servarr_data_tests;
|
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)]
|
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
|
||||||
pub enum ActiveKeybindingBlock {
|
pub enum ActiveKeybindingBlock {
|
||||||
#[default]
|
#[default]
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ pub struct CommandBody {
|
|||||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct DiskSpace {
|
pub struct DiskSpace {
|
||||||
|
pub path: Option<String>,
|
||||||
#[serde(deserialize_with = "super::from_i64")]
|
#[serde(deserialize_with = "super::from_i64")]
|
||||||
pub free_space: i64,
|
pub free_space: i64,
|
||||||
#[serde(deserialize_with = "super::from_i64")]
|
#[serde(deserialize_with = "super::from_i64")]
|
||||||
|
|||||||
@@ -427,6 +427,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_sonarr_serdeable_from_disk_spaces() {
|
fn test_sonarr_serdeable_from_disk_spaces() {
|
||||||
let disk_spaces = vec![DiskSpace {
|
let disk_spaces = vec![DiskSpace {
|
||||||
|
path: Some("/path".to_owned()),
|
||||||
free_space: 1,
|
free_space: 1,
|
||||||
total_space: 1,
|
total_space: 1,
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::models::lidarr_models::LidarrReleaseDownloadBody;
|
use crate::models::lidarr_models::LidarrReleaseDownloadBody;
|
||||||
|
use crate::models::servarr_data::Notification;
|
||||||
use crate::network::lidarr_network::LidarrEvent;
|
use crate::network::lidarr_network::LidarrEvent;
|
||||||
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@@ -30,5 +32,51 @@ mod tests {
|
|||||||
|
|
||||||
mock.assert_async().await;
|
mock.assert_async().await;
|
||||||
assert_ok!(result);
|
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::lidarr_models::LidarrReleaseDownloadBody;
|
||||||
|
use crate::models::servarr_data::Notification;
|
||||||
use crate::network::lidarr_network::LidarrEvent;
|
use crate::network::lidarr_network::LidarrEvent;
|
||||||
use crate::network::{Network, RequestMethod};
|
use crate::network::{Network, RequestMethod};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
@@ -31,8 +32,26 @@ impl Network<'_, '_> {
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
self
|
let result = self
|
||||||
.handle_request::<LidarrReleaseDownloadBody, Value>(request_props, |_, _| ())
|
.handle_request::<LidarrReleaseDownloadBody, Value>(request_props, |_, mut app| {
|
||||||
.await
|
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() {
|
async fn test_handle_get_diskspace_event() {
|
||||||
let diskspace_json = json!([
|
let diskspace_json = json!([
|
||||||
{
|
{
|
||||||
|
"path": "/path1",
|
||||||
"freeSpace": 1111,
|
"freeSpace": 1111,
|
||||||
"totalSpace": 2222,
|
"totalSpace": 2222,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"path": "/path2",
|
||||||
"freeSpace": 3333,
|
"freeSpace": 3333,
|
||||||
"totalSpace": 4444
|
"totalSpace": 4444
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
let response: Vec<DiskSpace> = serde_json::from_value(diskspace_json.clone()).unwrap();
|
|
||||||
let (mock, app, _server) = MockServarrApi::get()
|
let (mock, app, _server) = MockServarrApi::get()
|
||||||
.returns(diskspace_json)
|
.returns(diskspace_json)
|
||||||
.build_for(LidarrEvent::GetDiskSpace)
|
.build_for(LidarrEvent::GetDiskSpace)
|
||||||
.await;
|
.await;
|
||||||
app.lock().await.server_tabs.set_index(2);
|
app.lock().await.server_tabs.set_index(2);
|
||||||
let mut network = test_network(&app);
|
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;
|
let result = network.handle_lidarr_event(LidarrEvent::GetDiskSpace).await;
|
||||||
|
|
||||||
@@ -40,8 +53,11 @@ mod tests {
|
|||||||
panic!("Expected DiskSpaces");
|
panic!("Expected DiskSpaces");
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(disk_spaces, response);
|
assert_eq!(
|
||||||
assert!(!app.lock().await.data.lidarr_data.disk_space_vec.is_empty());
|
app.lock().await.data.lidarr_data.disk_space_vec,
|
||||||
|
disk_space_vec
|
||||||
|
);
|
||||||
|
assert_eq!(disk_spaces, disk_space_vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
+2
-1
@@ -229,6 +229,7 @@ impl<'a, 'b> Network<'a, 'b> {
|
|||||||
uri,
|
uri,
|
||||||
api_token,
|
api_token,
|
||||||
ssl_cert_path,
|
ssl_cert_path,
|
||||||
|
ssl,
|
||||||
custom_headers: custom_headers_option,
|
custom_headers: custom_headers_option,
|
||||||
..
|
..
|
||||||
} = app
|
} = app
|
||||||
@@ -245,7 +246,7 @@ impl<'a, 'b> Network<'a, 'b> {
|
|||||||
let mut uri = if let Some(servarr_uri) = uri {
|
let mut uri = if let Some(servarr_uri) = uri {
|
||||||
format!("{servarr_uri}/api/{api_version}{resource}")
|
format!("{servarr_uri}/api/{api_version}{resource}")
|
||||||
} else {
|
} else {
|
||||||
let protocol = if ssl_cert_path.is_some() {
|
let protocol = if ssl_cert_path.is_some() || ssl.unwrap_or(false) {
|
||||||
"https"
|
"https"
|
||||||
} else {
|
} else {
|
||||||
"http"
|
"http"
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ mod tests {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[should_panic(expected = "Servarr config is undefined")]
|
#[should_panic(expected = "Servarr config is undefined")]
|
||||||
#[rstest]
|
#[rstest]
|
||||||
async fn test_request_props_from_requires_radarr_config_to_be_present_for_all_network_events(
|
async fn test_request_props_from_requires_config_to_be_present_for_all_network_events(
|
||||||
#[values(RadarrEvent::HealthCheck, SonarrEvent::HealthCheck)] network_event: impl Into<NetworkEvent>
|
#[values(RadarrEvent::HealthCheck, SonarrEvent::HealthCheck)] network_event: impl Into<NetworkEvent>
|
||||||
+ NetworkResource,
|
+ NetworkResource,
|
||||||
) {
|
) {
|
||||||
@@ -492,6 +492,82 @@ mod tests {
|
|||||||
assert!(request_props.custom_headers.is_empty());
|
assert!(request_props.custom_headers.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rstest]
|
||||||
|
#[tokio::test]
|
||||||
|
async fn test_request_props_from_custom_config_ssl_doesnt_affect_ssl_cert_path(
|
||||||
|
#[values(RadarrEvent::GetMovies, SonarrEvent::ListSeries)] network_event: impl Into<NetworkEvent>
|
||||||
|
+ NetworkResource,
|
||||||
|
#[values(Some(true), Some(false), None)] ssl_option: Option<bool>,
|
||||||
|
) {
|
||||||
|
let api_token = "testToken1234".to_owned();
|
||||||
|
let app_arc = Arc::new(Mutex::new(App::test_default()));
|
||||||
|
let resource = network_event.resource();
|
||||||
|
let servarr_config = ServarrConfig {
|
||||||
|
host: Some("192.168.0.123".to_owned()),
|
||||||
|
port: Some(8080),
|
||||||
|
api_token: Some(api_token.clone()),
|
||||||
|
ssl_cert_path: Some("/test/cert.crt".to_owned()),
|
||||||
|
ssl: ssl_option,
|
||||||
|
..ServarrConfig::default()
|
||||||
|
};
|
||||||
|
{
|
||||||
|
let mut app = app_arc.lock().await;
|
||||||
|
app.server_tabs.tabs[0].config = Some(servarr_config.clone());
|
||||||
|
app.server_tabs.tabs[1].config = Some(servarr_config);
|
||||||
|
}
|
||||||
|
let network = test_network(&app_arc);
|
||||||
|
|
||||||
|
let request_props = network
|
||||||
|
.request_props_from(network_event, RequestMethod::Get, None::<()>, None, None)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
assert_str_eq!(
|
||||||
|
request_props.uri,
|
||||||
|
format!("https://192.168.0.123:8080/api/v3{resource}")
|
||||||
|
);
|
||||||
|
assert_eq!(request_props.method, RequestMethod::Get);
|
||||||
|
assert_eq!(request_props.body, None);
|
||||||
|
assert_str_eq!(request_props.api_token, api_token);
|
||||||
|
assert!(request_props.custom_headers.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[rstest]
|
||||||
|
#[tokio::test]
|
||||||
|
async fn test_request_props_uses_ssl_property(
|
||||||
|
#[values(RadarrEvent::GetMovies, SonarrEvent::ListSeries)] network_event: impl Into<NetworkEvent>
|
||||||
|
+ NetworkResource,
|
||||||
|
) {
|
||||||
|
let api_token = "testToken1234".to_owned();
|
||||||
|
let app_arc = Arc::new(Mutex::new(App::test_default()));
|
||||||
|
let resource = network_event.resource();
|
||||||
|
let servarr_config = ServarrConfig {
|
||||||
|
host: Some("192.168.0.123".to_owned()),
|
||||||
|
port: Some(8080),
|
||||||
|
api_token: Some(api_token.clone()),
|
||||||
|
ssl: Some(true),
|
||||||
|
..ServarrConfig::default()
|
||||||
|
};
|
||||||
|
{
|
||||||
|
let mut app = app_arc.lock().await;
|
||||||
|
app.server_tabs.tabs[0].config = Some(servarr_config.clone());
|
||||||
|
app.server_tabs.tabs[1].config = Some(servarr_config);
|
||||||
|
}
|
||||||
|
let network = test_network(&app_arc);
|
||||||
|
|
||||||
|
let request_props = network
|
||||||
|
.request_props_from(network_event, RequestMethod::Get, None::<()>, None, None)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
assert_str_eq!(
|
||||||
|
request_props.uri,
|
||||||
|
format!("https://192.168.0.123:8080/api/v3{resource}")
|
||||||
|
);
|
||||||
|
assert_eq!(request_props.method, RequestMethod::Get);
|
||||||
|
assert_eq!(request_props.body, None);
|
||||||
|
assert_str_eq!(request_props.api_token, api_token);
|
||||||
|
assert!(request_props.custom_headers.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
#[rstest]
|
#[rstest]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_request_props_from_custom_config_custom_headers(
|
async fn test_request_props_from_custom_config_custom_headers(
|
||||||
@@ -862,6 +938,7 @@ pub(in crate::network) mod test_utils {
|
|||||||
host,
|
host,
|
||||||
port,
|
port,
|
||||||
api_token: Some("test1234".to_owned()),
|
api_token: Some("test1234".to_owned()),
|
||||||
|
monitored_storage_paths: Some(vec!["/path1".to_owned()]),
|
||||||
..ServarrConfig::default()
|
..ServarrConfig::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use crate::models::radarr_models::{
|
|||||||
EditMovieParams, Movie, MovieCommandBody, MovieHistoryItem, RadarrRelease,
|
EditMovieParams, Movie, MovieCommandBody, MovieHistoryItem, RadarrRelease,
|
||||||
RadarrReleaseDownloadBody,
|
RadarrReleaseDownloadBody,
|
||||||
};
|
};
|
||||||
|
use crate::models::servarr_data::Notification;
|
||||||
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
|
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
|
||||||
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||||
use crate::models::stateful_table::StatefulTable;
|
use crate::models::stateful_table::StatefulTable;
|
||||||
@@ -85,9 +86,27 @@ impl Network<'_, '_> {
|
|||||||
.request_props_from(event, RequestMethod::Post, Some(params), None, None)
|
.request_props_from(event, RequestMethod::Post, Some(params), None, None)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
self
|
let result = self
|
||||||
.handle_request::<RadarrReleaseDownloadBody, Value>(request_props, |_, _| ())
|
.handle_request::<RadarrReleaseDownloadBody, Value>(request_props, |_, mut app| {
|
||||||
.await
|
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(
|
pub(in crate::network::radarr_network) async fn edit_movie(
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ mod tests {
|
|||||||
AddMovieBody, AddMovieOptions, Credit, DeleteMovieParams, DownloadRecord, EditMovieParams,
|
AddMovieBody, AddMovieOptions, Credit, DeleteMovieParams, DownloadRecord, EditMovieParams,
|
||||||
MinimumAvailability, Movie, MovieHistoryItem, MovieMonitor, RadarrReleaseDownloadBody,
|
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::modals::MovieDetailsModal;
|
||||||
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||||
use crate::models::stateful_table::SortOption;
|
use crate::models::stateful_table::SortOption;
|
||||||
@@ -164,14 +165,58 @@ mod tests {
|
|||||||
.await;
|
.await;
|
||||||
let mut network = test_network(&app);
|
let mut network = test_network(&app);
|
||||||
|
|
||||||
assert!(
|
let result = network
|
||||||
network
|
.handle_radarr_event(RadarrEvent::DownloadRelease(expected_body))
|
||||||
.handle_radarr_event(RadarrEvent::DownloadRelease(expected_body))
|
.await;
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
);
|
|
||||||
|
|
||||||
mock.assert_async().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]
|
#[tokio::test]
|
||||||
|
|||||||
@@ -17,10 +17,12 @@ mod tests {
|
|||||||
let (mock, app, _server) = MockServarrApi::get()
|
let (mock, app, _server) = MockServarrApi::get()
|
||||||
.returns(json!([
|
.returns(json!([
|
||||||
{
|
{
|
||||||
|
"path": "/path1",
|
||||||
"freeSpace": 1111,
|
"freeSpace": 1111,
|
||||||
"totalSpace": 2222,
|
"totalSpace": 2222,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"path": "/path2",
|
||||||
"freeSpace": 3333,
|
"freeSpace": 3333,
|
||||||
"totalSpace": 4444
|
"totalSpace": 4444
|
||||||
}
|
}
|
||||||
@@ -30,10 +32,12 @@ mod tests {
|
|||||||
let mut network = test_network(&app);
|
let mut network = test_network(&app);
|
||||||
let disk_space_vec = vec![
|
let disk_space_vec = vec![
|
||||||
DiskSpace {
|
DiskSpace {
|
||||||
|
path: Some("/path1".to_owned()),
|
||||||
free_space: 1111,
|
free_space: 1111,
|
||||||
total_space: 2222,
|
total_space: 2222,
|
||||||
},
|
},
|
||||||
DiskSpace {
|
DiskSpace {
|
||||||
|
path: Some("/path2".to_owned()),
|
||||||
free_space: 3333,
|
free_space: 3333,
|
||||||
total_space: 4444,
|
total_space: 4444,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use chrono::DateTime;
|
|||||||
|
|
||||||
pub fn diskspace() -> DiskSpace {
|
pub fn diskspace() -> DiskSpace {
|
||||||
DiskSpace {
|
DiskSpace {
|
||||||
|
path: Some("/path".to_owned()),
|
||||||
free_space: 6500,
|
free_space: 6500,
|
||||||
total_space: 8675309,
|
total_space: 8675309,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use crate::models::servarr_data::Notification;
|
||||||
use crate::models::sonarr_models::SonarrReleaseDownloadBody;
|
use crate::models::sonarr_models::SonarrReleaseDownloadBody;
|
||||||
use crate::network::sonarr_network::SonarrEvent;
|
use crate::network::sonarr_network::SonarrEvent;
|
||||||
use crate::network::{Network, RequestMethod};
|
use crate::network::{Network, RequestMethod};
|
||||||
@@ -31,8 +32,26 @@ impl Network<'_, '_> {
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
self
|
let result = self
|
||||||
.handle_request::<SonarrReleaseDownloadBody, Value>(request_props, |_, _| ())
|
.handle_request::<SonarrReleaseDownloadBody, Value>(request_props, |_, mut app| {
|
||||||
.await
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use crate::models::servarr_data::Notification;
|
||||||
use crate::models::sonarr_models::SonarrReleaseDownloadBody;
|
use crate::models::sonarr_models::SonarrReleaseDownloadBody;
|
||||||
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
||||||
use crate::network::sonarr_network::SonarrEvent;
|
use crate::network::sonarr_network::SonarrEvent;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@@ -33,5 +35,54 @@ mod tests {
|
|||||||
|
|
||||||
mock.assert_async().await;
|
mock.assert_async().await;
|
||||||
assert_ok!(result);
|
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()
|
let (mock, app, _server) = MockServarrApi::get()
|
||||||
.returns(json!([
|
.returns(json!([
|
||||||
{
|
{
|
||||||
|
"path": "/path1",
|
||||||
"freeSpace": 1111,
|
"freeSpace": 1111,
|
||||||
"totalSpace": 2222,
|
"totalSpace": 2222,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"path": "/path2",
|
||||||
"freeSpace": 3333,
|
"freeSpace": 3333,
|
||||||
"totalSpace": 4444
|
"totalSpace": 4444
|
||||||
}
|
}
|
||||||
@@ -127,10 +129,12 @@ mod tests {
|
|||||||
let mut network = test_network(&app);
|
let mut network = test_network(&app);
|
||||||
let disk_space_vec = vec![
|
let disk_space_vec = vec![
|
||||||
DiskSpace {
|
DiskSpace {
|
||||||
|
path: Some("/path1".to_owned()),
|
||||||
free_space: 1111,
|
free_space: 1111,
|
||||||
total_space: 2222,
|
total_space: 2222,
|
||||||
},
|
},
|
||||||
DiskSpace {
|
DiskSpace {
|
||||||
|
path: Some("/path2".to_owned()),
|
||||||
free_space: 3333,
|
free_space: 3333,
|
||||||
total_space: 4444,
|
total_space: 4444,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -356,12 +356,12 @@ fn draw_album_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
|||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
let leechers = leechers
|
let leechers = leechers
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
|
|
||||||
decorate_peer_style(
|
decorate_peer_style(
|
||||||
seeders,
|
seeders,
|
||||||
|
|||||||
@@ -501,12 +501,12 @@ fn draw_artist_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
|||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
let leechers = leechers
|
let leechers = leechers
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
|
|
||||||
decorate_peer_style(
|
decorate_peer_style(
|
||||||
seeders,
|
seeders,
|
||||||
|
|||||||
+17
-10
@@ -1,5 +1,3 @@
|
|||||||
use std::{cmp, iter};
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use crate::ui::ui_test_utils::test_utils::Utc;
|
use crate::ui::ui_test_utils::test_utils::Utc;
|
||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
@@ -14,6 +12,7 @@ use ratatui::{
|
|||||||
text::Text,
|
text::Text,
|
||||||
widgets::Paragraph,
|
widgets::Paragraph,
|
||||||
};
|
};
|
||||||
|
use std::{cmp, iter};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
DrawUi, draw_tabs,
|
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::indexers::IndexersUi;
|
||||||
use crate::ui::lidarr_ui::root_folders::RootFoldersUi;
|
use crate::ui::lidarr_ui::root_folders::RootFoldersUi;
|
||||||
use crate::ui::lidarr_ui::system::SystemUi;
|
use crate::ui::lidarr_ui::system::SystemUi;
|
||||||
|
use crate::ui::utils::{extract_monitored_disk_space_vec, extract_monitored_root_folders};
|
||||||
use crate::{
|
use crate::{
|
||||||
app::App,
|
app::App,
|
||||||
logos::LIDARR_LOGO,
|
logos::LIDARR_LOGO,
|
||||||
@@ -100,6 +100,8 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
start_time,
|
start_time,
|
||||||
..
|
..
|
||||||
} = &app.data.lidarr_data;
|
} = &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![
|
let mut constraints = vec![
|
||||||
Constraint::Length(1),
|
Constraint::Length(1),
|
||||||
@@ -110,7 +112,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
constraints.append(
|
constraints.append(
|
||||||
&mut iter::repeat_n(
|
&mut iter::repeat_n(
|
||||||
Constraint::Length(1),
|
Constraint::Length(1),
|
||||||
disk_space_vec.len() + root_folders.items.len() + 1,
|
monitored_disk_space_vec.len() + monitored_root_folders.len() + 1,
|
||||||
)
|
)
|
||||||
.collect(),
|
.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(uptime_paragraph, stat_item_areas[1]);
|
||||||
f.render_widget(storage, stat_item_areas[2]);
|
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 {
|
let DiskSpace {
|
||||||
|
path,
|
||||||
free_space,
|
free_space,
|
||||||
total_space,
|
total_space,
|
||||||
} = &disk_space_vec[i];
|
} = &monitored_disk_space_vec[i];
|
||||||
let title = format!("Disk {}", i + 1);
|
let title = if let Some(path) = path {
|
||||||
|
path
|
||||||
|
} else {
|
||||||
|
&format!("Disk {}", i + 1)
|
||||||
|
};
|
||||||
let ratio = if *total_space == 0 {
|
let ratio = if *total_space == 0 {
|
||||||
0f64
|
0f64
|
||||||
} else {
|
} 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(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 {
|
let RootFolder {
|
||||||
path, free_space, ..
|
path, free_space, ..
|
||||||
} = &root_folders.items[i];
|
} = &monitored_root_folders[i];
|
||||||
let space: f64 = convert_to_gb(*free_space);
|
let space: f64 = convert_to_gb(*free_space);
|
||||||
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
||||||
.block(borderless_block())
|
.block(borderless_block())
|
||||||
@@ -176,7 +183,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
|
|
||||||
f.render_widget(
|
f.render_widget(
|
||||||
root_folder_space,
|
root_folder_space,
|
||||||
stat_item_areas[i + disk_space_vec.len() + 4],
|
stat_item_areas[i + monitored_disk_space_vec.len() + 4],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+23
-1
@@ -14,6 +14,7 @@ use sonarr_ui::SonarrUi;
|
|||||||
use utils::layout_block;
|
use utils::layout_block;
|
||||||
|
|
||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
|
use crate::models::servarr_data::Notification;
|
||||||
use crate::models::servarr_models::KeybindingItem;
|
use crate::models::servarr_models::KeybindingItem;
|
||||||
use crate::models::{HorizontallyScrollableText, Route, TabState};
|
use crate::models::{HorizontallyScrollableText, Route, TabState};
|
||||||
use crate::ui::radarr_ui::RadarrUi;
|
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::input_box::InputBox;
|
||||||
use crate::ui::widgets::managarr_table::ManagarrTable;
|
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 builtin_themes;
|
||||||
mod lidarr_ui;
|
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() {
|
if app.keymapping_table.is_some() {
|
||||||
draw_help_popup(f, app);
|
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);
|
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 {
|
fn draw_tabs(f: &mut Frame<'_>, area: Rect, title: &str, tab_state: &TabState) -> Rect {
|
||||||
if title.is_empty() {
|
if title.is_empty() {
|
||||||
f.render_widget(layout_block().default_color(), area);
|
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::app::App;
|
||||||
use crate::logos::RADARR_LOGO;
|
use crate::logos::RADARR_LOGO;
|
||||||
use crate::models::Route;
|
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::root_folders::RootFoldersUi;
|
||||||
use crate::ui::radarr_ui::system::SystemUi;
|
use crate::ui::radarr_ui::system::SystemUi;
|
||||||
use crate::ui::styles::ManagarrStyle;
|
use crate::ui::styles::ManagarrStyle;
|
||||||
|
#[cfg(test)]
|
||||||
|
use crate::ui::ui_test_utils::test_utils::Utc;
|
||||||
use crate::ui::utils::{
|
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::ui::widgets::loading_block::LoadingBlock;
|
||||||
use crate::utils::convert_to_gb;
|
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 blocklist;
|
||||||
mod collections;
|
mod collections;
|
||||||
@@ -93,6 +93,8 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
start_time,
|
start_time,
|
||||||
..
|
..
|
||||||
} = &app.data.radarr_data;
|
} = &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![
|
let mut constraints = vec![
|
||||||
Constraint::Length(1),
|
Constraint::Length(1),
|
||||||
@@ -103,7 +105,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
constraints.append(
|
constraints.append(
|
||||||
&mut iter::repeat_n(
|
&mut iter::repeat_n(
|
||||||
Constraint::Length(1),
|
Constraint::Length(1),
|
||||||
disk_space_vec.len() + root_folders.items.len() + 1,
|
monitored_disk_space_vec.len() + monitored_root_folders.len() + 1,
|
||||||
)
|
)
|
||||||
.collect(),
|
.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(uptime_paragraph, stat_item_areas[1]);
|
||||||
f.render_widget(storage, stat_item_areas[2]);
|
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 {
|
let DiskSpace {
|
||||||
|
path,
|
||||||
free_space,
|
free_space,
|
||||||
total_space,
|
total_space,
|
||||||
} = &disk_space_vec[i];
|
} = &monitored_disk_space_vec[i];
|
||||||
let title = format!("Disk {}", i + 1);
|
let title = if let Some(path) = path {
|
||||||
|
path
|
||||||
|
} else {
|
||||||
|
&format!("Disk {}", i + 1)
|
||||||
|
};
|
||||||
let ratio = if *total_space == 0 {
|
let ratio = if *total_space == 0 {
|
||||||
0f64
|
0f64
|
||||||
} else {
|
} 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(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 {
|
let RootFolder {
|
||||||
path, free_space, ..
|
path, free_space, ..
|
||||||
} = &root_folders.items[i];
|
} = &monitored_root_folders[i];
|
||||||
let space: f64 = convert_to_gb(*free_space);
|
let space: f64 = convert_to_gb(*free_space);
|
||||||
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
||||||
.block(borderless_block())
|
.block(borderless_block())
|
||||||
@@ -169,7 +177,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
|
|
||||||
f.render_widget(
|
f.render_widget(
|
||||||
root_folder_space,
|
root_folder_space,
|
||||||
stat_item_areas[i + disk_space_vec.len() + 4],
|
stat_item_areas[i + monitored_disk_space_vec.len() + 4],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
|||||||
│Lidarr Version: 1.2.3.4 ││Test download title ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
│Lidarr Version: 1.2.3.4 ││Test download title ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
||||||
│Storage: ││ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
│Storage: ││ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||||
│Root Folders: ││ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
│Root Folders: ││ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
||||||
│/nfs: 204800.00 GB free ││ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
│/nfs: 204800.00 GB free ││ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
||||||
│ ││ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
|
│ ││ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
|||||||
│Lidarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
│Lidarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
||||||
│Storage: │=> a add │ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
│Storage: │=> a add │ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||||
│Root Folders: │ m toggle monitoring │ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
│Root Folders: │ m toggle monitoring │ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
||||||
│/nfs: 204800.00 GB free │ o sort │ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
│/nfs: 204800.00 GB free │ o sort │ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
||||||
│ │ del delete │ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
|
│ │ del delete │ ││ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ │
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ expression: output
|
|||||||
│Lidarr Version: 1.2.3.4 ││Test download title ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
│Lidarr Version: 1.2.3.4 ││Test download title ││ ⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ │
|
||||||
│Storage: ││ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
│Storage: ││ ││ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣾⡟⠀⢸⠃⠀⠀⠀⠈⠉⠉⠁⠀⢹⣷ │
|
||||||
│Root Folders: ││ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
│Root Folders: ││ ││ ⢿⣧⠀⠈⠀⠀⠀⠀⠀⠀⢀⡟⠀⣸⡿ │
|
||||||
│/nfs: 204800.00 GB free ││ ││ ⠘⣿⣄⠀⠻⣿⣿⡇⠀⢀⠞⠀⣠⣿⠃ │
|
│/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 ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
│Radarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
||||||
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||||
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
||||||
│/nfs: 204800.00 GB free ││ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
│/nfs: 204800.00 GB free ││ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
||||||
│ ││ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
|
│ ││ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
|||||||
│Radarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
│Radarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
||||||
│Storage: │=> a add │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
│Storage: │=> a add │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||||
│Root Folders: │ m toggle monitoring │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
│Root Folders: │ m toggle monitoring │ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
||||||
│/nfs: 204800.00 GB free │ o sort │ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
│/nfs: 204800.00 GB free │ o sort │ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
||||||
│ │ del delete │ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
|
│ │ del delete │ ││ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ │
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ expression: output
|
|||||||
│Radarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
│Radarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣿⡇⠀⠈⠙⠻⢿⣶⣤⡀⠀⠀⠀⠀ │
|
||||||
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
│Storage: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠈⠙⠻⢷⣦⡄⠀ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢉⠻⠀ │
|
||||||
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
│Root Folders: ││ ││ ⠀⣿⡇⠀⠀⠀⠀⠀⢀⣠⣴⣾⠿⠀⠀ │
|
||||||
│/nfs: 204800.00 GB free ││ ││ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ │
|
│/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 ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
│Sonarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
||||||
│Storage: ││ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
│Storage: ││ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||||
│Root Folders: ││ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
│Root Folders: ││ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
||||||
│/nfs: 204800.00 GB free ││ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
│/nfs: 204800.00 GB free ││ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
||||||
│ ││ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
|
│ ││ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ expression: output
|
|||||||
│Sonarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
│Sonarr Version: 1.2.3.4 ╭ Keybindings ──────────────────────────────────────────────────────────────────────────╮ ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
│Uptime: 0d 00:00:44 │ Key Alt Key Description │━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
||||||
│Storage: │=> a add │ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
│Storage: │=> a add │ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━│ e edit │ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||||
│Root Folders: │ m toggle monitoring │ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
│Root Folders: │ m toggle monitoring │ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
||||||
│/nfs: 204800.00 GB free │ o sort │ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
│/nfs: 204800.00 GB free │ o sort │ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
||||||
│ │ del delete │ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
|
│ │ del delete │ ││ ⠀⠙⠁⢀⣴⣾⣿⣿⣿⣿⣷⣦⡀⠈⠋⠀ │
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ expression: output
|
|||||||
│Sonarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
│Sonarr Version: 1.2.3.4 ││Test Download Title ││ ⠀⠀⠀⣠⣴⣶⣿⣿⣿⣿⣶⣦⣄⠀⠀⠀ │
|
||||||
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
│Uptime: 0d 00:00:44 ││50% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ⠀⣠⡀⠈⠻⣿⣿⣿⣿⣿⣿⠟⠁⢀⣀⠀ │
|
||||||
│Storage: ││ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
│Storage: ││ ││ ⢰⣿⣿⣦⠐⠄⠉⠉⠉⠉⠠⠂⣰⣿⣿⡆ │
|
||||||
│Disk 1: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
│/path: 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━││ ││ ⣿⣿⣿⣿⡆⠀⣴⣿⣿⣦⠀⢰⣿⣿⣿⣿ │
|
||||||
│Root Folders: ││ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
│Root Folders: ││ ││ ⣿⣿⣿⣿⡇⠀⠻⣿⣿⠟⠀⠸⣿⣿⣿⣿ │
|
||||||
│/nfs: 204800.00 GB free ││ ││ ⠸⣿⣿⠟⠠⠂⠀⢀⡀⠀⠐⠄⠻⣿⣿⠇ │
|
│/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()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
let leechers = leechers
|
let leechers = leechers
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
|
|
||||||
decorate_peer_style(
|
decorate_peer_style(
|
||||||
seeders,
|
seeders,
|
||||||
|
|||||||
@@ -388,12 +388,12 @@ fn draw_season_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
|||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
let leechers = leechers
|
let leechers = leechers
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(Number::from(0u64))
|
.unwrap_or(Number::from(0u64))
|
||||||
.as_u64()
|
.as_u64()
|
||||||
.unwrap();
|
.unwrap_or_default();
|
||||||
|
|
||||||
decorate_peer_style(
|
decorate_peer_style(
|
||||||
seeders,
|
seeders,
|
||||||
|
|||||||
+26
-19
@@ -1,5 +1,3 @@
|
|||||||
use std::{cmp, iter};
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use crate::ui::ui_test_utils::test_utils::Utc;
|
use crate::ui::ui_test_utils::test_utils::Utc;
|
||||||
use blocklist::BlocklistUi;
|
use blocklist::BlocklistUi;
|
||||||
@@ -18,8 +16,18 @@ use ratatui::{
|
|||||||
widgets::Paragraph,
|
widgets::Paragraph,
|
||||||
};
|
};
|
||||||
use root_folders::RootFoldersUi;
|
use root_folders::RootFoldersUi;
|
||||||
|
use std::{cmp, iter};
|
||||||
use system::SystemUi;
|
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::{
|
use crate::{
|
||||||
app::App,
|
app::App,
|
||||||
logos::SONARR_LOGO,
|
logos::SONARR_LOGO,
|
||||||
@@ -32,15 +40,6 @@ use crate::{
|
|||||||
utils::convert_to_gb,
|
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 blocklist;
|
||||||
mod downloads;
|
mod downloads;
|
||||||
mod history;
|
mod history;
|
||||||
@@ -101,6 +100,8 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
start_time,
|
start_time,
|
||||||
..
|
..
|
||||||
} = &app.data.sonarr_data;
|
} = &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![
|
let mut constraints = vec![
|
||||||
Constraint::Length(1),
|
Constraint::Length(1),
|
||||||
@@ -111,7 +112,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
constraints.append(
|
constraints.append(
|
||||||
&mut iter::repeat_n(
|
&mut iter::repeat_n(
|
||||||
Constraint::Length(1),
|
Constraint::Length(1),
|
||||||
disk_space_vec.len() + root_folders.items.len() + 1,
|
monitored_disk_space_vec.len() + monitored_root_folders.len() + 1,
|
||||||
)
|
)
|
||||||
.collect(),
|
.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(uptime_paragraph, stat_item_areas[1]);
|
||||||
f.render_widget(storage, stat_item_areas[2]);
|
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 {
|
let DiskSpace {
|
||||||
|
path,
|
||||||
free_space,
|
free_space,
|
||||||
total_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 {
|
let ratio = if *total_space == 0 {
|
||||||
0f64
|
0f64
|
||||||
} else {
|
} 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(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 {
|
let RootFolder {
|
||||||
path, free_space, ..
|
path, free_space, ..
|
||||||
} = &root_folders.items[i];
|
} = &monitored_root_folders[i];
|
||||||
let space: f64 = convert_to_gb(*free_space);
|
let space: f64 = convert_to_gb(*free_space);
|
||||||
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
let root_folder_space = Paragraph::new(format!("{path}: {space:.2} GB free"))
|
||||||
.block(borderless_block())
|
.block(borderless_block())
|
||||||
@@ -177,7 +184,7 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
|||||||
|
|
||||||
f.render_widget(
|
f.render_widget(
|
||||||
root_folder_space,
|
root_folder_space,
|
||||||
stat_item_areas[i + disk_space_vec.len() + 4],
|
stat_item_areas[i + monitored_disk_space_vec.len() + 4],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
mod snapshot_tests {
|
mod snapshot_tests {
|
||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
use crate::handlers::populate_keymapping_table;
|
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::lidarr::lidarr_data::ActiveLidarrBlock;
|
||||||
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||||
use crate::models::servarr_data::sonarr::sonarr_data::ActiveSonarrBlock;
|
use crate::models::servarr_data::sonarr::sonarr_data::ActiveSonarrBlock;
|
||||||
@@ -46,6 +47,40 @@ mod snapshot_tests {
|
|||||||
insta::assert_snapshot!(output);
|
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]
|
#[test]
|
||||||
fn test_sonarr_ui_renders_library_tab() {
|
fn test_sonarr_ui_renders_library_tab() {
|
||||||
let mut app = App::test_default_fully_populated();
|
let mut app = App::test_default_fully_populated();
|
||||||
@@ -84,6 +119,23 @@ mod snapshot_tests {
|
|||||||
insta::assert_snapshot!(output);
|
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]
|
#[test]
|
||||||
fn test_lidarr_ui_renders_library_tab() {
|
fn test_lidarr_ui_renders_library_tab() {
|
||||||
let mut app = App::test_default_fully_populated();
|
let mut app = App::test_default_fully_populated();
|
||||||
@@ -109,6 +161,23 @@ mod snapshot_tests {
|
|||||||
insta::assert_snapshot!(output);
|
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]
|
#[test]
|
||||||
fn test_lidarr_ui_renders_library_tab_error_popup() {
|
fn test_lidarr_ui_renders_library_tab_error_popup() {
|
||||||
let mut app = App::test_default_fully_populated();
|
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::THEME;
|
||||||
use crate::ui::styles::{
|
use crate::ui::styles::{
|
||||||
ManagarrStyle, default_style, failure_style, primary_style, secondary_style,
|
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::style::{Style, Stylize};
|
||||||
use ratatui::text::{Line, Span, Text};
|
use ratatui::text::{Line, Span, Text};
|
||||||
use ratatui::widgets::{Block, BorderType, Borders, LineGauge, ListItem, Paragraph, Wrap};
|
use ratatui::widgets::{Block, BorderType, Borders, LineGauge, ListItem, Paragraph, Wrap};
|
||||||
|
use std::collections::{HashMap, HashSet};
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[path = "utils_tests.rs"]
|
#[path = "utils_tests.rs"]
|
||||||
@@ -179,3 +183,120 @@ pub(super) fn decorate_peer_style(seeders: u64, leechers: u64, text: Text<'_>) -
|
|||||||
text.success()
|
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)]
|
#[cfg(test)]
|
||||||
mod 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::styles::{ManagarrStyle, default_style, failure_style, secondary_style};
|
||||||
use crate::ui::utils::{
|
use crate::ui::utils::{
|
||||||
borderless_block, centered_rect, convert_to_minutes_hours_days, decorate_peer_style,
|
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,
|
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,
|
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 {
|
enum PeerStyle {
|
||||||
Failure,
|
Failure,
|
||||||
Warning,
|
Warning,
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ pub(super) fn load_config(path: &str) -> Result<AppConfig> {
|
|||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
Err(e) => {
|
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);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user