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:
+8
-17
@@ -182,23 +182,14 @@ impl<'a> App<'a> {
|
||||
}
|
||||
|
||||
async fn populate_movie_collection_table(&mut self) {
|
||||
let collection_movies =
|
||||
if let Some(filtered_collections) = self.data.radarr_data.filtered_collections.as_ref() {
|
||||
filtered_collections
|
||||
.current_selection()
|
||||
.clone()
|
||||
.movies
|
||||
.unwrap_or_default()
|
||||
} else {
|
||||
self
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.current_selection()
|
||||
.clone()
|
||||
.movies
|
||||
.unwrap_or_default()
|
||||
};
|
||||
let collection_movies = self
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.current_selection()
|
||||
.clone()
|
||||
.movies
|
||||
.unwrap_or_default();
|
||||
self
|
||||
.data
|
||||
.radarr_data
|
||||
|
||||
@@ -8,7 +8,6 @@ mod tests {
|
||||
use crate::app::App;
|
||||
use crate::models::radarr_models::{Collection, CollectionMovie, Credit, Release};
|
||||
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
|
||||
use crate::models::StatefulTable;
|
||||
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
use crate::network::NetworkEvent;
|
||||
@@ -666,12 +665,14 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn test_populate_movie_collection_table_filtered() {
|
||||
let mut app = App::default();
|
||||
let mut filtered_collections = StatefulTable::default();
|
||||
filtered_collections.set_items(vec![Collection {
|
||||
movies: Some(vec![CollectionMovie::default()]),
|
||||
..Collection::default()
|
||||
}]);
|
||||
app.data.radarr_data.filtered_collections = Some(filtered_collections);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.set_filtered_items(vec![Collection {
|
||||
movies: Some(vec![CollectionMovie::default()]),
|
||||
..Collection::default()
|
||||
}]);
|
||||
|
||||
app.populate_movie_collection_table().await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user