072db8f749
- "Why it failed" banner offers Retry (the retry prompt), Run again… (New run form pre-filled; now allowed for failed runs from the banner) and Open in chat (the run's existing send-to-chat flow). - The run ⋮ menu shows while the detail loads: items listed from the run's list row, disabled until get_run answers (the loading placeholder had no actions, so the menu waited for the full detail). - Pipelines list rows: Run… in the row menu (not for archived pipelines) and a trailing Run button when the list sits beside its detail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
2.5 KiB
Dart
75 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/api_gateway.dart';
|
|
import '../domain/run_outcome_line.dart';
|
|
|
|
/// The run Summary's prominent "Why it failed" note: a failed run's recorded
|
|
/// failure reason (else its diagnostic), selectable, at the top of the
|
|
/// Summary so the reason is read before the facts. Nothing for other runs.
|
|
///
|
|
/// [actions] (the run's Retry, Run again… and Open in chat; see
|
|
/// `RunFailureActions`) sit under the reason, so what to do next is beside
|
|
/// why it failed.
|
|
class RunFailureBanner extends StatelessWidget {
|
|
const RunFailureBanner({super.key, required this.run, this.actions});
|
|
|
|
final JsonMap run;
|
|
final Widget? actions;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final outcome = runOutcomeLine(run);
|
|
if (outcome == null || !outcome.failed) return const SizedBox.shrink();
|
|
final theme = Theme.of(context);
|
|
final scheme = theme.colorScheme;
|
|
return Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
|
child: DecoratedBox(
|
|
key: const Key('run-failure-banner'),
|
|
decoration: ShapeDecoration(
|
|
color: scheme.errorContainer,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Icon(Icons.error_outline, color: scheme.onErrorContainer),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Why it failed',
|
|
style: theme.textTheme.titleSmall?.copyWith(
|
|
color: scheme.onErrorContainer,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
SelectableText(
|
|
outcome.full,
|
|
maxLines: 6,
|
|
minLines: 1,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: scheme.onErrorContainer,
|
|
),
|
|
),
|
|
if (actions case final actions?) ...[
|
|
const SizedBox(height: 8),
|
|
actions,
|
|
],
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|