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>
88 lines
3.6 KiB
Dart
88 lines
3.6 KiB
Dart
import '../../../core/api_gateway.dart';
|
|
import 'artifact_capture.dart';
|
|
import 'artifact_groups.dart';
|
|
import 'artifact_selection.dart';
|
|
import '../../../ui/text/plural.dart';
|
|
|
|
/// The "capture pending" wording shared by a running visit's summary and the
|
|
/// run-level empty state, so the two never spell it differently.
|
|
const String artifactCapturePending = 'capture pending';
|
|
|
|
/// The explicit message shown where the run's gallery would be when there are
|
|
/// no recorded artifacts. A running run says capture pending; a finished run
|
|
/// with available captures says plainly that nothing was recorded.
|
|
String artifactsEmptyMessage(bool executing) => executing
|
|
? 'Artifacts · $artifactCapturePending'
|
|
: 'No artifacts recorded for this run.';
|
|
|
|
/// The run summary's Artifacts section header.
|
|
///
|
|
/// The recorded count is the number of recorded entries [galleryGroups] yields:
|
|
/// stage files plus the turn documents the server actually recorded, never an
|
|
/// absent slot. The title takes its singular form for one. A run whose capture is
|
|
/// unavailable says so instead of claiming that nothing was recorded. Partial
|
|
/// capture is flagged when any visit excluded or omitted files.
|
|
String artifactsHeader(List<JsonMap> steps, {required bool executing}) {
|
|
final recorded = galleryGroups(
|
|
steps,
|
|
).fold<int>(0, (sum, group) => sum + group.recordedCount);
|
|
if (recorded == 0) {
|
|
if (executing) return artifactsEmptyMessage(true);
|
|
final unavailable = steps.any(
|
|
(step) => !ArtifactCapture.fromStep(step).isAvailable,
|
|
);
|
|
return unavailable
|
|
? 'Artifacts · capture unavailable'
|
|
: artifactsEmptyMessage(false);
|
|
}
|
|
final partial = steps.any((step) => ArtifactCapture.fromStep(step).isPartial);
|
|
var label =
|
|
'${recorded == 1 ? 'Artifact' : 'Artifacts'} · $recorded recorded';
|
|
if (partial) label += ' · partial capture';
|
|
return label;
|
|
}
|
|
|
|
/// The per-visit artifacts label.
|
|
///
|
|
/// A running visit says capture pending. A finished visit whose capture field was
|
|
/// absent says capture unavailable rather than "not recorded"; only an explicitly
|
|
/// empty capture says "not recorded for this visit". Without [count] the recorded
|
|
/// number excludes the turn-owned files and the retired session markdown, so the
|
|
/// stage-artifact words match the stage tiles; a caller that presents the turn
|
|
/// documents too passes its own recorded entry count.
|
|
String artifactsSummary(JsonMap step, {int? count}) {
|
|
final capture = ArtifactCapture.fromStep(step);
|
|
final recorded = count ?? stageArtifacts(step).length;
|
|
if (recorded == 0) {
|
|
if (step['status'] == 'running') {
|
|
return 'Artifacts · $artifactCapturePending';
|
|
}
|
|
if (!capture.isAvailable) return 'Artifacts · capture unavailable';
|
|
return 'Artifacts · not recorded for this visit';
|
|
}
|
|
var label = 'Artifacts · $recorded recorded';
|
|
if (capture.isPartial) label += ' · partial capture';
|
|
return label;
|
|
}
|
|
|
|
/// The partial-capture notes, one line per non-zero count and nothing when the
|
|
/// capture was complete or had no presented files. An unavailable capture yields
|
|
/// no notes because there is no evidence to quantify.
|
|
List<String> artifactCaptureNotes(JsonMap step) {
|
|
final notes = <String>[];
|
|
if (presentedArtifacts(artifactsOf(step)).isEmpty) return notes;
|
|
final capture = ArtifactCapture.fromStep(step);
|
|
if (capture.skipped > 0) {
|
|
notes.add(
|
|
'${countLabel(capture.skipped, 'file')} excluded from artifact capture.',
|
|
);
|
|
}
|
|
if (capture.truncated > 0) {
|
|
notes.add(
|
|
'${countLabel(capture.truncated, 'file')} omitted by artifact '
|
|
'capture limits.',
|
|
);
|
|
}
|
|
return notes;
|
|
}
|