feat: show connection details in status bar
This commit is contained in:
+4
-1
@@ -20,6 +20,7 @@ use crate::{
|
||||
pub fn run(terminal: &mut DefaultTerminal, initial: Option<Database>) -> Result<()> {
|
||||
let mut profiles = Profiles::open(&config_path()?)?;
|
||||
let mut browser = initial.map(App::new).transpose()?;
|
||||
let mut connection_label: Option<String> = None;
|
||||
let mut selection =
|
||||
ListState::default().with_selected((!profiles.entries.is_empty()).then_some(0));
|
||||
let mut focus = Focus::Explorer;
|
||||
@@ -52,7 +53,7 @@ pub fn run(terminal: &mut DefaultTerminal, initial: Option<Database>) -> Result<
|
||||
info.is_none() && focus == Focus::Query
|
||||
&& browser.as_ref().is_some_and(App::query_insert_mode)
|
||||
};
|
||||
let name = browser.as_ref().map_or("Not connected", App::database_name);
|
||||
let name = connection_label.as_deref().unwrap_or_else(|| browser.as_ref().map_or("Not connected", App::database_name));
|
||||
draw_bars(frame, top, bottom, browser.as_ref().map_or("—", App::provider), name, insert, position);
|
||||
let [sidebar, content] = Layout::horizontal([Constraint::Length(32), Constraint::Min(1)])
|
||||
.areas(workspace);
|
||||
@@ -132,6 +133,7 @@ pub fn run(terminal: &mut DefaultTerminal, initial: Option<Database>) -> Result<
|
||||
})
|
||||
.map(|connected| {
|
||||
browser = Some(connected);
|
||||
connection_label = Some(form.label());
|
||||
active =
|
||||
selection.selected().and_then(|index| {
|
||||
match entries[index] {
|
||||
@@ -241,6 +243,7 @@ pub fn run(terminal: &mut DefaultTerminal, initial: Option<Database>) -> Result<
|
||||
match form.connect().and_then(App::new) {
|
||||
Ok(connected) => {
|
||||
browser = Some(connected);
|
||||
connection_label = Some(form.label());
|
||||
active = Some(index);
|
||||
selection.select(Some(index));
|
||||
expanded = true;
|
||||
|
||||
@@ -52,6 +52,8 @@ Navigation:
|
||||
Keybindings float above the workspace; Up/Down/jk scroll, Home/End/g/G jump.
|
||||
Query Insert mode and connection/password fields keep ? as literal text.
|
||||
Full-width bars show dbdash/READ ONLY above and mode/database below.
|
||||
Saved PostgreSQL connections show database · user@host:port beside the mode,
|
||||
matching the sidebar; passwords are never included.
|
||||
The database provider sits immediately left of the bottom-right position badge.
|
||||
Only badges have colored backgrounds; the remaining bar area uses terminal defaults.
|
||||
Focused inputs show one-based line:column (Unicode characters, not screen cells).
|
||||
|
||||
Reference in New Issue
Block a user