fix: db name shows correctly instead of mirroring db uri

This commit is contained in:
əlemi 2022-11-14 01:46:17 +01:00
parent 54c61130f6
commit c1af8a1262
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 4 additions and 1 deletions

View file

@ -23,6 +23,7 @@ pub struct App {
view: AppStateView,
db_uri: String,
db_uri_tx: mpsc::Sender<String>,
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() {

View file

@ -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