Files
pipelines/app/tool/server_editor_save_probe.dart
alan 69ae0519bd Remove Cupertino fixture alternatives
Keep capture and probe tooling on the app's single Material surface by removing obsolete platform switches, hosts, and documentation. Preserve the existing Material routes and fixture behavior while retaining compatibility APIs outside this lane.
2026-11-11 20:10:51 +00:00

39 lines
1.2 KiB
Dart

import 'dart:js_interop';
import 'dart:js_interop_unsafe';
import 'package:flutter/material.dart';
import 'package:pipelines_app/core/servers/server_catalog.dart';
import 'package:pipelines_app/core/servers/server_catalog_store.dart';
import 'package:pipelines_app/features/settings/saved_servers_section.dart';
import 'package:pipelines_app/features/settings/server_connections.dart';
// Isolated, in-memory browser fixture: first write fails, retry succeeds.
// No sockets, real storage, or production requests.
void main() {
final connections = ServerConnections(
store: _Store(),
onSelected: (_) async {},
);
final body = SafeArea(
child: SingleChildScrollView(
child: SavedServersSection(connections: connections),
),
);
runApp(MaterialApp(home: Scaffold(body: body)));
}
class _Store extends MemoryServerCatalogStore {
var _attempts = 0;
@override
Future<bool> save(ServerCatalog catalog) async {
globalContext.setProperty(
'serverEditorSaveAttempts'.toJS,
(++_attempts).toJS,
);
await Future<void>.delayed(const Duration(seconds: 3));
if (_attempts == 1) return false;
return super.save(catalog);
}
}