feat: show connection details in status bar
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
- [ ] feature: ability to give the connection configs a custom name (control how they're displayed in the sidebar)
|
- [ ] feature: ability to give the connection configs a custom name (control how they're displayed in the sidebar)
|
||||||
|
- [ ] feature: ability to remove a database connection
|
||||||
- [ ] feature: line numbers in gutter of sql editor
|
- [ ] feature: line numbers in gutter of sql editor
|
||||||
+4
-1
@@ -20,6 +20,7 @@ use crate::{
|
|||||||
pub fn run(terminal: &mut DefaultTerminal, initial: Option<Database>) -> Result<()> {
|
pub fn run(terminal: &mut DefaultTerminal, initial: Option<Database>) -> Result<()> {
|
||||||
let mut profiles = Profiles::open(&config_path()?)?;
|
let mut profiles = Profiles::open(&config_path()?)?;
|
||||||
let mut browser = initial.map(App::new).transpose()?;
|
let mut browser = initial.map(App::new).transpose()?;
|
||||||
|
let mut connection_label: Option<String> = None;
|
||||||
let mut selection =
|
let mut selection =
|
||||||
ListState::default().with_selected((!profiles.entries.is_empty()).then_some(0));
|
ListState::default().with_selected((!profiles.entries.is_empty()).then_some(0));
|
||||||
let mut focus = Focus::Explorer;
|
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
|
info.is_none() && focus == Focus::Query
|
||||||
&& browser.as_ref().is_some_and(App::query_insert_mode)
|
&& 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);
|
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)])
|
let [sidebar, content] = Layout::horizontal([Constraint::Length(32), Constraint::Min(1)])
|
||||||
.areas(workspace);
|
.areas(workspace);
|
||||||
@@ -132,6 +133,7 @@ pub fn run(terminal: &mut DefaultTerminal, initial: Option<Database>) -> Result<
|
|||||||
})
|
})
|
||||||
.map(|connected| {
|
.map(|connected| {
|
||||||
browser = Some(connected);
|
browser = Some(connected);
|
||||||
|
connection_label = Some(form.label());
|
||||||
active =
|
active =
|
||||||
selection.selected().and_then(|index| {
|
selection.selected().and_then(|index| {
|
||||||
match entries[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) {
|
match form.connect().and_then(App::new) {
|
||||||
Ok(connected) => {
|
Ok(connected) => {
|
||||||
browser = Some(connected);
|
browser = Some(connected);
|
||||||
|
connection_label = Some(form.label());
|
||||||
active = Some(index);
|
active = Some(index);
|
||||||
selection.select(Some(index));
|
selection.select(Some(index));
|
||||||
expanded = true;
|
expanded = true;
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ Navigation:
|
|||||||
Keybindings float above the workspace; Up/Down/jk scroll, Home/End/g/G jump.
|
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.
|
Query Insert mode and connection/password fields keep ? as literal text.
|
||||||
Full-width bars show dbdash/READ ONLY above and mode/database below.
|
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.
|
The database provider sits immediately left of the bottom-right position badge.
|
||||||
Only badges have colored backgrounds; the remaining bar area uses terminal defaults.
|
Only badges have colored backgrounds; the remaining bar area uses terminal defaults.
|
||||||
Focused inputs show one-based line:column (Unicode characters, not screen cells).
|
Focused inputs show one-based line:column (Unicode characters, not screen cells).
|
||||||
|
|||||||
Reference in New Issue
Block a user