polish compact pipeline and run lists
This commit is contained in:
@@ -1,15 +1,7 @@
|
||||
import '../../../ui/theme/app_theme.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../graph/domain/graph_definition.dart';
|
||||
import '../../graph/layout/graph_node_layout.dart';
|
||||
import '../../graph/layout/layout_models.dart';
|
||||
import '../../graph/routing/graph_edge_routing.dart';
|
||||
import '../../graph/routing/route_models.dart';
|
||||
import '../../graph/widgets/graph_canvas_style.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../pipeline_format.dart';
|
||||
import '../pipeline_models.dart';
|
||||
@@ -207,8 +199,8 @@ class PipelineListPanel extends StatelessWidget {
|
||||
horizontal: kPipelineListInset,
|
||||
),
|
||||
visualDensity: VisualDensity.compact,
|
||||
leading: compact ? null : _pipelineIdentityIcon(context),
|
||||
title: _rowTitle(context, pipeline, compact: compact),
|
||||
leading: compact ? null : _pipelineIdentityIcon(context, pipeline),
|
||||
title: _rowTitle(context, pipeline, now: now, compact: compact),
|
||||
subtitle: _rowMetadata(context, pipeline, now, compact: compact),
|
||||
trailing: compact ? null : const Icon(Icons.chevron_right),
|
||||
);
|
||||
@@ -236,8 +228,15 @@ class PipelineListPanel extends StatelessWidget {
|
||||
backgroundColor: controller.selectedId == pipeline.id
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: null,
|
||||
leading: compact ? null : _pipelineIdentityIcon(context),
|
||||
title: _rowTitle(context, pipeline, compact: compact),
|
||||
leading: compact
|
||||
? null
|
||||
: _pipelineIdentityIcon(context, pipeline),
|
||||
title: _rowTitle(
|
||||
context,
|
||||
pipeline,
|
||||
now: now,
|
||||
compact: compact,
|
||||
),
|
||||
subtitle: _rowMetadata(
|
||||
context,
|
||||
pipeline,
|
||||
@@ -257,11 +256,12 @@ class PipelineListPanel extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// The row's title line: its name, and its version and id in the corner.
|
||||
/// The row's title line: its name and, when known, its latest run's age.
|
||||
/// A narrow split pane keeps the name alone; the detail preserves identity.
|
||||
Widget _rowTitle(
|
||||
BuildContext context,
|
||||
PipelineSummary pipeline, {
|
||||
required DateTime now,
|
||||
required bool compact,
|
||||
}) {
|
||||
final muted = _mutedStyle(context);
|
||||
@@ -273,35 +273,30 @@ class PipelineListPanel extends StatelessWidget {
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
);
|
||||
}
|
||||
return _measured(
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
pipeline.displayName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// Weight only: the native tile owns size and the selected colour.
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
final run = controller.runsLoaded
|
||||
? controller.latestRuns[pipeline.id]
|
||||
: null;
|
||||
final ranAgo = run == null ? null : runBadge(run, now).ranAgo;
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
pipeline.displayName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// Weight only: the native tile owns size and the selected colour.
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
if (ranAgo != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
_RightCorner(
|
||||
child: Text(
|
||||
'${pipelineVersionLabel(pipeline)} · #${pipeline.id}',
|
||||
style: muted,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(ranAgo, style: muted, maxLines: 1),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// The row below the title, its facts in the corners: what the pipeline is
|
||||
/// (stages, schedule) beside its miniature, then how it last ran beside when
|
||||
/// it was updated. Everything comes from recorded values.
|
||||
/// The row's one muted subtitle: latest-run state, stage count, and schedules.
|
||||
Widget _rowMetadata(
|
||||
BuildContext context,
|
||||
PipelineSummary pipeline,
|
||||
@@ -309,52 +304,26 @@ class PipelineListPanel extends StatelessWidget {
|
||||
required bool compact,
|
||||
}) {
|
||||
final style = _mutedStyle(context);
|
||||
final schedules = switch (pipeline.scheduleState) {
|
||||
PipelineScheduleState.scheduled => pipeline.scheduleLabel,
|
||||
PipelineScheduleState.unscheduled => '0 schedules',
|
||||
PipelineScheduleState.unclassified => '',
|
||||
};
|
||||
final what = [
|
||||
pipelineStageSummary(pipeline),
|
||||
if (pipeline.scheduleLabel.isNotEmpty) pipeline.scheduleLabel,
|
||||
if (schedules.isNotEmpty) schedules,
|
||||
].join(' · ');
|
||||
final updated = pipelineUpdatedLine(pipeline);
|
||||
final run = controller.runsLoaded
|
||||
? controller.latestRuns[pipeline.id]
|
||||
: null;
|
||||
final badge = run == null ? null : runBadge(run, now);
|
||||
final shape = pipeline.shape;
|
||||
// As the web's `row-run`: the coloured status glyph (its tooltip and
|
||||
// accessible name are the state word), then `2d ago · 4m 12s · run 488`.
|
||||
final lastRun = badge != null
|
||||
? Row(
|
||||
children: [
|
||||
RunStatusIcon(
|
||||
state: badge.state,
|
||||
label: runStateLabel(badge.state),
|
||||
size: 14,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
badge.metaLine,
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: controller.runsLoaded
|
||||
? Text(
|
||||
'no runs recorded',
|
||||
style: style,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
// A 640px window can leave this pane about 130px wide. At that size the
|
||||
// latest state is the useful decision signal; stage counts, timestamps,
|
||||
// graph cues and version live in the selected pipeline's detail instead.
|
||||
if (compact) {
|
||||
// Do not turn an in-flight or failed run-history read into a false
|
||||
// no-runs claim. The normal row also stays blank until history is known.
|
||||
if (badge == null) return lastRun;
|
||||
if (badge == null) return const SizedBox.shrink();
|
||||
return Semantics(
|
||||
label: runStateLabel(badge.state),
|
||||
child: Row(
|
||||
@@ -377,56 +346,34 @@ class PipelineListPanel extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
return _measured(
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
what,
|
||||
style: style,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
return Row(
|
||||
children: [
|
||||
if (badge != null) ...[
|
||||
Semantics(
|
||||
label: runStateLabel(badge.state),
|
||||
child: ExcludeSemantics(
|
||||
child: Container(
|
||||
key: Key('pipeline-status-${pipeline.id}'),
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: runStatusColor(badge.state).resolveFrom(context),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
if (shape != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
// The miniature keeps to its corner and scales down when narrow.
|
||||
_RightCorner(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: PipelineMiniGraph(
|
||||
key: Key('pipeline-mini-${pipeline.id}'),
|
||||
shape: shape,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: lastRun),
|
||||
if (updated != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
_RightCorner(
|
||||
child: Text(
|
||||
updated,
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
what,
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -442,187 +389,31 @@ class PipelineListPanel extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pipelineIdentityIcon(BuildContext context) => Semantics(
|
||||
label: 'Pipeline',
|
||||
child: Icon(
|
||||
useCupertinoControls(context)
|
||||
? CupertinoIcons.flowchart
|
||||
: Icons.account_tree_outlined,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The row's recorded flow cue: label-free stage boxes and their routes.
|
||||
///
|
||||
/// Mirrors `web/src/miniGraph.js` and `.pipeline-mini`: stage nodes only (no
|
||||
/// terminals, labels or placeholder), drawn from the shared graph layout and
|
||||
/// routing. Nothing is fetched and no node is invented, so a summary without a
|
||||
/// recorded `shape` draws no cue.
|
||||
class PipelineMiniGraph extends StatelessWidget {
|
||||
const PipelineMiniGraph({super.key, required this.shape});
|
||||
|
||||
/// The summary's recorded flow (`shape`), verbatim.
|
||||
final PipelineJson shape;
|
||||
|
||||
// The cue's graph coordinates, matching the web miniature's own metrics.
|
||||
// These are drawing coordinates for a graph, not row/control dimensions.
|
||||
static const double _nodeWidth = 26;
|
||||
static const double _nodeHeight = 12;
|
||||
static const double _columnGap = 12;
|
||||
static const double _rowGap = 8;
|
||||
static const double _padding = 2;
|
||||
static const double _maxWidth = 180;
|
||||
static const double _maxHeight = 22;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final flow = _miniatureFlow(shape);
|
||||
if (flow == null) return const SizedBox.shrink();
|
||||
final nodes = graphNodes(flow);
|
||||
final edges = graphEdges(flow);
|
||||
final layout = layoutGraphNodes(
|
||||
nodes: nodes,
|
||||
edges: edges,
|
||||
extents: <String, NodeExtent>{
|
||||
for (final node in nodes)
|
||||
node.key: NodeExtent(width: _nodeWidth, height: _nodeHeight),
|
||||
},
|
||||
config: GraphLayoutConfig(
|
||||
columnGap: _columnGap,
|
||||
rowGap: _rowGap,
|
||||
padding: _padding,
|
||||
),
|
||||
);
|
||||
final routing = routeGraphEdges(
|
||||
layout: layout,
|
||||
edges: edges,
|
||||
labelExtents: <int, LabelExtent>{
|
||||
// The cue is deliberately label-free, like the web miniature.
|
||||
for (final edge in edges) edge.id: LabelExtent(width: 0, height: 0),
|
||||
},
|
||||
config: RoutingConfig(
|
||||
nodeClearance: 2,
|
||||
laneSpacing: 6,
|
||||
corridorSpacing: 4,
|
||||
portSpacing: 3,
|
||||
labelGap: 0,
|
||||
boundsPadding: 2,
|
||||
),
|
||||
);
|
||||
final style = GraphCanvasStyle.of(context);
|
||||
final size = Size(math.max(routing.width, 1), math.max(routing.height, 1));
|
||||
return ExcludeSemantics(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 8),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: _maxWidth,
|
||||
maxHeight: _maxHeight,
|
||||
),
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: SizedBox(
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
child: CustomPaint(
|
||||
painter: _MiniGraphPainter(
|
||||
layout: layout,
|
||||
routes: routing.routes,
|
||||
color: style.edgeColor,
|
||||
strokeWidth: style.edgeWidth,
|
||||
),
|
||||
),
|
||||
),
|
||||
Widget _pipelineIdentityIcon(BuildContext context, PipelineSummary pipeline) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final colors = [scheme.primary, scheme.secondary, scheme.tertiary];
|
||||
final color = colors[pipeline.id.abs() % colors.length];
|
||||
final name = pipeline.displayName.trimLeft();
|
||||
final initial = name.isEmpty
|
||||
? '?'
|
||||
: String.fromCharCode(name.runes.first).toUpperCase();
|
||||
return Semantics(
|
||||
label: 'Pipeline ${pipeline.displayName}',
|
||||
child: ExcludeSemantics(
|
||||
child: Container(
|
||||
key: Key('pipeline-avatar-${pipeline.id}'),
|
||||
width: 40,
|
||||
height: 40,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: color.withValues(alpha: 0.14),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Text(initial, style: TextStyle(color: color)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The recorded stages with edges kept only between declared stage keys.
|
||||
///
|
||||
/// This is the web miniature's own filter: terminal routes (`#success`/
|
||||
/// `#failure`) and unknown targets are not drawn as cue nodes, and a shape
|
||||
/// with no declared stage key yields no cue.
|
||||
Map<String, dynamic>? _miniatureFlow(PipelineJson raw) {
|
||||
final stages = raw['stages'];
|
||||
if (stages is! List) return null;
|
||||
final recorded = <Map<String, dynamic>>[];
|
||||
final keys = <String>{};
|
||||
for (final entry in stages) {
|
||||
if (entry is! Map) continue;
|
||||
final stage = Map<String, dynamic>.from(entry);
|
||||
final key = '${stage['key'] ?? ''}';
|
||||
if (key.isEmpty) continue;
|
||||
recorded.add(stage);
|
||||
keys.add(key);
|
||||
}
|
||||
if (recorded.isEmpty) return null;
|
||||
for (final stage in recorded) {
|
||||
final edges = stage['edges'];
|
||||
if (edges is! Map) continue;
|
||||
stage['edges'] = <String, dynamic>{
|
||||
for (final edge in edges.entries)
|
||||
if (keys.contains('${edge.value}')) '${edge.key}': edge.value,
|
||||
};
|
||||
}
|
||||
return <String, dynamic>{'stages': recorded};
|
||||
}
|
||||
}
|
||||
|
||||
/// Paints the miniature's routed edges and rounded stage boxes in graph space.
|
||||
class _MiniGraphPainter extends CustomPainter {
|
||||
_MiniGraphPainter({
|
||||
required this.layout,
|
||||
required this.routes,
|
||||
required this.color,
|
||||
required this.strokeWidth,
|
||||
});
|
||||
|
||||
final GraphLayout layout;
|
||||
final List<EdgeRoute> routes;
|
||||
final Color color;
|
||||
final double strokeWidth;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
canvas.save();
|
||||
canvas.clipRect(Offset.zero & size);
|
||||
final edgePaint = Paint()
|
||||
..color = color.withValues(alpha: 0.5)
|
||||
..strokeWidth = strokeWidth
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeJoin = StrokeJoin.round;
|
||||
for (final route in routes) {
|
||||
if (route.points.length < 2) continue;
|
||||
final path = Path()..moveTo(route.points.first.x, route.points.first.y);
|
||||
for (var index = 1; index < route.points.length; index += 1) {
|
||||
path.lineTo(route.points[index].x, route.points[index].y);
|
||||
}
|
||||
canvas.drawPath(path, edgePaint);
|
||||
}
|
||||
final nodePaint = Paint()
|
||||
..color = color.withValues(alpha: 0.55)
|
||||
..style = PaintingStyle.fill;
|
||||
for (final box in layout.nodes) {
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromLTWH(box.x, box.y, box.width, box.height),
|
||||
const Radius.circular(3),
|
||||
),
|
||||
nodePaint,
|
||||
);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant _MiniGraphPainter oldDelegate) =>
|
||||
oldDelegate.color != color ||
|
||||
oldDelegate.strokeWidth != strokeWidth ||
|
||||
!identical(oldDelegate.layout, layout) ||
|
||||
!identical(oldDelegate.routes, routes);
|
||||
}
|
||||
|
||||
/// The Pipelines list's app-bar actions: filter (with its count) and sort.
|
||||
@@ -678,44 +469,3 @@ List<Widget> pipelineListActions(
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// A row's right-hand item: its own width, flush against the trailing edge,
|
||||
/// never more than about half the row, so the left side keeps the rest.
|
||||
class _RightCorner extends StatelessWidget {
|
||||
const _RightCorner({required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final width = _RowWidth.of(context);
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: width * 0.45),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The width of the row a [_RightCorner] sits in.
|
||||
class _RowWidth extends InheritedWidget {
|
||||
const _RowWidth({required this.width, required super.child});
|
||||
|
||||
final double width;
|
||||
|
||||
static double of(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<_RowWidth>()?.width ??
|
||||
MediaQuery.sizeOf(context).width;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(_RowWidth oldWidget) => width != oldWidget.width;
|
||||
}
|
||||
|
||||
/// Gives the [_RightCorner]s inside [child] the row's own width.
|
||||
Widget _measured(Widget child) => LayoutBuilder(
|
||||
builder: (context, constraints) => _RowWidth(
|
||||
width: constraints.hasBoundedWidth
|
||||
? constraints.maxWidth
|
||||
: MediaQuery.sizeOf(context).width,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -10,9 +10,9 @@ import '../../attention/notify/notification_controller.dart';
|
||||
import '../../attention/runtime/attention_controller.dart';
|
||||
import '../../attention/runtime/attention_store.dart';
|
||||
import '../../attention/ui/needs_you_runs_heading.dart';
|
||||
import '../../pipelines/pipeline_format.dart' show formatRanAgo;
|
||||
import '../domain/run_models.dart';
|
||||
import '../../../shell/shell_bar.dart';
|
||||
import 'run_path_mini.dart';
|
||||
import 'run_more_menu.dart';
|
||||
import 'runs_controller.dart';
|
||||
import 'runs_stats_page.dart';
|
||||
@@ -263,9 +263,8 @@ class RunsList extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// One run in the list with its facts in the row's corners: the run and its
|
||||
/// number on top, the pipeline and duration below, then when it ran and how
|
||||
/// far it got.
|
||||
/// One run in the list, with a status avatar, title/time, and one muted fact
|
||||
/// line. Its detail retains the full timestamp, path, and other diagnostics.
|
||||
class RunListRow extends StatelessWidget {
|
||||
/// The narrowest row that still shows its own actions menu.
|
||||
static const double _menuMinRowWidth = 280;
|
||||
@@ -323,53 +322,20 @@ class RunListRow extends StatelessWidget {
|
||||
color: secondary,
|
||||
fontSize: (base.fontSize ?? 14) - 1,
|
||||
);
|
||||
Widget line(String? start, String? end, TextStyle style, {Key? key}) =>
|
||||
LayoutBuilder(
|
||||
key: key,
|
||||
builder: (context, constraints) {
|
||||
Widget text(String value) => Text(
|
||||
value,
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
if (end == null) return text(start ?? '');
|
||||
final measure = TextPainter(
|
||||
text: TextSpan(text: end, style: style),
|
||||
textDirection: Directionality.of(context),
|
||||
textScaler: MediaQuery.textScalerOf(context),
|
||||
)..layout();
|
||||
final fits = measure.width + 12 < constraints.maxWidth;
|
||||
measure.dispose();
|
||||
if (!fits) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
text(start ?? ''),
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: text(end),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: text(start ?? '')),
|
||||
const SizedBox(width: 12),
|
||||
text(end),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
final scheduled = run['scheduled'] == true;
|
||||
final subtitle = [
|
||||
?pipelineLabel,
|
||||
if (scheduled) 'Scheduled',
|
||||
?facts.duration,
|
||||
?facts.progress,
|
||||
].join(' · ');
|
||||
final relativeTime = formatRanAgo('${run['created_at'] ?? ''}', now);
|
||||
Widget body(bool withMenu, bool compact) => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2, right: 12),
|
||||
child: RunStatusIcon(
|
||||
padding: const EdgeInsetsDirectional.only(end: 12),
|
||||
child: _RunStatusAvatar(
|
||||
state: runStateOf(run['status']),
|
||||
label: runStatusLabel(run),
|
||||
),
|
||||
@@ -404,21 +370,28 @@ class RunListRow extends StatelessWidget {
|
||||
),
|
||||
]
|
||||
: [
|
||||
line(title, id == null ? null : '#$id', titleStyle),
|
||||
const SizedBox(height: 2),
|
||||
line(
|
||||
[?pipelineLabel, if (scheduled) 'Scheduled'].join(' · '),
|
||||
facts.duration,
|
||||
small,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: titleStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (relativeTime != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
Text(relativeTime, style: small, maxLines: 1),
|
||||
],
|
||||
],
|
||||
),
|
||||
line(facts.when, facts.progress, small),
|
||||
// The run's path, each stage in its own result colour.
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: RunPathMini(run: run),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
subtitle,
|
||||
style: small,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -478,3 +451,25 @@ class RunListRow extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _RunStatusAvatar extends StatelessWidget {
|
||||
const _RunStatusAvatar({required this.state, required this.label});
|
||||
|
||||
final String state;
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = runStatusColor(state).resolveFrom(context);
|
||||
return Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: color.withValues(alpha: 0.14),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: RunStatusIcon(state: state, label: label),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../adaptive/host.dart';
|
||||
|
||||
/// The one status glyph a run row leads with, as the web's `statusIcon`: a
|
||||
/// single coloured icon whose tooltip and accessible name say the state.
|
||||
/// The shared status glyph whose tooltip and accessible name say the state.
|
||||
///
|
||||
/// [state] is the normalised run state (`succeeded`, `failed`, `running`,
|
||||
/// `waiting`, `queued`, `canceled`, `interrupted`, anything else unknown);
|
||||
@@ -47,7 +46,7 @@ CupertinoDynamicColor runStatusColor(String state) => switch (state) {
|
||||
'succeeded' => CupertinoColors.systemGreen,
|
||||
'failed' => CupertinoColors.systemRed,
|
||||
'running' || 'active' => CupertinoColors.systemBlue,
|
||||
'waiting' => CupertinoColors.systemTeal,
|
||||
'waiting' => CupertinoColors.systemYellow,
|
||||
'interrupted' => CupertinoColors.systemOrange,
|
||||
_ => CupertinoColors.systemGrey,
|
||||
};
|
||||
@@ -58,7 +57,8 @@ IconData _materialIcon(String state) => switch (state) {
|
||||
'running' || 'active' => Icons.autorenew,
|
||||
'canceled' => Icons.block,
|
||||
'interrupted' => Icons.pause_circle_outline,
|
||||
'waiting' || 'queued' => Icons.schedule,
|
||||
'waiting' => Icons.person_outline,
|
||||
'queued' => Icons.schedule,
|
||||
_ => Icons.help_outline,
|
||||
};
|
||||
|
||||
@@ -68,7 +68,8 @@ IconData _cupertinoIcon(String state) => switch (state) {
|
||||
'running' || 'active' => CupertinoIcons.arrow_2_circlepath,
|
||||
'canceled' => CupertinoIcons.nosign,
|
||||
'interrupted' => CupertinoIcons.pause_circle,
|
||||
'waiting' || 'queued' => CupertinoIcons.clock,
|
||||
'waiting' => CupertinoIcons.person_crop_circle,
|
||||
'queued' => CupertinoIcons.clock,
|
||||
_ => CupertinoIcons.question_circle,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user