forked from NationTech/harmony
feat: add load balancer score and frontend integration
- Implemented `OKDLoadBalancerScore` and integrated it as a `FrontendScore`. - Added `FrontendScore` trait for TUI displayable scores. - Implemented `Display` for `OKDLoadBalancerScore`. - Updated `ScoreListWidget` to handle `FrontendScore` types. - Included load balancer score in the TUI.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use crossterm::event::{Event, KeyCode, KeyEventKind};
|
||||
use harmony::{score::Score, topology::Topology};
|
||||
use harmony::{modules::okd::load_balancer::OKDLoadBalancerScore, score::Score, topology::{LoadBalancer, Topology}};
|
||||
use log::{info, warn};
|
||||
use ratatui::{
|
||||
layout::Rect, style::{Style, Stylize}, widgets::{List, ListItem, ListState, StatefulWidget, Widget}, Frame
|
||||
@@ -23,10 +23,12 @@ struct Execution<T: Topology> {
|
||||
score: Box<dyn Score<T>>,
|
||||
}
|
||||
|
||||
impl <T: Topology + LoadBalancer> FrontendScore<T> for OKDLoadBalancerScore {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct ScoreListWidget<T: Topology> {
|
||||
list_state: Arc<RwLock<ListState>>,
|
||||
scores: Vec<Box<dyn Score<T>>>,
|
||||
scores: Vec<Box<dyn FrontendScore<T>>>,
|
||||
execution: Option<Execution<T>>,
|
||||
execution_history: Vec<Execution<T>>,
|
||||
sender: mpsc::Sender<HarmonyTuiEvent<T>>,
|
||||
|
||||
Reference in New Issue
Block a user