141 lines
4.3 KiB
Dart
141 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/api_gateway.dart';
|
|
import '../../../ui/status/run_status_icon.dart';
|
|
import '../domain/run_models.dart';
|
|
import 'run_detail_content.dart';
|
|
import 'run_detail_tabs.dart';
|
|
import 'run_more_menu.dart';
|
|
import 'run_pipeline_link.dart';
|
|
|
|
/// The runs detail with standard Material controls.
|
|
///
|
|
/// The host header keeps the run identity, status and every action; the shared
|
|
/// tab body supplies Summary, Graph, Input, Output and Timeline.
|
|
Widget buildMaterialRunDetail({
|
|
required BuildContext context,
|
|
required JsonMap run,
|
|
required Widget headerActions,
|
|
bool inShellBar = false,
|
|
ValueChanged<num>? onRunOpened,
|
|
OpenPipeline? onOpenPipeline,
|
|
required bool detailLoading,
|
|
required String? error,
|
|
required bool copying,
|
|
required String? copyStatus,
|
|
required VoidCallback onBack,
|
|
required VoidCallback onCopy,
|
|
required ApiGateway gateway,
|
|
required ValueChanged<JsonMap> onRunChanged,
|
|
required String configuredEndpoint,
|
|
String? initialStageKey,
|
|
int? initialVisit,
|
|
}) {
|
|
final theme = Theme.of(context);
|
|
return RunDetailTabs(
|
|
run: run,
|
|
cupertino: false,
|
|
copying: copying,
|
|
copyStatus: copyStatus,
|
|
onCopy: onCopy,
|
|
gateway: gateway,
|
|
onRunChanged: onRunChanged,
|
|
configuredEndpoint: configuredEndpoint,
|
|
initialStageKey: initialStageKey,
|
|
initialVisit: initialVisit,
|
|
header: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
// Inside the app shell, Back and the more menu are in its bar.
|
|
if (!inShellBar)
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
child: Wrap(
|
|
spacing: 8,
|
|
runSpacing: 4,
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
children: [
|
|
TextButton.icon(
|
|
onPressed: onBack,
|
|
icon: const Icon(Icons.arrow_back),
|
|
label: const Text('Back to list'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
RunMoreMenu(
|
|
run: run,
|
|
gateway: gateway,
|
|
onRunChanged: onRunChanged,
|
|
cupertino: false,
|
|
onRunOpened: onRunOpened,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
|
child: Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: Wrap(
|
|
spacing: 8,
|
|
runSpacing: 4,
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
children: [
|
|
RunStatusKicker(
|
|
state: runStateOf(run['status']),
|
|
label: runStatusLabel(run),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
|
|
child: Text(detailTitle(run), style: theme.textTheme.headlineSmall),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
|
child: Wrap(
|
|
spacing: 8,
|
|
runSpacing: 4,
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
children: [
|
|
Text('Run ${run['id']}'),
|
|
Wrap(
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
children: [
|
|
const Text('Pipeline '),
|
|
RunPipelineLink(
|
|
run: run,
|
|
cupertino: false,
|
|
onOpenPipeline: onOpenPipeline,
|
|
),
|
|
],
|
|
),
|
|
headerActions,
|
|
],
|
|
),
|
|
),
|
|
if (detailLoading) const _Notice('Refreshing run details…'),
|
|
if (error != null) _Notice(error),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
class _Notice extends StatelessWidget {
|
|
const _Notice(this.text);
|
|
final String text;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
child: Semantics(liveRegion: true, child: Text(text)),
|
|
);
|
|
}
|