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>
39 lines
1.3 KiB
Dart
39 lines
1.3 KiB
Dart
import '../../../core/api_gateway.dart';
|
|
|
|
/// Whether the operator may retry [run], matching `canRetry` in
|
|
/// `web/src/actions.js` exactly: a loaded run that is not executing and whose
|
|
/// status is `failed`. A stale `failed` status while the run still executes is
|
|
/// not retryable.
|
|
bool canRetryRun(JsonMap? run) {
|
|
if (run == null) return false;
|
|
return run['executing'] != true && run['status'] == 'failed';
|
|
}
|
|
|
|
/// Whether [run] can be started again with its inputs: a finished run that
|
|
/// succeeded, was canceled or was interrupted, and names its pipeline. A
|
|
/// failed run has Retry instead in menus (see [canStartRunAgain]).
|
|
bool canRunAgain(JsonMap? run) =>
|
|
canStartRunAgain(run) && run!['status'] != 'failed';
|
|
|
|
/// Whether the New run form can be pre-filled from [run]: any finished run,
|
|
/// failed included, that names its pipeline. A failed run's banner offers it
|
|
/// beside Retry.
|
|
bool canStartRunAgain(JsonMap? run) {
|
|
if (run == null || run['executing'] == true) return false;
|
|
final pipeline = run['pipeline_id'];
|
|
return const {
|
|
'succeeded',
|
|
'failed',
|
|
'canceled',
|
|
'interrupted',
|
|
}.contains(run['status']) &&
|
|
pipeline is num &&
|
|
pipeline > 0;
|
|
}
|
|
|
|
/// The run id used by the retry request, or null for a malformed run.
|
|
num? retryRunId(JsonMap run) {
|
|
final id = run['id'];
|
|
return id is num ? id : null;
|
|
}
|