Files
pipelines/app/lib/features/runs/ui/run_pipeline_link.dart
T
alan 9551eceaed Complete Material-only APIs and fixtures
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
2026-11-11 21:55:39 +00:00

52 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import 'run_detail_content.dart';
/// Opens a pipeline at a version; 0 means its latest.
typedef OpenPipeline = void Function(int pipelineId, int version);
const runPipelineLinkKey = ValueKey<String>('run-pipeline-link');
/// The run's pipeline id, or null when the server recorded none.
int? runPipelineId(JsonMap run) {
final id = run['pipeline_id'];
return id is num && id > 0 && id == id.truncate() ? id.toInt() : null;
}
/// The run's pipeline name, a link to that pipeline at the run's pinned
/// version when the run names one and the host can navigate.
class RunPipelineLink extends StatelessWidget {
const RunPipelineLink({super.key, required this.run, this.onOpenPipeline});
final JsonMap run;
final OpenPipeline? onOpenPipeline;
@override
Widget build(BuildContext context) {
final name = detailPipeline(run);
final id = runPipelineId(run);
final open = onOpenPipeline;
if (id == null || open == null) return Text(name);
final version = run['version'];
void go() => open(id, version is num ? version.toInt() : 0);
final label = Text(
name,
style: const TextStyle(decoration: TextDecoration.underline),
);
return Semantics(
link: true,
label: 'Open pipeline $name',
excludeSemantics: true,
child: InkWell(
key: runPipelineLinkKey,
onTap: go,
child: DefaultTextStyle.merge(
style: TextStyle(color: Theme.of(context).colorScheme.primary),
child: label,
),
),
);
}
}