Refactored table filtering and searching so that they are now relative to the table being filtered/searched on. Also created two new widgets for error messages and popups to make life easier moving forward. Going to refactor table sorting into StatefulTable's as well so all tables can be searched, filtered, and sorted moving forwards.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#[cfg(test)]
|
||||
pub mod utils {
|
||||
use crate::models::radarr_models::{
|
||||
AddMovieSearchResult, Collection, CollectionMovie, Credit, Movie, MovieHistoryItem, Release,
|
||||
ReleaseField,
|
||||
AddMovieSearchResult, CollectionMovie, Credit, MovieHistoryItem, Release, ReleaseField,
|
||||
};
|
||||
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::RadarrData;
|
||||
@@ -31,30 +30,15 @@ pub mod utils {
|
||||
movie_details_modal.sort_ascending = Some(true);
|
||||
|
||||
let mut radarr_data = RadarrData {
|
||||
is_searching: true,
|
||||
is_filtering: true,
|
||||
delete_movie_files: true,
|
||||
add_list_exclusion: true,
|
||||
search: Some("test search".into()),
|
||||
filter: Some("test filter".into()),
|
||||
add_movie_search: Some("test search".into()),
|
||||
edit_root_folder: Some("test path".into()),
|
||||
movie_details_modal: Some(movie_details_modal),
|
||||
filtered_movies: Some(StatefulTable::default()),
|
||||
filtered_collections: Some(StatefulTable::default()),
|
||||
add_searched_movies: Some(StatefulTable::default()),
|
||||
..RadarrData::default()
|
||||
};
|
||||
radarr_data.movie_info_tabs.index = 1;
|
||||
radarr_data
|
||||
.filtered_movies
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.set_items(vec![Movie::default()]);
|
||||
radarr_data
|
||||
.filtered_collections
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.set_items(vec![Collection::default()]);
|
||||
radarr_data
|
||||
.add_searched_movies
|
||||
.as_mut()
|
||||
@@ -70,28 +54,6 @@ pub mod utils {
|
||||
radarr_data
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_search_reset {
|
||||
($radarr_data:expr) => {
|
||||
assert!(!$radarr_data.is_searching);
|
||||
assert!($radarr_data.search.is_none());
|
||||
assert!($radarr_data.filter.is_none());
|
||||
assert!($radarr_data.filtered_movies.is_none());
|
||||
assert!($radarr_data.filtered_collections.is_none());
|
||||
assert!($radarr_data.add_searched_movies.is_none());
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_filter_reset {
|
||||
($radarr_data:expr) => {
|
||||
assert!(!$radarr_data.is_filtering);
|
||||
assert!($radarr_data.filter.is_none());
|
||||
assert!($radarr_data.filtered_movies.is_none());
|
||||
assert!($radarr_data.filtered_collections.is_none());
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_movie_info_tabs_reset {
|
||||
($radarr_data:expr) => {
|
||||
|
||||
Reference in New Issue
Block a user