Added delete download functionality

This commit is contained in:
2023-08-08 10:50:04 -06:00
parent 8f6505bb1e
commit 69981857d8
6 changed files with 78 additions and 14 deletions
+24 -1
View File
@@ -92,6 +92,15 @@ pub(super) fn draw_radarr_ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, ar
30,
30,
),
ActiveRadarrBlock::DeleteDownloadPrompt => draw_popup_over(
f,
app,
content_rect,
draw_downloads,
draw_delete_download_prompt,
30,
30,
),
_ => (),
}
}
@@ -179,6 +188,20 @@ fn draw_delete_movie_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
);
}
fn draw_delete_download_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
draw_prompt_box(
f,
prompt_area,
" Confirm Cancel Download? ",
format!(
"Do you really want to delete this download: {}?",
app.data.radarr_data.downloads.current_selection().title
)
.as_str(),
&app.data.radarr_data.prompt_confirm,
);
}
fn draw_search_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
let chunks = vertical_chunks_with_margin(vec![Constraint::Length(3)], area, 1);
if !app.data.radarr_data.is_searching {
@@ -446,7 +469,7 @@ fn determine_row_style(downloads_vec: &[DownloadRecord], movie: &Movie) -> Style
if !movie.has_file {
if let Some(download) = downloads_vec
.iter()
.find(|&download| download.movie_id == movie.id)
.find(|&download| download.id == movie.id)
{
if download.status == "downloading" {
return style_warning();