545291e04a
- Run rows show a failed run's reason (else its diagnostic's first line, full text in a tooltip) or a short result preview; the Summary leads with "Why it failed". - Run again for succeeded/canceled/interrupted runs opens the New run form pre-filled (prompt, workspace, report format) at the latest version with the original offered. - Run detail and stage tabs show their names; touch shows captions on the Runs header and artifact viewer actions (desktop keeps tooltips). - ErrorNotice maps not connected / server too old / permission / timeout to what to do, raw detail behind Details (Schedules, create chat, Runs, Pipelines banners). - Settings has no Back arrow; Schedules keeps the rail on wide windows; phone Settings leads with Connection and Notifications and has a Jump to topic menu. - Walkthrough: Open Connection (skipped when connected), labelled Copy. - Pluralised counts; no duplicate status/rail names for screen readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.3 KiB
Dart
67 lines
2.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/run_pipeline_seed.dart';
|
|
import '../../pipelines/ui/run_pipeline_flow.dart';
|
|
import '../../pipelines/ui/run_pipeline_wording.dart';
|
|
import '../actions/retry_eligibility.dart';
|
|
import '../data/runs_repository.dart';
|
|
import 'run_detail_content.dart' show detailPrompt;
|
|
|
|
const runAgainActionLabel = 'Run again…';
|
|
const runAgainActionKey = ValueKey<String>('run-again-action');
|
|
|
|
/// The seed a Run again pre-fills from [run]: its stored prompt, workspace,
|
|
/// report requirement and the version it ran.
|
|
RunPipelineSeed runAgainSeed(JsonMap run) {
|
|
final version = run['version'];
|
|
return RunPipelineSeed(
|
|
prompt: detailPrompt(run) ?? '',
|
|
workspace: '${run['workspace'] ?? ''}'.trim(),
|
|
originalVersion: version is num ? version.toInt() : null,
|
|
outputFormat: runOutputFormatOf(run['output_format']),
|
|
);
|
|
}
|
|
|
|
/// Run again: opens the New run form for [run]'s pipeline at its latest
|
|
/// version (the original offered), pre-filled with the run's inputs.
|
|
///
|
|
/// A list row carries no input, so the run is read first. Nothing starts until
|
|
/// the form's own confirm, exactly as New run.
|
|
Future<void> startRunAgainFlow({
|
|
required BuildContext context,
|
|
required JsonMap run,
|
|
required PipelinesController controller,
|
|
required ApiGateway gateway,
|
|
ValueChanged<int>? onRunStarted,
|
|
}) async {
|
|
if (!canRunAgain(run)) return;
|
|
final pipelineId = (run['pipeline_id'] as num).toInt();
|
|
final JsonMap full;
|
|
final PipelineDetail detail;
|
|
try {
|
|
full = run['input'] is Map
|
|
? run
|
|
: await RunsRepository(gateway).getRun(run['id'] as num);
|
|
detail = await PipelinesRepository(gateway).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,
|
|
seed: runAgainSeed(full),
|
|
);
|
|
}
|