add_table dialog is now working properly well
This commit is contained in:
@@ -7,7 +7,7 @@ use crate::state::{
|
||||
use crossterm::event::{KeyEvent};
|
||||
use ratatui::widgets::TableState;
|
||||
use crate::tui::functions::common::add_table::handle_add_column_action;
|
||||
use crate::tui::functions::common::add_table::handle_delete_selected_columns;
|
||||
use crate::ui::handlers::context::DialogPurpose;
|
||||
|
||||
/// Handles navigation events specifically for the Add Table view.
|
||||
/// Returns true if the event was handled, false otherwise.
|
||||
@@ -255,7 +255,21 @@ pub fn handle_add_table_navigation(
|
||||
// TODO: Implement logic
|
||||
}
|
||||
AddTableFocus::DeleteSelectedButton => {
|
||||
handle_delete_selected_columns(add_table_state, command_message);
|
||||
// --- Show Confirmation Dialog ---
|
||||
let columns_to_delete: Vec<String> = add_table_state
|
||||
.columns
|
||||
.iter()
|
||||
.filter(|col| col.selected)
|
||||
.map(|col| col.name.clone())
|
||||
.collect();
|
||||
|
||||
if columns_to_delete.is_empty() {
|
||||
*command_message = "No columns selected for deletion.".to_string();
|
||||
} else {
|
||||
let message = format!("Delete the following columns?\n\n{}", columns_to_delete.join("\n"));
|
||||
let buttons = vec!["Confirm".to_string(), "Cancel".to_string()];
|
||||
app_state.show_dialog("Confirm Deletion", &message, buttons, DialogPurpose::ConfirmDeleteColumns);
|
||||
}
|
||||
}
|
||||
AddTableFocus::CancelButton => {
|
||||
*command_message = "Action: Cancel Add Table".to_string();
|
||||
|
||||
Reference in New Issue
Block a user