Added delete movie functionality
This commit is contained in:
+17
-12
@@ -9,18 +9,19 @@ macro_rules! generate_keybindings {
|
||||
}
|
||||
|
||||
generate_keybindings! {
|
||||
up,
|
||||
down,
|
||||
left,
|
||||
right,
|
||||
backspace,
|
||||
search,
|
||||
filter,
|
||||
home,
|
||||
end,
|
||||
submit,
|
||||
quit,
|
||||
esc
|
||||
up,
|
||||
down,
|
||||
left,
|
||||
right,
|
||||
backspace,
|
||||
search,
|
||||
filter,
|
||||
home,
|
||||
end,
|
||||
delete,
|
||||
submit,
|
||||
quit,
|
||||
esc
|
||||
}
|
||||
|
||||
pub struct KeyBinding {
|
||||
@@ -65,6 +66,10 @@ pub const DEFAULT_KEYBINDINGS: KeyBindings = KeyBindings {
|
||||
key: Key::End,
|
||||
desc: "End",
|
||||
},
|
||||
delete: KeyBinding {
|
||||
key: Key::Delete,
|
||||
desc: "Delete selected item",
|
||||
},
|
||||
submit: KeyBinding {
|
||||
key: Key::Enter,
|
||||
desc: "Select",
|
||||
|
||||
+4
-1
@@ -29,6 +29,7 @@ pub struct App {
|
||||
pub network_tick_frequency: Duration,
|
||||
pub is_routing: bool,
|
||||
pub is_loading: bool,
|
||||
pub should_refresh: bool,
|
||||
pub config: AppConfig,
|
||||
pub data: Data,
|
||||
}
|
||||
@@ -69,7 +70,7 @@ impl App {
|
||||
}
|
||||
|
||||
pub async fn on_tick(&mut self, is_first_render: bool) {
|
||||
if self.tick_count % self.tick_until_poll == 0 || self.is_routing {
|
||||
if self.tick_count % self.tick_until_poll == 0 || self.is_routing || self.should_refresh {
|
||||
match self.get_current_route() {
|
||||
Route::Radarr(active_radarr_block) => {
|
||||
self
|
||||
@@ -80,6 +81,7 @@ impl App {
|
||||
}
|
||||
|
||||
self.is_routing = false;
|
||||
self.should_refresh = false;
|
||||
}
|
||||
|
||||
self.tick_count += 1;
|
||||
@@ -133,6 +135,7 @@ impl Default for App {
|
||||
last_tick: Instant::now(),
|
||||
is_loading: false,
|
||||
is_routing: false,
|
||||
should_refresh: false,
|
||||
config: AppConfig::default(),
|
||||
data: Data::default(),
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ pub struct RadarrData {
|
||||
pub movie_info_tabs: TabState,
|
||||
pub search: String,
|
||||
pub filter: String,
|
||||
pub prompt_confirm: bool,
|
||||
pub is_searching: bool,
|
||||
}
|
||||
|
||||
@@ -88,6 +89,7 @@ impl Default for RadarrData {
|
||||
search: String::default(),
|
||||
filter: String::default(),
|
||||
is_searching: false,
|
||||
prompt_confirm: false,
|
||||
main_tabs: TabState::new(vec![
|
||||
TabRoute {
|
||||
title: "Library".to_owned(),
|
||||
@@ -146,6 +148,7 @@ pub enum ActiveRadarrBlock {
|
||||
CollectionDetails,
|
||||
Cast,
|
||||
Crew,
|
||||
DeleteMoviePrompt,
|
||||
FileInfo,
|
||||
FilterCollections,
|
||||
FilterMovies,
|
||||
@@ -192,6 +195,13 @@ impl App {
|
||||
self
|
||||
.dispatch_network_event(RadarrEvent::GetDownloads.into())
|
||||
.await;
|
||||
|
||||
if self.data.radarr_data.prompt_confirm {
|
||||
self.data.radarr_data.prompt_confirm = false;
|
||||
self
|
||||
.dispatch_network_event(RadarrEvent::DeleteMovie.into())
|
||||
.await;
|
||||
}
|
||||
}
|
||||
ActiveRadarrBlock::MovieDetails | ActiveRadarrBlock::FileInfo => {
|
||||
self.is_loading = true;
|
||||
|
||||
Reference in New Issue
Block a user