feat(app): Dispatch support for all relevant Sonarr blocks
This commit is contained in:
@@ -14,10 +14,10 @@ mod system_details_handler;
|
||||
mod system_handler_tests;
|
||||
|
||||
pub(super) struct SystemHandler<'a, 'b> {
|
||||
key: &'a Key,
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_radarr_block: &'a ActiveRadarrBlock,
|
||||
context: &'a Option<ActiveRadarrBlock>,
|
||||
active_radarr_block: ActiveRadarrBlock,
|
||||
context: Option<ActiveRadarrBlock>,
|
||||
}
|
||||
|
||||
impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemHandler<'a, 'b> {
|
||||
@@ -31,15 +31,15 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemHandler<'a, 'b
|
||||
}
|
||||
}
|
||||
|
||||
fn accepts(active_block: &'a ActiveRadarrBlock) -> bool {
|
||||
SystemDetailsHandler::accepts(active_block) || active_block == &ActiveRadarrBlock::System
|
||||
fn accepts(active_block: ActiveRadarrBlock) -> bool {
|
||||
SystemDetailsHandler::accepts(active_block) || active_block == ActiveRadarrBlock::System
|
||||
}
|
||||
|
||||
fn with(
|
||||
key: &'a Key,
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: &'a ActiveRadarrBlock,
|
||||
context: &'a Option<ActiveRadarrBlock>,
|
||||
active_block: ActiveRadarrBlock,
|
||||
context: Option<ActiveRadarrBlock>,
|
||||
) -> SystemHandler<'a, 'b> {
|
||||
SystemHandler {
|
||||
key,
|
||||
@@ -49,7 +49,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemHandler<'a, 'b
|
||||
}
|
||||
}
|
||||
|
||||
fn get_key(&self) -> &Key {
|
||||
fn get_key(&self) -> Key {
|
||||
self.key
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemHandler<'a, 'b
|
||||
fn handle_delete(&mut self) {}
|
||||
|
||||
fn handle_left_right_action(&mut self) {
|
||||
if self.active_radarr_block == &ActiveRadarrBlock::System {
|
||||
if self.active_radarr_block == ActiveRadarrBlock::System {
|
||||
handle_change_tab_left_right_keys(self.app, self.key);
|
||||
}
|
||||
}
|
||||
@@ -83,18 +83,18 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemHandler<'a, 'b
|
||||
}
|
||||
|
||||
fn handle_char_key_event(&mut self) {
|
||||
if self.active_radarr_block == &ActiveRadarrBlock::System {
|
||||
if self.active_radarr_block == ActiveRadarrBlock::System {
|
||||
let key = self.key;
|
||||
match self.key {
|
||||
_ if *key == DEFAULT_KEYBINDINGS.refresh.key => {
|
||||
_ if key == DEFAULT_KEYBINDINGS.refresh.key => {
|
||||
self.app.should_refresh = true;
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.events.key => {
|
||||
_ if key == DEFAULT_KEYBINDINGS.events.key => {
|
||||
self
|
||||
.app
|
||||
.push_navigation_stack(ActiveRadarrBlock::SystemQueuedEvents.into());
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.logs.key => {
|
||||
_ if key == DEFAULT_KEYBINDINGS.logs.key => {
|
||||
self
|
||||
.app
|
||||
.push_navigation_stack(ActiveRadarrBlock::SystemLogs.into());
|
||||
@@ -106,12 +106,12 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemHandler<'a, 'b
|
||||
.set_items(self.app.data.radarr_data.logs.items.to_vec());
|
||||
self.app.data.radarr_data.log_details.scroll_to_bottom();
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.tasks.key => {
|
||||
_ if key == DEFAULT_KEYBINDINGS.tasks.key => {
|
||||
self
|
||||
.app
|
||||
.push_navigation_stack(ActiveRadarrBlock::SystemTasks.into());
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.update.key => {
|
||||
_ if key == DEFAULT_KEYBINDINGS.update.key => {
|
||||
self
|
||||
.app
|
||||
.push_navigation_stack(ActiveRadarrBlock::SystemUpdates.into());
|
||||
|
||||
@@ -12,22 +12,22 @@ use crate::network::radarr_network::RadarrEvent;
|
||||
mod system_details_handler_tests;
|
||||
|
||||
pub(super) struct SystemDetailsHandler<'a, 'b> {
|
||||
key: &'a Key,
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_radarr_block: &'a ActiveRadarrBlock,
|
||||
_context: &'a Option<ActiveRadarrBlock>,
|
||||
active_radarr_block: ActiveRadarrBlock,
|
||||
_context: Option<ActiveRadarrBlock>,
|
||||
}
|
||||
|
||||
impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler<'a, 'b> {
|
||||
fn accepts(active_block: &'a ActiveRadarrBlock) -> bool {
|
||||
SYSTEM_DETAILS_BLOCKS.contains(active_block)
|
||||
fn accepts(active_block: ActiveRadarrBlock) -> bool {
|
||||
SYSTEM_DETAILS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
key: &'a Key,
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: &'a ActiveRadarrBlock,
|
||||
context: &'a Option<ActiveRadarrBlock>,
|
||||
active_block: ActiveRadarrBlock,
|
||||
context: Option<ActiveRadarrBlock>,
|
||||
) -> SystemDetailsHandler<'a, 'b> {
|
||||
SystemDetailsHandler {
|
||||
key,
|
||||
@@ -37,7 +37,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
}
|
||||
}
|
||||
|
||||
fn get_key(&self) -> &Key {
|
||||
fn get_key(&self) -> Key {
|
||||
self.key
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
|
||||
match self.active_radarr_block {
|
||||
ActiveRadarrBlock::SystemLogs => match self.key {
|
||||
_ if *key == DEFAULT_KEYBINDINGS.left.key => {
|
||||
_ if key == DEFAULT_KEYBINDINGS.left.key => {
|
||||
self
|
||||
.app
|
||||
.data
|
||||
@@ -110,7 +110,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
.iter()
|
||||
.for_each(|log| log.scroll_right());
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.right.key => {
|
||||
_ if key == DEFAULT_KEYBINDINGS.right.key => {
|
||||
self
|
||||
.app
|
||||
.data
|
||||
@@ -163,14 +163,14 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
}
|
||||
|
||||
fn handle_char_key_event(&mut self) {
|
||||
if SYSTEM_DETAILS_BLOCKS.contains(self.active_radarr_block)
|
||||
&& self.key == &DEFAULT_KEYBINDINGS.refresh.key
|
||||
if SYSTEM_DETAILS_BLOCKS.contains(&self.active_radarr_block)
|
||||
&& self.key == DEFAULT_KEYBINDINGS.refresh.key
|
||||
{
|
||||
self.app.should_refresh = true;
|
||||
}
|
||||
|
||||
if self.active_radarr_block == &ActiveRadarrBlock::SystemTaskStartConfirmPrompt
|
||||
&& *self.key == DEFAULT_KEYBINDINGS.confirm.key
|
||||
if self.active_radarr_block == ActiveRadarrBlock::SystemTaskStartConfirmPrompt
|
||||
&& self.key == DEFAULT_KEYBINDINGS.confirm.key
|
||||
{
|
||||
self.app.data.radarr_data.prompt_confirm = true;
|
||||
self.app.data.radarr_data.prompt_confirm_action = Some(RadarrEvent::StartTask(None));
|
||||
|
||||
@@ -49,14 +49,14 @@ mod tests {
|
||||
text
|
||||
));
|
||||
|
||||
SystemDetailsHandler::with(&key, &mut app, &ActiveRadarrBlock::SystemLogs, &None).handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.log_details.current_selection().text,
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(&key, &mut app, &ActiveRadarrBlock::SystemLogs, &None).handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.log_details.current_selection().text,
|
||||
@@ -76,14 +76,14 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(simple_stateful_iterable_vec!(RadarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(&key, &mut app, &ActiveRadarrBlock::SystemTasks, &None).handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.tasks.current_selection().name,
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(&key, &mut app, &ActiveRadarrBlock::SystemTasks, &None).handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.tasks.current_selection().name,
|
||||
@@ -104,14 +104,14 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(simple_stateful_iterable_vec!(RadarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(&key, &mut app, &ActiveRadarrBlock::SystemTasks, &None).handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.tasks.current_selection().name,
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(&key, &mut app, &ActiveRadarrBlock::SystemTasks, &None).handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.tasks.current_selection().name,
|
||||
@@ -131,26 +131,16 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(simple_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.queued_events.current_selection().name,
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.queued_events.current_selection().name,
|
||||
@@ -171,26 +161,16 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(simple_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.queued_events.current_selection().name,
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveRadarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.radarr_data.queued_events.current_selection().name,
|
||||
@@ -204,20 +184,20 @@ mod tests {
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.up.key,
|
||||
DEFAULT_KEYBINDINGS.up.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.data.radarr_data.updates.offset, 0);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.down.key,
|
||||
DEFAULT_KEYBINDINGS.down.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -231,20 +211,20 @@ mod tests {
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.up.key,
|
||||
DEFAULT_KEYBINDINGS.up.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.data.radarr_data.updates.offset, 0);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.down.key,
|
||||
DEFAULT_KEYBINDINGS.down.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -283,10 +263,10 @@ mod tests {
|
||||
));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.end.key,
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemLogs,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemLogs,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -296,10 +276,10 @@ mod tests {
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.home.key,
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemLogs,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemLogs,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -321,10 +301,10 @@ mod tests {
|
||||
.set_items(extended_stateful_iterable_vec!(RadarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.end.key,
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTasks,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTasks,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -334,10 +314,10 @@ mod tests {
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.home.key,
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTasks,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTasks,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -360,10 +340,10 @@ mod tests {
|
||||
.set_items(extended_stateful_iterable_vec!(RadarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.end.key,
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTasks,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTasks,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -373,10 +353,10 @@ mod tests {
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.home.key,
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTasks,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTasks,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -398,10 +378,10 @@ mod tests {
|
||||
.set_items(extended_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.end.key,
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -411,10 +391,10 @@ mod tests {
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.home.key,
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -437,10 +417,10 @@ mod tests {
|
||||
.set_items(extended_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.end.key,
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -450,10 +430,10 @@ mod tests {
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.home.key,
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -469,20 +449,20 @@ mod tests {
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.end.key,
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.data.radarr_data.updates.offset, 1);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.home.key,
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -496,20 +476,20 @@ mod tests {
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.end.key,
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.data.radarr_data.updates.offset, 0);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.home.key,
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -534,10 +514,10 @@ mod tests {
|
||||
.set_items(vec!["t1".into(), "t22".into()]);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.left.key,
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -545,10 +525,10 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.log_details.items[1].to_string(), "t22");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.right.key,
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -556,10 +536,10 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.log_details.items[1].to_string(), "22");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.right.key,
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -567,10 +547,10 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.log_details.items[1].to_string(), "2");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.right.key,
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -578,10 +558,10 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.log_details.items[1].to_string(), "");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.right.key,
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -589,10 +569,10 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.log_details.items[1].to_string(), "");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.left.key,
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -600,10 +580,10 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.log_details.items[1].to_string(), "2");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.left.key,
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -611,10 +591,10 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.log_details.items[1].to_string(), "22");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.left.key,
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -629,20 +609,20 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&key,
|
||||
key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&key,
|
||||
key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -664,17 +644,12 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&SUBMIT_KEY,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTasks,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveRadarrBlock::SystemTasks, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into()
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -685,17 +660,12 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTasks.into());
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&SUBMIT_KEY,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTasks,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveRadarrBlock::SystemTasks, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemTasks.into()
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -708,10 +678,10 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&SUBMIT_KEY,
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -722,7 +692,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemTasks.into()
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -734,10 +704,10 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&SUBMIT_KEY,
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -745,7 +715,7 @@ mod tests {
|
||||
assert_eq!(app.data.radarr_data.prompt_confirm_action, None);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemTasks.into()
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -776,10 +746,9 @@ mod tests {
|
||||
.log_details
|
||||
.set_items(vec![HorizontallyScrollableText::default()]);
|
||||
|
||||
SystemDetailsHandler::with(&ESC_KEY, &mut app, &ActiveRadarrBlock::SystemLogs, &None)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(ESC_KEY, &mut app, ActiveRadarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert!(app.data.radarr_data.log_details.items.is_empty());
|
||||
}
|
||||
|
||||
@@ -795,10 +764,9 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemDetailsHandler::with(&ESC_KEY, &mut app, &ActiveRadarrBlock::SystemTasks, &None)
|
||||
.handle();
|
||||
SystemDetailsHandler::with(ESC_KEY, &mut app, ActiveRadarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -814,14 +782,14 @@ mod tests {
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&ESC_KEY,
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -831,10 +799,10 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemUpdates.into());
|
||||
|
||||
SystemDetailsHandler::with(&ESC_KEY, &mut app, &ActiveRadarrBlock::SystemUpdates, &None)
|
||||
SystemDetailsHandler::with(ESC_KEY, &mut app, ActiveRadarrBlock::SystemUpdates, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -845,16 +813,16 @@ mod tests {
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&ESC_KEY,
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemTasks.into()
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -882,14 +850,14 @@ mod tests {
|
||||
app.push_navigation_stack(active_radarr_block.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.refresh.key,
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &active_radarr_block.into());
|
||||
assert_eq!(app.get_current_route(), active_radarr_block.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -909,14 +877,14 @@ mod tests {
|
||||
app.push_navigation_stack(active_radarr_block.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.refresh.key,
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
&active_radarr_block,
|
||||
&None,
|
||||
active_radarr_block,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &active_radarr_block.into());
|
||||
assert_eq!(app.get_current_route(), active_radarr_block.into());
|
||||
assert!(!app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -928,10 +896,10 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.confirm.key,
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
@@ -942,7 +910,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemTasks.into()
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -951,9 +919,9 @@ mod tests {
|
||||
fn test_system_details_handler_accepts() {
|
||||
ActiveRadarrBlock::iter().for_each(|active_radarr_block| {
|
||||
if SYSTEM_DETAILS_BLOCKS.contains(&active_radarr_block) {
|
||||
assert!(SystemDetailsHandler::accepts(&active_radarr_block));
|
||||
assert!(SystemDetailsHandler::accepts(active_radarr_block));
|
||||
} else {
|
||||
assert!(!SystemDetailsHandler::accepts(&active_radarr_block));
|
||||
assert!(!SystemDetailsHandler::accepts(active_radarr_block));
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -964,10 +932,10 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.esc.key,
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(!handler.is_ready());
|
||||
@@ -979,10 +947,10 @@ mod tests {
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.esc.key,
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(!handler.is_ready());
|
||||
@@ -999,10 +967,10 @@ mod tests {
|
||||
.set_items(vec![HorizontallyScrollableText::default()]);
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.esc.key,
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(handler.is_ready());
|
||||
@@ -1015,10 +983,10 @@ mod tests {
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.esc.key,
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemUpdates,
|
||||
&None,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(handler.is_ready());
|
||||
|
||||
@@ -28,18 +28,18 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.set_index(6);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.left.key,
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
&ActiveRadarrBlock::Indexers.into()
|
||||
ActiveRadarrBlock::Indexers.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
@@ -49,18 +49,18 @@ mod tests {
|
||||
app.data.radarr_data.main_tabs.set_index(6);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.right.key,
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.radarr_data.main_tabs.get_active_route(),
|
||||
&ActiveRadarrBlock::Movies.into()
|
||||
ActiveRadarrBlock::Movies.into()
|
||||
);
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::Movies.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Movies.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::System.into());
|
||||
|
||||
SystemHandler::with(&ESC_KEY, &mut app, &ActiveRadarrBlock::System, &None).handle();
|
||||
SystemHandler::with(ESC_KEY, &mut app, ActiveRadarrBlock::System, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -112,16 +112,16 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.update.key,
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemUpdates.into()
|
||||
ActiveRadarrBlock::SystemUpdates.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -146,14 +146,14 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.update.key,
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -175,16 +175,16 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.events.key,
|
||||
DEFAULT_KEYBINDINGS.events.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemQueuedEvents.into()
|
||||
ActiveRadarrBlock::SystemQueuedEvents.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -209,14 +209,14 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.events.key,
|
||||
DEFAULT_KEYBINDINGS.events.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -239,14 +239,14 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::System.into());
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.refresh.key,
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert!(app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -272,14 +272,14 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveRadarrBlock::System.into());
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.refresh.key,
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert!(!app.should_refresh);
|
||||
}
|
||||
|
||||
@@ -302,16 +302,16 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.logs.key,
|
||||
DEFAULT_KEYBINDINGS.logs.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemLogs.into()
|
||||
ActiveRadarrBlock::SystemLogs.into()
|
||||
);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.log_details.items,
|
||||
@@ -344,14 +344,14 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.logs.key,
|
||||
DEFAULT_KEYBINDINGS.logs.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
assert!(app.data.radarr_data.log_details.is_empty());
|
||||
}
|
||||
|
||||
@@ -374,16 +374,16 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.tasks.key,
|
||||
DEFAULT_KEYBINDINGS.tasks.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemTasks.into()
|
||||
ActiveRadarrBlock::SystemTasks.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -408,14 +408,14 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.tasks.key,
|
||||
DEFAULT_KEYBINDINGS.tasks.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::System.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,9 +444,9 @@ mod tests {
|
||||
|
||||
ActiveRadarrBlock::iter().for_each(|active_radarr_block| {
|
||||
if system_blocks.contains(&active_radarr_block) {
|
||||
assert!(SystemHandler::accepts(&active_radarr_block));
|
||||
assert!(SystemHandler::accepts(active_radarr_block));
|
||||
} else {
|
||||
assert!(!SystemHandler::accepts(&active_radarr_block));
|
||||
assert!(!SystemHandler::accepts(active_radarr_block));
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -457,10 +457,10 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.update.key,
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(!system_handler.is_ready());
|
||||
@@ -482,10 +482,10 @@ mod tests {
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.update.key,
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(!system_handler.is_ready());
|
||||
@@ -503,10 +503,10 @@ mod tests {
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.update.key,
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(!system_handler.is_ready());
|
||||
@@ -524,10 +524,10 @@ mod tests {
|
||||
.set_items(vec![RadarrTask::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.update.key,
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(!system_handler.is_ready());
|
||||
@@ -550,10 +550,10 @@ mod tests {
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.update.key,
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
ActiveRadarrBlock::System,
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(system_handler.is_ready());
|
||||
|
||||
Reference in New Issue
Block a user