|
|
|
@ -5,14 +5,13 @@ use crate::utils::{get_columns, get_records};
|
|
|
|
|
use database_tree::Database;
|
|
|
|
|
|
|
|
|
|
pub async fn handler(key: Key, app: &mut App) -> anyhow::Result<()> {
|
|
|
|
|
app.databases.event(key)?;
|
|
|
|
|
match key {
|
|
|
|
|
Key::Esc => app.focus_block = FocusBlock::DabataseList,
|
|
|
|
|
Key::Right => app.focus_block = FocusBlock::RecordTable,
|
|
|
|
|
Key::Right => app.focus_block = FocusBlock::Table,
|
|
|
|
|
Key::Char('c') => app.focus_block = FocusBlock::ConnectionList,
|
|
|
|
|
Key::Enter => {
|
|
|
|
|
if let Some((table, database)) = app.databases.tree.selected_table() {
|
|
|
|
|
app.focus_block = FocusBlock::RecordTable;
|
|
|
|
|
app.focus_block = FocusBlock::Table;
|
|
|
|
|
let (headers, records) = get_records(
|
|
|
|
|
&Database {
|
|
|
|
|
name: database.clone(),
|
|
|
|
@ -36,7 +35,7 @@ pub async fn handler(key: Key, app: &mut App) -> anyhow::Result<()> {
|
|
|
|
|
app.structure_table.reset(headers, records);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_ => (),
|
|
|
|
|
key => app.databases.event(key)?,
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|