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