outputting to the status line

This commit is contained in:
filipriec
2025-06-13 13:38:40 +02:00
parent 3c0af05a3c
commit f50887a326
7 changed files with 117 additions and 43 deletions

View File

@@ -42,10 +42,9 @@ use crate::tui::{
use crate::ui::handlers::context::UiContext;
use crate::ui::handlers::rat_state::UiStateHandler;
use anyhow::Result;
use common::proto::multieko2::search::search_response::Hit; // Correctly imported
use common::proto::multieko2::search::search_response::Hit;
use crossterm::cursor::SetCursorStyle;
use crossterm::event::KeyCode;
use crossterm::event::{Event, KeyEvent};
use crossterm::event::{Event, KeyCode, KeyEvent};
use tokio::sync::mpsc;
use tokio::sync::mpsc::unbounded_channel;
use tracing::{info, error};
@@ -186,15 +185,18 @@ impl EventHandler {
let table_name = search_state.table_name.clone();
let sender = self.search_result_sender.clone();
info!("--- 1. Spawning search task for query: '{}' ---", query);
// We now move the grpc_client into the task, just like with login.
tokio::spawn(async move {
info!("--- 2. Background task started. ---");
match grpc_client.search_table(table_name, query).await {
Ok(response) => {
info!("Search successful. Received {} hits.", response.hits.len());
info!("--- 3a. gRPC call successful. Found {} hits. ---", response.hits.len());
let _ = sender.send(response.hits);
}
Err(e) => {
error!("gRPC search call failed: {}", e);
error!("--- 3b. gRPC call failed: {} ---", e);
let _ = sender.send(vec![]);
}
}