Make rundown hover diagnostics actionable
This commit is contained in:
parent
de72069577
commit
4d2dc1de95
|
|
@ -111,6 +111,101 @@ fn row_diagnostic_message(row: &PreviewRow, index: usize, diagnostic: &Diagnosti
|
|||
}
|
||||
}
|
||||
|
||||
fn diagnostic_resolution(row: &PreviewRow, index: usize, diagnostic: &Diagnostic) -> &'static str {
|
||||
match diagnostic.code.as_str() {
|
||||
"OVERLAP" if row.related_issues.contains(&index) => {
|
||||
"Edit this cue's end or duration, or the following cue's start or duration. If both are correct, place them on separate parallel tracks, then apply and recheck."
|
||||
}
|
||||
"OVERLAP" => {
|
||||
"Edit this cue's start or duration, or the highlighted predecessor's end or duration. If both are correct, place them on separate parallel tracks, then apply and recheck."
|
||||
}
|
||||
"BACKWARD_TIME" => {
|
||||
"Correct this cue's start time, or place simultaneous cues on separate tracks, then apply and recheck."
|
||||
}
|
||||
"NEGATIVE_DURATION" => {
|
||||
"Correct the start, end or duration so the resulting duration is positive, then apply and recheck."
|
||||
}
|
||||
"CONFLICTING_TIMES" | "CONFLICTING_MERGE" => {
|
||||
"Correct the source timing or enter an explicit duration in Edit row, then apply and recheck."
|
||||
}
|
||||
"UNTIMED_ROW" => {
|
||||
"Open Details and choose Note, Marker, Gap or Ignore, or enter a duration for an event; then apply and recheck."
|
||||
}
|
||||
"MISSING_DURATION" => {
|
||||
"Open Details and enter a duration, or classify the row as a marker, note, gap or ignored row; then apply and recheck."
|
||||
}
|
||||
"MISSING_START" => {
|
||||
"Correct or supply the start time in the source or Edit row, then apply and recheck."
|
||||
}
|
||||
"MISSING_TITLE" => {
|
||||
"Supply a title, or choose a non-event row type in Details, then apply and recheck."
|
||||
}
|
||||
"ORPHAN_NOTE" => {
|
||||
"Choose another row type, or ensure a timed event precedes this note, then apply and recheck."
|
||||
}
|
||||
"UNRESOLVED_GAP" | "INVALID_GAP" => {
|
||||
"Correct the neighboring timing boundaries or choose the appropriate gap resolution, then apply and recheck."
|
||||
}
|
||||
"GAP_OVERLAP" => {
|
||||
"Correct the break or overlapping event boundaries, then apply and recheck."
|
||||
}
|
||||
"INVALID_EVENT" => {
|
||||
"Add a positive duration and title, or classify this as a marker, note, gap or ignored row; then apply and recheck."
|
||||
}
|
||||
"TARGET_TIME_LIMIT" => {
|
||||
"Split the rundown by day, or keep its times and durations within one day, then apply and recheck."
|
||||
}
|
||||
_ => "Open Details, correct the highlighted row, then apply and recheck.",
|
||||
}
|
||||
}
|
||||
|
||||
fn row_hover_text(row: &PreviewRow, analysis: &Analysis, status: &str) -> String {
|
||||
let mut explanation = String::new();
|
||||
for index in &row.issues {
|
||||
let diagnostic = &analysis.diagnostics[*index];
|
||||
if !explanation.is_empty() {
|
||||
explanation.push_str("\n\n");
|
||||
}
|
||||
let severity = if needs_information(diagnostic) {
|
||||
"WARNING"
|
||||
} else {
|
||||
"ERROR"
|
||||
};
|
||||
let relationship = if row.related_issues.contains(index) {
|
||||
"RELATED "
|
||||
} else {
|
||||
""
|
||||
};
|
||||
explanation.push_str(&format!(
|
||||
"{severity} · {relationship}{}\n{}\n{}\n\nHow to resolve: {}",
|
||||
diagnostic.code.replace('_', " "),
|
||||
if row.related_issues.contains(index) {
|
||||
format!("Related issue at {}", diagnostic.location)
|
||||
} else {
|
||||
diagnostic.location.clone()
|
||||
},
|
||||
row_diagnostic_message(row, *index, diagnostic),
|
||||
diagnostic_resolution(row, *index, diagnostic),
|
||||
));
|
||||
}
|
||||
if !explanation.is_empty() {
|
||||
explanation.push_str("\n\n");
|
||||
}
|
||||
explanation.push_str(&format!("Status: {status}"));
|
||||
if !row.decisions.is_empty() {
|
||||
explanation.push('\n');
|
||||
explanation.push_str(&row.decisions);
|
||||
}
|
||||
if row.row > 0 {
|
||||
explanation
|
||||
.push_str("\n\nDouble-click anywhere on this row to edit it and view original cells.");
|
||||
} else {
|
||||
explanation
|
||||
.push_str("\n\nDouble-click anywhere on this gap to view its timing and resolution.");
|
||||
}
|
||||
explanation
|
||||
}
|
||||
|
||||
/// Combine timed draft entries and omitted problem rows without changing the IR.
|
||||
fn preview_rows(a: &Analysis, table: Option<&Table>) -> Vec<PreviewRow> {
|
||||
let mut rows = Vec::new();
|
||||
|
|
@ -1323,29 +1418,7 @@ impl App {
|
|||
} else {
|
||||
"Timed"
|
||||
};
|
||||
let mut explanation = status.to_owned();
|
||||
if !row.decisions.is_empty() {
|
||||
explanation.push_str("\n\n");
|
||||
explanation.push_str(&row.decisions);
|
||||
}
|
||||
for index in &row.issues {
|
||||
let diagnostic = &a.diagnostics[*index];
|
||||
explanation.push_str("\n\n");
|
||||
explanation.push_str(&row_diagnostic_message(
|
||||
row,
|
||||
*index,
|
||||
diagnostic,
|
||||
));
|
||||
}
|
||||
if row.row > 0 {
|
||||
explanation.push_str(
|
||||
"\n\nDouble-click anywhere on this row to edit it and view original cells.",
|
||||
);
|
||||
} else {
|
||||
explanation.push_str(
|
||||
"\n\nDouble-click anywhere on this gap to view its timing and resolution.",
|
||||
);
|
||||
}
|
||||
let explanation = row_hover_text(row, a, status);
|
||||
if ui
|
||||
.add(
|
||||
egui::Label::new(RichText::new(&title).color(color))
|
||||
|
|
@ -1697,8 +1770,11 @@ mod tests {
|
|||
assert!(
|
||||
labels
|
||||
.iter()
|
||||
.any(|(s, _)| s.contains("Source row · not a timer")
|
||||
&& s.contains("This row has content but no timing"))
|
||||
.any(|(s, _)| s.contains("WARNING · UNTIMED ROW")
|
||||
&& s.contains("Show!row 3")
|
||||
&& s.contains("This row has content but no timing")
|
||||
&& s.contains("How to resolve:")
|
||||
&& s.contains("Status: Source row · not a timer"))
|
||||
);
|
||||
assert!(!labels.iter().any(|(s, _)| s.contains("Row preview:")));
|
||||
click_size(&mut app, &ctx, title, size);
|
||||
|
|
@ -2431,7 +2507,11 @@ mod tests {
|
|||
assert!(
|
||||
labels
|
||||
.iter()
|
||||
.any(|(text, _)| text.contains("predecessor in the overlap"))
|
||||
.any(|(text, _)| text.contains("ERROR · RELATED OVERLAP")
|
||||
&& text.contains("Related issue at Show!row 15")
|
||||
&& text.contains("predecessor in the overlap")
|
||||
&& text.contains("How to resolve:")
|
||||
&& text.contains("following cue's start or duration"))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,9 +77,12 @@ visually distinct from labels and ordinary actions; the active tab uses the stro
|
|||
parent timer instead of duplicating it. Amber means unresolved, red means an
|
||||
error, gray means ignored, and teal marks gaps. An overlap marks both the later
|
||||
cue and its predecessor in red because either timing may need correction; each
|
||||
row's hover and inspector explains its side of the conflict. Gaps appear in
|
||||
schedule order with their start, end and elapsed duration (no timer). Named breaks use their
|
||||
source row; inferred gaps update after recheck. Each gap offers **Keep gap**
|
||||
row's hover leads with the warning or error severity, code, source location,
|
||||
full explanation and a concrete way to resolve it. Row status and editing hints
|
||||
follow as secondary information; raw source cells remain in the double-click
|
||||
inspector. For overlaps, both affected rows explain their side of the conflict.
|
||||
Gaps appear in schedule order with their start, end and elapsed duration (no timer).
|
||||
Named breaks use their source row; inferred gaps update after recheck. Each gap offers **Keep gap**
|
||||
(default, no timer), **Extend previous timing** (extend the preceding event's end),
|
||||
or **Add to next timing** (start the following event earlier, keeping its end).
|
||||
Apply & recheck updates durations and Ontime output. Allocated intervals remain
|
||||
|
|
|
|||
Loading…
Reference in New Issue