Skip to content

Commit

Permalink
feat(launchpad): display launchpad and node version strings
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin authored and joshuef committed Jun 25, 2024
1 parent 7d2f3de commit 43976b9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions node-launchpad/src/components/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct Home {
action_sender: Option<UnboundedSender<Action>>,
config: Config,
// state
launchpad_version_str: String,
node_services: Vec<NodeServiceData>,
is_nat_status_determined: bool,
error_while_running_nat_detection: usize,
Expand Down Expand Up @@ -75,11 +76,13 @@ impl Home {
peers_args: PeersArgs,
safenode_path: Option<PathBuf>,
) -> Result<Self> {
let version_str = env!("CARGO_PKG_VERSION");
let mut home = Self {
peers_args,
action_sender: Default::default(),
config: Default::default(),
active: true,
launchpad_version_str: version_str.to_string(),
node_services: Default::default(),
is_nat_status_determined: false,
error_while_running_nat_detection: 0,
Expand Down Expand Up @@ -394,10 +397,14 @@ impl Component for Home {
vec![Constraint::Min(40), Constraint::Fill(20)],
)
.split(layer_zero[0]);

f.render_widget(
Paragraph::new("Autonomi Node Launchpad")
.alignment(Alignment::Left)
.fg(LIGHT_PERIWINKLE),
Paragraph::new(format!(
"Autonomi Node Launchpad (v{})",
self.launchpad_version_str
))
.alignment(Alignment::Left)
.fg(LIGHT_PERIWINKLE),
layer_one_header[0],
);
let discord_user_name_text = if self.discord_username.is_empty() {
Expand Down Expand Up @@ -493,8 +500,9 @@ impl Component for Home {
}
let peer_id = peer_id.map(|p| p.to_string()).unwrap_or("-".to_string());
let status = format!("{:?}", n.status);
let version = format!("v{}", n.version);

let row = vec![n.service_name.clone(), peer_id, status];
let row = vec![n.service_name.clone(), peer_id, version, status];
let row_style = if n.status == ServiceStatus::Running {
Style::default().fg(EUCALYPTUS)
} else {
Expand Down Expand Up @@ -522,6 +530,7 @@ impl Component for Home {
let node_widths = [
Constraint::Max(15),
Constraint::Min(30),
Constraint::Max(20),
Constraint::Max(10),
];
let table = Table::new(node_rows, node_widths)
Expand Down

0 comments on commit 43976b9

Please sign in to comment.