feat: add read-only SQLite inspection

This commit is contained in:
Valdemar Lorenzen
2026-10-19 12:06:25 +02:00
parent c73fa18bf3
commit bbc21f96cf
6 changed files with 460 additions and 43 deletions
+10 -5
View File
@@ -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] =