WIP: fix(tui): update ui when push next or main finishes
Removes the artificial pause while we wait for any CI to start before checking the CI status. Closes kemitix/git-next#160
This commit is contained in:
parent
35c2057f05
commit
896c9aa54a
4 changed files with 21 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
use git_next_core::RepoConfigSource;
|
use git_next_core::{git, RepoConfigSource};
|
||||||
|
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
|
@ -35,18 +35,20 @@ impl Handler<AdvanceMain> for RepoActor {
|
||||||
commit: commit.clone(),
|
commit: commit.clone(),
|
||||||
});
|
});
|
||||||
|
|
||||||
match advance_main(commit, &repo_details, &repo_config, &**open_repository) {
|
if let Err(err) = advance_main(commit, &repo_details, &repo_config, &**open_repository) {
|
||||||
Err(err) => {
|
warn!("advance main: {err}");
|
||||||
warn!("advance main: {err}");
|
self.alert_tui(format!("advance main: {err}"));
|
||||||
}
|
} else {
|
||||||
Ok(()) => match repo_config.source() {
|
self.update_tui(RepoUpdate::MainUpdated);
|
||||||
|
self.update_tui_log(git::graph::log(&self.repo_details));
|
||||||
|
match repo_config.source() {
|
||||||
RepoConfigSource::Repo => {
|
RepoConfigSource::Repo => {
|
||||||
do_send(&addr, LoadConfigFromRepo, self.log.as_ref());
|
do_send(&addr, LoadConfigFromRepo, self.log.as_ref());
|
||||||
}
|
}
|
||||||
RepoConfigSource::Server => {
|
RepoConfigSource::Server => {
|
||||||
do_send(&addr, ValidateRepo::new(message_token), self.log.as_ref());
|
do_send(&addr, ValidateRepo::new(message_token), self.log.as_ref());
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//
|
//
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
|
use git_next_core::git;
|
||||||
use tracing::{warn, Instrument};
|
use tracing::{warn, Instrument};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -49,7 +50,9 @@ impl Handler<AdvanceNext> for RepoActor {
|
||||||
self.message_token,
|
self.message_token,
|
||||||
) {
|
) {
|
||||||
Ok(message_token) => {
|
Ok(message_token) => {
|
||||||
// pause to allow any CI checks to be started
|
self.update_tui(RepoUpdate::NextUpdated);
|
||||||
|
self.update_tui_log(git::graph::log(&self.repo_details));
|
||||||
|
// INFO: pause to allow any CI checks to be started
|
||||||
let sleep_duration = self.sleep_duration;
|
let sleep_duration = self.sleep_duration;
|
||||||
let log = self.log.clone();
|
let log = self.log.clone();
|
||||||
async move {
|
async move {
|
||||||
|
|
|
@ -92,6 +92,8 @@ pub enum RepoUpdate {
|
||||||
},
|
},
|
||||||
RegisteredWebhook,
|
RegisteredWebhook,
|
||||||
Opened,
|
Opened,
|
||||||
|
NextUpdated,
|
||||||
|
MainUpdated,
|
||||||
}
|
}
|
||||||
|
|
||||||
message!(
|
message!(
|
||||||
|
|
|
@ -58,10 +58,16 @@ impl Handler<ServerUpdate> for Tui {
|
||||||
repo_state
|
repo_state
|
||||||
.update_message(format!("advancing next to {commit}"), ACTING);
|
.update_message(format!("advancing next to {commit}"), ACTING);
|
||||||
}
|
}
|
||||||
|
RepoUpdate::NextUpdated => {
|
||||||
|
repo_state.update_message("next updated - pause while CI starts", OKAY);
|
||||||
|
}
|
||||||
RepoUpdate::AdvancingMain { commit } => {
|
RepoUpdate::AdvancingMain { commit } => {
|
||||||
repo_state
|
repo_state
|
||||||
.update_message(format!("advancing main to {commit}"), ACTING);
|
.update_message(format!("advancing main to {commit}"), ACTING);
|
||||||
}
|
}
|
||||||
|
RepoUpdate::MainUpdated => {
|
||||||
|
repo_state.update_message("main updated", OKAY);
|
||||||
|
}
|
||||||
RepoUpdate::Opening => {
|
RepoUpdate::Opening => {
|
||||||
repo_state.update_message("opening...", PREP);
|
repo_state.update_message("opening...", PREP);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue