feat(app): Retry sits beside a failed run's status
This commit is contained in:
@@ -19,6 +19,7 @@ class RunDetailActions extends StatelessWidget {
|
||||
required this.gateway,
|
||||
required this.onRunChanged,
|
||||
this.onRunOpened,
|
||||
this.retry = true,
|
||||
});
|
||||
|
||||
final JsonMap run;
|
||||
@@ -28,6 +29,9 @@ class RunDetailActions extends StatelessWidget {
|
||||
/// Opens the new run named by an accepted retry reply; see [RetryRunAction].
|
||||
final ValueChanged<num>? onRunOpened;
|
||||
|
||||
/// False when the host draws Retry beside the run's failed status instead.
|
||||
final bool retry;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -51,7 +55,7 @@ class RunDetailActions extends StatelessWidget {
|
||||
),
|
||||
if (canScheduleRun(run))
|
||||
ScheduleRunAction(run: run, gateway: gateway),
|
||||
if (retryRunId(run) != null && canRetryRun(run))
|
||||
if (retry && retryRunId(run) != null && canRetryRun(run))
|
||||
RetryRunAction(
|
||||
run: run,
|
||||
gateway: gateway,
|
||||
|
||||
@@ -15,6 +15,7 @@ Widget buildCupertinoRunDetail({
|
||||
required BuildContext context,
|
||||
required JsonMap run,
|
||||
required Widget headerActions,
|
||||
Widget? statusAction,
|
||||
required bool detailLoading,
|
||||
required String? error,
|
||||
required bool copying,
|
||||
@@ -72,9 +73,17 @@ Widget buildCupertinoRunDetail({
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
RunStatusKicker(
|
||||
state: runStateOf(run['status']),
|
||||
label: runStatusLabel(run),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
RunStatusKicker(
|
||||
state: runStateOf(run['status']),
|
||||
label: runStatusLabel(run),
|
||||
),
|
||||
?statusAction,
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
|
||||
@@ -15,6 +15,7 @@ Widget buildMaterialRunDetail({
|
||||
required BuildContext context,
|
||||
required JsonMap run,
|
||||
required Widget headerActions,
|
||||
Widget? statusAction,
|
||||
required bool detailLoading,
|
||||
required String? error,
|
||||
required bool copying,
|
||||
@@ -62,9 +63,17 @@ Widget buildMaterialRunDetail({
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: RunStatusKicker(
|
||||
state: runStateOf(run['status']),
|
||||
label: runStatusLabel(run),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
RunStatusKicker(
|
||||
state: runStateOf(run['status']),
|
||||
label: runStatusLabel(run),
|
||||
),
|
||||
?statusAction,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:flutter/services.dart';
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../core/transport/pipelines_client.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../actions/retry_action.dart';
|
||||
import '../actions/retry_eligibility.dart';
|
||||
import 'run_detail_actions.dart';
|
||||
import 'run_detail_content.dart';
|
||||
import 'run_detail_cupertino.dart';
|
||||
@@ -60,12 +62,23 @@ class _RunDetailViewState extends State<RunDetailView> {
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.controller.acceptRunDetail,
|
||||
onRunOpened: widget.onRunOpened,
|
||||
retry: false,
|
||||
);
|
||||
// Retry sits next to the status it answers, and only for a failed run.
|
||||
final statusAction = retryRunId(run) != null && canRetryRun(run)
|
||||
? RetryRunAction(
|
||||
run: run,
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.controller.acceptRunDetail,
|
||||
onRunOpened: widget.onRunOpened,
|
||||
)
|
||||
: null;
|
||||
return cupertino
|
||||
? buildCupertinoRunDetail(
|
||||
context: context,
|
||||
run: run,
|
||||
headerActions: headerActions,
|
||||
statusAction: statusAction,
|
||||
detailLoading: widget.controller.detailLoading,
|
||||
error: widget.controller.error,
|
||||
copying: _copying,
|
||||
@@ -82,6 +95,7 @@ class _RunDetailViewState extends State<RunDetailView> {
|
||||
context: context,
|
||||
run: run,
|
||||
headerActions: headerActions,
|
||||
statusAction: statusAction,
|
||||
detailLoading: widget.controller.detailLoading,
|
||||
error: widget.controller.error,
|
||||
copying: _copying,
|
||||
|
||||
Reference in New Issue
Block a user