Files
pipelines/app/tool/schedules_list_probe_app.dart
alan b60ad6d98f Remove alternate hosts from tooling probes
Keep the probe suite on the Material composition so browser fixtures and capture drivers no longer render or select Cupertino hosts. Record the final residual legacy arguments and implementation checks for the delivery gate.
2026-11-11 21:38:30 +00:00

99 lines
2.9 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/schedules/screen.dart';
/// Isolated browser fixture for the read-only schedules list.
///
/// Run with:
/// flutter build web -t tool/schedules_list_probe_app.dart
/// and open `/?brightness=dark&scale=2`.
void main() {
final parameters = Uri.base.queryParameters;
final dark = parameters['brightness'] == 'dark';
final scale = double.tryParse(parameters['scale'] ?? '') ?? 1.0;
final screen = SchedulesScreen(gateway: _FixtureGateway(), onOpen: (_) {});
Widget media(BuildContext context, Widget? app) => MediaQuery(
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(scale)),
child: app!,
);
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
theme: dark ? ThemeData(brightness: Brightness.dark) : null,
builder: media,
home: Scaffold(
appBar: AppBar(title: const Text('Schedules')),
body: screen,
),
),
);
}
class _FixtureGateway implements ApiGateway {
@override
Future<JsonMap> call(String type, [JsonMap fields = const {}]) async {
if (type != 'list_schedules') {
throw StateError('The schedules list fixture only lists schedules.');
}
return {
'type': 'schedules',
'schedules': [
{
'id': 8,
'revision': 3,
'name': 'Research batteries',
'pipeline_id': 4,
'version': 2,
'enabled': true,
'input': {'prompt': 'Find battery chemistry sources'},
'workspace': '/srv/research',
'rule': {
'every': '24h',
'days': ['mon', 'wed'],
'timezone': 'Europe/London',
},
'next_due': '2026-10-22T09:00:00Z',
},
{
'id': 9,
'revision': 1,
'name': 'Nightly report',
'pipeline_id': 7,
'version': 5,
'enabled': false,
'input': {'prompt': 'Summarise the open issues'},
'workspace': '/srv/reports',
'rule': {
'times': ['10:00', '18:30'],
'days': <String>[],
'timezone': 'Local',
},
},
{
'id': 10,
'revision': 2,
'name': 'Weekly digest',
'pipeline_id': 12,
'version': 1,
'enabled': true,
'input': {'prompt': 'Collect the week’s changes'},
'workspace': '/srv/digest',
'rule': {'every': '168h', 'days': <String>[]},
'next_due': '2026-10-26T08:30:00+01:00',
},
{
'id': 11,
'revision': 1,
'name': 'Sparse server record',
'enabled': false,
'input': <String, dynamic>{},
'rule': <String, dynamic>{},
},
],
};
}
@override
Stream<JsonMap> get frames => const Stream.empty();
}