App: archive and unarchive pipelines
The pipeline's bar gets a Pipeline actions menu with Archive (confirm dialog: history is kept) or Unarchive; an archived detail says so and offers no Run. The list hides archived pipelines and the scope control gains an Archived view. Server refusals (enabled schedule, newer version) are shown verbatim. The capture fixture answers archive requests.
This commit is contained in:
@@ -172,7 +172,19 @@ List<JsonMap> probeRuns() => [
|
||||
..._fillerRuns(),
|
||||
];
|
||||
|
||||
/// Pipelines this fixture session archived, with their archive time.
|
||||
final _probeArchived = <int, String>{};
|
||||
|
||||
List<JsonMap> probePipelines() => [
|
||||
for (final pipeline in _probePipelineRows())
|
||||
{
|
||||
...pipeline,
|
||||
if (_probeArchived[pipeline['id']] != null)
|
||||
'archived_at': _probeArchived[pipeline['id']],
|
||||
},
|
||||
];
|
||||
|
||||
List<JsonMap> _probePipelineRows() => [
|
||||
{
|
||||
'id': 24,
|
||||
'name': 'Release train',
|
||||
@@ -434,6 +446,29 @@ JsonMap? probeReply(JsonMap request) {
|
||||
'type': 'pipeline',
|
||||
'detail': probePipelineDetail(pipelineId, version is int ? version : 0),
|
||||
};
|
||||
case 'archive_pipeline':
|
||||
case 'unarchive_pipeline':
|
||||
// Mirrors the server: an enabled schedule blocks archiving.
|
||||
final pipelineId = request['pipeline_id'];
|
||||
final row = probePipelines().where((p) => p['id'] == pipelineId);
|
||||
if (row.isEmpty) return error('pipeline not found');
|
||||
final archive = type == 'archive_pipeline';
|
||||
if (archive && (row.first['enabled_schedule_count'] as int) > 0) {
|
||||
return error(
|
||||
'pipeline "${row.first['name']}" has enabled schedule(s) '
|
||||
'"Nightly docs" (#3); pause or repoint them before archiving',
|
||||
);
|
||||
}
|
||||
if (archive) {
|
||||
_probeArchived[pipelineId as int] = '2026-10-20T09:30:00Z';
|
||||
} else {
|
||||
_probeArchived.remove(pipelineId);
|
||||
}
|
||||
return {
|
||||
'id': id,
|
||||
'type': archive ? 'pipeline_archived' : 'pipeline_unarchived',
|
||||
'detail': probePipelineDetail(pipelineId as int, 0),
|
||||
};
|
||||
case 'search':
|
||||
// The app must send exactly the browser's SearchRequest body; anything
|
||||
// else is answered with a visible refusal so the capture cannot pass.
|
||||
|
||||
Reference in New Issue
Block a user