add_table ready to be used as a post request, only small changes are needed
This commit is contained in:
@@ -8,7 +8,7 @@ use crate::state::{
|
||||
use crossterm::event::KeyEvent;
|
||||
use crate::state::app::buffer::AppView;
|
||||
use crate::state::app::buffer::BufferState;
|
||||
use crate::state::pages::add_table::AddTableState;
|
||||
use crate::state::pages::add_table::{AddTableState, LinkDefinition};
|
||||
|
||||
/// Handles navigation events specifically for the Admin Panel view.
|
||||
/// Returns true if the event was handled, false otherwise.
|
||||
@@ -165,11 +165,23 @@ pub fn handle_admin_navigation(
|
||||
if let Some(p_idx) = admin_state.selected_profile_index {
|
||||
if let Some(profile) = app_state.profile_tree.profiles.get(p_idx) {
|
||||
let selected_profile_name = profile.name.clone();
|
||||
// --- Populate Links from Profile Tables ---
|
||||
let available_links: Vec<LinkDefinition> = profile
|
||||
.tables
|
||||
.iter()
|
||||
.map(|table| LinkDefinition {
|
||||
linked_table_name: table.name.clone(),
|
||||
is_required: false,
|
||||
selected: false,
|
||||
})
|
||||
.collect();
|
||||
// --- End Populate Links ---
|
||||
|
||||
|
||||
// Create and populate the new AddTableState
|
||||
let new_add_table_state = AddTableState {
|
||||
profile_name: selected_profile_name,
|
||||
links: available_links,
|
||||
// Reset other fields to defaults for a fresh start
|
||||
..AddTableState::default()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user