Connect saved machines concurrently in the chat workspace

This commit is contained in:
2026-11-08 22:21:17 +00:00
parent 663d5fb5c9
commit e4904395f0
44 changed files with 2574 additions and 60 deletions
+22 -1
View File
@@ -1,3 +1,4 @@
import 'package:pipelines_app/core/servers/chat/chat_server_pool.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/server_connections.dart';
@@ -797,7 +798,7 @@ Future<void> main() async {
if (query != null && query.isNotEmpty) _typeSearchWhenShown(query);
useAppUrlStrategy();
ServerConnections? machines;
if (params['machines'] == '1') {
if (params['machines'] == '1' || params['federated'] == '1') {
machines = ServerConnections(
store: MemoryServerCatalogStore(
catalog: ServerCatalog(
@@ -820,9 +821,29 @@ Future<void> main() async {
);
await machines.load();
}
final pool = params['federated'] == '1' && machines != null
? ChatServerPool(
machines,
connect: (machine) async {
final client = PipelinesClient(
channelFactory: (_) => _FixtureChannel(),
);
await client.connect(Uri.parse(machine.endpoints.first));
return ChatMachineConnection(
gateway: client,
endpoint: () => client.endpoint.toString(),
connected: () => true,
states: client.states,
close: client.dispose,
retry: () => client.connect(Uri.parse(machine.endpoints.first)),
);
},
)
: null;
final app = PipelinesApp(
serverId: machines?.catalog.active?.id,
servers: machines,
chatPool: pool,
server: fixtureServer(params),
webPlatform: params['nativeUpdate'] == null ? kIsWeb : false,
androidSupported: params['nativeUpdate'] == null ? null : true,