feat: Improve output of tui. From p-r tui-score-info (#11)
WIP: formatted score debug print into a table with a name header and the score information below Co-authored-by: Jean-Gabriel Gill-Couture <jg@nationtech.io> Reviewed-on: #11 Reviewed-by: johnride <jg@nationtech.io> Co-authored-by: Willem <wrolleman@nationtech.io> Co-committed-by: Willem <wrolleman@nationtech.io>
This commit is contained in:
@@ -8,7 +8,7 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
harmony = { path = "../../harmony" }
|
||||
#harmony_tui = { path = "../../harmony_tui" }
|
||||
harmony_tui = { path = "../../harmony_tui" }
|
||||
harmony_types = { path = "../../harmony_types" }
|
||||
cidr = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use harmony::{
|
||||
data::Version,
|
||||
inventory::Inventory,
|
||||
maestro::Maestro,
|
||||
modules::lamp::{LAMPConfig, LAMPScore},
|
||||
topology::{HAClusterTopology, Url},
|
||||
@@ -17,8 +18,9 @@ async fn main() {
|
||||
},
|
||||
};
|
||||
|
||||
Maestro::<HAClusterTopology>::load_from_env()
|
||||
.interpret(Box::new(lamp_stack))
|
||||
.await
|
||||
.unwrap();
|
||||
let inventory = Inventory::autoload();
|
||||
let topology = HAClusterTopology::autoload();
|
||||
let mut maestro = Maestro::new(inventory, topology);
|
||||
maestro.register_all(vec![Box::new(lamp_stack)]);
|
||||
harmony_tui::init(maestro).await.unwrap();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
use std::net::{SocketAddr, SocketAddrV4};
|
||||
|
||||
use harmony::{
|
||||
inventory::Inventory,
|
||||
maestro::Maestro,
|
||||
modules::dummy::{ErrorScore, PanicScore, SuccessScore},
|
||||
topology::HAClusterTopology,
|
||||
modules::{
|
||||
dns::DnsScore,
|
||||
dummy::{ErrorScore, PanicScore, SuccessScore},
|
||||
load_balancer::LoadBalancerScore,
|
||||
okd::load_balancer::OKDLoadBalancerScore,
|
||||
},
|
||||
topology::{
|
||||
BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode,
|
||||
LoadBalancerService,
|
||||
},
|
||||
};
|
||||
use harmony_macros::ipv4;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
@@ -11,10 +22,52 @@ async fn main() {
|
||||
let topology = HAClusterTopology::autoload();
|
||||
let mut maestro = Maestro::new(inventory, topology);
|
||||
|
||||
|
||||
maestro.register_all(vec![
|
||||
Box::new(SuccessScore {}),
|
||||
Box::new(ErrorScore {}),
|
||||
Box::new(PanicScore {}),
|
||||
Box::new(DnsScore::new(vec![], None)),
|
||||
Box::new(build_large_score()),
|
||||
]);
|
||||
harmony_tui::init(maestro).await.unwrap();
|
||||
}
|
||||
|
||||
fn build_large_score() -> LoadBalancerScore {
|
||||
let backend_server = BackendServer {
|
||||
address: "192.168.0.0".to_string(),
|
||||
port: 342,
|
||||
};
|
||||
let lb_service = LoadBalancerService {
|
||||
backend_servers: vec![
|
||||
backend_server.clone(),
|
||||
backend_server.clone(),
|
||||
backend_server.clone(),
|
||||
],
|
||||
listening_port: SocketAddr::V4(SocketAddrV4::new(ipv4!("192.168.0.0"), 49387)),
|
||||
health_check: Some(HealthCheck::HTTP(
|
||||
"/some_long_ass_path_to_see_how_it_is_displayed_but_it_has_to_be_even_longer"
|
||||
.to_string(),
|
||||
HttpMethod::GET,
|
||||
HttpStatusCode::Success2xx,
|
||||
)),
|
||||
};
|
||||
LoadBalancerScore {
|
||||
public_services: vec![
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
],
|
||||
private_services: vec![
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
lb_service.clone(),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user