minor navigation fixes for validator tab
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
		
							parent
							
								
									ac67bb4310
								
							
						
					
					
						commit
						9e7cdffd29
					
				| @ -2,7 +2,7 @@ | |||||||
| name = "ghost-eye" | name = "ghost-eye" | ||||||
| authors = ["str3tch <stretch@ghostchain.io>"] | authors = ["str3tch <stretch@ghostchain.io>"] | ||||||
| description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost" | description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost" | ||||||
| version = "0.3.51" | version = "0.3.52" | ||||||
| edition = "2021" | edition = "2021" | ||||||
| homepage = "https://git.ghostchain.io/ghostchain" | homepage = "https://git.ghostchain.io/ghostchain" | ||||||
| repository = "https://git.ghostchain.io/ghostchain/ghost-eye" | repository = "https://git.ghostchain.io/ghostchain/ghost-eye" | ||||||
|  | |||||||
| @ -50,9 +50,14 @@ impl BondPopup { | |||||||
|             palette: StylePalette::default(), |             palette: StylePalette::default(), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| impl BondPopup { |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn log_event(&mut self, message: String, level: ActionLevel) { |     fn log_event(&mut self, message: String, level: ActionLevel) { | ||||||
|         if let Some(action_tx) = &self.action_tx { |         if let Some(action_tx) = &self.action_tx { | ||||||
|             let _ = action_tx.send( |             let _ = action_tx.send( | ||||||
| @ -148,7 +153,7 @@ impl Component for BondPopup { | |||||||
|                 KeyCode::Backspace => self.delete_char(), |                 KeyCode::Backspace => self.delete_char(), | ||||||
|                 KeyCode::Left => self.move_cursor_left(), |                 KeyCode::Left => self.move_cursor_left(), | ||||||
|                 KeyCode::Right => self.move_cursor_right(), |                 KeyCode::Right => self.move_cursor_right(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), 
 | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -41,6 +41,13 @@ impl ChillPopup { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn submit_message(&mut self) { |     fn submit_message(&mut self) { | ||||||
|         if let Some(network_tx) = &self.network_tx { 
 |         if let Some(network_tx) = &self.network_tx { 
 | ||||||
|             let _ = network_tx.send(Action::ChillFrom(self.secret_seed)); |             let _ = network_tx.send(Action::ChillFrom(self.secret_seed)); | ||||||
| @ -85,7 +92,7 @@ impl Component for ChillPopup { | |||||||
|         if self.is_active && key.kind == KeyEventKind::Press { |         if self.is_active && key.kind == KeyEventKind::Press { | ||||||
|             match key.code { |             match key.code { | ||||||
|                 KeyCode::Enter => self.submit_message(), |                 KeyCode::Enter => self.submit_message(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), 
 | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -171,18 +171,10 @@ impl Component for Validator { | |||||||
|                 CurrentTab::UnbondPopup | |                 CurrentTab::UnbondPopup | | ||||||
|                 CurrentTab::RebondPopup | |                 CurrentTab::RebondPopup | | ||||||
|                 CurrentTab::WithdrawPopup | |                 CurrentTab::WithdrawPopup | | ||||||
|                 CurrentTab::PayoutPopup => match key.code { |                 CurrentTab::PayoutPopup => { | ||||||
|                 KeyCode::Esc => { |  | ||||||
|                     self.current_tab = self.previous_tab; |  | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 _ => { |  | ||||||
|                     for component in self.components.iter_mut() { |                     for component in self.components.iter_mut() { | ||||||
|                         component.handle_key_event(key)?; |                         component.handle_key_event(key)?; | ||||||
|                     } |                     } | ||||||
|                 } |  | ||||||
|             }, |             }, | ||||||
|             _ => match key.code { |             _ => match key.code { | ||||||
|                 KeyCode::Esc => { |                 KeyCode::Esc => { | ||||||
| @ -193,86 +185,49 @@ impl Component for Validator { | |||||||
|                     } |                     } | ||||||
|                     return Ok(Some(Action::SetActiveScreen(Mode::Menu))); |                     return Ok(Some(Action::SetActiveScreen(Mode::Menu))); | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('l') | KeyCode::Right => { |  | ||||||
|                     self.move_right(); |  | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 KeyCode::Char('h') | KeyCode::Left => { |  | ||||||
|                     self.move_left(); |  | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 KeyCode::Char('R') => { |                 KeyCode::Char('R') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::RotatePopup; |                     self.current_tab = CurrentTab::RotatePopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('V') => { |                 KeyCode::Char('V') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::ValidatePopup; |                     self.current_tab = CurrentTab::ValidatePopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('U') => { |                 KeyCode::Char('U') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::UnbondPopup; |                     self.current_tab = CurrentTab::UnbondPopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('C') => { |                 KeyCode::Char('C') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::ChillPopup; |                     self.current_tab = CurrentTab::ChillPopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('B') => { |                 KeyCode::Char('B') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::BondPopup; |                     self.current_tab = CurrentTab::BondPopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('E') => { |                 KeyCode::Char('E') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::RebondPopup; |                     self.current_tab = CurrentTab::RebondPopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('W') => { |                 KeyCode::Char('W') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::WithdrawPopup; |                     self.current_tab = CurrentTab::WithdrawPopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('L') => { |                 KeyCode::Char('L') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::ListenAddresses; |                     self.current_tab = CurrentTab::ListenAddresses; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|                 KeyCode::Char('I') => { |                 KeyCode::Char('I') => { | ||||||
|                     self.previous_tab = self.current_tab; |                     self.previous_tab = self.current_tab; | ||||||
|                     self.current_tab = CurrentTab::PayeePopup; |                     self.current_tab = CurrentTab::PayeePopup; | ||||||
|                     for component in self.components.iter_mut() { |  | ||||||
|                         component.set_active(self.current_tab.clone()); |  | ||||||
|                     } |  | ||||||
|                 }, |                 }, | ||||||
|  |                 KeyCode::Char('l') | KeyCode::Right => self.move_right(), | ||||||
|  |                 KeyCode::Char('h') | KeyCode::Left => self.move_left(), | ||||||
|                 _ => { |                 _ => { | ||||||
|                     for component in self.components.iter_mut() { |                     for component in self.components.iter_mut() { | ||||||
|                         component.handle_key_event(key)?; |                         component.handle_key_event(key)?; | ||||||
|                     } |                     } | ||||||
|                 } |                 }, | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         Ok(None) |         Ok(None) | ||||||
| @ -282,15 +237,14 @@ impl Component for Validator { | |||||||
|         match action { |         match action { | ||||||
|             Action::SetActiveScreen(Mode::Validator) => { |             Action::SetActiveScreen(Mode::Validator) => { | ||||||
|                 self.is_active = true; |                 self.is_active = true; | ||||||
|  |                 self.previous_tab = CurrentTab::NominatorsByValidator; | ||||||
|                 self.current_tab = CurrentTab::NominatorsByValidator; |                 self.current_tab = CurrentTab::NominatorsByValidator; | ||||||
|             } |             } | ||||||
|             Action::PayoutValidatorPopup(_, _) => { |             Action::PayoutValidatorPopup(_, _) => { | ||||||
|                 self.previous_tab = self.current_tab; |                 self.previous_tab = self.current_tab; | ||||||
|                 self.current_tab = CurrentTab::PayoutPopup; |                 self.current_tab = CurrentTab::PayoutPopup; | ||||||
|             } |             } | ||||||
|             Action::ClosePopup => { |             Action::ClosePopup => self.current_tab = self.previous_tab, | ||||||
|                 self.current_tab = self.previous_tab; |  | ||||||
|             }, |  | ||||||
|             _ => {}, |             _ => {}, | ||||||
|         } |         } | ||||||
|         for component in self.components.iter_mut() { |         for component in self.components.iter_mut() { | ||||||
|  | |||||||
| @ -52,9 +52,14 @@ impl PayoutPopup { | |||||||
|         self.is_claimed = is_claimed; |         self.is_claimed = is_claimed; | ||||||
|         self.era_index = era_index; 
 |         self.era_index = era_index; 
 | ||||||
|     } |     } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| impl PayoutPopup { |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn start_payout(&mut self) { |     fn start_payout(&mut self) { | ||||||
|         if self.is_claimed { |         if self.is_claimed { | ||||||
|             if let Some(action_tx) = &self.action_tx { |             if let Some(action_tx) = &self.action_tx { | ||||||
| @ -111,7 +116,7 @@ impl Component for PayoutPopup { | |||||||
|         if self.is_active && key.kind == KeyEventKind::Press { |         if self.is_active && key.kind == KeyEventKind::Press { | ||||||
|             match key.code { |             match key.code { | ||||||
|                 KeyCode::Enter => self.start_payout(), |                 KeyCode::Enter => self.start_payout(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), 
 | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -44,9 +44,14 @@ impl RebondPopup { | |||||||
|             palette: StylePalette::default(), |             palette: StylePalette::default(), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| impl RebondPopup { |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn log_event(&mut self, message: String, level: ActionLevel) { |     fn log_event(&mut self, message: String, level: ActionLevel) { | ||||||
|         if let Some(action_tx) = &self.action_tx { |         if let Some(action_tx) = &self.action_tx { | ||||||
|             let _ = action_tx.send( |             let _ = action_tx.send( | ||||||
| @ -137,7 +142,7 @@ impl Component for RebondPopup { | |||||||
|                 KeyCode::Backspace => self.delete_char(), |                 KeyCode::Backspace => self.delete_char(), | ||||||
|                 KeyCode::Left => self.move_cursor_left(), |                 KeyCode::Left => self.move_cursor_left(), | ||||||
|                 KeyCode::Right => self.move_cursor_right(), |                 KeyCode::Right => self.move_cursor_right(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -44,6 +44,13 @@ impl RotatePopup { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn rotate_keys(&mut self) { |     fn rotate_keys(&mut self) { | ||||||
|         if !self.cached_keys.is_empty() && self.cached_keys.len() == 258 { |         if !self.cached_keys.is_empty() && self.cached_keys.len() == 258 { | ||||||
|             if let Some(network_tx) = &self.network_tx { |             if let Some(network_tx) = &self.network_tx { | ||||||
| @ -123,7 +130,7 @@ impl Component for RotatePopup { | |||||||
|         if self.is_active && key.kind == KeyEventKind::Press { |         if self.is_active && key.kind == KeyEventKind::Press { | ||||||
|             match key.code { |             match key.code { | ||||||
|                 KeyCode::Enter => self.rotate_keys(), |                 KeyCode::Enter => self.rotate_keys(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), 
 | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -49,6 +49,13 @@ impl UnbondPopup { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn log_event(&mut self, message: String, level: ActionLevel) { |     fn log_event(&mut self, message: String, level: ActionLevel) { | ||||||
|         if let Some(action_tx) = &self.action_tx { |         if let Some(action_tx) = &self.action_tx { | ||||||
|             let _ = action_tx.send( |             let _ = action_tx.send( | ||||||
| @ -146,7 +153,7 @@ impl Component for UnbondPopup { | |||||||
|                 KeyCode::Backspace => self.delete_char(), |                 KeyCode::Backspace => self.delete_char(), | ||||||
|                 KeyCode::Left => self.move_cursor_left(), |                 KeyCode::Left => self.move_cursor_left(), | ||||||
|                 KeyCode::Right => self.move_cursor_right(), |                 KeyCode::Right => self.move_cursor_right(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), 
 | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -44,9 +44,14 @@ impl ValidatePopup { | |||||||
|             palette: StylePalette::default(), |             palette: StylePalette::default(), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| impl ValidatePopup { |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn log_event(&mut self, message: String, level: ActionLevel) { |     fn log_event(&mut self, message: String, level: ActionLevel) { | ||||||
|         if let Some(action_tx) = &self.action_tx { |         if let Some(action_tx) = &self.action_tx { | ||||||
|             let _ = action_tx.send( |             let _ = action_tx.send( | ||||||
| @ -137,7 +142,7 @@ impl Component for ValidatePopup { | |||||||
|                 KeyCode::Backspace => self.delete_char(), |                 KeyCode::Backspace => self.delete_char(), | ||||||
|                 KeyCode::Left => self.move_cursor_left(), |                 KeyCode::Left => self.move_cursor_left(), | ||||||
|                 KeyCode::Right => self.move_cursor_right(), |                 KeyCode::Right => self.move_cursor_right(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), 
 | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -52,6 +52,13 @@ impl WithdrawPopup { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     fn close_popup(&mut self) { | ||||||
|  |         self.is_active = false; | ||||||
|  |         if let Some(action_tx) = &self.action_tx { | ||||||
|  |             let _ = action_tx.send(Action::ClosePopup); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn stash_should_be_killed(&self) -> bool { |     fn stash_should_be_killed(&self) -> bool { | ||||||
|         self.unlocking_is_empty && self.active_balance < self.existential_deposit |         self.unlocking_is_empty && self.active_balance < self.existential_deposit | ||||||
|     } |     } | ||||||
| @ -112,7 +119,7 @@ impl Component for WithdrawPopup { | |||||||
|         if self.is_active && key.kind == KeyEventKind::Press { |         if self.is_active && key.kind == KeyEventKind::Press { | ||||||
|             match key.code { |             match key.code { | ||||||
|                 KeyCode::Enter => self.proceed(), |                 KeyCode::Enter => self.proceed(), | ||||||
|                 KeyCode::Esc => self.is_active = false, 
 |                 KeyCode::Esc => self.close_popup(), 
 | ||||||
|                 _ => {}, |                 _ => {}, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user