mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-13 01:03:54 +01:00
ui + config: modals content drawing refactoring, move connections config to separate file
This commit is contained in:
@@ -12,16 +12,17 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Ui, Widget};
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CLOCK_COUNTDOWN, GRAPH, TIMER, WATCH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, ModalPosition, View};
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::node::NodeConfig;
|
||||
|
||||
/// Dandelion setup ui section.
|
||||
/// Dandelion server setup section content.
|
||||
pub struct DandelionSetup {
|
||||
/// Epoch duration value in seconds.
|
||||
epoch_edit: String,
|
||||
@@ -34,30 +35,62 @@ pub struct DandelionSetup {
|
||||
|
||||
/// Stem phase probability value (stem 90% of the time, fluff 10% of the time by default).
|
||||
stem_prob_edit: String,
|
||||
|
||||
/// [`Modal`] identifiers allowed at this ui container.
|
||||
modal_ids: Vec<&'static str>,
|
||||
}
|
||||
|
||||
/// Identifier epoch duration value [`Modal`].
|
||||
pub const EPOCH_MODAL: &'static str = "epoch_secs";
|
||||
/// Identifier for embargo expiration time value [`Modal`].
|
||||
pub const EMBARGO_MODAL: &'static str = "embargo_secs";
|
||||
/// Identifier for aggregation period value [`Modal`].
|
||||
pub const AGGREGATION_MODAL: &'static str = "aggregation_secs";
|
||||
/// Identifier for Stem phase probability value [`Modal`].
|
||||
pub const STEM_PROBABILITY_MODAL: &'static str = "stem_probability";
|
||||
|
||||
impl Default for DandelionSetup {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
epoch_edit: NodeConfig::get_dandelion_epoch(),
|
||||
embargo_edit: NodeConfig::get_reorg_cache_period(),
|
||||
aggregation_edit: NodeConfig::get_dandelion_aggregation(),
|
||||
stem_prob_edit: NodeConfig::get_stem_probability()
|
||||
stem_prob_edit: NodeConfig::get_stem_probability(),
|
||||
modal_ids: vec![
|
||||
EPOCH_MODAL,
|
||||
EMBARGO_MODAL,
|
||||
AGGREGATION_MODAL,
|
||||
STEM_PROBABILITY_MODAL
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModalContainer for DandelionSetup {
|
||||
fn modal_ids(&self) -> &Vec<&'static str> {
|
||||
&self.modal_ids
|
||||
}
|
||||
|
||||
fn modal_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
_: &mut eframe::Frame,
|
||||
modal: &Modal,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
match modal.id {
|
||||
EPOCH_MODAL => self.epoch_modal(ui, modal, cb),
|
||||
EMBARGO_MODAL => self.embargo_modal(ui, modal, cb),
|
||||
AGGREGATION_MODAL => self.aggregation_modal(ui, modal, cb),
|
||||
STEM_PROBABILITY_MODAL => self.stem_prob_modal(ui, modal, cb),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DandelionSetup {
|
||||
/// Identifier epoch duration value [`Modal`].
|
||||
pub const EPOCH_MODAL: &'static str = "epoch_secs";
|
||||
/// Identifier for embargo expiration time value [`Modal`].
|
||||
pub const EMBARGO_MODAL: &'static str = "embargo_secs";
|
||||
/// Identifier for aggregation period value [`Modal`].
|
||||
pub const AGGREGATION_MODAL: &'static str = "aggregation_secs";
|
||||
/// Identifier for Stem phase probability value [`Modal`].
|
||||
pub const STEM_PROBABILITY_MODAL: &'static str = "stem_probability";
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) {
|
||||
// Draw modal content for current ui container.
|
||||
self.current_modal_ui(ui, frame, cb);
|
||||
|
||||
pub fn ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
View::sub_title(ui, format!("{} {}", GRAPH, "Dandelion"));
|
||||
View::horizontal_line(ui, Colors::STROKE);
|
||||
ui.add_space(6.0);
|
||||
@@ -101,7 +134,7 @@ impl DandelionSetup {
|
||||
}
|
||||
|
||||
/// Draw epoch duration setup content.
|
||||
fn epoch_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn epoch_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.epoch_duration"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -113,7 +146,7 @@ impl DandelionSetup {
|
||||
// Setup values for modal.
|
||||
self.epoch_edit = epoch;
|
||||
// Show epoch setup modal.
|
||||
Modal::new(Self::EPOCH_MODAL)
|
||||
Modal::new(EPOCH_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -123,7 +156,7 @@ impl DandelionSetup {
|
||||
}
|
||||
|
||||
/// Draw epoch duration [`Modal`] content.
|
||||
pub fn epoch_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn epoch_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.epoch_duration"))
|
||||
@@ -186,7 +219,7 @@ impl DandelionSetup {
|
||||
}
|
||||
|
||||
/// Draw embargo expiration time setup content.
|
||||
fn embargo_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn embargo_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.embargo_timer"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -198,16 +231,17 @@ impl DandelionSetup {
|
||||
// Setup values for modal.
|
||||
self.embargo_edit = embargo;
|
||||
// Show embargo setup modal.
|
||||
Modal::new(Self::EMBARGO_MODAL)
|
||||
Modal::new(EMBARGO_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
cb.show_keyboard();
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
|
||||
/// Draw epoch duration [`Modal`] content.
|
||||
pub fn embargo_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn embargo_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.embargo_timer"))
|
||||
@@ -270,7 +304,7 @@ impl DandelionSetup {
|
||||
}
|
||||
|
||||
/// Draw aggregation period setup content.
|
||||
fn aggregation_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn aggregation_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.aggregation_period"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -282,7 +316,7 @@ impl DandelionSetup {
|
||||
// Setup values for modal.
|
||||
self.aggregation_edit = agg;
|
||||
// Show aggregation setup modal.
|
||||
Modal::new(Self::AGGREGATION_MODAL)
|
||||
Modal::new(AGGREGATION_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -292,7 +326,7 @@ impl DandelionSetup {
|
||||
}
|
||||
|
||||
/// Draw aggregation period [`Modal`] content.
|
||||
pub fn aggregation_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn aggregation_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.aggregation_period"))
|
||||
@@ -355,7 +389,7 @@ impl DandelionSetup {
|
||||
}
|
||||
|
||||
/// Draw stem phase probability setup content.
|
||||
fn stem_prob_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn stem_prob_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.stem_probability"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -367,7 +401,7 @@ impl DandelionSetup {
|
||||
// Setup values for modal.
|
||||
self.stem_prob_edit = stem_prob;
|
||||
// Show stem probability setup modal.
|
||||
Modal::new(Self::STEM_PROBABILITY_MODAL)
|
||||
Modal::new(STEM_PROBABILITY_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -377,7 +411,7 @@ impl DandelionSetup {
|
||||
}
|
||||
|
||||
/// Draw stem phase probability [`Modal`] content.
|
||||
pub fn stem_prob_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn stem_prob_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.stem_probability"))
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Ui, Widget};
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
use egui_extras::{Size, StripBuilder};
|
||||
use grin_core::global::ChainTypes;
|
||||
|
||||
@@ -20,11 +20,12 @@ use crate::AppConfig;
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CLIPBOARD_TEXT, CLOCK_CLOCKWISE, COMPUTER_TOWER, COPY, PLUG, POWER, SHIELD, SHIELD_SLASH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, ModalPosition, NetworkContent, View};
|
||||
use crate::gui::views::{Modal, NetworkContent, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::node::{Node, NodeConfig};
|
||||
|
||||
/// Integrated node server setup ui section.
|
||||
/// Integrated node general setup section content.
|
||||
pub struct NodeSetup {
|
||||
/// IP Addresses available at system.
|
||||
available_ips: Vec<String>,
|
||||
@@ -42,8 +43,20 @@ pub struct NodeSetup {
|
||||
|
||||
/// Future Time Limit value.
|
||||
ftl_edit: String,
|
||||
|
||||
/// [`Modal`] identifiers allowed at this ui container.
|
||||
modal_ids: Vec<&'static str>
|
||||
}
|
||||
|
||||
/// Identifier for API port value [`Modal`].
|
||||
pub const API_PORT_MODAL: &'static str = "api_port";
|
||||
/// Identifier for API secret value [`Modal`].
|
||||
pub const API_SECRET_MODAL: &'static str = "api_secret";
|
||||
/// Identifier for Foreign API secret value [`Modal`].
|
||||
pub const FOREIGN_API_SECRET_MODAL: &'static str = "foreign_api_secret";
|
||||
/// Identifier for FTL value [`Modal`].
|
||||
pub const FTL_MODAL: &'static str = "ftl";
|
||||
|
||||
impl Default for NodeSetup {
|
||||
fn default() -> Self {
|
||||
let (api_ip, api_port) = NodeConfig::get_api_ip_port();
|
||||
@@ -55,17 +68,41 @@ impl Default for NodeSetup {
|
||||
is_api_port_available,
|
||||
secret_edit: "".to_string(),
|
||||
ftl_edit: NodeConfig::get_ftl(),
|
||||
modal_ids: vec![
|
||||
API_PORT_MODAL,
|
||||
API_SECRET_MODAL,
|
||||
FOREIGN_API_SECRET_MODAL,
|
||||
FTL_MODAL
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModalContainer for NodeSetup {
|
||||
fn modal_ids(&self) -> &Vec<&'static str> {
|
||||
&self.modal_ids
|
||||
}
|
||||
|
||||
fn modal_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
_: &mut eframe::Frame,
|
||||
modal: &Modal,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
match modal.id {
|
||||
API_PORT_MODAL => self.api_port_modal(ui, modal, cb),
|
||||
API_SECRET_MODAL => self.secret_modal(ui, modal, cb),
|
||||
FOREIGN_API_SECRET_MODAL => self.secret_modal(ui, modal, cb),
|
||||
FTL_MODAL => self.ftl_modal(ui, modal, cb),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NodeSetup {
|
||||
pub const API_PORT_MODAL: &'static str = "api_port";
|
||||
pub const API_SECRET_MODAL: &'static str = "api_secret";
|
||||
pub const FOREIGN_API_SECRET_MODAL: &'static str = "foreign_api_secret";
|
||||
pub const FTL_MODAL: &'static str = "ftl";
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) {
|
||||
// Draw modal content for current ui container.
|
||||
self.current_modal_ui(ui, frame, cb);
|
||||
|
||||
pub fn ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
View::sub_title(ui, format!("{} {}", COMPUTER_TOWER, t!("network_settings.server")));
|
||||
View::horizontal_line(ui, Colors::STROKE);
|
||||
ui.add_space(4.0);
|
||||
@@ -150,10 +187,10 @@ impl NodeSetup {
|
||||
// Show API port setup.
|
||||
self.api_port_setup_ui(ui, cb);
|
||||
// Show API secret setup.
|
||||
self.secret_ui(Self::API_SECRET_MODAL, ui, cb);
|
||||
self.secret_ui(API_SECRET_MODAL, ui, cb);
|
||||
ui.add_space(12.0);
|
||||
// Show Foreign API secret setup.
|
||||
self.secret_ui(Self::FOREIGN_API_SECRET_MODAL, ui, cb);
|
||||
self.secret_ui(FOREIGN_API_SECRET_MODAL, ui, cb);
|
||||
ui.add_space(6.0);
|
||||
});
|
||||
}
|
||||
@@ -183,7 +220,7 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw [`ChainTypes`] setup content.
|
||||
fn chain_type_ui(&mut self, ui: &mut Ui) {
|
||||
fn chain_type_ui(&mut self, ui: &mut egui::Ui) {
|
||||
let saved_chain_type = AppConfig::chain_type();
|
||||
let mut selected_chain_type = saved_chain_type;
|
||||
|
||||
@@ -207,7 +244,7 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw API port setup content.
|
||||
fn api_port_setup_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn api_port_setup_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.api_port"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -221,7 +258,7 @@ impl NodeSetup {
|
||||
self.api_port_available_edit = self.is_api_port_available;
|
||||
|
||||
// Show API port modal.
|
||||
Modal::new(Self::API_PORT_MODAL)
|
||||
Modal::new(API_PORT_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -240,7 +277,7 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw API port [`Modal`] content.
|
||||
pub fn api_port_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn api_port_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.api_port"))
|
||||
@@ -309,9 +346,9 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw API secret token setup content.
|
||||
fn secret_ui(&mut self, modal_id: &'static str, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn secret_ui(&mut self, modal_id: &'static str, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
let secret_title = match modal_id {
|
||||
Self::API_SECRET_MODAL => t!("network_settings.api_secret"),
|
||||
API_SECRET_MODAL => t!("network_settings.api_secret"),
|
||||
_ => t!("network_settings.foreign_api_secret")
|
||||
};
|
||||
ui.label(RichText::new(secret_title)
|
||||
@@ -321,7 +358,7 @@ impl NodeSetup {
|
||||
ui.add_space(6.0);
|
||||
|
||||
let secret_value = match modal_id {
|
||||
Self::API_SECRET_MODAL => NodeConfig::get_api_secret(),
|
||||
API_SECRET_MODAL => NodeConfig::get_api_secret(),
|
||||
_ => NodeConfig::get_foreign_api_secret()
|
||||
};
|
||||
|
||||
@@ -344,11 +381,11 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw API secret token [`Modal`] content.
|
||||
pub fn secret_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn secret_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
let description = match modal.id {
|
||||
Self::API_SECRET_MODAL => t!("network_settings.api_secret"),
|
||||
API_SECRET_MODAL => t!("network_settings.api_secret"),
|
||||
_ => t!("network_settings.foreign_api_secret")
|
||||
};
|
||||
ui.label(RichText::new(description).size(17.0).color(Colors::GRAY));
|
||||
@@ -417,7 +454,7 @@ impl NodeSetup {
|
||||
let on_save = || {
|
||||
let secret = self.secret_edit.clone();
|
||||
match modal.id {
|
||||
Self::API_SECRET_MODAL => {
|
||||
API_SECRET_MODAL => {
|
||||
NodeConfig::save_api_secret(&secret);
|
||||
}
|
||||
_ => {
|
||||
@@ -444,7 +481,7 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw FTL setup content.
|
||||
fn ftl_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn ftl_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.ftl"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -456,7 +493,7 @@ impl NodeSetup {
|
||||
// Setup values for modal.
|
||||
self.ftl_edit = ftl;
|
||||
// Show ftl value setup modal.
|
||||
Modal::new(Self::FTL_MODAL)
|
||||
Modal::new(FTL_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -470,7 +507,7 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw FTL [`Modal`] content.
|
||||
pub fn ftl_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn ftl_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.ftl"))
|
||||
@@ -533,7 +570,7 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw chain validation mode setup content.
|
||||
pub fn validation_mode_ui(&mut self, ui: &mut Ui) {
|
||||
pub fn validation_mode_ui(&mut self, ui: &mut egui::Ui) {
|
||||
let validate = NodeConfig::is_full_chain_validation();
|
||||
View::checkbox(ui, validate, t!("network_settings.full_validation"), || {
|
||||
NodeConfig::toggle_full_chain_validation();
|
||||
@@ -547,7 +584,7 @@ impl NodeSetup {
|
||||
}
|
||||
|
||||
/// Draw archive mode setup content.
|
||||
pub fn archive_mode_ui(&mut self, ui: &mut Ui) {
|
||||
fn archive_mode_ui(&mut self, ui: &mut egui::Ui) {
|
||||
let archive_mode = NodeConfig::is_archive_mode();
|
||||
View::checkbox(ui, archive_mode, t!("network_settings.archive_mode"), || {
|
||||
NodeConfig::toggle_archive_mode();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Align, Id, Layout, RichText, Rounding, TextStyle, Ui, Widget};
|
||||
use egui::{Align, Id, Layout, RichText, Rounding, TextStyle, Widget};
|
||||
use egui_extras::{Size, StripBuilder};
|
||||
use grin_core::global::ChainTypes;
|
||||
|
||||
@@ -20,8 +20,9 @@ use crate::AppConfig;
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{ARROW_FAT_LINE_UP, ARROW_FAT_LINES_DOWN, ARROW_FAT_LINES_UP, CLIPBOARD_TEXT, GLOBE_SIMPLE, HANDSHAKE, PLUG, PLUS_CIRCLE, PROHIBIT_INSET, TRASH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, ModalPosition, View};
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::node::{NodeConfig, PeersConfig};
|
||||
|
||||
/// Type of peer.
|
||||
@@ -34,7 +35,7 @@ enum PeerType {
|
||||
Preferred
|
||||
}
|
||||
|
||||
/// P2P server setup ui section.
|
||||
/// P2P server setup section content.
|
||||
pub struct P2PSetup {
|
||||
/// P2P port value.
|
||||
port_edit: String,
|
||||
@@ -64,9 +65,31 @@ pub struct P2PSetup {
|
||||
max_outbound_count: String,
|
||||
|
||||
/// Preferred minimum number of outbound peers.
|
||||
min_outbound_count: String
|
||||
min_outbound_count: String,
|
||||
|
||||
/// [`Modal`] identifiers allowed at this ui container.
|
||||
modal_ids: Vec<&'static str>
|
||||
}
|
||||
|
||||
/// Identifier for port value [`Modal`].
|
||||
pub const PORT_MODAL: &'static str = "p2p_port";
|
||||
/// Identifier for custom seed [`Modal`].
|
||||
pub const CUSTOM_SEED_MODAL: &'static str = "p2p_custom_seed";
|
||||
/// Identifier for allowed peer [`Modal`].
|
||||
pub const ALLOW_PEER_MODAL: &'static str = "p2p_allow_peer";
|
||||
/// Identifier for denied peer [`Modal`].
|
||||
pub const DENY_PEER_MODAL: &'static str = "p2p_deny_peer";
|
||||
/// Identifier for preferred peer [`Modal`].
|
||||
pub const PREFER_PEER_MODAL: &'static str = "p2p_prefer_peer";
|
||||
/// Identifier for ban window [`Modal`].
|
||||
pub const BAN_WINDOW_MODAL: &'static str = "p2p_ban_window";
|
||||
/// Identifier for maximum number of inbound peers [`Modal`].
|
||||
pub const MAX_INBOUND_MODAL: &'static str = "p2p_max_inbound";
|
||||
/// Identifier for maximum number of outbound peers [`Modal`].
|
||||
pub const MAX_OUTBOUND_MODAL: &'static str = "p2p_max_outbound";
|
||||
/// Identifier for minimum number of outbound peers [`Modal`].
|
||||
pub const MIN_OUTBOUND_MODAL: &'static str = "p2p_min_outbound";
|
||||
|
||||
impl Default for P2PSetup {
|
||||
fn default() -> Self {
|
||||
let port = NodeConfig::get_p2p_port();
|
||||
@@ -91,34 +114,54 @@ impl Default for P2PSetup {
|
||||
max_inbound_count: NodeConfig::get_max_inbound_peers(),
|
||||
max_outbound_count: NodeConfig::get_max_outbound_peers(),
|
||||
min_outbound_count: NodeConfig::get_min_outbound_peers(),
|
||||
modal_ids: vec![
|
||||
PORT_MODAL,
|
||||
CUSTOM_SEED_MODAL,
|
||||
ALLOW_PEER_MODAL,
|
||||
DENY_PEER_MODAL,
|
||||
PREFER_PEER_MODAL,
|
||||
BAN_WINDOW_MODAL,
|
||||
MAX_INBOUND_MODAL,
|
||||
MAX_OUTBOUND_MODAL,
|
||||
MIN_OUTBOUND_MODAL
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModalContainer for P2PSetup {
|
||||
fn modal_ids(&self) -> &Vec<&'static str> {
|
||||
&self.modal_ids
|
||||
}
|
||||
|
||||
fn modal_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
_: &mut eframe::Frame,
|
||||
modal: &Modal,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
match modal.id {
|
||||
PORT_MODAL => self.port_modal(ui, modal, cb),
|
||||
CUSTOM_SEED_MODAL => self.peer_modal(ui, modal, cb),
|
||||
ALLOW_PEER_MODAL => self.peer_modal(ui, modal, cb),
|
||||
DENY_PEER_MODAL => self.peer_modal(ui, modal, cb),
|
||||
PREFER_PEER_MODAL => self.peer_modal(ui, modal, cb),
|
||||
BAN_WINDOW_MODAL => self.ban_window_modal(ui, modal, cb),
|
||||
MAX_INBOUND_MODAL => self.max_inbound_modal(ui, modal, cb),
|
||||
MAX_OUTBOUND_MODAL => self.max_outbound_modal(ui, modal, cb),
|
||||
MIN_OUTBOUND_MODAL => self.min_outbound_modal(ui, modal, cb),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl P2PSetup {
|
||||
/// Identifier for port value [`Modal`].
|
||||
pub const PORT_MODAL: &'static str = "p2p_port";
|
||||
/// Identifier for custom seed [`Modal`].
|
||||
pub const CUSTOM_SEED_MODAL: &'static str = "p2p_custom_seed";
|
||||
/// Identifier for allowed peer [`Modal`].
|
||||
pub const ALLOW_PEER_MODAL: &'static str = "p2p_allow_peer";
|
||||
/// Identifier for denied peer [`Modal`].
|
||||
pub const DENY_PEER_MODAL: &'static str = "p2p_deny_peer";
|
||||
/// Identifier for preferred peer [`Modal`].
|
||||
pub const PREFER_PEER_MODAL: &'static str = "p2p_prefer_peer";
|
||||
/// Identifier for ban window [`Modal`].
|
||||
pub const BAN_WINDOW_MODAL: &'static str = "p2p_ban_window";
|
||||
/// Identifier for maximum number of inbound peers [`Modal`].
|
||||
pub const MAX_INBOUND_MODAL: &'static str = "p2p_max_inbound";
|
||||
/// Identifier for maximum number of outbound peers [`Modal`].
|
||||
pub const MAX_OUTBOUND_MODAL: &'static str = "p2p_max_outbound";
|
||||
/// Identifier for minimum number of outbound peers [`Modal`].
|
||||
pub const MIN_OUTBOUND_MODAL: &'static str = "p2p_min_outbound";
|
||||
|
||||
/// Title for custom DNS Seeds setup section.
|
||||
const DNS_SEEDS_TITLE: &'static str = "DNS Seeds";
|
||||
|
||||
pub fn ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) {
|
||||
// Draw modal content for current ui container.
|
||||
self.current_modal_ui(ui, frame, cb);
|
||||
|
||||
View::sub_title(ui, format!("{} {}", HANDSHAKE, t!("network_settings.p2p_server")));
|
||||
View::horizontal_line(ui, Colors::STROKE);
|
||||
ui.add_space(6.0);
|
||||
@@ -199,7 +242,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw p2p port setup content.
|
||||
fn port_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn port_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.p2p_port"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -212,7 +255,7 @@ impl P2PSetup {
|
||||
self.port_edit = port;
|
||||
self.port_available_edit = self.is_port_available;
|
||||
// Show p2p port modal.
|
||||
Modal::new(Self::PORT_MODAL)
|
||||
Modal::new(PORT_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -231,7 +274,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw p2p port [`Modal`] content.
|
||||
pub fn port_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn port_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.p2p_port"))
|
||||
@@ -300,7 +343,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw peer list content based on provided [`PeerType`].
|
||||
fn peer_list_ui(&mut self, ui: &mut Ui, peer_type: &PeerType, cb: &dyn PlatformCallbacks) {
|
||||
fn peer_list_ui(&mut self, ui: &mut egui::Ui, peer_type: &PeerType, cb: &dyn PlatformCallbacks) {
|
||||
let peers = match peer_type {
|
||||
PeerType::DefaultSeed => {
|
||||
if AppConfig::chain_type() == ChainTypes::Testnet {
|
||||
@@ -317,7 +360,7 @@ impl P2PSetup {
|
||||
for (index, peer) in peers.iter().enumerate() {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
// Draw peer list item.
|
||||
Self::peer_item_ui(ui, peer, peer_type, View::item_rounding(index, peers.len()));
|
||||
peer_item_ui(ui, peer, peer_type, View::item_rounding(index, peers.len()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -349,10 +392,10 @@ impl P2PSetup {
|
||||
self.peer_edit = "".to_string();
|
||||
// Select modal id.
|
||||
let modal_id = match peer_type {
|
||||
PeerType::Allowed => Self::ALLOW_PEER_MODAL,
|
||||
PeerType::Denied => Self::DENY_PEER_MODAL,
|
||||
PeerType::Preferred => Self::PREFER_PEER_MODAL,
|
||||
_ => Self::CUSTOM_SEED_MODAL
|
||||
PeerType::Allowed => ALLOW_PEER_MODAL,
|
||||
PeerType::Denied => DENY_PEER_MODAL,
|
||||
PeerType::Preferred => PREFER_PEER_MODAL,
|
||||
_ => CUSTOM_SEED_MODAL
|
||||
};
|
||||
// Select modal title.
|
||||
let modal_title = match peer_type {
|
||||
@@ -373,11 +416,11 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw peer creation [`Modal`] content.
|
||||
pub fn peer_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn peer_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
let label_text = match modal.id {
|
||||
Self::CUSTOM_SEED_MODAL => t!("network_settings.seed_address"),
|
||||
CUSTOM_SEED_MODAL => t!("network_settings.seed_address"),
|
||||
&_ => t!("network_settings.peer_address")
|
||||
};
|
||||
ui.label(RichText::new(label_text).size(17.0).color(Colors::GRAY));
|
||||
@@ -442,10 +485,10 @@ impl P2PSetup {
|
||||
// Save peer at config.
|
||||
if is_correct_address {
|
||||
match modal.id {
|
||||
Self::CUSTOM_SEED_MODAL => NodeConfig::save_custom_seed(peer),
|
||||
Self::ALLOW_PEER_MODAL => NodeConfig::allow_peer(peer),
|
||||
Self::DENY_PEER_MODAL => NodeConfig::deny_peer(peer),
|
||||
Self::PREFER_PEER_MODAL => NodeConfig::prefer_peer(peer),
|
||||
CUSTOM_SEED_MODAL => NodeConfig::save_custom_seed(peer),
|
||||
ALLOW_PEER_MODAL => NodeConfig::allow_peer(peer),
|
||||
DENY_PEER_MODAL => NodeConfig::deny_peer(peer),
|
||||
PREFER_PEER_MODAL => NodeConfig::prefer_peer(peer),
|
||||
&_ => {}
|
||||
}
|
||||
|
||||
@@ -472,55 +515,8 @@ impl P2PSetup {
|
||||
});
|
||||
}
|
||||
|
||||
/// Draw peer list item.
|
||||
fn peer_item_ui(ui: &mut Ui, peer_addr: &String, peer_type: &PeerType, rounding: Rounding) {
|
||||
// Setup layout size.
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
rect.set_height(42.0);
|
||||
|
||||
// Draw round background.
|
||||
let mut bg_rect = rect.clone();
|
||||
bg_rect.min += egui::emath::vec2(6.0, 0.0);
|
||||
ui.painter().rect(bg_rect, rounding, Colors::WHITE, View::ITEM_STROKE);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
// Draw delete button for non-default seed peers.
|
||||
if peer_type != &PeerType::DefaultSeed {
|
||||
View::item_button(ui, [false, true], TRASH, || {
|
||||
match peer_type {
|
||||
PeerType::CustomSeed => {
|
||||
NodeConfig::remove_custom_seed(peer_addr);
|
||||
}
|
||||
PeerType::Allowed => {
|
||||
NodeConfig::remove_allowed_peer(peer_addr);
|
||||
}
|
||||
PeerType::Denied => {
|
||||
NodeConfig::remove_denied_peer(peer_addr);
|
||||
}
|
||||
PeerType::Preferred => {
|
||||
NodeConfig::remove_preferred_peer(peer_addr);
|
||||
}
|
||||
PeerType::DefaultSeed => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let layout_size = ui.available_size();
|
||||
ui.allocate_ui_with_layout(layout_size, Layout::left_to_right(Align::Center), |ui| {
|
||||
ui.add_space(12.0);
|
||||
// Draw peer address.
|
||||
let peer_text = format!("{} {}", GLOBE_SIMPLE, &peer_addr);
|
||||
ui.label(RichText::new(peer_text)
|
||||
.color(Colors::TEXT_BUTTON)
|
||||
.size(16.0));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// Draw seeding type setup content.
|
||||
fn seeding_type_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn seeding_type_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
let title = Self::DNS_SEEDS_TITLE;
|
||||
ui.label(RichText::new(title).size(16.0).color(Colors::GRAY));
|
||||
ui.add_space(2.0);
|
||||
@@ -540,7 +536,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw ban window setup content.
|
||||
fn ban_window_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn ban_window_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.ban_window"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -552,7 +548,7 @@ impl P2PSetup {
|
||||
// Setup values for modal.
|
||||
self.ban_window_edit = ban_window;
|
||||
// Show ban window period setup modal.
|
||||
Modal::new(Self::BAN_WINDOW_MODAL)
|
||||
Modal::new(BAN_WINDOW_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -567,7 +563,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw ban window [`Modal`] content.
|
||||
pub fn ban_window_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn ban_window_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.ban_window"))
|
||||
@@ -630,7 +626,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of inbound peers setup content.
|
||||
fn max_inbound_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn max_inbound_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.max_inbound_count"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -643,7 +639,7 @@ impl P2PSetup {
|
||||
// Setup values for modal.
|
||||
self.max_inbound_count = max_inbound;
|
||||
// Show maximum number of inbound peers setup modal.
|
||||
Modal::new(Self::MAX_INBOUND_MODAL)
|
||||
Modal::new(MAX_INBOUND_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -653,7 +649,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of inbound peers [`Modal`] content.
|
||||
pub fn max_inbound_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn max_inbound_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.max_inbound_count"))
|
||||
@@ -716,7 +712,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of outbound peers setup content.
|
||||
fn max_outbound_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn max_outbound_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.max_outbound_count"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -729,7 +725,7 @@ impl P2PSetup {
|
||||
// Setup values for modal.
|
||||
self.max_outbound_count = max_outbound;
|
||||
// Show maximum number of outbound peers setup modal.
|
||||
Modal::new(Self::MAX_OUTBOUND_MODAL)
|
||||
Modal::new(MAX_OUTBOUND_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -739,7 +735,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of outbound peers [`Modal`] content.
|
||||
pub fn max_outbound_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn max_outbound_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.max_outbound_count"))
|
||||
@@ -802,7 +798,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw minimum number of outbound peers setup content.
|
||||
fn min_outbound_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn min_outbound_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.min_outbound_count"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -815,7 +811,7 @@ impl P2PSetup {
|
||||
// Setup values for modal.
|
||||
self.min_outbound_count = min_outbound;
|
||||
// Show maximum number of outbound peers setup modal.
|
||||
Modal::new(Self::MIN_OUTBOUND_MODAL)
|
||||
Modal::new(MIN_OUTBOUND_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -829,7 +825,7 @@ impl P2PSetup {
|
||||
}
|
||||
|
||||
/// Draw minimum number of outbound peers [`Modal`] content.
|
||||
pub fn min_outbound_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn min_outbound_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.min_outbound_count"))
|
||||
@@ -890,4 +886,51 @@ impl P2PSetup {
|
||||
ui.add_space(6.0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Draw peer list item.
|
||||
fn peer_item_ui(ui: &mut egui::Ui, peer_addr: &String, peer_type: &PeerType, rounding: Rounding) {
|
||||
// Setup layout size.
|
||||
let mut rect = ui.available_rect_before_wrap();
|
||||
rect.set_height(42.0);
|
||||
|
||||
// Draw round background.
|
||||
let mut bg_rect = rect.clone();
|
||||
bg_rect.min += egui::emath::vec2(6.0, 0.0);
|
||||
ui.painter().rect(bg_rect, rounding, Colors::WHITE, View::ITEM_STROKE);
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
// Draw delete button for non-default seed peers.
|
||||
if peer_type != &PeerType::DefaultSeed {
|
||||
View::item_button(ui, [false, true], TRASH, || {
|
||||
match peer_type {
|
||||
PeerType::CustomSeed => {
|
||||
NodeConfig::remove_custom_seed(peer_addr);
|
||||
}
|
||||
PeerType::Allowed => {
|
||||
NodeConfig::remove_allowed_peer(peer_addr);
|
||||
}
|
||||
PeerType::Denied => {
|
||||
NodeConfig::remove_denied_peer(peer_addr);
|
||||
}
|
||||
PeerType::Preferred => {
|
||||
NodeConfig::remove_preferred_peer(peer_addr);
|
||||
}
|
||||
PeerType::DefaultSeed => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let layout_size = ui.available_size();
|
||||
ui.allocate_ui_with_layout(layout_size, Layout::left_to_right(Align::Center), |ui| {
|
||||
ui.add_space(12.0);
|
||||
// Draw peer address.
|
||||
let peer_text = format!("{} {}", GLOBE_SIMPLE, &peer_addr);
|
||||
ui.label(RichText::new(peer_text)
|
||||
.color(Colors::TEXT_BUTTON)
|
||||
.size(16.0));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -12,16 +12,17 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Ui, Widget};
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{BEZIER_CURVE, BOUNDING_BOX, CHART_SCATTER, CIRCLES_THREE, CLOCK_COUNTDOWN, HAND_COINS};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, ModalPosition, View};
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::node::NodeConfig;
|
||||
|
||||
/// Memory pool setup ui section.
|
||||
/// Memory pool setup section content.
|
||||
pub struct PoolSetup {
|
||||
/// Base fee value that's accepted into the pool.
|
||||
fee_base_edit: String,
|
||||
@@ -37,8 +38,22 @@ pub struct PoolSetup {
|
||||
|
||||
/// Maximum total weight of transactions to build a block.
|
||||
max_weight_edit: String,
|
||||
|
||||
/// [`Modal`] identifiers allowed at this ui container.
|
||||
modal_ids: Vec<&'static str>,
|
||||
}
|
||||
|
||||
/// Identifier for base fee value [`Modal`].
|
||||
pub const FEE_BASE_MODAL: &'static str = "fee_base";
|
||||
/// Identifier for reorg cache retention period value [`Modal`].
|
||||
pub const REORG_PERIOD_MODAL: &'static str = "reorg_period";
|
||||
/// Identifier for maximum number of transactions in the pool [`Modal`].
|
||||
pub const POOL_SIZE_MODAL: &'static str = "pool_size";
|
||||
/// Identifier for maximum number of transactions in the stempool [`Modal`].
|
||||
pub const STEMPOOL_SIZE_MODAL: &'static str = "stempool_size";
|
||||
/// Identifier for maximum total weight of transactions [`Modal`].
|
||||
pub const MAX_WEIGHT_MODAL: &'static str = "max_weight";
|
||||
|
||||
impl Default for PoolSetup {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -47,23 +62,43 @@ impl Default for PoolSetup {
|
||||
pool_size_edit: NodeConfig::get_max_pool_size(),
|
||||
stempool_size_edit: NodeConfig::get_max_stempool_size(),
|
||||
max_weight_edit: NodeConfig::get_mineable_max_weight(),
|
||||
modal_ids: vec![
|
||||
FEE_BASE_MODAL,
|
||||
REORG_PERIOD_MODAL,
|
||||
POOL_SIZE_MODAL,
|
||||
STEMPOOL_SIZE_MODAL,
|
||||
MAX_WEIGHT_MODAL
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModalContainer for PoolSetup {
|
||||
fn modal_ids(&self) -> &Vec<&'static str> {
|
||||
&self.modal_ids
|
||||
}
|
||||
|
||||
fn modal_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
_: &mut eframe::Frame,
|
||||
modal: &Modal,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
match modal.id {
|
||||
FEE_BASE_MODAL => self.fee_base_modal(ui, modal, cb),
|
||||
REORG_PERIOD_MODAL => self.reorg_period_modal(ui, modal, cb),
|
||||
POOL_SIZE_MODAL => self.pool_size_modal(ui, modal, cb),
|
||||
STEMPOOL_SIZE_MODAL => self.stem_size_modal(ui, modal, cb),
|
||||
MAX_WEIGHT_MODAL => self.max_weight_modal(ui, modal, cb),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PoolSetup {
|
||||
/// Identifier for base fee value [`Modal`].
|
||||
pub const FEE_BASE_MODAL: &'static str = "fee_base";
|
||||
/// Identifier for reorg cache retention period value [`Modal`].
|
||||
pub const REORG_PERIOD_MODAL: &'static str = "reorg_period";
|
||||
/// Identifier for maximum number of transactions in the pool [`Modal`].
|
||||
pub const POOL_SIZE_MODAL: &'static str = "pool_size";
|
||||
/// Identifier for maximum number of transactions in the stempool [`Modal`].
|
||||
pub const STEMPOOL_SIZE_MODAL: &'static str = "stempool_size";
|
||||
/// Identifier for maximum total weight of transactions [`Modal`].
|
||||
pub const MAX_WEIGHT_MODAL: &'static str = "max_weight";
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) {
|
||||
// Draw modal content for current ui container.
|
||||
self.current_modal_ui(ui, frame, cb);
|
||||
|
||||
pub fn ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
View::sub_title(ui, format!("{} {}", CHART_SCATTER, t!("network_settings.tx_pool")));
|
||||
View::horizontal_line(ui, Colors::STROKE);
|
||||
ui.add_space(6.0);
|
||||
@@ -91,7 +126,7 @@ impl PoolSetup {
|
||||
ui.add_space(6.0);
|
||||
|
||||
// Show stem pool size setup.
|
||||
self.stempool_size_ui(ui, cb);
|
||||
self.stem_size_ui(ui, cb);
|
||||
|
||||
ui.add_space(6.0);
|
||||
View::horizontal_line(ui, Colors::ITEM_STROKE);
|
||||
@@ -103,7 +138,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw fee base setup content.
|
||||
fn fee_base_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn fee_base_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.pool_fee"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -115,7 +150,7 @@ impl PoolSetup {
|
||||
// Setup values for modal.
|
||||
self.fee_base_edit = fee;
|
||||
// Show fee setup modal.
|
||||
Modal::new(Self::FEE_BASE_MODAL)
|
||||
Modal::new(FEE_BASE_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -125,7 +160,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw fee base [`Modal`] content.
|
||||
pub fn fee_base_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn fee_base_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.pool_fee"))
|
||||
@@ -188,7 +223,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw reorg cache retention period setup content.
|
||||
fn reorg_period_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn reorg_period_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.reorg_period"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -200,7 +235,7 @@ impl PoolSetup {
|
||||
// Setup values for modal.
|
||||
self.reorg_period_edit = period;
|
||||
// Show reorg period setup modal.
|
||||
Modal::new(Self::REORG_PERIOD_MODAL)
|
||||
Modal::new(REORG_PERIOD_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -210,7 +245,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw reorg cache retention period [`Modal`] content.
|
||||
pub fn reorg_period_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn reorg_period_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.reorg_period"))
|
||||
@@ -273,7 +308,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of transactions in the pool setup content.
|
||||
fn pool_size_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn pool_size_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.max_tx_pool"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -285,7 +320,7 @@ impl PoolSetup {
|
||||
// Setup values for modal.
|
||||
self.pool_size_edit = size;
|
||||
// Show pool size setup modal.
|
||||
Modal::new(Self::POOL_SIZE_MODAL)
|
||||
Modal::new(POOL_SIZE_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -295,7 +330,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of transactions in the pool [`Modal`] content.
|
||||
pub fn pool_size_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn pool_size_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.max_tx_pool"))
|
||||
@@ -358,7 +393,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of transactions in the stempool setup content.
|
||||
fn stempool_size_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn stem_size_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.max_tx_stempool"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -370,7 +405,7 @@ impl PoolSetup {
|
||||
// Setup values for modal.
|
||||
self.stempool_size_edit = size;
|
||||
// Show stempool size setup modal.
|
||||
Modal::new(Self::STEMPOOL_SIZE_MODAL)
|
||||
Modal::new(STEMPOOL_SIZE_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -380,7 +415,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum number of transactions in the stempool [`Modal`] content.
|
||||
pub fn stempool_size_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn stem_size_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.max_tx_stempool"))
|
||||
@@ -443,7 +478,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum total weight of transactions setup content.
|
||||
fn max_weight_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn max_weight_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.max_tx_weight"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -455,7 +490,7 @@ impl PoolSetup {
|
||||
// Setup values for modal.
|
||||
self.max_weight_edit = weight;
|
||||
// Show total tx weight setup modal.
|
||||
Modal::new(Self::MAX_WEIGHT_MODAL)
|
||||
Modal::new(MAX_WEIGHT_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -465,7 +500,7 @@ impl PoolSetup {
|
||||
}
|
||||
|
||||
/// Draw maximum total weight of transactions [`Modal`] content.
|
||||
pub fn max_weight_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn max_weight_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.max_tx_weight"))
|
||||
|
||||
@@ -12,16 +12,17 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Ui, Widget};
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{BARBELL, HARD_DRIVES, PLUG, TIMER};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, ModalPosition, View};
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::node::{Node, NodeConfig};
|
||||
|
||||
/// Stratum server setup ui section.
|
||||
/// Stratum server setup section content.
|
||||
pub struct StratumSetup {
|
||||
/// IP Addresses available at system.
|
||||
available_ips: Vec<String>,
|
||||
@@ -38,9 +39,19 @@ pub struct StratumSetup {
|
||||
attempt_time_edit: String,
|
||||
|
||||
/// Minimum share difficulty value to request from miners.
|
||||
min_share_diff_edit: String
|
||||
min_share_diff_edit: String,
|
||||
|
||||
/// [`Modal`] identifiers allowed at this ui container.
|
||||
modal_ids: Vec<&'static str>
|
||||
}
|
||||
|
||||
/// Identifier for stratum port [`Modal`].
|
||||
const STRATUM_PORT_MODAL: &'static str = "stratum_port";
|
||||
/// Identifier for attempt time [`Modal`].
|
||||
const ATTEMPT_TIME_MODAL: &'static str = "stratum_attempt_time";
|
||||
/// Identifier for minimum share difficulty [`Modal`].
|
||||
const MIN_SHARE_DIFF_MODAL: &'static str = "stratum_min_share_diff";
|
||||
|
||||
impl Default for StratumSetup {
|
||||
fn default() -> Self {
|
||||
let (ip, port) = NodeConfig::get_stratum_address();
|
||||
@@ -51,20 +62,40 @@ impl Default for StratumSetup {
|
||||
stratum_port_available_edit: is_port_available,
|
||||
is_port_available,
|
||||
attempt_time_edit: NodeConfig::get_stratum_attempt_time(),
|
||||
min_share_diff_edit: NodeConfig::get_stratum_min_share_diff()
|
||||
min_share_diff_edit: NodeConfig::get_stratum_min_share_diff(),
|
||||
modal_ids: vec![
|
||||
STRATUM_PORT_MODAL,
|
||||
ATTEMPT_TIME_MODAL,
|
||||
MIN_SHARE_DIFF_MODAL
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModalContainer for StratumSetup {
|
||||
fn modal_ids(&self) -> &Vec<&'static str> {
|
||||
&self.modal_ids
|
||||
}
|
||||
|
||||
fn modal_ui(&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
_: &mut eframe::Frame,
|
||||
modal: &Modal,
|
||||
cb: &dyn PlatformCallbacks) {
|
||||
match modal.id {
|
||||
STRATUM_PORT_MODAL => self.port_modal(ui, modal, cb),
|
||||
ATTEMPT_TIME_MODAL => self.attempt_modal(ui, modal, cb),
|
||||
MIN_SHARE_DIFF_MODAL => self.min_diff_modal(ui, modal, cb),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StratumSetup {
|
||||
/// Identifier for stratum port [`Modal`].
|
||||
pub const STRATUM_PORT_MODAL: &'static str = "stratum_port";
|
||||
/// Identifier for attempt time [`Modal`].
|
||||
pub const ATTEMPT_TIME_MODAL: &'static str = "stratum_attempt_time";
|
||||
/// Identifier for minimum share difficulty [`Modal`].
|
||||
pub const MIN_SHARE_DIFF_MODAL: &'static str = "stratum_min_share_diff";
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) {
|
||||
// Draw modal content for current ui container.
|
||||
self.current_modal_ui(ui, frame, cb);
|
||||
|
||||
pub fn ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
View::sub_title(ui, format!("{} {}", HARD_DRIVES, t!("network_mining.server")));
|
||||
View::horizontal_line(ui, Colors::STROKE);
|
||||
ui.add_space(6.0);
|
||||
@@ -150,7 +181,7 @@ impl StratumSetup {
|
||||
}
|
||||
|
||||
/// Draw stratum port value setup content.
|
||||
fn port_setup_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn port_setup_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.stratum_port"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -163,7 +194,7 @@ impl StratumSetup {
|
||||
self.stratum_port_edit = port;
|
||||
self.stratum_port_available_edit = self.is_port_available;
|
||||
// Show stratum port modal.
|
||||
Modal::new(Self::STRATUM_PORT_MODAL)
|
||||
Modal::new(STRATUM_PORT_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -182,7 +213,7 @@ impl StratumSetup {
|
||||
}
|
||||
|
||||
/// Draw stratum port [`Modal`] content.
|
||||
pub fn port_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn port_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.stratum_port"))
|
||||
@@ -257,7 +288,7 @@ impl StratumSetup {
|
||||
}
|
||||
|
||||
/// Draw attempt time value setup content.
|
||||
fn attempt_time_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn attempt_time_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.attempt_time"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -270,7 +301,7 @@ impl StratumSetup {
|
||||
self.attempt_time_edit = time;
|
||||
|
||||
// Show attempt time modal.
|
||||
Modal::new(Self::ATTEMPT_TIME_MODAL)
|
||||
Modal::new(ATTEMPT_TIME_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -285,7 +316,7 @@ impl StratumSetup {
|
||||
}
|
||||
|
||||
/// Draw attempt time [`Modal`] content.
|
||||
pub fn attempt_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn attempt_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.attempt_time"))
|
||||
@@ -348,7 +379,7 @@ impl StratumSetup {
|
||||
}
|
||||
|
||||
/// Draw minimum share difficulty value setup content.
|
||||
fn min_diff_ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn min_diff_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.label(RichText::new(t!("network_settings.min_share_diff"))
|
||||
.size(16.0)
|
||||
.color(Colors::GRAY)
|
||||
@@ -361,7 +392,7 @@ impl StratumSetup {
|
||||
self.min_share_diff_edit = diff;
|
||||
|
||||
// Show share difficulty setup modal.
|
||||
Modal::new(Self::MIN_SHARE_DIFF_MODAL)
|
||||
Modal::new(MIN_SHARE_DIFF_MODAL)
|
||||
.position(ModalPosition::CenterTop)
|
||||
.title(t!("network_settings.change_value"))
|
||||
.show();
|
||||
@@ -371,7 +402,7 @@ impl StratumSetup {
|
||||
}
|
||||
|
||||
/// Draw minimum acceptable share difficulty [`Modal`] content.
|
||||
pub fn min_diff_modal(&mut self, ui: &mut Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
fn min_diff_modal(&mut self, ui: &mut egui::Ui, modal: &Modal, cb: &dyn PlatformCallbacks) {
|
||||
ui.add_space(6.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.label(RichText::new(t!("network_settings.min_share_diff"))
|
||||
@@ -435,7 +466,7 @@ impl StratumSetup {
|
||||
}
|
||||
|
||||
/// Reminder to restart enabled node to show on edit setting at [`Modal`].
|
||||
pub fn server_restart_required_ui(ui: &mut Ui) {
|
||||
pub fn server_restart_required_ui(ui: &mut egui::Ui) {
|
||||
if Node::get_stratum_stats().is_running {
|
||||
ui.add_space(12.0);
|
||||
ui.label(RichText::new(t!("network_mining.restart_server_required"))
|
||||
|
||||
Reference in New Issue
Block a user