feat: add read-only SQLite inspection
This commit is contained in:
+10
-5
@@ -3,6 +3,7 @@ use ratatui::{
|
||||
DefaultTerminal, Frame,
|
||||
layout::{Constraint, Layout},
|
||||
style::{Color, Modifier, Style},
|
||||
text::Line,
|
||||
widgets::{Block, Cell, List, ListItem, ListState, Paragraph, Row, Table, TableState},
|
||||
};
|
||||
|
||||
@@ -152,7 +153,7 @@ impl App {
|
||||
|
||||
fn load_page(&mut self, index: usize) {
|
||||
if let Some(active) = self.active {
|
||||
// ponytail: synchronous reads block input; server timeout is 5s, use a worker if responsiveness matters.
|
||||
// ponytail: synchronous reads block input; use a worker if responsiveness matters.
|
||||
match self.db.page(&self.relations[active], &self.columns, index) {
|
||||
Ok(page) => {
|
||||
self.rows_state =
|
||||
@@ -169,10 +170,10 @@ impl App {
|
||||
fn refresh(&mut self) {
|
||||
match self.db.relations() {
|
||||
Ok(relations) => {
|
||||
let oid = self.active.map(|index| self.relations[index].oid);
|
||||
let id = self.active.map(|index| self.relations[index].id);
|
||||
let selected = relations
|
||||
.iter()
|
||||
.position(|relation| Some(relation.oid) == oid)
|
||||
.position(|relation| Some(relation.id) == id)
|
||||
.or_else(|| (!relations.is_empty()).then_some(0));
|
||||
self.relations = relations;
|
||||
self.selection = ListState::default().with_selected(selected);
|
||||
@@ -199,8 +200,12 @@ impl App {
|
||||
])
|
||||
.areas(area);
|
||||
frame.render_widget(
|
||||
Paragraph::new(" dbdash │ PostgreSQL │ READ ONLY")
|
||||
.style(Style::default().fg(Color::Cyan)),
|
||||
Paragraph::new(Line::from_iter([
|
||||
" dbdash │ ",
|
||||
self.db.name(),
|
||||
" │ READ ONLY",
|
||||
]))
|
||||
.style(Style::default().fg(Color::Cyan)),
|
||||
header,
|
||||
);
|
||||
let [sidebar, content] =
|
||||
|
||||
Reference in New Issue
Block a user