sync all repos
This commit is contained in:
@@ -18,10 +18,15 @@ impl Workspace {
|
||||
let repo_list = cx.new(|cx| RepoListView::new(window, cx));
|
||||
|
||||
let connected = backend.read(cx).is_connected();
|
||||
let sync_progress = backend.read(cx).sync_progress();
|
||||
|
||||
let subscription = cx.subscribe(&backend, |this, _backend, event, cx| {
|
||||
match event {
|
||||
BackendEvent::Connected => this.status = "Connected".into(),
|
||||
BackendEvent::SyncProgress { total, current } => {
|
||||
this.status = format!("Syncing repositories... {current}/{total}").into()
|
||||
}
|
||||
BackendEvent::Synced => this.status = "Connected".into(),
|
||||
BackendEvent::Error(error) => this.status = error.clone().into(),
|
||||
_ => return,
|
||||
}
|
||||
@@ -30,7 +35,9 @@ impl Workspace {
|
||||
|
||||
Self {
|
||||
active_screen: repo_list.into(),
|
||||
status: if connected {
|
||||
status: if let Some((total, current)) = sync_progress {
|
||||
format!("Syncing repositories... {current}/{total}").into()
|
||||
} else if connected {
|
||||
"Connected".into()
|
||||
} else {
|
||||
"Connecting...".into()
|
||||
|
||||
Reference in New Issue
Block a user