Unify row issue actions with a formatted inspector
This commit is contained in:
parent
5e3d3236b7
commit
bb13e2b6fa
|
|
@ -456,6 +456,9 @@ impl App {
|
|||
}
|
||||
|
||||
fn row_window(&mut self, ctx: &egui::Context) {
|
||||
if !self.row_details {
|
||||
return;
|
||||
}
|
||||
let Some(row) = self.selected_row else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -477,32 +480,83 @@ impl App {
|
|||
})
|
||||
.unwrap_or(1)
|
||||
.max(1);
|
||||
let preview = self.analysis.as_ref().and_then(|a| {
|
||||
preview_rows(a, Some(table))
|
||||
.into_iter()
|
||||
.find(|r| r.row == row)
|
||||
});
|
||||
let mut open = self.row_details;
|
||||
egui::Window::new(format!("Source row {row}"))
|
||||
egui::Window::new(format!("Row {row} · {}", self.sheet))
|
||||
.id(egui::Id::new("row_details"))
|
||||
.open(&mut open)
|
||||
.default_width(500.0)
|
||||
.default_width(560.0)
|
||||
.default_height(500.0)
|
||||
.vscroll(true)
|
||||
.show(ctx, |ui| {
|
||||
ui.label(
|
||||
"Original source values. Edit the row type and duration in Schedule & corrections.",
|
||||
);
|
||||
for (c, cell) in cells
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, c)| !c.text.is_empty() || c.formula.is_some())
|
||||
{
|
||||
ui.separator();
|
||||
ui.strong(format!(
|
||||
"{} · {}",
|
||||
column_name(c),
|
||||
table.cell(header - 1, c).text
|
||||
));
|
||||
ui.label(&cell.text);
|
||||
if let Some(formula) = &cell.formula {
|
||||
ui.small(format!("Formula: {formula}"));
|
||||
if let Some(preview) = &preview {
|
||||
ui.heading(&preview.title);
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.strong("Row type:");
|
||||
ui.label(profile.row_kinds.get(&row).map(String::as_str).unwrap_or(&preview.kind));
|
||||
});
|
||||
if self.dirty {
|
||||
ui.colored_label(PREVIEW_AMBER, "Pending changes · timing and diagnostics are from the last analysis");
|
||||
}
|
||||
egui::Frame::group(ui.style()).show(ui, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
for (label, value) in [("Start", &preview.start), ("End", &preview.end), ("Duration", &preview.duration)] {
|
||||
ui.vertical(|ui| { ui.small(label); ui.strong(value); });
|
||||
ui.add_space(20.0);
|
||||
}
|
||||
});
|
||||
if preview.gap { ui.small("Gap interval · duration is elapsed time; allocation follows the selected gap resolution."); }
|
||||
});
|
||||
if let Some(duration) = profile.durations.get(&row) {
|
||||
ui.label(format!("Duration correction: {duration}"));
|
||||
}
|
||||
if let Some(a) = &self.analysis {
|
||||
if !preview.issues.is_empty() { ui.heading("Needs attention"); }
|
||||
for index in &preview.issues {
|
||||
let d = &a.diagnostics[*index];
|
||||
let color = if needs_information(d) { PREVIEW_AMBER } else { PREVIEW_RED };
|
||||
egui::Frame::group(ui.style()).show(ui, |ui| {
|
||||
ui.colored_label(color, d.code.replace('_', " "));
|
||||
ui.add(egui::Label::new(d.message.split("\nRow preview:").next().unwrap_or_default()).wrap());
|
||||
});
|
||||
}
|
||||
}
|
||||
if !preview.decisions.is_empty() {
|
||||
ui.heading("Timing decisions");
|
||||
ui.add(egui::Label::new(&preview.decisions).wrap());
|
||||
}
|
||||
}
|
||||
ui.separator();
|
||||
ui.heading("Original cells");
|
||||
ui.small("Source values are unchanged. Make corrections in the review table, then apply & recheck.");
|
||||
let value_width = (ui.available_width() - 150.0).max(120.0);
|
||||
egui::Grid::new("inspector_cells").striped(true).spacing(egui::vec2(16.0, 12.0)).show(ui, |ui| {
|
||||
ui.strong("Column / header");
|
||||
ui.strong("Source value");
|
||||
ui.end_row();
|
||||
for (c, cell) in cells.iter().enumerate() {
|
||||
ui.vertical(|ui| {
|
||||
ui.set_width(120.0);
|
||||
ui.strong(column_name(c));
|
||||
ui.add(egui::Label::new(table.cell(header - 1, c).text).wrap());
|
||||
if let Some(usage) = profile.usage(c) { ui.small(usage); }
|
||||
});
|
||||
ui.vertical(|ui| {
|
||||
ui.set_width(value_width);
|
||||
if cell.text.is_empty() { ui.weak("Empty"); }
|
||||
else { ui.add(egui::Label::new(&cell.text).wrap()); }
|
||||
if let Some(formula) = &cell.formula {
|
||||
ui.small("Formula");
|
||||
ui.add(egui::Label::new(RichText::new(formula).monospace()).wrap());
|
||||
}
|
||||
});
|
||||
ui.end_row();
|
||||
}
|
||||
});
|
||||
});
|
||||
self.row_details = open;
|
||||
}
|
||||
|
|
@ -782,9 +836,11 @@ impl App {
|
|||
.unwrap_or_default(),
|
||||
);
|
||||
}
|
||||
explanation.push_str(
|
||||
"\n\nDouble-click the title or row number to view original cells.",
|
||||
);
|
||||
if row.row > 0 {
|
||||
explanation.push_str(
|
||||
"\n\nDouble-click the title or row number to view original cells.",
|
||||
);
|
||||
}
|
||||
if ui
|
||||
.add(
|
||||
egui::Label::new(RichText::new(&row.title).color(color))
|
||||
|
|
@ -805,16 +861,20 @@ impl App {
|
|||
if ui
|
||||
.small_button(
|
||||
RichText::new(if error {
|
||||
"Error · details"
|
||||
"Error"
|
||||
} else {
|
||||
"Unresolved · details"
|
||||
"Unresolved"
|
||||
})
|
||||
.color(color),
|
||||
)
|
||||
.on_hover_text(&explanation)
|
||||
.clicked()
|
||||
{
|
||||
resolve = Some(*index);
|
||||
if row.row > 0 {
|
||||
details = Some(row.row);
|
||||
} else {
|
||||
resolve = Some(*index);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1294,13 +1354,21 @@ mod tests {
|
|||
assert!(labels.iter().any(|(s, _)| s == "Auto (Event)"));
|
||||
let resolve = labels
|
||||
.iter()
|
||||
.find(|(s, _)| s == "Unresolved · details")
|
||||
.filter(|(s, _)| s == "Unresolved")
|
||||
.nth(1)
|
||||
.unwrap()
|
||||
.1
|
||||
.center();
|
||||
click_size(&mut app, &ctx, resolve, [860.0, 900.0]);
|
||||
assert!(app.review_view == ReviewView::Rows);
|
||||
assert_eq!(app.selected_row, Some(3));
|
||||
assert!(app.row_details);
|
||||
assert!(!app.show_issue_details);
|
||||
render(&mut app, &ctx, [860.0, 900.0], vec![]);
|
||||
let labels = render(&mut app, &ctx, [860.0, 900.0], vec![]);
|
||||
assert!(labels.iter().any(|(s, _)| s == "Original cells"));
|
||||
assert!(labels.iter().any(|(s, _)| s == "UNTIMED ROW"));
|
||||
assert!(labels.iter().any(|(s, _)| s == "Empty"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1331,7 +1399,7 @@ mod tests {
|
|||
configure_style(&ctx);
|
||||
render(&mut app, &ctx, [860.0, 900.0], vec![]);
|
||||
let labels = render(&mut app, &ctx, [860.0, 900.0], vec![]);
|
||||
assert!(labels.iter().any(|(s, _)| s == "Error · details"));
|
||||
assert!(labels.iter().any(|(s, _)| s == "Error"));
|
||||
app.tables[0].rows[1][0].text = "invalid clock".into();
|
||||
let a = pipeline::analyze(&app.tables[0], &profile, &AtomicBool::new(false), |_, _| {});
|
||||
assert!(a.rundown.is_none());
|
||||
|
|
|
|||
|
|
@ -56,9 +56,12 @@ click **Analyze rundown**. Review has two views:
|
|||
remove the stale choice in Setup or reset decisions and recheck.
|
||||
Unknown values show `?`.
|
||||
Hover over a title or issue button for row status and full diagnostic explanations.
|
||||
Double-click a row number/title to read all original cells. **Issues** opens the issue
|
||||
navigator, including sheet-level and gap errors; row issue buttons open the
|
||||
relevant explanation. The table fills the remaining space. On narrow windows,
|
||||
Double-click a row number/title, or click its **Unresolved** / **Error** button,
|
||||
to open the row inspector. It shows timing, row type, full diagnostics, timing
|
||||
decisions and a formatted table of original cells (including empty values and
|
||||
formulas). Pending edits are distinguished from the last analyzed timing.
|
||||
**Issues** opens the issue navigator, including sheet-level and gap errors.
|
||||
The table fills the remaining space. On narrow windows,
|
||||
timing values stack so corrections remain accessible. Changes require recheck;
|
||||
the timing preview and diagnostics continue to show the previous analysis.
|
||||
- **Columns** shows inference evidence, per-column role dropdowns, and sample
|
||||
|
|
|
|||
Loading…
Reference in New Issue