mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-18 12:48:55 +00:00
stratum: start/stop refactoring, add ability to disable stratum server without node restart
This commit is contained in:
@@ -65,19 +65,32 @@ impl StratumSetup {
|
||||
pub const MIN_SHARE_DIFF_MODAL: &'static str = "stratum_min_share_diff";
|
||||
|
||||
pub fn ui(&mut self, ui: &mut Ui, cb: &dyn PlatformCallbacks) {
|
||||
View::sub_title(ui, format!("{} {}", HARD_DRIVES, t!("network_mining.server_setup")));
|
||||
View::sub_title(ui, format!("{} {}", HARD_DRIVES, t!("network_mining.server")));
|
||||
View::horizontal_line(ui, Colors::STROKE);
|
||||
ui.add_space(6.0);
|
||||
|
||||
ui.vertical_centered(|ui| {
|
||||
// Show button to enable stratum server if port is available and server is not running.
|
||||
if self.is_port_available && !Node::is_stratum_server_starting() && Node::is_running()
|
||||
&& !Node::get_stratum_stats().is_running {
|
||||
ui.add_space(6.0);
|
||||
View::button(ui, t!("network_mining.enable_server"), Colors::GOLD, || {
|
||||
Node::start_stratum_server();
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
// Show loading indicator or controls to start/stop stratum server if port is available.
|
||||
if self.is_port_available {
|
||||
if Node::is_stratum_starting() || Node::is_stratum_stopping() {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.add_space(8.0);
|
||||
View::small_loading_spinner(ui);
|
||||
ui.add_space(8.0);
|
||||
});
|
||||
} else if Node::get_stratum_stats().is_running {
|
||||
ui.add_space(6.0);
|
||||
View::button(ui, t!("network_mining.disable_server"), Colors::GOLD, || {
|
||||
Node::stop_stratum();
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
} else {
|
||||
ui.add_space(6.0);
|
||||
View::button(ui, t!("network_mining.enable_server"), Colors::GOLD, || {
|
||||
Node::start_stratum();
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
}
|
||||
|
||||
// Show stratum server autorun checkbox.
|
||||
|
||||
@@ -18,7 +18,7 @@ use grin_chain::SyncStatus;
|
||||
use grin_servers::WorkerStats;
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{BARBELL, CLOCK_AFTERNOON, COMPUTER_TOWER, CPU, CUBE, FADERS, FOLDER_DASHED, FOLDER_NOTCH_MINUS, FOLDER_NOTCH_PLUS, PLUGS, PLUGS_CONNECTED, POLYGON};
|
||||
use crate::gui::icons::{BARBELL, CLOCK_AFTERNOON, CPU, CUBE, FADERS, FOLDER_DASHED, FOLDER_NOTCH_MINUS, FOLDER_NOTCH_PLUS, HARD_DRIVES, PLUGS, PLUGS_CONNECTED, POLYGON};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, NetworkContainer, View};
|
||||
use crate::gui::views::network::{NetworkTab, NetworkTabType};
|
||||
@@ -45,7 +45,7 @@ impl NetworkTab for NetworkMining {
|
||||
}
|
||||
|
||||
// Show loading spinner when node is stopping or stratum server is starting.
|
||||
if Node::is_stopping() || Node::is_stratum_server_starting() {
|
||||
if Node::is_stopping() || Node::is_stratum_starting() {
|
||||
ui.centered_and_justified(|ui| {
|
||||
View::big_loading_spinner(ui);
|
||||
});
|
||||
@@ -80,7 +80,7 @@ impl NetworkTab for NetworkMining {
|
||||
}
|
||||
|
||||
// Show stratum mining server info.
|
||||
View::sub_title(ui, format!("{} {}", COMPUTER_TOWER, t!("network_mining.server")));
|
||||
View::sub_title(ui, format!("{} {}", HARD_DRIVES, t!("network_mining.server")));
|
||||
ui.columns(2, |columns| {
|
||||
columns[0].vertical_centered(|ui| {
|
||||
let (stratum_addr, stratum_port) = NodeConfig::get_stratum_address();
|
||||
|
||||
Reference in New Issue
Block a user