Added network support for updating all indexer settings, editing specific indexer settings, deleting an indexer; Also added keybindings for all of the above that change the current route. Added full support for deleting an indexer; still need to add an indexer_handler to handle the add, edit, and settings functionalities
This commit is contained in:
@@ -16,6 +16,7 @@ generate_keybindings! {
|
||||
right,
|
||||
backspace,
|
||||
search,
|
||||
settings,
|
||||
filter,
|
||||
sort,
|
||||
edit,
|
||||
@@ -66,6 +67,10 @@ pub const DEFAULT_KEYBINDINGS: KeyBindings = KeyBindings {
|
||||
key: Key::Char('s'),
|
||||
desc: "Search",
|
||||
},
|
||||
settings: KeyBinding {
|
||||
key: Key::Char('s'),
|
||||
desc: "Settings",
|
||||
},
|
||||
filter: KeyBinding {
|
||||
key: Key::Char('f'),
|
||||
desc: "Filter",
|
||||
|
||||
+22
-4
@@ -5,8 +5,8 @@ use strum::IntoEnumIterator;
|
||||
use crate::app::{App, Route};
|
||||
use crate::models::radarr_models::{
|
||||
AddMovieSearchResult, Collection, CollectionMovie, Credit, DiskSpace, DownloadRecord, Indexer,
|
||||
MinimumAvailability, Monitor, Movie, MovieHistoryItem, QueueEvent, Release, ReleaseField,
|
||||
RootFolder, Task,
|
||||
IndexerSettings, MinimumAvailability, Monitor, Movie, MovieHistoryItem, QueueEvent, Release,
|
||||
ReleaseField, RootFolder, Task,
|
||||
};
|
||||
use crate::models::{
|
||||
BlockSelectionState, HorizontallyScrollableText, ScrollableText, StatefulList, StatefulTable,
|
||||
@@ -37,6 +37,7 @@ pub struct RadarrData<'a> {
|
||||
pub selected_block: BlockSelectionState<'a, ActiveRadarrBlock>,
|
||||
pub downloads: StatefulTable<DownloadRecord>,
|
||||
pub indexers: StatefulTable<Indexer>,
|
||||
pub indexer_settings: Option<IndexerSettings>,
|
||||
pub quality_profile_map: BiMap<u64, String>,
|
||||
pub tags_map: BiMap<u64, String>,
|
||||
pub movie_details: ScrollableText,
|
||||
@@ -263,6 +264,7 @@ impl<'a> Default for RadarrData<'a> {
|
||||
filtered_movies: StatefulTable::default(),
|
||||
downloads: StatefulTable::default(),
|
||||
indexers: StatefulTable::default(),
|
||||
indexer_settings: None,
|
||||
quality_profile_map: BiMap::default(),
|
||||
tags_map: BiMap::default(),
|
||||
file_details: String::default(),
|
||||
@@ -324,7 +326,7 @@ impl<'a> Default for RadarrData<'a> {
|
||||
title: "Indexers",
|
||||
route: ActiveRadarrBlock::Indexers.into(),
|
||||
help: "",
|
||||
contextual_help: Some("<r> refresh"),
|
||||
contextual_help: Some("<enter> edit | <s> settings | <del> delete | <r> refresh"),
|
||||
},
|
||||
TabRoute {
|
||||
title: "System",
|
||||
@@ -377,6 +379,7 @@ impl<'a> Default for RadarrData<'a> {
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
|
||||
pub enum ActiveRadarrBlock {
|
||||
AddIndexer,
|
||||
AddMovieAlreadyInLibrary,
|
||||
AddMovieSearchInput,
|
||||
AddMovieSearchResults,
|
||||
@@ -394,11 +397,12 @@ pub enum ActiveRadarrBlock {
|
||||
CollectionDetails,
|
||||
Cast,
|
||||
Crew,
|
||||
DeleteDownloadPrompt,
|
||||
DeleteIndexerPrompt,
|
||||
DeleteMoviePrompt,
|
||||
DeleteMovieConfirmPrompt,
|
||||
DeleteMovieToggleDeleteFile,
|
||||
DeleteMovieToggleAddListExclusion,
|
||||
DeleteDownloadPrompt,
|
||||
DeleteRootFolderPrompt,
|
||||
Downloads,
|
||||
EditCollectionPrompt,
|
||||
@@ -408,6 +412,7 @@ pub enum ActiveRadarrBlock {
|
||||
EditCollectionSelectQualityProfile,
|
||||
EditCollectionToggleSearchOnAdd,
|
||||
EditCollectionToggleMonitored,
|
||||
EditIndexer,
|
||||
EditMoviePrompt,
|
||||
EditMovieConfirmPrompt,
|
||||
EditMoviePathInput,
|
||||
@@ -419,6 +424,7 @@ pub enum ActiveRadarrBlock {
|
||||
FilterCollections,
|
||||
FilterMovies,
|
||||
Indexers,
|
||||
IndexerSettings,
|
||||
ManualSearch,
|
||||
ManualSearchSortPrompt,
|
||||
ManualSearchConfirmPrompt,
|
||||
@@ -531,6 +537,13 @@ pub static DELETE_MOVIE_SELECTION_BLOCKS: [ActiveRadarrBlock; 3] = [
|
||||
ActiveRadarrBlock::DeleteMovieToggleAddListExclusion,
|
||||
ActiveRadarrBlock::DeleteMovieConfirmPrompt,
|
||||
];
|
||||
pub static INDEXER_BLOCKS: [ActiveRadarrBlock; 5] = [
|
||||
ActiveRadarrBlock::Indexers,
|
||||
ActiveRadarrBlock::IndexerSettings,
|
||||
ActiveRadarrBlock::AddIndexer,
|
||||
ActiveRadarrBlock::EditIndexer,
|
||||
ActiveRadarrBlock::DeleteIndexerPrompt,
|
||||
];
|
||||
pub static SYSTEM_DETAILS_BLOCKS: [ActiveRadarrBlock; 5] = [
|
||||
ActiveRadarrBlock::SystemLogs,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
@@ -587,6 +600,11 @@ impl<'a> App<'a> {
|
||||
.dispatch_network_event(RadarrEvent::GetIndexers.into())
|
||||
.await;
|
||||
}
|
||||
ActiveRadarrBlock::IndexerSettings => {
|
||||
self
|
||||
.dispatch_network_event(RadarrEvent::GetIndexerSettings.into())
|
||||
.await;
|
||||
}
|
||||
ActiveRadarrBlock::System => {
|
||||
self
|
||||
.dispatch_network_event(RadarrEvent::GetTasks.into())
|
||||
|
||||
+19
-1
@@ -274,6 +274,7 @@ mod tests {
|
||||
assert!(radarr_data.filtered_movies.items.is_empty());
|
||||
assert!(radarr_data.downloads.items.is_empty());
|
||||
assert!(radarr_data.indexers.items.is_empty());
|
||||
assert!(radarr_data.indexer_settings.is_none());
|
||||
assert!(radarr_data.quality_profile_map.is_empty());
|
||||
assert!(radarr_data.tags_map.is_empty());
|
||||
assert!(radarr_data.file_details.is_empty());
|
||||
@@ -357,7 +358,7 @@ mod tests {
|
||||
assert!(radarr_data.main_tabs.tabs[4].help.is_empty());
|
||||
assert_eq!(
|
||||
radarr_data.main_tabs.tabs[4].contextual_help,
|
||||
Some("<r> refresh")
|
||||
Some("<enter> edit | <s> settings | <del> delete | <r> refresh")
|
||||
);
|
||||
|
||||
assert_str_eq!(radarr_data.main_tabs.tabs[5].title, "System");
|
||||
@@ -713,6 +714,23 @@ mod tests {
|
||||
assert_eq!(app.tick_count, 0);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_dispatch_by_indexer_settings_block() {
|
||||
let (mut app, mut sync_network_rx) = construct_app_unit();
|
||||
|
||||
app
|
||||
.dispatch_by_radarr_block(&ActiveRadarrBlock::IndexerSettings)
|
||||
.await;
|
||||
|
||||
assert!(app.is_loading);
|
||||
assert_eq!(
|
||||
sync_network_rx.recv().await.unwrap(),
|
||||
RadarrEvent::GetIndexerSettings.into()
|
||||
);
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.tick_count, 0);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_dispatch_by_system_block() {
|
||||
let (mut app, mut sync_network_rx) = construct_app_unit();
|
||||
|
||||
Reference in New Issue
Block a user