Skip to content

Commit

Permalink
feat: provides error message on connection failure
Browse files Browse the repository at this point in the history
Signed-off-by: AlexsJones <[email protected]>
  • Loading branch information
AlexsJones committed Jan 3, 2025
1 parent 9f55e87 commit 5faa10e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,11 @@ impl eframe::App for MyApp {
// connection status
ui.label("Connection Status:");
if self.is_connected {
ui.label("Connected");
// set color to green
ui.label(egui::RichText::new("Connected").color(egui::Color32::from_rgb(0, 255, 0)));
} else {
ui.label("Disconnected");
// set color to yellow
ui.label(egui::RichText::new("Disconnected").color(egui::Color32::from_rgb(255, 255, 0)));
}

});
Expand Down Expand Up @@ -311,7 +313,15 @@ fn send_req(
filters,
label_selector: "".to_string(),
});
let response = client.unwrap().analyze(request).await.unwrap();
let response = client.unwrap().analyze(request).await;
if response.is_err() {
connect_error_tx
.send("Error connecting to the Kubernetes cluster".to_string())
.unwrap();
loading_tx.send(false).unwrap();
return;
}
let response = response.unwrap();
loading_tx.send(false).unwrap();

response_tx.send(response.into_inner()).unwrap();
Expand Down

0 comments on commit 5faa10e

Please sign in to comment.