ssh remote: Handle disconnect on project and show overlay (#19014)

Demo:



https://github.com/user-attachments/assets/e5edf8f3-8c15-482e-a792-6eb619f83de4


Release Notes:

- N/A

---------

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-10-10 12:59:09 +02:00 committed by GitHub
parent e3ff2ced79
commit b75532fad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 264 additions and 78 deletions

View file

@ -823,6 +823,10 @@ impl Workspace {
}
}
project::Event::DisconnectedFromSshRemote => {
this.update_window_edited(cx);
}
project::Event::Closed => {
cx.remove_window();
}
@ -1464,6 +1468,10 @@ impl Workspace {
self.on_prompt_for_open_path = Some(prompt)
}
pub fn serialized_ssh_project(&self) -> Option<SerializedSshProject> {
self.serialized_ssh_project.clone()
}
pub fn set_serialized_ssh_project(&mut self, serialized_ssh_project: SerializedSshProject) {
self.serialized_ssh_project = Some(serialized_ssh_project);
}
@ -1791,7 +1799,7 @@ impl Workspace {
mut save_intent: SaveIntent,
cx: &mut ViewContext<Self>,
) -> Task<Result<bool>> {
if self.project.read(cx).is_disconnected() {
if self.project.read(cx).is_disconnected(cx) {
return Task::ready(Ok(true));
}
let dirty_items = self
@ -3447,7 +3455,7 @@ impl Workspace {
}
fn update_window_edited(&mut self, cx: &mut WindowContext) {
let is_edited = !self.project.read(cx).is_disconnected()
let is_edited = !self.project.read(cx).is_disconnected(cx)
&& self
.items(cx)
.any(|item| item.has_conflict(cx) || item.is_dirty(cx));
@ -4858,7 +4866,7 @@ impl Render for Workspace {
.children(self.render_notifications(cx)),
)
.child(self.status_bar.clone())
.children(if self.project.read(cx).is_disconnected() {
.children(if self.project.read(cx).is_disconnected(cx) {
if let Some(render) = self.render_disconnected_overlay.take() {
let result = render(self, cx);
self.render_disconnected_overlay = Some(render);