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