Clarify missing column warnings with actionable cards
This commit is contained in:
parent
39d5bb1fe7
commit
0c51c8d22a
|
|
@ -1502,13 +1502,16 @@ impl App {
|
|||
} else {
|
||||
format!("{affected} {column_word} · ")
|
||||
};
|
||||
ui.colored_label(
|
||||
PREVIEW_AMBER,
|
||||
format!(
|
||||
"! Column mapping needs attention · {affected_summary}{} issues",
|
||||
errors.len()
|
||||
),
|
||||
);
|
||||
if !errors.iter().all(|error| error.code == "MISSING_COLUMN") {
|
||||
let issue_word = if errors.len() == 1 { "issue" } else { "issues" };
|
||||
ui.colored_label(
|
||||
PREVIEW_AMBER,
|
||||
format!(
|
||||
"! Column mapping needs attention · {affected_summary}{} {issue_word}",
|
||||
errors.len()
|
||||
),
|
||||
);
|
||||
}
|
||||
for ((role, candidates), error) in ambiguous {
|
||||
let code = error.code.as_str();
|
||||
let message = error.message.as_str();
|
||||
|
|
@ -1564,24 +1567,39 @@ impl App {
|
|||
.map(|error| {
|
||||
if error.code == "MISSING_COLUMN" {
|
||||
if error.message.starts_with("Cannot infer title;") {
|
||||
return ("Title column missing", "Choose Title for the appropriate column below.");
|
||||
return ("Title column missing", "Choose Title in the role dropdown of the appropriate column below.");
|
||||
}
|
||||
if error.message.starts_with("Cannot infer start;") {
|
||||
return ("Start column missing", "Choose Start or Start–end for the appropriate column below.");
|
||||
return ("Start column missing", "Choose Start or Start–end in the role dropdown of the appropriate column below.");
|
||||
}
|
||||
}
|
||||
column_issue_advice(&error.code, duration)
|
||||
})
|
||||
.collect();
|
||||
if missing {
|
||||
egui::Frame::new()
|
||||
.fill(PREVIEW_AMBER.gamma_multiply(0.08))
|
||||
.inner_margin(10.0)
|
||||
.corner_radius(5.0)
|
||||
.show(ui, |ui| {
|
||||
ui.set_min_width(ui.available_width());
|
||||
for (reason, action) in &advice {
|
||||
ui.label(
|
||||
RichText::new(format!("! {reason}"))
|
||||
.color(PREVIEW_AMBER)
|
||||
.strong(),
|
||||
);
|
||||
ui.indent(("missing_column_action", reason), |ui| {
|
||||
ui.label(RichText::new("Next step").strong());
|
||||
ui.label(*action);
|
||||
});
|
||||
}
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
continue;
|
||||
}
|
||||
let title = column.map_or_else(
|
||||
|| {
|
||||
if missing {
|
||||
"Missing column"
|
||||
} else {
|
||||
"Sheet / settings"
|
||||
}
|
||||
.into()
|
||||
},
|
||||
|| "Sheet / settings".into(),
|
||||
|c| format!("Column {}", column_name(c)),
|
||||
);
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
|
|
@ -2965,9 +2983,25 @@ mod tests {
|
|||
assert!(
|
||||
labels
|
||||
.iter()
|
||||
.any(|(text, _)| text.starts_with("Title column missing."))
|
||||
.any(|(text, _)| text == "! Title column missing")
|
||||
);
|
||||
assert!(labels.iter().any(|(text, _)| text == "Suggested: Start"));
|
||||
let heading = labels
|
||||
.iter()
|
||||
.find(|(text, _)| text == "! Title column missing")
|
||||
.unwrap()
|
||||
.1;
|
||||
let action = labels
|
||||
.iter()
|
||||
.find(|(text, _)| text == "Next step")
|
||||
.unwrap()
|
||||
.1;
|
||||
assert!(action.left() > heading.left());
|
||||
assert!(action.top() >= heading.bottom());
|
||||
assert!(!labels.iter().any(
|
||||
|(text, _)| text.starts_with("! Column mapping needs attention")
|
||||
|| text.starts_with("Missing column ·")
|
||||
));
|
||||
assert!(!labels.iter().any(|(text, _)| matches!(
|
||||
text.as_str(),
|
||||
"Needs attention" | "Review column…" | "Affected cells"
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ visually distinct from labels and ordinary actions; the active tab uses the stro
|
|||
and source location. This grouping changes only the GUI summary, not CLI logs.
|
||||
Missing required columns are reported at sheet level: no unrelated column is
|
||||
highlighted, and existing role suggestions remain available.
|
||||
A missing-column warning uses an amber card with an indented **Next step**
|
||||
explaining which role to choose, without duplicate summary headings.
|
||||
When detection is blocked,
|
||||
recognised headers still provide hints; these do not replace validation. Expand **Detection evidence** for
|
||||
full inference and validation details; hover the **Columns** tab for a compact
|
||||
|
|
|
|||
Loading…
Reference in New Issue