Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(launchpad): launchpad wallet integration follow up #2304

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions node-launchpad/.config/config.json5
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"<Ctrl-x>": {"StatusActions":"StopNodes"},
"<Ctrl-X>": {"StatusActions":"StopNodes"},
"<Ctrl-Shift-x>": {"StatusActions":"StopNodes"},
"<Ctrl-b>": {"StatusActions":"TriggerBetaProgramme"},
"<Ctrl-B>": {"StatusActions":"TriggerBetaProgramme"},
"<Ctrl-Shift-b>": {"StatusActions":"TriggerBetaProgramme"},
"<Ctrl-b>": {"StatusActions":"TriggerRewardsAddress"},
"<Ctrl-B>": {"StatusActions":"TriggerRewardsAddress"},
"<Ctrl-Shift-b>": {"StatusActions":"TriggerRewardsAddress"},

"up" : {"StatusActions":"PreviousTableItem"},
"down": {"StatusActions":"NextTableItem"},
Expand Down Expand Up @@ -48,9 +48,9 @@
"<Ctrl-p>": {"OptionsActions":"TriggerChangePortRange"},
"<Ctrl-P>": {"OptionsActions":"TriggerChangePortRange"},
"<Ctrl-Shift-p>": {"OptionsActions":"TriggerChangePortRange"},
"<Ctrl-b>": {"OptionsActions":"TriggerBetaProgramme"},
"<Ctrl-B>": {"OptionsActions":"TriggerBetaProgramme"},
"<Ctrl-Shift-b>": {"OptionsActions":"TriggerBetaProgramme"},
"<Ctrl-b>": {"OptionsActions":"TriggerRewardsAddress"},
"<Ctrl-B>": {"OptionsActions":"TriggerRewardsAddress"},
"<Ctrl-Shift-b>": {"OptionsActions":"TriggerRewardsAddress"},
"<Ctrl-l>": {"OptionsActions":"TriggerAccessLogs"},
"<Ctrl-L>": {"OptionsActions":"TriggerAccessLogs"},
"<Ctrl-Shift-l>": {"OptionsActions":"TriggerAccessLogs"},
Expand Down
8 changes: 4 additions & 4 deletions node-launchpad/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum Action {
StoreStorageDrive(PathBuf, String),
StoreConnectionMode(ConnectionMode),
StorePortRange(u32, u32),
StoreDiscordUserName(String),
StoreRewardsAddress(String),
StoreNodesToStart(usize),

Tick,
Expand Down Expand Up @@ -58,7 +58,7 @@ pub enum StatusActions {
NodesStatsObtained(NodeStats),

TriggerManageNodes,
TriggerBetaProgramme,
TriggerRewardsAddress,

PreviousTableItem,
NextTableItem,
Expand All @@ -71,11 +71,11 @@ pub enum OptionsActions {
TriggerChangeDrive,
TriggerChangeConnectionMode,
TriggerChangePortRange,
TriggerBetaProgramme,
TriggerRewardsAddress,
TriggerResetNodes,
TriggerAccessLogs,
UpdateConnectionMode(ConnectionMode),
UpdatePortRange(u32, u32),
UpdateBetaProgrammeUsername(String),
UpdateRewardsAddress(String),
UpdateStorageDrive(PathBuf, String),
}
18 changes: 9 additions & 9 deletions node-launchpad/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use crate::{
help::Help,
options::Options,
popup::{
beta_programme::BetaProgramme, change_drive::ChangeDrivePopup,
connection_mode::ChangeConnectionModePopUp, manage_nodes::ManageNodes,
port_range::PortRangePopUp, reset_nodes::ResetNodesPopup,
change_drive::ChangeDrivePopup, connection_mode::ChangeConnectionModePopUp,
manage_nodes::ManageNodes, port_range::PortRangePopUp, reset_nodes::ResetNodesPopup,
rewards_address::RewardsAddress,
},
status::{Status, StatusConfig},
Component,
Expand Down Expand Up @@ -91,7 +91,7 @@ impl App {
// Main Screens
let status_config = StatusConfig {
allocated_disk_space: app_data.nodes_to_start,
discord_username: app_data.discord_username.clone(),
rewards_address: app_data.discord_username.clone(),
peers_args,
safenode_path,
data_dir_path,
Expand Down Expand Up @@ -119,7 +119,7 @@ impl App {
ChangeDrivePopup::new(storage_mountpoint.clone(), app_data.nodes_to_start)?;
let change_connection_mode = ChangeConnectionModePopUp::new(connection_mode)?;
let port_range = PortRangePopUp::new(connection_mode, port_from, port_to);
let beta_programme = BetaProgramme::new(app_data.discord_username.clone());
let rewards_address = RewardsAddress::new(app_data.discord_username.clone());

Ok(Self {
config,
Expand All @@ -143,7 +143,7 @@ impl App {
Box::new(change_drive),
Box::new(change_connection_mode),
Box::new(port_range),
Box::new(beta_programme),
Box::new(rewards_address),
Box::new(reset_nodes),
Box::new(manage_nodes),
],
Expand Down Expand Up @@ -276,9 +276,9 @@ impl App {
self.app_data.port_to = Some(*to);
self.app_data.save(None)?;
}
Action::StoreDiscordUserName(ref username) => {
debug!("Storing discord username: {username:?}");
self.app_data.discord_username.clone_from(username);
Action::StoreRewardsAddress(ref rewards_address) => {
debug!("Storing rewards address: {rewards_address:?}");
self.app_data.discord_username.clone_from(rewards_address);
self.app_data.save(None)?;
}
Action::StoreNodesToStart(ref count) => {
Expand Down
20 changes: 10 additions & 10 deletions node-launchpad/src/components/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use sn_node_manager::config::get_service_log_dir_path;
pub struct Options {
pub storage_mountpoint: PathBuf,
pub storage_drive: String,
pub discord_username: String,
pub rewards_address: String,
pub connection_mode: ConnectionMode,
pub port_edit: bool,
pub port_from: Option<u32>,
Expand All @@ -41,15 +41,15 @@ impl Options {
pub async fn new(
storage_mountpoint: PathBuf,
storage_drive: String,
discord_username: String,
rewards_address: String,
connection_mode: ConnectionMode,
port_from: Option<u32>,
port_to: Option<u32>,
) -> Result<Self> {
Ok(Self {
storage_mountpoint,
storage_drive,
discord_username,
rewards_address,
connection_mode,
port_edit: false,
port_from,
Expand Down Expand Up @@ -192,7 +192,7 @@ impl Component for Options {
.style(Style::default().fg(GHOST_WHITE));

// Beta Rewards Program
let beta_legend = if self.discord_username.is_empty() {
let beta_legend = if self.rewards_address.is_empty() {
" Add Wallet "
} else {
" Change Wallet "
Expand All @@ -215,7 +215,7 @@ impl Component for Options {
),
Cell::from(
Line::from(vec![Span::styled(
format!(" {} ", self.discord_username),
format!(" {} ", self.rewards_address),
Style::default().fg(VIVID_SKY_BLUE),
)])
.alignment(Alignment::Left),
Expand Down Expand Up @@ -354,7 +354,7 @@ impl Component for Options {
| Scene::ChangeDrivePopUp
| Scene::ChangeConnectionModePopUp
| Scene::ChangePortsPopUp { .. }
| Scene::OptionsBetaProgrammePopUp
| Scene::OptionsRewardsAddressPopUp
| Scene::ResetNodesPopUp => {
self.active = true;
// make sure we're in navigation mode
Expand Down Expand Up @@ -385,11 +385,11 @@ impl Component for Options {
self.port_from = Some(from);
self.port_to = Some(to);
}
OptionsActions::TriggerBetaProgramme => {
return Ok(Some(Action::SwitchScene(Scene::OptionsBetaProgrammePopUp)));
OptionsActions::TriggerRewardsAddress => {
return Ok(Some(Action::SwitchScene(Scene::OptionsRewardsAddressPopUp)));
}
OptionsActions::UpdateBetaProgrammeUsername(username) => {
self.discord_username = username;
OptionsActions::UpdateRewardsAddress(rewards_address) => {
self.rewards_address = rewards_address;
}
OptionsActions::TriggerAccessLogs => {
if let Err(e) = system::open_folder(
Expand Down
2 changes: 1 addition & 1 deletion node-launchpad/src/components/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

pub mod beta_programme;
pub mod change_drive;
pub mod connection_mode;
pub mod manage_nodes;
pub mod port_range;
pub mod reset_nodes;
pub mod rewards_address;
Loading
Loading