web: add select all/partial/none for search table

This commit is contained in:
2024-02-21 15:02:58 -08:00
parent cda99fc7a5
commit 42ce88d931
3 changed files with 43 additions and 3 deletions

View File

@@ -277,6 +277,24 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
Msg::ShowThreadResult(bad) => {
error!("show_thread_query error: {bad:#?}");
}
Msg::SelectionSetNone => {
if let Context::SearchResult {
selected_threads, ..
} = &mut model.context
{
*selected_threads = HashSet::new();
}
}
Msg::SelectionSetAll => {
if let Context::SearchResult {
results,
selected_threads,
..
} = &mut model.context
{
*selected_threads = results.iter().map(|node| node.thread.clone()).collect();
}
}
Msg::SelectionMarkAsRead => {
if let Context::SearchResult {
selected_threads, ..
@@ -423,6 +441,8 @@ pub enum Msg {
Result<graphql_client::Response<graphql::show_thread_query::ResponseData>, gloo_net::Error>,
),
SelectionSetNone,
SelectionSetAll,
SelectionMarkAsRead,
SelectionMarkAsUnread,
SelectionAddThread(String),