From eb96c64e26abb87a64ab3ae4c7871f70a4634739 Mon Sep 17 00:00:00 2001 From: filipriec Date: Sat, 14 Jun 2025 12:47:59 +0200 Subject: [PATCH] links to the other tables --- client/src/ui/handlers/ui.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/client/src/ui/handlers/ui.rs b/client/src/ui/handlers/ui.rs index 137bd03..213f411 100644 --- a/client/src/ui/handlers/ui.rs +++ b/client/src/ui/handlers/ui.rs @@ -98,6 +98,7 @@ pub async fn run_ui() -> Result<()> { initial_profile.clone(), initial_table.clone(), filtered_columns, + vec![], // FIX 1: Provide the missing 4th argument ); UiService::fetch_and_set_table_count(&mut grpc_client, &mut form_state) @@ -339,11 +340,30 @@ pub async fn run_ui() -> Result<()> { .map(|c| c.name.clone()) .collect(); - let filtered_columns = filter_user_columns(new_columns); + // FIX 2: Look up links in the profile_tree + let new_links: Vec = app_state + .profile_tree + .profiles + .iter() + .find(|p| p.name == *prof_name) + .and_then(|profile| { + profile + .tables + .iter() + .find(|t| t.name == *tbl_name) + }) + .map_or(vec![], |table| { + table.depends_on.clone() + }); + + let filtered_columns = + filter_user_columns(new_columns); + form_state = FormState::new( prof_name.clone(), tbl_name.clone(), filtered_columns, + new_links, ); if let Err(e) = UiService::fetch_and_set_table_count(