|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
use crate::app::{App, FocusBlock};
|
|
|
|
|
use crate::components::table::RECORDS_LIMIT_PER_PAGE;
|
|
|
|
|
use crate::components::Component as _;
|
|
|
|
|
use crate::event::Key;
|
|
|
|
|
use crate::utils::get_records;
|
|
|
|
|
use database_tree::Database;
|
|
|
|
|
|
|
|
|
|
pub async fn handler(key: Key, app: &mut App) -> anyhow::Result<()> {
|
|
|
|
|
match key {
|
|
|
|
@ -11,7 +14,29 @@ pub async fn handler(key: Key, app: &mut App) -> anyhow::Result<()> {
|
|
|
|
|
app.clipboard.store(text)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
key => app.record_table.event(key)?,
|
|
|
|
|
key => {
|
|
|
|
|
app.record_table.event(key)?;
|
|
|
|
|
if let Some(index) = app.record_table.state.selected() {
|
|
|
|
|
if index == app.record_table.rows.len().saturating_sub(1) {
|
|
|
|
|
if let Some((table, database)) = app.databases.tree().selected_table() {
|
|
|
|
|
let (_, records) = get_records(
|
|
|
|
|
&Database {
|
|
|
|
|
name: database.clone(),
|
|
|
|
|
tables: vec![],
|
|
|
|
|
},
|
|
|
|
|
&table,
|
|
|
|
|
index as u16,
|
|
|
|
|
RECORDS_LIMIT_PER_PAGE,
|
|
|
|
|
app.pool.as_ref().unwrap(),
|
|
|
|
|
)
|
|
|
|
|
.await?;
|
|
|
|
|
if !records.is_empty() {
|
|
|
|
|
app.record_table.rows.extend(records);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|