Added network support for updating all indexer settings, editing specific indexer settings, deleting an indexer; Also added keybindings for all of the above that change the current route. Added full support for deleting an indexer; still need to add an indexer_handler to handle the add, edit, and settings functionalities
This commit is contained in:
@@ -9,17 +9,24 @@ use crate::app::App;
|
||||
use crate::models::radarr_models::Indexer;
|
||||
use crate::models::Route;
|
||||
use crate::ui::utils::{layout_block_top_border, style_failure, style_primary, style_success};
|
||||
use crate::ui::{draw_table, DrawUi, TableProps};
|
||||
use crate::ui::{draw_prompt_box, draw_prompt_popup_over, draw_table, DrawUi, TableProps};
|
||||
|
||||
pub(super) struct IndexersUi {}
|
||||
|
||||
impl DrawUi for IndexersUi {
|
||||
fn draw<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, content_rect: Rect) {
|
||||
if matches!(
|
||||
*app.get_current_route(),
|
||||
Route::Radarr(ActiveRadarrBlock::Indexers, _)
|
||||
) {
|
||||
draw_indexers(f, app, content_rect);
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
match active_radarr_block {
|
||||
ActiveRadarrBlock::Indexers => draw_indexers(f, app, content_rect),
|
||||
ActiveRadarrBlock::DeleteIndexerPrompt => draw_prompt_popup_over(
|
||||
f,
|
||||
app,
|
||||
content_rect,
|
||||
draw_indexers,
|
||||
draw_delete_indexer_prompt,
|
||||
),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,3 +101,28 @@ fn draw_indexers<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
fn draw_delete_indexer_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
"Delete Indexer",
|
||||
format!(
|
||||
"Do you really want to delete this indexer: {}?",
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.indexers
|
||||
.current_selection()
|
||||
.name
|
||||
.clone()
|
||||
.unwrap_or_default()
|
||||
)
|
||||
.as_str(),
|
||||
app.data.radarr_data.prompt_confirm,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ use tui::Frame;
|
||||
|
||||
use crate::app::radarr::{
|
||||
ActiveRadarrBlock, RadarrData, ADD_MOVIE_BLOCKS, COLLECTION_DETAILS_BLOCKS, DELETE_MOVIE_BLOCKS,
|
||||
EDIT_COLLECTION_BLOCKS, EDIT_MOVIE_BLOCKS, FILTER_BLOCKS, MOVIE_DETAILS_BLOCKS, SEARCH_BLOCKS,
|
||||
SYSTEM_DETAILS_BLOCKS,
|
||||
EDIT_COLLECTION_BLOCKS, EDIT_MOVIE_BLOCKS, FILTER_BLOCKS, INDEXER_BLOCKS, MOVIE_DETAILS_BLOCKS,
|
||||
SEARCH_BLOCKS, SYSTEM_DETAILS_BLOCKS,
|
||||
};
|
||||
use crate::app::App;
|
||||
use crate::logos::RADARR_LOGO;
|
||||
@@ -74,7 +74,9 @@ impl DrawUi for RadarrUi {
|
||||
ActiveRadarrBlock::Downloads
|
||||
| ActiveRadarrBlock::DeleteDownloadPrompt
|
||||
| ActiveRadarrBlock::UpdateDownloadsPrompt => DownloadsUi::draw(f, app, content_rect),
|
||||
ActiveRadarrBlock::Indexers => IndexersUi::draw(f, app, content_rect),
|
||||
_ if INDEXER_BLOCKS.contains(&active_radarr_block) => {
|
||||
IndexersUi::draw(f, app, content_rect)
|
||||
}
|
||||
ActiveRadarrBlock::RootFolders
|
||||
| ActiveRadarrBlock::AddRootFolderPrompt
|
||||
| ActiveRadarrBlock::DeleteRootFolderPrompt => RootFoldersUi::draw(f, app, content_rect),
|
||||
|
||||
Reference in New Issue
Block a user