545291e04a
- Run rows show a failed run's reason (else its diagnostic's first line, full text in a tooltip) or a short result preview; the Summary leads with "Why it failed". - Run again for succeeded/canceled/interrupted runs opens the New run form pre-filled (prompt, workspace, report format) at the latest version with the original offered. - Run detail and stage tabs show their names; touch shows captions on the Runs header and artifact viewer actions (desktop keeps tooltips). - ErrorNotice maps not connected / server too old / permission / timeout to what to do, raw detail behind Details (Schedules, create chat, Runs, Pipelines banners). - Settings has no Back arrow; Schedules keeps the rail on wide windows; phone Settings leads with Connection and Notifications and has a Jump to topic menu. - Walkthrough: Open Connection (skipped when connected), labelled Copy. - Pluralised counts; no duplicate status/rail names for screen readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.8 KiB
Dart
44 lines
1.8 KiB
Dart
import '../../../core/api_gateway.dart';
|
|
import 'run_models.dart' show runStateOf;
|
|
|
|
/// The longest result preview a succeeded run's row shows; a longer one is
|
|
/// left to the run's detail rather than cut into a misleading fragment.
|
|
const int runResultPreviewRowLimit = 140;
|
|
|
|
/// Why a run ended, in one line for its list row, with the full recorded text
|
|
/// for a tooltip. [failed] says the line explains a failure (drawn in the
|
|
/// error colour); otherwise it is a succeeded run's short result.
|
|
typedef RunOutcomeLine = ({String line, String full, bool failed});
|
|
|
|
/// The row's outcome line, or null when the run recorded nothing to show.
|
|
///
|
|
/// A failed run shows its failure reason, else its diagnostic's first
|
|
/// non-blank line. A succeeded run shows its result preview only when it is
|
|
/// short (at most [runResultPreviewRowLimit] characters on one line).
|
|
RunOutcomeLine? runOutcomeLine(JsonMap run) {
|
|
final state = runStateOf(run['status']);
|
|
if (state == 'failed' && run['executing'] != true) {
|
|
final reason = '${run['failure_reason'] ?? ''}'.trim();
|
|
final diagnostic = '${run['diagnostic'] ?? ''}'.trim();
|
|
final full = reason.isNotEmpty ? reason : diagnostic;
|
|
if (full.isEmpty) return null;
|
|
return (line: firstLine(full), full: full, failed: true);
|
|
}
|
|
if (state == 'succeeded') {
|
|
final preview = '${run['result_preview'] ?? ''}'.trim();
|
|
if (preview.isEmpty ||
|
|
preview.contains('\n') ||
|
|
preview.length > runResultPreviewRowLimit) {
|
|
return null;
|
|
}
|
|
return (line: preview, full: preview, failed: false);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// The first non-blank line of [text], trimmed.
|
|
String firstLine(String text) => text
|
|
.split('\n')
|
|
.map((line) => line.trim())
|
|
.firstWhere((line) => line.isNotEmpty, orElse: () => '');
|