Connect saved machines concurrently in the chat workspace
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user