17 lines
578 B
Dart
17 lines
578 B
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';
|
|
}
|
|
|
|
/// 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;
|
|
}
|