From c1af8a12629557a220ac24d75d04e4c7228d2839 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 14 Nov 2022 01:46:17 +0100 Subject: [PATCH] fix: db name shows correctly instead of mirroring db uri --- src/gui/mod.rs | 4 +++- src/gui/scaffold.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 813d1fc..9f6b9b6 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -23,6 +23,7 @@ pub struct App { view: AppStateView, db_uri: String, db_uri_tx: mpsc::Sender, + last_db_uri: String, interval: i64, last_redraw: i64, @@ -59,6 +60,7 @@ impl App { } Self { db_uri_tx, interval, panels, width_tx, view, logger_view, + last_db_uri: "[disconnected]".into(), db_uri: initial_uri.unwrap_or("".into()), buffer_source: entities::sources::Model::default(), buffer_metric: entities::metrics::Model::default(), @@ -116,7 +118,7 @@ impl eframe::App for App { }); TopBottomPanel::bottom("footer").show(ctx, |ui| { - footer(ctx, ui, self.logger_view.clone(), self.db_uri.clone(), self.view.points.borrow().len()); + footer(ctx, ui, self.logger_view.clone(), self.last_db_uri.clone(), self.view.points.borrow().len()); }); for m in self.editing.iter_mut() { diff --git a/src/gui/scaffold.rs b/src/gui/scaffold.rs index de88c25..b0f292b 100644 --- a/src/gui/scaffold.rs +++ b/src/gui/scaffold.rs @@ -314,6 +314,7 @@ pub fn header(app: &mut App, ui: &mut Ui, frame: &mut Frame) { .show(ui); if ui.button("connect").clicked() { app.update_db_uri(); + app.last_db_uri = app.db_uri.split("/").last().unwrap_or("").to_string(); } ui.separator(); let last_edit = app.edit; // replace panels when going into edit mode