feat(handler): History tab support

This commit is contained in:
2024-12-02 18:03:59 -07:00
parent 1c6e798632
commit 4f5bad5874
13 changed files with 1805 additions and 23 deletions
+11 -3
View File
@@ -238,7 +238,7 @@ pub enum ActiveSonarrBlock {
FilterSeriesHistory,
FilterSeriesHistoryError,
History,
HistoryDetails,
HistoryItemDetails,
HistorySortPrompt,
Indexers,
IndexerSettingsConfirmPrompt,
@@ -252,8 +252,6 @@ pub enum ActiveSonarrBlock {
ManualSeasonSearch,
ManualSeasonSearchConfirmPrompt,
ManualSeasonSearchSortPrompt,
MarkHistoryItemAsFailedConfirmPrompt,
MarkHistoryItemAsFailedPrompt,
RootFolders,
SearchEpisodes,
SearchEpisodesError,
@@ -372,6 +370,16 @@ pub const DELETE_SERIES_SELECTION_BLOCKS: &[&[ActiveSonarrBlock]] = &[
&[ActiveSonarrBlock::DeleteSeriesConfirmPrompt],
];
pub static HISTORY_BLOCKS: [ActiveSonarrBlock; 7] = [
ActiveSonarrBlock::History,
ActiveSonarrBlock::HistoryItemDetails,
ActiveSonarrBlock::HistorySortPrompt,
ActiveSonarrBlock::FilterHistory,
ActiveSonarrBlock::FilterHistoryError,
ActiveSonarrBlock::SearchHistory,
ActiveSonarrBlock::SearchHistoryError,
];
impl From<ActiveSonarrBlock> for Route {
fn from(active_sonarr_block: ActiveSonarrBlock) -> Route {
Route::Sonarr(active_sonarr_block, None)
@@ -204,7 +204,7 @@ mod tests {
use crate::models::servarr_data::sonarr::sonarr_data::{
ActiveSonarrBlock, ADD_SERIES_BLOCKS, ADD_SERIES_SELECTION_BLOCKS, BLOCKLIST_BLOCKS,
DELETE_SERIES_BLOCKS, DELETE_SERIES_SELECTION_BLOCKS, DOWNLOADS_BLOCKS, EDIT_SERIES_BLOCKS,
EDIT_SERIES_SELECTION_BLOCKS, LIBRARY_BLOCKS,
EDIT_SERIES_SELECTION_BLOCKS, HISTORY_BLOCKS, LIBRARY_BLOCKS,
};
#[test]
@@ -374,5 +374,17 @@ mod tests {
);
assert_eq!(delete_series_block_iter.next(), None);
}
#[test]
fn test_history_blocks_contents() {
assert_eq!(HISTORY_BLOCKS.len(), 7);
assert!(HISTORY_BLOCKS.contains(&ActiveSonarrBlock::History));
assert!(HISTORY_BLOCKS.contains(&ActiveSonarrBlock::HistoryItemDetails));
assert!(HISTORY_BLOCKS.contains(&ActiveSonarrBlock::HistorySortPrompt));
assert!(HISTORY_BLOCKS.contains(&ActiveSonarrBlock::FilterHistory));
assert!(HISTORY_BLOCKS.contains(&ActiveSonarrBlock::FilterHistoryError));
assert!(HISTORY_BLOCKS.contains(&ActiveSonarrBlock::SearchHistory));
assert!(HISTORY_BLOCKS.contains(&ActiveSonarrBlock::SearchHistoryError));
}
}
}