tablenames added properly well

This commit is contained in:
filipriec
2025-05-26 19:51:48 +02:00
parent f3cd921c76
commit bf2726c151
3 changed files with 75 additions and 55 deletions

View File

@@ -163,22 +163,21 @@ pub async fn run_ui() -> Result<()> {
// Ensure admin_state.add_logic_state matches the pending fetch
if admin_state.add_logic_state.profile_name == profile_name &&
admin_state.add_logic_state.selected_table_name.as_deref() == Some(table_name.as_str()) {
info!("Fetching table structure for {}.{}", profile_name, table_name);
let fetch_message = UiService::initialize_add_logic_table_data(
&mut grpc_client,
&mut admin_state.add_logic_state,
&app_state.profile_tree, // Pass the profile tree
).await.unwrap_or_else(|e| {
error!("Error initializing add_logic_table_data: {}", e);
format!("Error fetching table structure: {}", e)
});
if !fetch_message.contains("Error") && !fetch_message.contains("Warning") {
info!("{}", fetch_message);
// Optionally update command message on success if desired
// event_handler.command_message = fetch_message;
} else {
event_handler.command_message = fetch_message; // Show error/warning to user
event_handler.command_message = fetch_message;
}
needs_redraw = true;
} else {
@@ -188,15 +187,12 @@ pub async fn run_ui() -> Result<()> {
admin_state.add_logic_state.profile_name,
admin_state.add_logic_state.selected_table_name
);
// Cleared by .take(), no need to set to None explicitly unless re-queueing
}
} else {
warn!(
"Pending table structure fetch for {}.{} but AddLogic view is not active. Fetch ignored.",
profile_name, table_name
);
// If you need to re-queue:
// app_state.pending_table_structure_fetch = Some((profile_name, table_name));
}
}