mirror of
https://github.com/hinto-janai/gupax.git
synced 2024-12-23 11:29:38 +00:00
Status Submenu: remove [Monero] submenu, fix [P2Pool] spacing
There's not much interesting data I could display that regular Monero GUI or a block explorer can't do, so I'm scrapping the [Monero] tab. Maybe it'll come back if I rewrite [Status] to include graphs (never). The [P2Pool] submenu is pretty much done, this changed the spacing to make the logs larger and so all the elements fit correctly.
This commit is contained in:
parent
475bdcce0e
commit
f97935d1e8
5 changed files with 17 additions and 54 deletions
|
@ -175,13 +175,13 @@ pub const STATUS_XMRIG_THREADS: &str = "The amount of threads XMRig is curre
|
||||||
pub const STATUS_SUBMENU_PROCESSES: &str = "View the status of process related data for [Gupax|P2Pool|XMRig]";
|
pub const STATUS_SUBMENU_PROCESSES: &str = "View the status of process related data for [Gupax|P2Pool|XMRig]";
|
||||||
pub const STATUS_SUBMENU_P2POOL: &str = "View P2Pool specific data";
|
pub const STATUS_SUBMENU_P2POOL: &str = "View P2Pool specific data";
|
||||||
pub const STATUS_SUBMENU_MONERO: &str = "View general Monero blockchain data";
|
pub const STATUS_SUBMENU_MONERO: &str = "View general Monero blockchain data";
|
||||||
pub const STATUS_SUBMENU_PAYOUT: &str = "The total amount of payouts received via P2Pool across all time";
|
|
||||||
//-- P2Pool
|
//-- P2Pool
|
||||||
pub const STATUS_SUBMENU_XMR: &str = "The total of XMR mined via P2Pool across all time";
|
pub const STATUS_SUBMENU_PAYOUT: &str = "The total amount of payouts received via P2Pool across all time. This includes all payouts you have ever received using Gupax and P2Pool.";
|
||||||
pub const STATUS_SUBMENU_LATEST: &str = "Sort the logs latest to oldest";
|
pub const STATUS_SUBMENU_XMR: &str = "The total of XMR mined via P2Pool across all time. This includes all the XMR you have ever mined using Gupax and P2Pool.";
|
||||||
pub const STATUS_SUBMENU_OLDEST: &str = "Sort the logs oldest to latest";
|
pub const STATUS_SUBMENU_LATEST: &str = "Sort the payouts from latest to oldest";
|
||||||
pub const STATUS_SUBMENU_BIGGEST: &str = "Sort the logs by the biggest payouts first";
|
pub const STATUS_SUBMENU_OLDEST: &str = "Sort the payouts from oldest to latest";
|
||||||
pub const STATUS_SUBMENU_SMALLEST: &str = "Sort the logs by the smallest payouts first";
|
pub const STATUS_SUBMENU_BIGGEST: &str = "Sort the payouts from biggest to smallest";
|
||||||
|
pub const STATUS_SUBMENU_SMALLEST: &str = "Sort the payouts from smallest to biggest";
|
||||||
pub const STATUS_SUBMENU_AUTOMATIC: &str = "Automatically calculate share/block time with your current P2Pool 1 hour average hashrate";
|
pub const STATUS_SUBMENU_AUTOMATIC: &str = "Automatically calculate share/block time with your current P2Pool 1 hour average hashrate";
|
||||||
pub const STATUS_SUBMENU_MANUAL: &str = "Manually input a hashrate to calculate share/block time with current P2Pool/Monero network stats";
|
pub const STATUS_SUBMENU_MANUAL: &str = "Manually input a hashrate to calculate share/block time with current P2Pool/Monero network stats";
|
||||||
pub const STATUS_SUBMENU_HASH: &str = "Use [Hash] as the hashrate metric";
|
pub const STATUS_SUBMENU_HASH: &str = "Use [Hash] as the hashrate metric";
|
||||||
|
|
|
@ -823,7 +823,6 @@ pub enum File {
|
||||||
pub enum Submenu {
|
pub enum Submenu {
|
||||||
Processes,
|
Processes,
|
||||||
P2pool,
|
P2pool,
|
||||||
Monero,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Submenu {
|
impl Default for Submenu {
|
||||||
|
|
|
@ -200,6 +200,8 @@ pub enum ProcessState {
|
||||||
Waiting, // Process was successfully killed by a restart, and is ready to be started again, YELLOW!
|
Waiting, // Process was successfully killed by a restart, and is ready to be started again, YELLOW!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ProcessState { fn default() -> Self { Self::Dead } }
|
||||||
|
|
||||||
#[derive(Copy,Clone,Eq,PartialEq,Debug)]
|
#[derive(Copy,Clone,Eq,PartialEq,Debug)]
|
||||||
pub enum ProcessSignal {
|
pub enum ProcessSignal {
|
||||||
None,
|
None,
|
||||||
|
@ -208,6 +210,8 @@ pub enum ProcessSignal {
|
||||||
Restart,
|
Restart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ProcessSignal { fn default() -> Self { Self::None } }
|
||||||
|
|
||||||
#[derive(Copy,Clone,Eq,PartialEq,Debug)]
|
#[derive(Copy,Clone,Eq,PartialEq,Debug)]
|
||||||
pub enum ProcessName {
|
pub enum ProcessName {
|
||||||
P2pool,
|
P2pool,
|
||||||
|
@ -1828,40 +1832,6 @@ impl Hashrate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- PubMoneroApi
|
|
||||||
#[derive(Debug,Clone)]
|
|
||||||
struct PubMoneroApi {
|
|
||||||
size: HumanNumber, // Blockchain size in GB
|
|
||||||
diff: HumanNumber, // Current difficulty
|
|
||||||
height: HumanNumber, // Current height
|
|
||||||
incoming: HumanNumber, // In-peers
|
|
||||||
outgoing: HumanNumber, // Out-peers
|
|
||||||
restricted: bool, // Is RPC in restricted mode?
|
|
||||||
synchronized: bool, // Are we synced?
|
|
||||||
tx_pool_size: HumanNumber, // Current amout of TX in TX pool
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- PrivMoneroApi
|
|
||||||
// This matches some stats from monerod's JSON-RPC HTTP call [get_info]
|
|
||||||
// It _seems_ monerod initializes stats with [0], so no [Option], hopefully nothing panics :D
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
||||||
struct PrivMoneroApi {
|
|
||||||
result: Result,
|
|
||||||
}
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
||||||
struct Result {
|
|
||||||
database_size: u128, // bytes
|
|
||||||
difficulty: u128,
|
|
||||||
height: u64,
|
|
||||||
incoming_connections_count: u32,
|
|
||||||
nettype: String, // mainnet, stagenet, testnet
|
|
||||||
outgoing_connections_count: u32,
|
|
||||||
restricted: bool,
|
|
||||||
status: String, // OK
|
|
||||||
synchronized: bool,
|
|
||||||
tx_pool_size: u32, // tx pool
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TESTS
|
//---------------------------------------------------------------------------------------------------- TESTS
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -1058,9 +1058,8 @@ impl eframe::App for App {
|
||||||
match self.tab {
|
match self.tab {
|
||||||
Tab::Status => {
|
Tab::Status => {
|
||||||
match self.state.status.submenu {
|
match self.state.status.submenu {
|
||||||
Submenu::Processes => self.state.status.submenu = Submenu::Monero,
|
Submenu::Processes => self.state.status.submenu = Submenu::P2pool,
|
||||||
Submenu::P2pool => self.state.status.submenu = Submenu::Processes,
|
Submenu::P2pool => self.state.status.submenu = Submenu::Processes,
|
||||||
Submenu::Monero => self.state.status.submenu = Submenu::P2pool,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Tab::Gupax => flip!(self.state.gupax.simple),
|
Tab::Gupax => flip!(self.state.gupax.simple),
|
||||||
|
@ -1074,8 +1073,7 @@ impl eframe::App for App {
|
||||||
Tab::Status => {
|
Tab::Status => {
|
||||||
match self.state.status.submenu {
|
match self.state.status.submenu {
|
||||||
Submenu::Processes => self.state.status.submenu = Submenu::P2pool,
|
Submenu::Processes => self.state.status.submenu = Submenu::P2pool,
|
||||||
Submenu::P2pool => self.state.status.submenu = Submenu::Monero,
|
Submenu::P2pool => self.state.status.submenu = Submenu::Processes,
|
||||||
Submenu::Monero => self.state.status.submenu = Submenu::Processes,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Tab::Gupax => flip!(self.state.gupax.simple),
|
Tab::Gupax => flip!(self.state.gupax.simple),
|
||||||
|
@ -1473,11 +1471,7 @@ impl eframe::App for App {
|
||||||
match self.tab {
|
match self.tab {
|
||||||
Tab::Status => {
|
Tab::Status => {
|
||||||
ui.group(|ui| {
|
ui.group(|ui| {
|
||||||
let width = (ui.available_width() / 3.0)-14.25;
|
let width = (ui.available_width() / 2.0)-10.5;
|
||||||
if ui.add_sized([width, height], SelectableLabel::new(self.state.status.submenu == Submenu::Monero, "Monero")).on_hover_text(STATUS_SUBMENU_MONERO).clicked() {
|
|
||||||
self.state.status.submenu = Submenu::Monero;
|
|
||||||
}
|
|
||||||
ui.separator();
|
|
||||||
if ui.add_sized([width, height], SelectableLabel::new(self.state.status.submenu == Submenu::P2pool, "P2Pool")).on_hover_text(STATUS_SUBMENU_P2POOL).clicked() {
|
if ui.add_sized([width, height], SelectableLabel::new(self.state.status.submenu == Submenu::P2pool, "P2Pool")).on_hover_text(STATUS_SUBMENU_P2POOL).clicked() {
|
||||||
self.state.status.submenu = Submenu::P2pool;
|
self.state.status.submenu = Submenu::P2pool;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ pub fn show(&mut self, sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolAp
|
||||||
} else if self.submenu == Submenu::P2pool {
|
} else if self.submenu == Submenu::P2pool {
|
||||||
let api = lock!(gupax_p2pool_api);
|
let api = lock!(gupax_p2pool_api);
|
||||||
let text = height / 25.0;
|
let text = height / 25.0;
|
||||||
let log = height / 2.4;
|
let log = height / 2.5;
|
||||||
ui.style_mut().override_text_style = Some(Monospace);
|
ui.style_mut().override_text_style = Some(Monospace);
|
||||||
// Payout Text + PayoutView buttons
|
// Payout Text + PayoutView buttons
|
||||||
ui.group(|ui| {
|
ui.group(|ui| {
|
||||||
|
@ -164,6 +164,7 @@ pub fn show(&mut self, sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolAp
|
||||||
// Actual logs
|
// Actual logs
|
||||||
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
|
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
|
||||||
egui::ScrollArea::vertical().stick_to_bottom(self.payout_view == PayoutView::Oldest).max_width(width).max_height(log).auto_shrink([false; 2]).show_viewport(ui, |ui, _| {
|
egui::ScrollArea::vertical().stick_to_bottom(self.payout_view == PayoutView::Oldest).max_width(width).max_height(log).auto_shrink([false; 2]).show_viewport(ui, |ui, _| {
|
||||||
|
ui.style_mut().override_text_style = Some(Name("MonospaceLarge".into()));
|
||||||
match self.payout_view {
|
match self.payout_view {
|
||||||
PayoutView::Latest => ui.add_sized([width, log], TextEdit::multiline(&mut api.log_rev.as_str())),
|
PayoutView::Latest => ui.add_sized([width, log], TextEdit::multiline(&mut api.log_rev.as_str())),
|
||||||
PayoutView::Oldest => ui.add_sized([width, log], TextEdit::multiline(&mut api.log.as_str())),
|
PayoutView::Oldest => ui.add_sized([width, log], TextEdit::multiline(&mut api.log.as_str())),
|
||||||
|
@ -175,6 +176,7 @@ pub fn show(&mut self, sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolAp
|
||||||
});
|
});
|
||||||
drop(api);
|
drop(api);
|
||||||
// Payout/Share Calculator
|
// Payout/Share Calculator
|
||||||
|
ui.style_mut().override_text_style = Some(Monospace);
|
||||||
let button = (width/20.0)-(SPACE*1.666);
|
let button = (width/20.0)-(SPACE*1.666);
|
||||||
ui.group(|ui| { ui.horizontal(|ui| {
|
ui.group(|ui| { ui.horizontal(|ui| {
|
||||||
ui.set_min_width(width-SPACE);
|
ui.set_min_width(width-SPACE);
|
||||||
|
@ -198,7 +200,7 @@ pub fn show(&mut self, sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolAp
|
||||||
ui.set_enabled(p2pool_alive);
|
ui.set_enabled(p2pool_alive);
|
||||||
let text = height / 25.0;
|
let text = height / 25.0;
|
||||||
let width = (width/3.0)-(SPACE*1.666);
|
let width = (width/3.0)-(SPACE*1.666);
|
||||||
let min_height = ui.available_height()/1.25;
|
let min_height = ui.available_height()/1.35;
|
||||||
let api = lock!(p2pool_api);
|
let api = lock!(p2pool_api);
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.group(|ui| { ui.vertical(|ui| {
|
ui.group(|ui| { ui.vertical(|ui| {
|
||||||
|
@ -252,8 +254,6 @@ pub fn show(&mut self, sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolAp
|
||||||
// Tick bar
|
// Tick bar
|
||||||
ui.add_sized([ui.available_width(), text], Label::new(api.calculate_tick_bar())).on_hover_text(STATUS_SUBMENU_PROGRESS_BAR);
|
ui.add_sized([ui.available_width(), text], Label::new(api.calculate_tick_bar())).on_hover_text(STATUS_SUBMENU_PROGRESS_BAR);
|
||||||
drop(api);
|
drop(api);
|
||||||
//---------------------------------------------------------------------------------------------------- [Monero]
|
|
||||||
} else if self.submenu == Submenu::Monero {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue