Added field_type to Radarr events to dynamically display fields at runtime. Also updated the keybinding for events in the systems tab to reuse the 'e' key.
This commit is contained in:
@@ -23,7 +23,7 @@ generate_keybindings! {
|
||||
tasks,
|
||||
refresh,
|
||||
update,
|
||||
queue,
|
||||
events,
|
||||
home,
|
||||
end,
|
||||
delete,
|
||||
@@ -78,6 +78,10 @@ pub const DEFAULT_KEYBINDINGS: KeyBindings = KeyBindings {
|
||||
key: Key::Char('e'),
|
||||
desc: "Edit",
|
||||
},
|
||||
events: KeyBinding {
|
||||
key: Key::Char('e'),
|
||||
desc: "Events",
|
||||
},
|
||||
logs: KeyBinding {
|
||||
key: Key::Char('l'),
|
||||
desc: "Logs",
|
||||
@@ -94,10 +98,6 @@ pub const DEFAULT_KEYBINDINGS: KeyBindings = KeyBindings {
|
||||
key: Key::Char('u'),
|
||||
desc: "Update",
|
||||
},
|
||||
queue: KeyBinding {
|
||||
key: Key::Char('z'),
|
||||
desc: "Queue",
|
||||
},
|
||||
home: KeyBinding {
|
||||
key: Key::Home,
|
||||
desc: "Home",
|
||||
|
||||
+3
-3
@@ -330,7 +330,7 @@ impl<'a> Default for RadarrData<'a> {
|
||||
title: "System",
|
||||
route: ActiveRadarrBlock::System.into(),
|
||||
help: "",
|
||||
contextual_help: Some("<t> open tasks | <z> open queue | <l> open logs | <u> open updates | <r> refresh")
|
||||
contextual_help: Some("<t> open tasks | <e> open events | <l> open logs | <u> open updates | <r> refresh")
|
||||
}
|
||||
]),
|
||||
movie_info_tabs: TabState::new(vec![
|
||||
@@ -429,7 +429,7 @@ pub enum ActiveRadarrBlock {
|
||||
RootFolders,
|
||||
System,
|
||||
SystemLogs,
|
||||
SystemQueue,
|
||||
SystemQueuedEvents,
|
||||
SystemTasks,
|
||||
SystemTaskStartConfirmPrompt,
|
||||
SystemUpdates,
|
||||
@@ -533,7 +533,7 @@ pub static DELETE_MOVIE_SELECTION_BLOCKS: [ActiveRadarrBlock; 3] = [
|
||||
];
|
||||
pub static SYSTEM_DETAILS_BLOCKS: [ActiveRadarrBlock; 5] = [
|
||||
ActiveRadarrBlock::SystemLogs,
|
||||
ActiveRadarrBlock::SystemQueue,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
ActiveRadarrBlock::SystemTasks,
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
|
||||
ActiveRadarrBlock::SystemUpdates,
|
||||
|
||||
@@ -368,7 +368,7 @@ mod tests {
|
||||
assert!(radarr_data.main_tabs.tabs[5].help.is_empty());
|
||||
assert_eq!(
|
||||
radarr_data.main_tabs.tabs[5].contextual_help,
|
||||
Some("<t> open tasks | <z> open queue | <l> open logs | <u> open updates | <r> refresh")
|
||||
Some("<t> open tasks | <e> open events | <l> open logs | <u> open updates | <r> refresh")
|
||||
);
|
||||
|
||||
assert_eq!(radarr_data.movie_info_tabs.tabs.len(), 6);
|
||||
|
||||
@@ -585,10 +585,10 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for RadarrHandler<'a, 'b
|
||||
_ if *key == DEFAULT_KEYBINDINGS.refresh.key => {
|
||||
self.app.should_refresh = true;
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.queue.key => {
|
||||
_ if *key == DEFAULT_KEYBINDINGS.events.key => {
|
||||
self
|
||||
.app
|
||||
.push_navigation_stack(ActiveRadarrBlock::SystemQueue.into());
|
||||
.push_navigation_stack(ActiveRadarrBlock::SystemQueuedEvents.into());
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.logs.key => {
|
||||
self
|
||||
|
||||
@@ -962,11 +962,11 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_queue_key() {
|
||||
fn test_queued_events_key() {
|
||||
let mut app = App::default();
|
||||
|
||||
RadarrHandler::with(
|
||||
&DEFAULT_KEYBINDINGS.queue.key,
|
||||
&DEFAULT_KEYBINDINGS.events.key,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::System,
|
||||
&None,
|
||||
@@ -975,7 +975,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
&ActiveRadarrBlock::SystemQueue.into()
|
||||
&ActiveRadarrBlock::SystemQueuedEvents.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1293,7 +1293,7 @@ mod tests {
|
||||
ActiveRadarrBlock::System,
|
||||
ActiveRadarrBlock::SystemLogs,
|
||||
ActiveRadarrBlock::SystemTasks,
|
||||
ActiveRadarrBlock::SystemQueue,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
ActiveRadarrBlock::SystemUpdates
|
||||
)]
|
||||
active_radarr_block: ActiveRadarrBlock,
|
||||
|
||||
@@ -41,7 +41,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
ActiveRadarrBlock::SystemLogs => self.app.data.radarr_data.log_details.scroll_up(),
|
||||
ActiveRadarrBlock::SystemTasks => self.app.data.radarr_data.tasks.scroll_up(),
|
||||
ActiveRadarrBlock::SystemUpdates => self.app.data.radarr_data.updates.scroll_up(),
|
||||
ActiveRadarrBlock::SystemQueue => self.app.data.radarr_data.queued_events.scroll_up(),
|
||||
ActiveRadarrBlock::SystemQueuedEvents => self.app.data.radarr_data.queued_events.scroll_up(),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,9 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
ActiveRadarrBlock::SystemLogs => self.app.data.radarr_data.log_details.scroll_down(),
|
||||
ActiveRadarrBlock::SystemTasks => self.app.data.radarr_data.tasks.scroll_down(),
|
||||
ActiveRadarrBlock::SystemUpdates => self.app.data.radarr_data.updates.scroll_down(),
|
||||
ActiveRadarrBlock::SystemQueue => self.app.data.radarr_data.queued_events.scroll_down(),
|
||||
ActiveRadarrBlock::SystemQueuedEvents => {
|
||||
self.app.data.radarr_data.queued_events.scroll_down()
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -61,7 +63,9 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
ActiveRadarrBlock::SystemLogs => self.app.data.radarr_data.log_details.scroll_to_top(),
|
||||
ActiveRadarrBlock::SystemTasks => self.app.data.radarr_data.tasks.scroll_to_top(),
|
||||
ActiveRadarrBlock::SystemUpdates => self.app.data.radarr_data.updates.scroll_to_top(),
|
||||
ActiveRadarrBlock::SystemQueue => self.app.data.radarr_data.queued_events.scroll_to_top(),
|
||||
ActiveRadarrBlock::SystemQueuedEvents => {
|
||||
self.app.data.radarr_data.queued_events.scroll_to_top()
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -71,7 +75,9 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
ActiveRadarrBlock::SystemLogs => self.app.data.radarr_data.log_details.scroll_to_bottom(),
|
||||
ActiveRadarrBlock::SystemTasks => self.app.data.radarr_data.tasks.scroll_to_bottom(),
|
||||
ActiveRadarrBlock::SystemUpdates => self.app.data.radarr_data.updates.scroll_to_bottom(),
|
||||
ActiveRadarrBlock::SystemQueue => self.app.data.radarr_data.queued_events.scroll_to_bottom(),
|
||||
ActiveRadarrBlock::SystemQueuedEvents => {
|
||||
self.app.data.radarr_data.queued_events.scroll_to_bottom()
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -134,7 +140,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for SystemDetailsHandler
|
||||
self.app.data.radarr_data.reset_log_details_list();
|
||||
self.app.pop_navigation_stack()
|
||||
}
|
||||
ActiveRadarrBlock::SystemQueue
|
||||
ActiveRadarrBlock::SystemQueuedEvents
|
||||
| ActiveRadarrBlock::SystemTasks
|
||||
| ActiveRadarrBlock::SystemUpdates => self.app.pop_navigation_stack(),
|
||||
ActiveRadarrBlock::SystemTaskStartConfirmPrompt => {
|
||||
|
||||
@@ -43,7 +43,7 @@ mod tests {
|
||||
SystemDetailsHandler,
|
||||
queued_events,
|
||||
simple_stateful_iterable_vec!(QueueEvent, String, name),
|
||||
ActiveRadarrBlock::SystemQueue,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
None,
|
||||
name
|
||||
);
|
||||
@@ -89,7 +89,7 @@ mod tests {
|
||||
SystemDetailsHandler,
|
||||
queued_events,
|
||||
extended_stateful_iterable_vec!(QueueEvent, String, name),
|
||||
ActiveRadarrBlock::SystemQueue,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
None,
|
||||
name
|
||||
);
|
||||
@@ -357,17 +357,22 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_esc_system_queue() {
|
||||
fn test_esc_system_queued_events() {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemQueue.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemQueuedEvents.into());
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.queued_events
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
SystemDetailsHandler::with(&ESC_KEY, &mut app, &ActiveRadarrBlock::SystemQueue, &None)
|
||||
SystemDetailsHandler::with(
|
||||
&ESC_KEY,
|
||||
&mut app,
|
||||
&ActiveRadarrBlock::SystemQueuedEvents,
|
||||
&None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), &ActiveRadarrBlock::System.into());
|
||||
@@ -423,7 +428,7 @@ mod tests {
|
||||
#[values(
|
||||
ActiveRadarrBlock::SystemLogs,
|
||||
ActiveRadarrBlock::SystemTasks,
|
||||
ActiveRadarrBlock::SystemQueue,
|
||||
ActiveRadarrBlock::SystemQueuedEvents,
|
||||
ActiveRadarrBlock::SystemUpdates
|
||||
)]
|
||||
active_radarr_block: ActiveRadarrBlock,
|
||||
|
||||
@@ -180,6 +180,8 @@ pub struct IndexerField {
|
||||
pub name: Option<String>,
|
||||
pub label: Option<String>,
|
||||
pub value: Option<Value>,
|
||||
#[serde(rename(deserialize = "type"))]
|
||||
pub field_type: Option<String>,
|
||||
pub advanced: bool,
|
||||
pub select_options: Option<Vec<IndexerSelectOption>>,
|
||||
}
|
||||
|
||||
@@ -872,6 +872,7 @@ mod test {
|
||||
"name": "valueIsString",
|
||||
"label": "Value Is String",
|
||||
"value": "hello",
|
||||
"type": "textbox",
|
||||
"advanced": false
|
||||
},
|
||||
{
|
||||
@@ -879,6 +880,7 @@ mod test {
|
||||
"name": "emptyValueWithSelectOptions",
|
||||
"label": "Empty Value With Select Options",
|
||||
"advanced": true,
|
||||
"type": "select",
|
||||
"selectOptions": [
|
||||
{
|
||||
"value": -2,
|
||||
@@ -892,6 +894,7 @@ mod test {
|
||||
"name": "valueIsAnArray",
|
||||
"label": "Value is an array",
|
||||
"value": [1, 2],
|
||||
"type": "select",
|
||||
"advanced": false,
|
||||
},
|
||||
],
|
||||
@@ -2214,6 +2217,7 @@ mod test {
|
||||
label: Some("Value Is String".to_owned()),
|
||||
value: Some(json!("hello")),
|
||||
advanced: false,
|
||||
field_type: Some("textbox".to_owned()),
|
||||
select_options: None,
|
||||
},
|
||||
IndexerField {
|
||||
@@ -2222,6 +2226,7 @@ mod test {
|
||||
label: Some("Empty Value With Select Options".to_owned()),
|
||||
value: None,
|
||||
advanced: true,
|
||||
field_type: Some("select".to_owned()),
|
||||
select_options: Some(vec![IndexerSelectOption {
|
||||
value: Number::from(-2),
|
||||
name: Some("Original".to_owned()),
|
||||
@@ -2234,6 +2239,7 @@ mod test {
|
||||
label: Some("Value is an array".to_owned()),
|
||||
value: Some(json!([1, 2])),
|
||||
advanced: false,
|
||||
field_type: Some("select".to_owned()),
|
||||
select_options: None,
|
||||
},
|
||||
]),
|
||||
|
||||
@@ -36,7 +36,7 @@ impl DrawUi for SystemDetailsUi {
|
||||
draw_tasks_popup,
|
||||
)
|
||||
}
|
||||
ActiveRadarrBlock::SystemQueue => draw_medium_popup_over(
|
||||
ActiveRadarrBlock::SystemQueuedEvents => draw_medium_popup_over(
|
||||
f,
|
||||
app,
|
||||
content_rect,
|
||||
|
||||
Reference in New Issue
Block a user