merge(app): land pipelines-layout

This commit is contained in:
2026-10-22 15:07:12 +01:00
8 changed files with 307 additions and 96 deletions
@@ -6,7 +6,6 @@ import '../../../core/api_gateway.dart';
import '../../graph/domain/graph_definition.dart';
import '../../graph/widgets/stage_definition_view.dart';
import '../pipeline_models.dart';
import '../pipeline_query.dart';
import '../pipelines_controller.dart';
import '../ui/run_pipeline_action.dart';
import 'pipeline_controls.dart';
@@ -303,42 +302,41 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
);
Widget _header(BuildContext context, PipelineDetail detail) {
final title = Text(detail.displayName, style: pipelineTitleStyle(context));
final subtitle = Text(
pipelineSubtitle(detail),
style: pipelineMutedStyle(context),
);
final heading = Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [title, subtitle],
);
final action = Align(
alignment: AlignmentDirectional.centerStart,
child: RunPipelineAction(
controller: _controller,
detail: detail,
gateway: widget.gateway,
onRunStarted: widget.onRunStarted,
),
final title = Text(
detail.displayName,
style: pipelineTitleStyle(context),
maxLines: 1,
overflow: TextOverflow.ellipsis,
);
final heading = widget.showBack
? Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
PipelineBackButton(onPressed: _controller.clearSelection),
const SizedBox(width: 4),
Expanded(child: title),
],
)
: title;
return Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
key: const Key('pipeline-detail-header'),
// The web detail head is a compact single identity line; the recorded
// id/version/stage facts live at the top of the Summary tab.
padding: const EdgeInsets.fromLTRB(12, 6, 12, 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (widget.showBack)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PipelineBackButton(onPressed: _controller.clearSelection),
const SizedBox(width: 4),
Expanded(child: heading),
],
)
else
heading,
const SizedBox(height: 8),
action,
heading,
const SizedBox(height: 4),
Align(
alignment: AlignmentDirectional.centerStart,
child: RunPipelineAction(
controller: _controller,
detail: detail,
gateway: widget.gateway,
onRunStarted: widget.onRunStarted,
),
),
],
),
);
@@ -16,6 +16,10 @@ import '../pipelines_controller.dart';
import 'pipeline_controls.dart';
import 'pipeline_filter_page.dart';
/// The list's horizontal rhythm, matching the web's toolbar and row inset
/// (`var(--space-s)`: 12px). The detail pane keeps its own content padding.
const double kPipelineListInset = 12;
/// The left/top pane: filter and sort controls, then the truthful list states.
class PipelineListPanel extends StatelessWidget {
const PipelineListPanel({super.key, required this.controller});
@@ -29,14 +33,50 @@ class PipelineListPanel extends StatelessWidget {
(pipeline) =>
pipeline.scheduleState == PipelineScheduleState.unclassified,
);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_toolbar(context, filters, hasUnclassified),
if (controller.listError != null)
PipelineErrorBanner(
message: controller.listError!,
onRetry: controller.load,
),
if (controller.runsError != null)
PipelineErrorBanner(
message:
'${controller.runsLoaded ? 'Last runs could not be refreshed' : 'Last runs unavailable'}: '
'${controller.runsError}',
onRetry: controller.load,
),
if (controller.listLoading && controller.pipelinesLoaded)
const Padding(
padding: EdgeInsets.symmetric(horizontal: kPipelineListInset),
child: PipelineProgress(label: 'Refreshing pipelines'),
),
Expanded(child: _content(context)),
],
);
}
/// The web's compact toolbar: filter (whose page carries the name search),
/// sort and clear, on the list's 12px inset with a separator underneath.
Widget _toolbar(
BuildContext context,
PipelineFilters filters,
bool hasUnclassified,
) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
padding: const EdgeInsets.symmetric(
horizontal: kPipelineListInset,
vertical: 2,
),
child: Wrap(
spacing: 8,
runSpacing: 4,
key: const Key('pipeline-toolbar'),
spacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
PipelineTextButton(
@@ -65,24 +105,7 @@ class PipelineListPanel extends StatelessWidget {
],
),
),
if (controller.listError != null)
PipelineErrorBanner(
message: controller.listError!,
onRetry: controller.load,
),
if (controller.runsError != null)
PipelineErrorBanner(
message:
'${controller.runsLoaded ? 'Last runs could not be refreshed' : 'Last runs unavailable'}: '
'${controller.runsError}',
onRetry: controller.load,
),
if (controller.listLoading && controller.pipelinesLoaded)
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: PipelineProgress(label: 'Refreshing pipelines'),
),
Expanded(child: _content(context)),
const Divider(height: 1),
],
);
}
@@ -150,9 +173,10 @@ class PipelineListPanel extends StatelessWidget {
Widget _materialList(BuildContext context, List<PipelineSummary> items) {
final now = DateTime.now();
return ListView.builder(
return ListView.separated(
key: const Key('pipeline-list'),
itemCount: items.length,
separatorBuilder: (context, index) => const Divider(height: 1),
itemBuilder: (context, index) {
final pipeline = items[index];
return ListTile(
@@ -160,8 +184,12 @@ class PipelineListPanel extends StatelessWidget {
selected: controller.selectedId == pipeline.id,
onTap: () =>
controller.openPipeline(pipeline.id, version: pipeline.version),
contentPadding: const EdgeInsets.symmetric(
horizontal: kPipelineListInset,
),
visualDensity: VisualDensity.compact,
title: _rowTitle(context, pipeline),
subtitle: _subtitle(context, pipeline, now),
subtitle: _rowMetadata(context, pipeline, now),
);
},
);
@@ -178,7 +206,7 @@ class PipelineListPanel extends StatelessWidget {
CupertinoListTile(
key: Key('pipeline-row-${pipeline.id}'),
title: _rowTitle(context, pipeline),
subtitle: _subtitle(context, pipeline, now),
subtitle: _rowMetadata(context, pipeline, now),
trailing: const CupertinoListTileChevron(),
onTap: () => controller.openPipeline(
pipeline.id,
@@ -191,43 +219,71 @@ class PipelineListPanel extends StatelessWidget {
);
}
/// The row's name plus its recorded miniature, when the reply carried one.
/// The trailing cue never replaces or fills in any metadata line.
/// The row's title line: its name and its version at the trailing edge.
Widget _rowTitle(BuildContext context, PipelineSummary pipeline) {
final shape = pipeline.shape;
final muted = _mutedStyle(context);
return Row(
children: [
Expanded(child: Text(pipeline.displayName)),
if (shape != null)
PipelineMiniGraph(
key: Key('pipeline-mini-${pipeline.id}'),
shape: shape,
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),
),
),
const SizedBox(width: 8),
Text(pipelineVersionLabel(pipeline), style: muted),
],
);
}
Widget _subtitle(
/// The row's one muted metadata line plus its last-run line.
///
/// Everything printed comes from recorded values: the identity, the stage
/// count, the configured schedules and the parseable updated time. The run
/// line keeps the web's state word and `row-meta` fragments
/// (`Succeeded · 2h ago · 1m 5s · run 42`).
Widget _rowMetadata(
BuildContext context,
PipelineSummary pipeline,
DateTime now,
) {
final rows = <Widget>[Text(pipelineSubtitle(pipeline))];
final updated = pipelineUpdatedLine(pipeline);
if (updated != null) rows.add(Text(updated));
if (pipeline.scheduleLabel.isNotEmpty) {
rows.add(Text(pipeline.scheduleLabel));
}
if (controller.runsLoaded) {
final run = controller.latestRuns[pipeline.id];
if (run == null) {
rows.add(Text('no runs recorded', style: _mutedStyle(context)));
} else {
final badge = runBadge(run, now);
rows.add(Text('${runStateLabel(badge.state)} · ${badge.metaLine}'));
}
}
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: rows);
final style = _mutedStyle(context);
final facts = <String>[
'id ${pipeline.id}',
pipelineStageSummary(pipeline),
if (pipeline.scheduleLabel.isNotEmpty) pipeline.scheduleLabel,
?pipelineUpdatedLine(pipeline),
].join(' · ');
final run = controller.runsLoaded
? controller.latestRuns[pipeline.id]
: null;
final badge = run == null ? null : runBadge(run, now);
final runLine = controller.runsLoaded
? badge == null
? 'no runs recorded'
: '${runStateLabel(badge.state)} · ${badge.metaLine}'
: null;
final shape = pipeline.shape;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// The web prints the miniature as its own right-aligned block below the
// title rather than inside the title line.
if (shape != null)
Align(
alignment: AlignmentDirectional.centerEnd,
child: PipelineMiniGraph(
key: Key('pipeline-mini-${pipeline.id}'),
shape: shape,
),
),
Text(facts, style: style),
if (runLine != null && runLine.isNotEmpty) Text(runLine, style: style),
],
);
}
TextStyle? _mutedStyle(BuildContext context) {
@@ -31,6 +31,15 @@ class PipelineSummaryView extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// The web's Summary subtitle: the compact header names the pipeline,
// this line carries its recorded identity.
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Text(
pipelineSubtitle(detail),
style: pipelineMutedStyle(context),
),
),
if (historical)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),