Skip to content

Commit

Permalink
feat(launchpad): remove missinformation when upgrading nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzi committed Nov 14, 2024
1 parent 1b348e0 commit 2ebd136
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion node-launchpad/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl App {
let change_connection_mode = ChangeConnectionModePopUp::new(connection_mode)?;
let port_range = PortRangePopUp::new(connection_mode, port_from, port_to);
let rewards_address = RewardsAddress::new(app_data.discord_username.clone());
let upgrade_nodes = UpgradeNodesPopUp::new(app_data.nodes_to_start);
let upgrade_nodes = UpgradeNodesPopUp::new();
let remove_node = RemoveNodePopUp::default();

Ok(Self {
Expand Down
2 changes: 1 addition & 1 deletion node-launchpad/src/components/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ impl Component for Options {
| Scene::ChangePortsPopUp { .. }
| Scene::OptionsRewardsAddressPopUp
| Scene::ResetNodesPopUp
| Scene::UpgradeNodesPopUp { .. } => {
| Scene::UpgradeNodesPopUp => {
self.active = true;
// make sure we're in navigation mode
return Ok(Some(Action::SwitchInputMode(InputMode::Navigation)));
Expand Down
18 changes: 9 additions & 9 deletions node-launchpad/src/components/popup/upgrade_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ use crossterm::event::{KeyCode, KeyEvent};
use ratatui::{prelude::*, widgets::*};

pub struct UpgradeNodesPopUp {
amount_of_nodes: usize,
/// Whether the component is active right now, capturing keystrokes + draw things.
active: bool,
}

impl UpgradeNodesPopUp {
pub fn new(amount_of_nodes: usize) -> Self {
Self {
amount_of_nodes,
active: false,
}
pub fn new() -> Self {
Self { active: false }
}
}

impl Default for UpgradeNodesPopUp {
fn default() -> Self {
Self::new()
}
}

Expand Down Expand Up @@ -134,9 +136,7 @@ impl Component for UpgradeNodesPopUp {
)),
Line::from(Span::styled(
format!(
"Upgrade time ~ {:.1?} mins ({:?} nodes * {:?} secs)",
self.amount_of_nodes * (node_mgmt::FIXED_INTERVAL / 1_000) as usize / 60,
self.amount_of_nodes,
"Upgrade time is {:.1?} seconds per node",
node_mgmt::FIXED_INTERVAL / 1_000,
),
Style::default().fg(LIGHT_PERIWINKLE),
Expand Down

0 comments on commit 2ebd136

Please sign in to comment.