Added 'Test All Indexers' table and functionality to the Indexers tab, and upgraded to Ratatui 0.24.0 and cleaned up code for newer Ratatui version
This commit is contained in:
@@ -22,6 +22,7 @@ generate_keybindings! {
|
||||
edit,
|
||||
logs,
|
||||
tasks,
|
||||
test,
|
||||
refresh,
|
||||
update,
|
||||
events,
|
||||
@@ -97,6 +98,10 @@ pub const DEFAULT_KEYBINDINGS: KeyBindings = KeyBindings {
|
||||
key: Key::Char('t'),
|
||||
desc: "tasks",
|
||||
},
|
||||
test: KeyBinding {
|
||||
key: Key::Char('t'),
|
||||
desc: "test",
|
||||
},
|
||||
refresh: KeyBinding {
|
||||
key: Key::Ctrl('r'),
|
||||
desc: "refresh",
|
||||
|
||||
@@ -21,6 +21,7 @@ mod test {
|
||||
#[case(DEFAULT_KEYBINDINGS.events, Key::Char('e'), "events")]
|
||||
#[case(DEFAULT_KEYBINDINGS.logs, Key::Char('l'), "logs")]
|
||||
#[case(DEFAULT_KEYBINDINGS.tasks, Key::Char('t'), "tasks")]
|
||||
#[case(DEFAULT_KEYBINDINGS.test, Key::Char('t'), "test")]
|
||||
#[case(DEFAULT_KEYBINDINGS.refresh, Key::Ctrl('r'), "refresh")]
|
||||
#[case(DEFAULT_KEYBINDINGS.update, Key::Char('u'), "update")]
|
||||
#[case(DEFAULT_KEYBINDINGS.home, Key::Home, "home")]
|
||||
|
||||
@@ -49,6 +49,11 @@ impl<'a> App<'a> {
|
||||
.dispatch_network_event(RadarrEvent::GetIndexerSettings.into())
|
||||
.await;
|
||||
}
|
||||
ActiveRadarrBlock::TestAllIndexers => {
|
||||
self
|
||||
.dispatch_network_event(RadarrEvent::TestAllIndexers.into())
|
||||
.await;
|
||||
}
|
||||
ActiveRadarrBlock::System => {
|
||||
self
|
||||
.dispatch_network_event(RadarrEvent::GetTasks.into())
|
||||
|
||||
@@ -50,7 +50,7 @@ pub static ROOT_FOLDERS_CONTEXT_CLUES: [ContextClue; 3] = [
|
||||
),
|
||||
];
|
||||
|
||||
pub static INDEXERS_CONTEXT_CLUES: [ContextClue; 5] = [
|
||||
pub static INDEXERS_CONTEXT_CLUES: [ContextClue; 6] = [
|
||||
(DEFAULT_KEYBINDINGS.add, DEFAULT_KEYBINDINGS.add.desc),
|
||||
(DEFAULT_KEYBINDINGS.edit, DEFAULT_KEYBINDINGS.edit.desc),
|
||||
(
|
||||
@@ -58,6 +58,7 @@ pub static INDEXERS_CONTEXT_CLUES: [ContextClue; 5] = [
|
||||
DEFAULT_KEYBINDINGS.settings.desc,
|
||||
),
|
||||
(DEFAULT_KEYBINDINGS.delete, DEFAULT_KEYBINDINGS.delete.desc),
|
||||
(DEFAULT_KEYBINDINGS.test, "test all indexers"),
|
||||
(
|
||||
DEFAULT_KEYBINDINGS.refresh,
|
||||
DEFAULT_KEYBINDINGS.refresh.desc,
|
||||
|
||||
@@ -166,6 +166,11 @@ mod tests {
|
||||
|
||||
let (key_binding, description) = indexers_context_clues_iter.next().unwrap();
|
||||
|
||||
assert_eq!(*key_binding, DEFAULT_KEYBINDINGS.test);
|
||||
assert_str_eq!(*description, "test all indexers");
|
||||
|
||||
let (key_binding, description) = indexers_context_clues_iter.next().unwrap();
|
||||
|
||||
assert_eq!(*key_binding, DEFAULT_KEYBINDINGS.refresh);
|
||||
assert_str_eq!(*description, DEFAULT_KEYBINDINGS.refresh.desc);
|
||||
assert_eq!(indexers_context_clues_iter.next(), None);
|
||||
|
||||
@@ -162,6 +162,22 @@ mod tests {
|
||||
assert_eq!(app.tick_count, 0);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_dispatch_by_test_all_indexers_block() {
|
||||
let (mut app, mut sync_network_rx) = construct_app_unit();
|
||||
|
||||
app
|
||||
.dispatch_by_radarr_block(&ActiveRadarrBlock::TestAllIndexers)
|
||||
.await;
|
||||
|
||||
assert!(app.is_loading);
|
||||
assert_eq!(
|
||||
sync_network_rx.recv().await.unwrap(),
|
||||
RadarrEvent::TestAllIndexers.into()
|
||||
);
|
||||
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