ssh: Add session state indicator to title bar (#18645)

![image](https://github.com/user-attachments/assets/0ed6f59c-e0e7-49e6-8db7-f09ec5cdf653)
The indicator turns yellow when ssh client is trying to reconnect. Note
that the state tracking is probably not ideal (we'll see how it pans out
once we start dog-fooding), but at the very least "green=good" should be
a decent mental model for now.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-10-03 00:35:56 +02:00 committed by GitHub
parent e2d613a803
commit 19b186671b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 66 additions and 5 deletions

View file

@ -1217,7 +1217,10 @@ impl Project {
server.ssh_connection_string.is_some()
}
pub fn ssh_connection_string(&self, cx: &ModelContext<Self>) -> Option<SharedString> {
pub fn ssh_connection_string(&self, cx: &AppContext) -> Option<SharedString> {
if let Some(ssh_state) = &self.ssh_client {
return Some(ssh_state.connection_string().into());
}
let dev_server_id = self.dev_server_project_id()?;
dev_server_projects::Store::global(cx)
.read(cx)
@ -1226,6 +1229,10 @@ impl Project {
.clone()
}
pub fn ssh_is_connected(&self) -> Option<bool> {
Some(!self.ssh_client.as_ref()?.is_reconnect_underway())
}
pub fn replica_id(&self) -> ReplicaId {
match self.client_state {
ProjectClientState::Remote { replica_id, .. } => replica_id,