feat: decompose processes view into separate functions

This commit is contained in:
Louis-Marie Baer 2024-03-03 09:01:48 +01:00
parent 80575e281c
commit 86d1daee02

View file

@ -1,3 +1,4 @@
use egui::Ui;
use std::sync::{Arc, Mutex};
use crate::disk::state::Status;
@ -31,6 +32,32 @@ impl Status {
let height = height / 25.0;
ui.horizontal(|ui| {
// [Gupax]
gupax(ui, min_height, width, height, sys);
// [P2Pool]
p2pool(
ui,
min_height,
width,
height,
p2pool_alive,
p2pool_api,
p2pool_img,
);
// [XMRig]
xmrig(
ui,
min_height,
width,
height,
xmrig_alive,
xmrig_api,
xmrig_img,
max_threads,
);
});
}
}
fn gupax(ui: &mut Ui, min_height: f32, width: f32, height: f32, sys: &Arc<Mutex<Sys>>) {
ui.group(|ui| {
ui.vertical(|ui| {
debug!("Status Tab | Rendering [Gupax]");
@ -93,7 +120,17 @@ impl Status {
drop(sys);
})
});
// [P2Pool]
}
fn p2pool(
ui: &mut Ui,
min_height: f32,
width: f32,
height: f32,
p2pool_alive: bool,
p2pool_api: &Arc<Mutex<PubP2poolApi>>,
p2pool_img: &Arc<Mutex<ImgP2pool>>,
) {
ui.group(|ui| {
ui.vertical(|ui| {
debug!("Status Tab | Rendering [P2Pool]");
@ -219,7 +256,17 @@ impl Status {
drop(api);
})
});
// [XMRig]
}
fn xmrig(
ui: &mut Ui,
min_height: f32,
width: f32,
height: f32,
xmrig_alive: bool,
xmrig_api: &Arc<Mutex<PubXmrigApi>>,
xmrig_img: &Arc<Mutex<ImgXmrig>>,
max_threads: usize,
) {
ui.group(|ui| {
ui.vertical(|ui| {
debug!("Status Tab | Rendering [XMRig]");
@ -298,6 +345,4 @@ impl Status {
drop(api);
})
});
});
}
}