Files
pipelines/app/lib/features/runs/ui/run_detail_visit_artifacts.dart
T
alan 5425001d82 Send artifacts, runs and pipelines to a new or existing chat
One picker offers a new chat (the saved Open in chat harness and model)
or any open chat. An existing chat gets the reference appended to its
draft and focused, never sent. Artifacts gain the action in their viewer
and gallery; the run and pipeline item becomes Send to chat.
2026-11-13 18:43:14 +00:00

64 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../artifacts/domain/artifact_chat_context.dart';
import '../../artifacts/ui/artifact_gallery_page.dart';
/// The visit's recorded stage artifacts, in recorded order.
///
/// Selecting a row opens the existing artifact gallery page for exactly this
/// visit, so the pane never grows a second viewer or a link-only substitute.
/// The page receives the whole run so a shared `public/` file stays with the
/// visit that first recorded it, and it lists exactly the rows shown here.
///
/// An empty list is never described as "nothing recorded" on its own: the
/// existing capture semantics say whether the capture is unavailable, still
/// pending or explicitly empty for this visit.
class RunVisitArtifacts extends StatelessWidget {
const RunVisitArtifacts({
super.key,
required this.step,
required this.visitIndex,
required this.runSteps,
required this.configuredEndpoint,
required this.run,
this.onSendToChat,
});
final JsonMap step;
/// The visit's index in [runSteps], so the opened page is the same group.
final int visitIndex;
final List<JsonMap> runSteps;
final String configuredEndpoint;
final JsonMap run;
final void Function(String draft)? onSendToChat;
/// The same gallery as the run's Artifacts tab, focused on this visit.
@override
Widget build(BuildContext context) => KeyedSubtree(
key: const Key('run-visit-body-artifacts'),
child: ArtifactGalleryPage(
key: ValueKey('run-visit-artifacts-$visitIndex'),
steps: runSteps.isEmpty ? <JsonMap>[step] : runSteps,
focusIndex: runSteps.isEmpty ? 0 : visitIndex,
configuredEndpoint: configuredEndpoint,
embedded: true,
artifactChatContext: ArtifactChatContext(
runId: '${run['id'] ?? ''}',
runTitle: '${run['title'] ?? run['name'] ?? ''}',
pipelineName: '${run['name'] ?? ''}',
pipelineVersion: run['version'] is num
? (run['version'] as num).toInt().toString()
: null,
stageKey: '${step['stage'] ?? ''}',
visit: visitIndex + 1,
configuredEndpoint: configuredEndpoint,
recordedSteps: step,
),
onSendToChat: onSendToChat,
),
);
}