mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-10 22:17:51 +00:00
Job state handling cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ use self_update::cargo_crate_version;
|
||||
use crate::{
|
||||
app::{AppConfig, DiffKind, ViewConfig, ViewState},
|
||||
config::{ProjectUnit, ProjectUnitNode},
|
||||
jobs::{bindiff::queue_bindiff, objdiff::queue_build, update::queue_update},
|
||||
jobs::{bindiff::start_bindiff, objdiff::start_build, update::start_update},
|
||||
update::RELEASE_URL,
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc<RwLock<AppConfig>>, view_state:
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
view_state.jobs.push(queue_update());
|
||||
view_state.jobs.push(start_update());
|
||||
}
|
||||
if ui
|
||||
.button("Manual")
|
||||
@@ -190,7 +190,7 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc<RwLock<AppConfig>>, view_state:
|
||||
build = true;
|
||||
}
|
||||
if build {
|
||||
view_state.jobs.push(queue_build(config.clone(), view_state.diff_config.clone()));
|
||||
view_state.jobs.push(start_build(config.clone(), view_state.diff_config.clone()));
|
||||
}
|
||||
}
|
||||
} else if view_state.diff_kind == DiffKind::WholeBinary {
|
||||
@@ -218,7 +218,7 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc<RwLock<AppConfig>>, view_state:
|
||||
|
||||
if let (Some(_), Some(_)) = (left_obj, right_obj) {
|
||||
if ui.button("Build").clicked() {
|
||||
view_state.jobs.push(queue_bindiff(config.clone()));
|
||||
view_state.jobs.push(start_bindiff(config.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ pub fn data_diff_ui(ui: &mut egui::Ui, view_state: &mut ViewState) -> bool {
|
||||
ui.scope(|ui| {
|
||||
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
|
||||
ui.style_mut().wrap = Some(false);
|
||||
if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
|
||||
if view_state.jobs.is_running(Job::ObjDiff) {
|
||||
ui.colored_label(view_state.view_config.replace_color, "Building…");
|
||||
} else {
|
||||
ui.label("Last built:");
|
||||
|
||||
@@ -445,7 +445,7 @@ pub fn function_diff_ui(ui: &mut egui::Ui, view_state: &mut ViewState) -> bool {
|
||||
ui.scope(|ui| {
|
||||
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
|
||||
ui.style_mut().wrap = Some(false);
|
||||
if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
|
||||
if view_state.jobs.is_running(Job::ObjDiff) {
|
||||
ui.colored_label(view_state.view_config.replace_color, "Building…");
|
||||
} else {
|
||||
ui.label("Last built:");
|
||||
|
||||
@@ -6,7 +6,7 @@ pub fn jobs_ui(ui: &mut egui::Ui, view_state: &mut ViewState) {
|
||||
ui.label("Jobs");
|
||||
|
||||
let mut remove_job: Option<usize> = None;
|
||||
for (idx, job) in view_state.jobs.iter_mut().enumerate() {
|
||||
for job in view_state.jobs.iter_mut() {
|
||||
let Ok(status) = job.status.read() else {
|
||||
continue;
|
||||
};
|
||||
@@ -20,7 +20,7 @@ pub fn jobs_ui(ui: &mut egui::Ui, view_state: &mut ViewState) {
|
||||
log::error!("Failed to cancel job: {e:?}");
|
||||
}
|
||||
} else {
|
||||
remove_job = Some(idx);
|
||||
remove_job = Some(job.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user