Make pending column changes immediately visible

This commit is contained in:
Dandaedre 2026-11-03 18:04:53 +01:00
parent cbbd22427c
commit db91470e89
1 changed files with 26 additions and 7 deletions

View File

@ -1219,14 +1219,20 @@ impl App {
.unwrap_or_else(|| profile.clone());
let mapping_pending = column_settings_changed(&profile, &analyzed_profile);
let (mapping, evidence) = detect::inspect(table, &profile);
if mapping_pending {
egui::Frame::new()
.fill(Color32::from_rgb(53, 43, 88))
.stroke(egui::Stroke::new(2.0_f32, PREVIEW_PENDING))
.corner_radius(5.0)
.inner_margin(8.0)
.show(ui, |ui| {
ui.colored_label(PREVIEW_PENDING, "Pending column changes");
ui.label("Apply & recheck to update the schedule.");
});
}
match &mapping {
Ok(m) => {
if mapping_pending {
ui.colored_label(
PREVIEW_PENDING,
"Column mapping changed · Apply & recheck",
);
} else {
if !mapping_pending {
ui.colored_label(PREVIEW_SUCCESS, "OK Column mapping verified");
}
ui.horizontal_wrapped(|ui| {
@ -1520,6 +1526,7 @@ impl App {
if before != serde_json::to_string(&profile).unwrap() {
self.profile = serde_json::to_string_pretty(&profile).unwrap();
self.decisions_changed();
ui.ctx().request_repaint();
}
}
self.mapping_focus = mapping_focus;
@ -3034,7 +3041,12 @@ mod tests {
assert!(
labels
.iter()
.any(|(text, _)| text == "Column mapping changed · Apply & recheck")
.any(|(text, _)| text == "Pending column changes")
);
assert!(
labels
.iter()
.any(|(text, _)| text == "Apply & recheck to update the schedule.")
);
assert!(labels.iter().any(|(text, _)| text == "Pending apply"));
for (current, choice, expected) in [
@ -3061,6 +3073,7 @@ mod tests {
.1
.center();
click_size(&mut app, &ctx, option, size);
assert!(ctx.has_requested_repaint());
let profile: Profile = serde_json::from_str(&app.profile).unwrap();
assert!(
!profile.columns.contains_key("start"),
@ -3075,6 +3088,12 @@ mod tests {
expected.is_some(),
"{current} -> {choice} should show pending state only when it differs from the analyzed mapping"
);
assert_eq!(
labels
.iter()
.any(|(text, _)| text == "Pending column changes"),
expected.is_some()
);
}
}
#[test]