feat(models): Added an additional History tab to the mocked tabs for viewing all Sonarr history at once

This commit is contained in:
2024-11-20 13:24:44 -07:00
parent 9d782af020
commit bd2d2875a5
3 changed files with 71 additions and 56 deletions
+68 -55
View File
@@ -4,7 +4,10 @@ use strum::EnumIter;
use crate::models::{ use crate::models::{
servarr_models::{Indexer, QueueEvent}, servarr_models::{Indexer, QueueEvent},
sonarr_models::{BlocklistItem, DownloadRecord, IndexerSettings, Season, Series}, sonarr_models::{
BlocklistItem, DownloadRecord, IndexerSettings, Season, Series, SonarrHistoryItem,
SonarrHistoryWrapper,
},
stateful_list::StatefulList, stateful_list::StatefulList,
stateful_table::StatefulTable, stateful_table::StatefulTable,
HorizontallyScrollableText, Route, HorizontallyScrollableText, Route,
@@ -19,6 +22,7 @@ mod sonarr_data_tests;
pub struct SonarrData { pub struct SonarrData {
pub blocklist: StatefulTable<BlocklistItem>, pub blocklist: StatefulTable<BlocklistItem>,
pub downloads: StatefulTable<DownloadRecord>, pub downloads: StatefulTable<DownloadRecord>,
pub history: StatefulTable<SonarrHistoryWrapper>,
pub indexers: StatefulTable<Indexer>, pub indexers: StatefulTable<Indexer>,
pub indexer_settings: Option<IndexerSettings>, pub indexer_settings: Option<IndexerSettings>,
pub logs: StatefulList<HorizontallyScrollableText>, pub logs: StatefulList<HorizontallyScrollableText>,
@@ -27,6 +31,7 @@ pub struct SonarrData {
pub seasons: StatefulTable<Season>, pub seasons: StatefulTable<Season>,
pub season_details_modal: Option<SeasonDetailsModal>, pub season_details_modal: Option<SeasonDetailsModal>,
pub series: StatefulTable<Series>, pub series: StatefulTable<Series>,
pub series_history: Option<StatefulTable<SonarrHistoryItem>>,
pub start_time: DateTime<Utc>, pub start_time: DateTime<Utc>,
pub version: String, pub version: String,
} }
@@ -36,14 +41,16 @@ impl Default for SonarrData {
SonarrData { SonarrData {
blocklist: StatefulTable::default(), blocklist: StatefulTable::default(),
downloads: StatefulTable::default(), downloads: StatefulTable::default(),
history: StatefulTable::default(),
indexers: StatefulTable::default(), indexers: StatefulTable::default(),
indexer_settings: None, indexer_settings: None,
logs: StatefulList::default(), logs: StatefulList::default(),
quality_profile_map: BiMap::new(), quality_profile_map: BiMap::new(),
queued_events: StatefulTable::default(), queued_events: StatefulTable::default(),
seasons: StatefulTable::default(), seasons: StatefulTable::default(),
series: StatefulTable::default(),
season_details_modal: None, season_details_modal: None,
series: StatefulTable::default(),
series_history: None,
start_time: DateTime::default(), start_time: DateTime::default(),
version: String::new(), version: String::new(),
} }
@@ -53,73 +60,79 @@ impl Default for SonarrData {
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default, EnumIter)] #[derive(Clone, Copy, PartialEq, Eq, Debug, Default, EnumIter)]
pub enum ActiveSonarrBlock { pub enum ActiveSonarrBlock {
#[default] #[default]
Series, AddRootFolderPrompt,
UpdateAndScanSeriesPrompt, AddSeriesAlreadyInLibrary,
EditSeriesPrompt, AddSeriesConfirmPrompt,
SeriesSortPrompt, AddSeriesEmptySearchResults,
SearchSeries,
SearchSeriesError,
FilterSeries,
FilterSeriesError,
DeleteSeriesPrompt,
DeleteSeriesConfirmPrompt,
AutomaticallySearchSeriesPrompt,
UpdateAllSeriesPrompt,
SeriesDetails,
SeriesHistory,
HistoryDetails,
MarkHistoryItemAsFailurePrompt,
MarkHistoryItemAsFailureConfirmPrompt,
SearchSeason,
SearchSeasonError,
AutomaticallySearchSeasonPrompt,
SeasonDetails,
SeasonHistory,
ManualSeasonSearch,
ManualSeasonSearchSortPrompt,
ManualSeasonSearchConfirmPrompt,
DeleteEpisodeFilePrompt,
EpisodeDetails,
EpisodesSortPrompt,
SearchEpisodes,
SearchEpisodesError,
FilterEpisodes,
FilterEpisodesError,
AutomaticallySearchEpisodePrompt,
EditEpisodePrompt,
EpisodeHistory,
EpisodeFile,
ManualEpisodeSearch,
ManualEpisodeSearchSortPrompt,
ManualEpisodeSearchConfirmPrompt,
AddSeriesPrompt, AddSeriesPrompt,
AddSeriesSearchInput, AddSeriesSearchInput,
AddSeriesSearchResults, AddSeriesSearchResults,
AddSeriesAlreadyInLibrary, AllIndexerSettingsPrompt,
AddSeriesEmptySearchResults, AutomaticallySearchEpisodePrompt,
AddSeriesConfirmPrompt, AutomaticallySearchSeasonPrompt,
Downloads, AutomaticallySearchSeriesPrompt,
DeleteDownloadPrompt,
Blocklist, Blocklist,
BlocklistClearAllItemsPrompt, BlocklistClearAllItemsPrompt,
BlocklistItemDetails, BlocklistItemDetails,
BlocklistSortPrompt, BlocklistSortPrompt,
DeleteBlocklistItemPrompt, DeleteBlocklistItemPrompt,
RootFolders, DeleteDownloadPrompt,
AddRootFolderPrompt, DeleteEpisodeFilePrompt,
DeleteRootFolderPrompt,
Indexers,
DeleteIndexerPrompt, DeleteIndexerPrompt,
DeleteRootFolderPrompt,
DeleteSeriesConfirmPrompt,
DeleteSeriesPrompt,
Downloads,
EditEpisodePrompt,
EditIndexerPrompt, EditIndexerPrompt,
AllIndexerSettingsPrompt, EditSeriesPrompt,
TestIndexer, EpisodeDetails,
TestAllIndexers, EpisodeFile,
EpisodeHistory,
EpisodesSortPrompt,
FilterEpisodes,
FilterEpisodesError,
FilterHistory,
FilterHistoryError,
FilterSeries,
FilterSeriesError,
History,
HistoryDetails,
HistorySortPrompt,
Indexers,
ManualEpisodeSearch,
ManualEpisodeSearchConfirmPrompt,
ManualEpisodeSearchSortPrompt,
ManualSeasonSearch,
ManualSeasonSearchConfirmPrompt,
ManualSeasonSearchSortPrompt,
MarkHistoryItemAsFailureConfirmPrompt,
MarkHistoryItemAsFailurePrompt,
RootFolders,
SearchEpisodes,
SearchEpisodesError,
SearchHistory,
SearchHistoryError,
SearchSeason,
SearchSeasonError,
SearchSeries,
SearchSeriesError,
SeasonDetails,
SeasonHistory,
Series,
SeriesDetails,
SeriesHistory,
SeriesSortPrompt,
System, System,
SystemTasks,
SystemTaskStartConfirmPrompt,
SystemLogs, SystemLogs,
SystemQueuedEvents, SystemQueuedEvents,
SystemTasks,
SystemTaskStartConfirmPrompt,
SystemUpdates, SystemUpdates,
TestAllIndexers,
TestIndexer,
UpdateAllSeriesPrompt,
UpdateAndScanSeriesPrompt,
} }
impl From<ActiveSonarrBlock> for Route { impl From<ActiveSonarrBlock> for Route {
@@ -36,6 +36,7 @@ mod tests {
assert!(sonarr_data.blocklist.is_empty()); assert!(sonarr_data.blocklist.is_empty());
assert!(sonarr_data.downloads.is_empty()); assert!(sonarr_data.downloads.is_empty());
assert!(sonarr_data.history.is_empty());
assert!(sonarr_data.indexers.is_empty()); assert!(sonarr_data.indexers.is_empty());
assert!(sonarr_data.indexer_settings.is_none()); assert!(sonarr_data.indexer_settings.is_none());
assert!(sonarr_data.logs.is_empty()); assert!(sonarr_data.logs.is_empty());
@@ -44,6 +45,7 @@ mod tests {
assert!(sonarr_data.seasons.is_empty()); assert!(sonarr_data.seasons.is_empty());
assert!(sonarr_data.season_details_modal.is_none()); assert!(sonarr_data.season_details_modal.is_none());
assert!(sonarr_data.series.is_empty()); assert!(sonarr_data.series.is_empty());
assert!(sonarr_data.series_history.is_empty());
assert_eq!(sonarr_data.start_time, <DateTime<Utc>>::default()); assert_eq!(sonarr_data.start_time, <DateTime<Utc>>::default());
assert!(sonarr_data.version.is_empty()); assert!(sonarr_data.version.is_empty());
} }
+1 -1
View File
@@ -306,7 +306,7 @@ impl SeriesStatus {
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)] #[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SonarrEpisodeHistoryResponse { pub struct SonarrHistoryWrapper {
pub records: Vec<SonarrHistoryItem>, pub records: Vec<SonarrHistoryItem>,
} }