fix(style): Addressed linter complaints on formatting
This commit is contained in:
@@ -33,7 +33,7 @@ impl DrawUi for BlocklistUi {
|
||||
fn draw(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
draw_blocklist_table(f, app, area);
|
||||
|
||||
|
||||
match active_sonarr_block {
|
||||
ActiveSonarrBlock::BlocklistItemDetails => {
|
||||
draw_blocklist_item_details_popup(f, app);
|
||||
|
||||
@@ -34,12 +34,7 @@ impl DrawUi for EditIndexerUi {
|
||||
}
|
||||
|
||||
fn draw(f: &mut Frame<'_>, app: &mut App<'_>, _area: Rect) {
|
||||
draw_popup(
|
||||
f,
|
||||
app,
|
||||
draw_edit_indexer_prompt,
|
||||
Size::WideLargePrompt,
|
||||
);
|
||||
draw_popup(f, app, draw_edit_indexer_prompt, Size::WideLargePrompt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,7 @@ impl DrawUi for IndexerSettingsUi {
|
||||
}
|
||||
|
||||
fn draw(f: &mut Frame<'_>, app: &mut App<'_>, _area: Rect) {
|
||||
draw_popup(
|
||||
f,
|
||||
app,
|
||||
draw_edit_indexer_settings_prompt,
|
||||
Size::LargePrompt,
|
||||
);
|
||||
draw_popup(f, app, draw_edit_indexer_settings_prompt, Size::LargePrompt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,11 +57,16 @@ impl DrawUi for IndexersUi {
|
||||
app.is_loading || app.data.sonarr_data.indexer_test_errors.is_none(),
|
||||
title_block("Testing Indexer"),
|
||||
))
|
||||
.size(Size::LargeMessage);
|
||||
.size(Size::LargeMessage);
|
||||
f.render_widget(loading_popup, f.area());
|
||||
} else {
|
||||
let popup = {
|
||||
let result = app.data.sonarr_data.indexer_test_errors.as_ref().expect("Test result is unpopulated");
|
||||
let result = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.indexer_test_errors
|
||||
.as_ref()
|
||||
.expect("Test result is unpopulated");
|
||||
|
||||
if !result.is_empty() {
|
||||
Popup::new(Message::new(result.clone())).size(Size::LargeMessage)
|
||||
@@ -99,7 +104,7 @@ impl DrawUi for IndexersUi {
|
||||
);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,7 @@ impl DrawUi for TestAllIndexersUi {
|
||||
}
|
||||
|
||||
fn draw(f: &mut Frame<'_>, app: &mut App<'_>, _area: Rect) {
|
||||
draw_popup(
|
||||
f,
|
||||
app,
|
||||
draw_test_all_indexers_test_results,
|
||||
Size::Large,
|
||||
);
|
||||
draw_popup(f, app, draw_test_all_indexers_test_results, Size::Large);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ impl DrawUi for AddSeriesUi {
|
||||
fn draw(f: &mut Frame<'_>, app: &mut App<'_>, _area: Rect) {
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
draw_popup(f, app, draw_add_series_search, Size::Large);
|
||||
|
||||
|
||||
match active_sonarr_block {
|
||||
ActiveSonarrBlock::AddSeriesPrompt
|
||||
| ActiveSonarrBlock::AddSeriesSelectMonitor
|
||||
|
||||
@@ -48,24 +48,23 @@ impl DrawUi for EditSeriesUi {
|
||||
draw_popup(f, app, SeriesDetailsUi::draw, Size::Large);
|
||||
}
|
||||
}
|
||||
|
||||
let draw_edit_series_prompt =
|
||||
|f: &mut Frame<'_>, app: &mut App<'_>, prompt_area: Rect| {
|
||||
draw_edit_series_confirmation_prompt(f, app, prompt_area);
|
||||
|
||||
match active_sonarr_block {
|
||||
ActiveSonarrBlock::EditSeriesSelectSeriesType => {
|
||||
draw_edit_series_select_series_type_popup(f, app);
|
||||
}
|
||||
ActiveSonarrBlock::EditSeriesSelectQualityProfile => {
|
||||
draw_edit_series_select_quality_profile_popup(f, app);
|
||||
}
|
||||
ActiveSonarrBlock::EditSeriesSelectLanguageProfile => {
|
||||
draw_edit_series_select_language_profile_popup(f, app);
|
||||
}
|
||||
_ => (),
|
||||
|
||||
let draw_edit_series_prompt = |f: &mut Frame<'_>, app: &mut App<'_>, prompt_area: Rect| {
|
||||
draw_edit_series_confirmation_prompt(f, app, prompt_area);
|
||||
|
||||
match active_sonarr_block {
|
||||
ActiveSonarrBlock::EditSeriesSelectSeriesType => {
|
||||
draw_edit_series_select_series_type_popup(f, app);
|
||||
}
|
||||
};
|
||||
ActiveSonarrBlock::EditSeriesSelectQualityProfile => {
|
||||
draw_edit_series_select_quality_profile_popup(f, app);
|
||||
}
|
||||
ActiveSonarrBlock::EditSeriesSelectLanguageProfile => {
|
||||
draw_edit_series_select_language_profile_popup(f, app);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
};
|
||||
|
||||
draw_popup(f, app, draw_edit_series_prompt, Size::Long);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, EPISODE_DETAILS_BLOCKS};
|
||||
use crate::ui::sonarr_ui::library::episode_details_ui::EpisodeDetailsUi;
|
||||
use crate::ui::DrawUi;
|
||||
use strum::IntoEnumIterator;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{
|
||||
ActiveSonarrBlock, EPISODE_DETAILS_BLOCKS,
|
||||
};
|
||||
use crate::ui::sonarr_ui::library::episode_details_ui::EpisodeDetailsUi;
|
||||
use crate::ui::DrawUi;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
#[test]
|
||||
fn test_episode_details_ui_accepts() {
|
||||
ActiveSonarrBlock::iter().for_each(|active_sonarr_block| {
|
||||
if EPISODE_DETAILS_BLOCKS.contains(&active_sonarr_block) {
|
||||
assert!(EpisodeDetailsUi::accepts(active_sonarr_block.into()));
|
||||
} else {
|
||||
assert!(!EpisodeDetailsUi::accepts(active_sonarr_block.into()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_episode_details_ui_accepts() {
|
||||
ActiveSonarrBlock::iter().for_each(|active_sonarr_block| {
|
||||
if EPISODE_DETAILS_BLOCKS.contains(&active_sonarr_block) {
|
||||
assert!(EpisodeDetailsUi::accepts(active_sonarr_block.into()));
|
||||
} else {
|
||||
assert!(!EpisodeDetailsUi::accepts(active_sonarr_block.into()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use strum::IntoEnumIterator;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, EPISODE_DETAILS_BLOCKS, SEASON_DETAILS_BLOCKS};
|
||||
use crate::ui::sonarr_ui::library::season_details_ui::SeasonDetailsUi;
|
||||
use crate::ui::DrawUi;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{
|
||||
ActiveSonarrBlock, EPISODE_DETAILS_BLOCKS, SEASON_DETAILS_BLOCKS,
|
||||
};
|
||||
use crate::ui::sonarr_ui::library::season_details_ui::SeasonDetailsUi;
|
||||
use crate::ui::DrawUi;
|
||||
|
||||
#[test]
|
||||
fn test_season_details_ui_accepts() {
|
||||
let mut blocks = SEASON_DETAILS_BLOCKS.clone().to_vec();
|
||||
blocks.extend(EPISODE_DETAILS_BLOCKS);
|
||||
|
||||
ActiveSonarrBlock::iter().for_each(|active_sonarr_block| {
|
||||
if blocks.contains(&active_sonarr_block) {
|
||||
assert!(SeasonDetailsUi::accepts(active_sonarr_block.into()));
|
||||
} else {
|
||||
assert!(!SeasonDetailsUi::accepts(active_sonarr_block.into()));
|
||||
}
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
fn test_season_details_ui_accepts() {
|
||||
let mut blocks = SEASON_DETAILS_BLOCKS.clone().to_vec();
|
||||
blocks.extend(EPISODE_DETAILS_BLOCKS);
|
||||
|
||||
ActiveSonarrBlock::iter().for_each(|active_sonarr_block| {
|
||||
if blocks.contains(&active_sonarr_block) {
|
||||
assert!(SeasonDetailsUi::accepts(active_sonarr_block.into()));
|
||||
} else {
|
||||
assert!(!SeasonDetailsUi::accepts(active_sonarr_block.into()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
mod tests {
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, EPISODE_DETAILS_BLOCKS, SEASON_DETAILS_BLOCKS, SERIES_DETAILS_BLOCKS};
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{
|
||||
ActiveSonarrBlock, EPISODE_DETAILS_BLOCKS, SEASON_DETAILS_BLOCKS, SERIES_DETAILS_BLOCKS,
|
||||
};
|
||||
use crate::ui::sonarr_ui::library::series_details_ui::SeriesDetailsUi;
|
||||
use crate::ui::DrawUi;
|
||||
|
||||
@@ -11,7 +13,7 @@ mod tests {
|
||||
let mut blocks = SERIES_DETAILS_BLOCKS.clone().to_vec();
|
||||
blocks.extend(SEASON_DETAILS_BLOCKS);
|
||||
blocks.extend(EPISODE_DETAILS_BLOCKS);
|
||||
|
||||
|
||||
ActiveSonarrBlock::iter().for_each(|active_sonarr_block| {
|
||||
if blocks.contains(&active_sonarr_block) {
|
||||
assert!(SeriesDetailsUi::accepts(active_sonarr_block.into()));
|
||||
|
||||
@@ -32,14 +32,11 @@ impl DrawUi for RootFoldersUi {
|
||||
fn draw(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
draw_root_folders(f, app, area);
|
||||
|
||||
|
||||
match active_sonarr_block {
|
||||
ActiveSonarrBlock::AddRootFolderPrompt => draw_popup(
|
||||
f,
|
||||
app,
|
||||
draw_add_root_folder_prompt_box,
|
||||
Size::InputBox,
|
||||
),
|
||||
ActiveSonarrBlock::AddRootFolderPrompt => {
|
||||
draw_popup(f, app, draw_add_root_folder_prompt_box, Size::InputBox)
|
||||
}
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt => {
|
||||
let prompt = format!(
|
||||
"Do you really want to delete this root folder: \n{}?",
|
||||
|
||||
@@ -58,7 +58,7 @@ impl DrawUi for SystemUi {
|
||||
fn draw(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let route = app.get_current_route();
|
||||
draw_system_ui_layout(f, app, area);
|
||||
|
||||
|
||||
if SystemDetailsUi::accepts(route) {
|
||||
SystemDetailsUi::draw(f, app, area);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, SYSTEM
|
||||
use crate::models::sonarr_models::SonarrTask;
|
||||
use crate::models::Route;
|
||||
use crate::ui::sonarr_ui::system::{
|
||||
draw_queued_events, extract_task_props, TASK_TABLE_CONSTRAINTS,
|
||||
TASK_TABLE_HEADERS,
|
||||
draw_queued_events, extract_task_props, TASK_TABLE_CONSTRAINTS, TASK_TABLE_HEADERS,
|
||||
};
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
use crate::ui::utils::{borderless_block, style_log_list_item, title_block};
|
||||
@@ -44,19 +43,11 @@ impl DrawUi for SystemDetailsUi {
|
||||
draw_logs_popup(f, app);
|
||||
}
|
||||
ActiveSonarrBlock::SystemTasks | ActiveSonarrBlock::SystemTaskStartConfirmPrompt => {
|
||||
draw_popup(
|
||||
f,
|
||||
app,
|
||||
draw_tasks_popup,
|
||||
Size::Large,
|
||||
)
|
||||
draw_popup(f, app, draw_tasks_popup, Size::Large)
|
||||
}
|
||||
ActiveSonarrBlock::SystemQueuedEvents => {
|
||||
draw_popup(f, app, draw_queued_events, Size::Medium)
|
||||
}
|
||||
ActiveSonarrBlock::SystemQueuedEvents => draw_popup(
|
||||
f,
|
||||
app,
|
||||
draw_queued_events,
|
||||
Size::Medium,
|
||||
),
|
||||
ActiveSonarrBlock::SystemUpdates => {
|
||||
draw_updates_popup(f, app);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user