complete redesign oh how client is displaying data

This commit is contained in:
filipriec
2025-06-16 16:10:24 +02:00
parent c31f08d5b8
commit a9c4527318
10 changed files with 141 additions and 48 deletions

View File

@@ -7,6 +7,7 @@ use crate::state::pages::add_logic::AddLogicState;
use crate::state::app::state::AppState;
use crate::utils::columns::filter_user_columns;
use anyhow::{Context, Result};
use std::sync::Arc;
pub struct UiService;
@@ -102,7 +103,6 @@ impl UiService {
.context("Failed to get profile tree")?;
app_state.profile_tree = profile_tree;
// Determine initial table to load (e.g., first table of first profile, or a default)
let initial_profile_name = app_state
.profile_tree
.profiles
@@ -115,7 +115,7 @@ impl UiService {
.profiles
.first()
.and_then(|p| p.tables.first().map(|t| t.name.clone()))
.unwrap_or_else(|| "2025_company_data1".to_string()); // Fallback if no tables
.unwrap_or_else(|| "2025_company_data1".to_string());
app_state.set_current_view_table(
initial_profile_name.clone(),
@@ -133,6 +133,15 @@ impl UiService {
initial_profile_name, initial_table_name
))?;
// NEW: Populate the "Rulebook" cache
let cache_key = format!(
"{}.{}",
initial_profile_name, initial_table_name
);
app_state
.schema_cache
.insert(cache_key, Arc::new(table_structure.clone()));
let column_names: Vec<String> = table_structure
.columns
.iter()