Compare commits
2 commits
263cb6d3f1
...
bd6b0b2d31
Author | SHA1 | Date | |
---|---|---|---|
bd6b0b2d31 | |||
7a4f9a45a6 |
6 changed files with 19 additions and 10 deletions
|
@ -18,22 +18,26 @@ impl Handler<CloneRepo> for RepoActor {
|
|||
#[instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self.repo_details))]
|
||||
fn handle(&mut self, _msg: CloneRepo, ctx: &mut Self::Context) -> Self::Result {
|
||||
logger(self.log.as_ref(), "Handler: CloneRepo: start");
|
||||
self.update_tui(RepoUpdate::Cloning);
|
||||
self.update_tui(RepoUpdate::Opening);
|
||||
debug!("Handler: CloneRepo: start");
|
||||
match git::repository::open(&*self.repository_factory, &self.repo_details) {
|
||||
Ok(repository) => {
|
||||
logger(self.log.as_ref(), "open okay");
|
||||
debug!("open okay");
|
||||
self.update_tui(RepoUpdate::Opened);
|
||||
self.open_repository.replace(repository);
|
||||
if self.repo_details.repo_config.is_none() {
|
||||
self.update_tui(RepoUpdate::LoadingConfigFromRepo);
|
||||
do_send(&ctx.address(), LoadConfigFromRepo, self.log.as_ref());
|
||||
} else {
|
||||
self.update_tui(RepoUpdate::RegisteringWebhook);
|
||||
do_send(&ctx.address(), RegisterWebhook::new(), self.log.as_ref());
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
logger(self.log.as_ref(), "open failed");
|
||||
warn!("Could not open repo: {err:?}");
|
||||
self.alert_tui(err.to_string());
|
||||
}
|
||||
}
|
||||
debug!("Handler: CloneRepo: finish");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
use actix::prelude::*;
|
||||
|
||||
use tracing::{debug, Instrument as _};
|
||||
use tracing::{debug, error, Instrument as _};
|
||||
|
||||
use crate::{
|
||||
repo::{
|
||||
|
@ -33,7 +33,7 @@ impl Handler<RegisterWebhook> for RepoActor {
|
|||
async move {
|
||||
match forge.register_webhook(&repo_listen_url).await {
|
||||
Ok(registered_webhook) => {
|
||||
debug!(?registered_webhook, "");
|
||||
debug!(?registered_webhook, "webhook registered");
|
||||
do_send(
|
||||
&addr,
|
||||
WebhookRegistered::from(registered_webhook),
|
||||
|
@ -41,6 +41,7 @@ impl Handler<RegisterWebhook> for RepoActor {
|
|||
);
|
||||
}
|
||||
Err(err) => {
|
||||
error!(?err, "failed to register webhook");
|
||||
notify_user(
|
||||
notify_user_recipient.as_ref(),
|
||||
UserNotification::WebhookRegistration {
|
||||
|
@ -56,6 +57,8 @@ impl Handler<RegisterWebhook> for RepoActor {
|
|||
.in_current_span()
|
||||
.into_actor(self)
|
||||
.wait(ctx);
|
||||
} else {
|
||||
self.alert_tui("already have a webhook id - cant register webhook");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ pub enum RepoUpdate {
|
|||
AdvancingMain {
|
||||
commit: git::Commit,
|
||||
},
|
||||
Cloning,
|
||||
Opening,
|
||||
LoadingConfigFromRepo,
|
||||
ReceiveCIStatus {
|
||||
status: Status,
|
||||
|
@ -88,6 +88,7 @@ pub enum RepoUpdate {
|
|||
push: Push,
|
||||
},
|
||||
RegisteredWebhook,
|
||||
Opened,
|
||||
}
|
||||
|
||||
message!(
|
||||
|
|
|
@ -56,8 +56,11 @@ impl Handler<ServerUpdate> for Tui {
|
|||
RepoUpdate::AdvancingMain { commit } => {
|
||||
repo_state.update_message(format!("advancing main to {commit}"));
|
||||
}
|
||||
RepoUpdate::Cloning => {
|
||||
repo_state.update_message("cloning...");
|
||||
RepoUpdate::Opening => {
|
||||
repo_state.update_message("opening...");
|
||||
}
|
||||
RepoUpdate::Opened => {
|
||||
repo_state.update_message("opened");
|
||||
}
|
||||
RepoUpdate::LoadingConfigFromRepo => {
|
||||
repo_state.update_message("loading config from repo...");
|
||||
|
|
|
@ -5,11 +5,9 @@ use ratatui::{
|
|||
buffer::Buffer,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::{Line, Text},
|
||||
widgets::{Paragraph, Widget},
|
||||
widgets::Widget,
|
||||
};
|
||||
|
||||
use crate::trace_dbg;
|
||||
|
||||
pub struct ConfiguredRepoWidget<'a> {
|
||||
pub repo_alias: &'a RepoAlias,
|
||||
pub message: &'a str,
|
||||
|
|
|
@ -35,7 +35,7 @@ pub async fn register(
|
|||
"active": true,
|
||||
"events": ["push"],
|
||||
"config": {
|
||||
"url": repo_listen_url.as_ref(),
|
||||
"url": repo_listen_url.to_string(),
|
||||
"content_type": "json",
|
||||
"secret": authorisation.to_string(),
|
||||
"insecure_ssl": "0",
|
||||
|
|
Loading…
Reference in a new issue