26bb583f10
Keep Settings navigation independent while preserving shell actions and destination-specific state. Add the reviewed chat, run-entry, layout, and regression-test updates needed by the destination behavior.
41 lines
1.3 KiB
Dart
41 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/api_gateway.dart';
|
|
import '../../pipelines/pipeline_models.dart';
|
|
import '../../pipelines/pipeline_repository.dart';
|
|
import '../../pipelines/pipelines_controller.dart';
|
|
import '../../pipelines/ui/run_pipeline_flow.dart';
|
|
import '../../pipelines/ui/run_pipeline_wording.dart';
|
|
import 'new_run_picker.dart';
|
|
|
|
/// The Runs tab's New run: pick an active pipeline, read its latest version,
|
|
/// then the same start flow a pipeline's Run action opens.
|
|
Future<void> startNewRunFlow({
|
|
required BuildContext context,
|
|
required PipelinesController controller,
|
|
required ApiGateway gateway,
|
|
ValueChanged<int>? onRunStarted,
|
|
}) async {
|
|
final repository = PipelinesRepository(gateway);
|
|
final pipelineId = await pickPipelineForNewRun(context, repository);
|
|
if (pipelineId == null || !context.mounted) return;
|
|
final PipelineDetail detail;
|
|
try {
|
|
detail = await repository.getPipeline(pipelineId, 0);
|
|
} catch (error) {
|
|
if (!context.mounted) return;
|
|
ScaffoldMessenger.maybeOf(
|
|
context,
|
|
)?.showSnackBar(SnackBar(content: Text(describeRunPipelineError(error))));
|
|
return;
|
|
}
|
|
if (!context.mounted) return;
|
|
await openRunPipelineFlow(
|
|
context: context,
|
|
controller: controller,
|
|
detail: detail,
|
|
gateway: gateway,
|
|
onRunStarted: onRunStarted,
|
|
);
|
|
}
|