fix(network): Fixed an issue with dynamic typing in responses from Sonarr for history items
This commit is contained in:
@@ -41,6 +41,10 @@ pub enum Serdeable {
|
||||
Sonarr(SonarrSerdeable),
|
||||
}
|
||||
|
||||
pub trait EnumDisplayStyle<'a> {
|
||||
fn to_display_str(self) -> &'a str;
|
||||
}
|
||||
|
||||
pub trait Scrollable {
|
||||
fn scroll_down(&mut self);
|
||||
fn scroll_up(&mut self);
|
||||
|
||||
@@ -13,7 +13,7 @@ use super::servarr_models::{
|
||||
HostConfig, Indexer, Language, LogResponse, QualityProfile, QualityWrapper, QueueEvent, Release,
|
||||
SecurityConfig,
|
||||
};
|
||||
use super::Serdeable;
|
||||
use super::{EnumDisplayStyle, Serdeable};
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "radarr_models_tests.rs"]
|
||||
@@ -313,8 +313,8 @@ impl Display for MinimumAvailability {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinimumAvailability {
|
||||
pub fn to_display_str<'a>(self) -> &'a str {
|
||||
impl<'a> EnumDisplayStyle<'a> for MinimumAvailability {
|
||||
fn to_display_str(self) -> &'a str {
|
||||
match self {
|
||||
MinimumAvailability::Tba => "TBA",
|
||||
MinimumAvailability::Announced => "Announced",
|
||||
@@ -343,8 +343,8 @@ impl Display for Monitor {
|
||||
}
|
||||
}
|
||||
|
||||
impl Monitor {
|
||||
pub fn to_display_str<'a>(self) -> &'a str {
|
||||
impl<'a> EnumDisplayStyle<'a> for Monitor {
|
||||
fn to_display_str(self) -> &'a str {
|
||||
match self {
|
||||
Monitor::MovieOnly => "Movie only",
|
||||
Monitor::MovieAndCollection => "Movie and Collection",
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
Release, RootFolder, SystemStatus, Tag, Task, TaskName, Update,
|
||||
},
|
||||
servarr_models::{HostConfig, Log, LogResponse, QueueEvent, SecurityConfig},
|
||||
Serdeable,
|
||||
EnumDisplayStyle, Serdeable,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use crate::models::{
|
||||
servarr_models::Release, sonarr_models::Episode, stateful_table::StatefulTable, ScrollableText,
|
||||
servarr_models::Release,
|
||||
sonarr_models::{Episode, SonarrHistoryItem},
|
||||
stateful_table::StatefulTable,
|
||||
ScrollableText,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -8,7 +11,7 @@ pub struct EpisodeDetailsModal {
|
||||
pub file_details: String,
|
||||
pub audio_details: String,
|
||||
pub video_details: String,
|
||||
// pub episode_history: StatefulTable<MovieHistoryItem>,
|
||||
pub episode_history: StatefulTable<SonarrHistoryItem>,
|
||||
pub episode_releases: StatefulTable<Release>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user