From 1d775026017b200b38a07c7304b87b56a2386490 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Mon, 22 Jun 2026 04:17:22 +0300 Subject: [PATCH 1/4] feat(connection): implement connection actions and fix layout test hang --- lib/core/storage/local_db.dart | 1 + .../connections/connections_panel.dart | 78 +++++++++++++ .../connections/connections_panel_mongo.dart | 33 +++++- .../connections/connections_panel_mysql.dart | 33 +++++- ...connections_panel_postgres_connection.dart | 33 +++++- .../connections/connections_panel_redis.dart | 33 +++++- .../connections/connections_panel_sqlite.dart | 34 +++++- lib/features/main_screen/main_screen.dart | 31 ++++- .../main_screen/querya_window_title_bar.dart | 23 +++- .../connections_panel_layout_test.dart | 109 ++++++++++++++++++ 10 files changed, 381 insertions(+), 27 deletions(-) diff --git a/lib/core/storage/local_db.dart b/lib/core/storage/local_db.dart index 07ff8442..eebba457 100644 --- a/lib/core/storage/local_db.dart +++ b/lib/core/storage/local_db.dart @@ -379,6 +379,7 @@ class LocalDb { Future close() async { await _db?.close(); _db = null; + _cachedDbPath = null; } } diff --git a/lib/features/connections/connections_panel.dart b/lib/features/connections/connections_panel.dart index cc65b630..cadae7bf 100644 --- a/lib/features/connections/connections_panel.dart +++ b/lib/features/connections/connections_panel.dart @@ -57,6 +57,7 @@ import 'package:querya_desktop/core/database/mongodb_service.dart'; import 'package:querya_desktop/core/database/mysql_service.dart'; import 'package:querya_desktop/core/database/postgres_service.dart'; import 'package:querya_desktop/core/database/redis_connection.dart'; +import 'package:meta/meta.dart' show visibleForTesting; import 'package:querya_desktop/core/database/redis_info.dart'; import 'package:querya_desktop/core/database/sqlite_service.dart'; import 'package:querya_desktop/core/storage/folders_storage.dart'; @@ -67,6 +68,8 @@ import 'package:querya_desktop/core/motion/querya_motion.dart'; import 'package:querya_desktop/core/motion/querya_motion_context.dart'; import 'package:querya_desktop/features/connections/connection_creation_flow.dart'; import 'package:querya_desktop/shared/widgets/widgets.dart'; +import 'package:querya_desktop/core/database/redis_service.dart'; +import 'package:querya_desktop/app/app_shutdown.dart'; import 'package:querya_desktop/features/mongodb/mongo_database_dialog.dart'; import 'package:querya_desktop/features/postgresql/postgres_object_kind.dart'; @@ -219,6 +222,7 @@ class ConnectionsPanelState extends State { List _connections = []; Map _folderIdByName = {}; final Set _expandedFolders = {}; + final Set _expandedConnections = {}; /// Ignores stale [setState] when multiple [_loadData] runs overlap (e.g. tests). int _loadDataGeneration = 0; @@ -312,6 +316,59 @@ class ConnectionsPanelState extends State { await _loadData(); } + void connect(int connectionId) { + setState(() { + _expandedConnections.add(connectionId); + }); + } + + @visibleForTesting + bool isConnectionExpanded(int id) => _expandedConnections.contains(id); + + Future disconnect(ConnectionRow conn) async { + final id = conn.id!; + setState(() { + _expandedConnections.remove(id); + }); + if (conn.type == 'postgresql') { + PostgresService.instance.interrupt(conn, database: conn.databaseName ?? 'postgres', mode: PgSessionMode.readOnly); + PostgresService.instance.interrupt(conn, database: conn.databaseName ?? 'postgres', mode: PgSessionMode.readWrite); + } else if (conn.type == 'mysql') { + MysqlService.instance.interrupt(conn, database: conn.databaseName ?? '', mode: MysqlSessionMode.readOnly); + MysqlService.instance.interrupt(conn, database: conn.databaseName ?? '', mode: MysqlSessionMode.readWrite); + } else if (conn.type == 'sqlite') { + SqliteService.instance.interrupt(conn, mode: SqliteSessionMode.readOnly); + SqliteService.instance.interrupt(conn, mode: SqliteSessionMode.readWrite); + } else if (conn.type == 'redis') { + final redisConn = RedisService.instance.getConnection(id); + if (redisConn != null) { + await RedisService.instance.disconnect(redisConn); + } + } else if (conn.type == 'mongodb') { + await MongoService.instance.disconnectByConnectionId(id); + } + } + + Future disconnectAll() async { + setState(() { + _expandedConnections.clear(); + }); + await disconnectAllExternalServices(); + await SqliteService.instance.disconnectAll(); + } + + Future disconnectOthers(ConnectionRow keepConn) async { + final keepId = keepConn.id!; + setState(() { + _expandedConnections.clear(); + _expandedConnections.add(keepId); + }); + for (final conn in _connections) { + if (conn.id == keepId) continue; + await disconnect(conn); + } + } + /// Icon for a connection type (matches New Connection dialog). material.IconData _iconForType(String type) { return switch (type) { @@ -338,6 +395,17 @@ class ConnectionsPanelState extends State { Widget _buildConnectionTile(ConnectionRow conn) { final isSelected = widget.selectedConnectionId != null && widget.selectedConnectionId == conn.id; + final isExpanded = _expandedConnections.contains(conn.id); + void handleExpandedChanged(bool expanded) { + setState(() { + if (expanded) { + _expandedConnections.add(conn.id!); + } else { + _expandedConnections.remove(conn.id!); + } + }); + } + if (conn.type == 'postgresql') { return _PostgresConnectionTile( connection: conn, @@ -348,6 +416,8 @@ class ConnectionsPanelState extends State { onTap: () => widget.onConnectionSelected?.call(conn), onPostgresObjectSelected: widget.onPostgresObjectSelected, onPostgresOpenSqlWorkspace: widget.onPostgresOpenSqlWorkspace, + isExpanded: isExpanded, + onExpandedChanged: handleExpandedChanged, ); } else if (conn.type == 'mysql') { return _MysqlConnectionTile( @@ -359,6 +429,8 @@ class ConnectionsPanelState extends State { onTap: () => widget.onConnectionSelected?.call(conn), onMysqlObjectSelected: widget.onMysqlObjectSelected, onMysqlOpenSqlWorkspace: widget.onMysqlOpenSqlWorkspace, + isExpanded: isExpanded, + onExpandedChanged: handleExpandedChanged, ); } else if (conn.type == 'redis') { return _RedisConnectionTile( @@ -369,6 +441,8 @@ class ConnectionsPanelState extends State { onRemove: () => _removeConnection(conn.id!), onTap: () => widget.onConnectionSelected?.call(conn), onDatabaseTap: (db) => widget.onRedisDatabaseSelected?.call(conn, db), + isExpanded: isExpanded, + onExpandedChanged: handleExpandedChanged, ); } else if (conn.type == 'mongodb') { return _MongoConnectionTile( @@ -379,6 +453,8 @@ class ConnectionsPanelState extends State { onRemove: () => _removeConnection(conn.id!), onTap: () => widget.onConnectionSelected?.call(conn), onDatabaseTap: (db) => widget.onMongoDBDatabaseSelected?.call(conn, db), + isExpanded: isExpanded, + onExpandedChanged: handleExpandedChanged, ); } else if (conn.type == 'sqlite') { return _SqliteConnectionTile( @@ -390,6 +466,8 @@ class ConnectionsPanelState extends State { onTap: () => widget.onConnectionSelected?.call(conn), onSqliteObjectSelected: widget.onSqliteObjectSelected, onSqliteOpenSqlWorkspace: widget.onSqliteOpenSqlWorkspace, + isExpanded: isExpanded, + onExpandedChanged: handleExpandedChanged, ); } return _ConnectionTile( diff --git a/lib/features/connections/connections_panel_mongo.dart b/lib/features/connections/connections_panel_mongo.dart index 29ac0343..cc1c5d41 100644 --- a/lib/features/connections/connections_panel_mongo.dart +++ b/lib/features/connections/connections_panel_mongo.dart @@ -11,6 +11,8 @@ class _MongoConnectionTile extends StatefulWidget { required this.onRemove, this.onTap, this.onDatabaseTap, + this.isExpanded = false, + this.onExpandedChanged, }); final ConnectionRow connection; @@ -20,24 +22,47 @@ class _MongoConnectionTile extends StatefulWidget { final VoidCallback onRemove; final VoidCallback? onTap; final void Function(String database)? onDatabaseTap; + final bool isExpanded; + final ValueChanged? onExpandedChanged; @override State<_MongoConnectionTile> createState() => _MongoConnectionTileState(); } class _MongoConnectionTileState extends State<_MongoConnectionTile> { - bool _expanded = false; + bool get _expanded => widget.isExpanded; bool _loading = false; String? _error; List _databases = []; - void _toggle() { - setState(() => _expanded = !_expanded); - if (_expanded && _databases.isEmpty && !_loading) { + @override + void initState() { + super.initState(); + if (widget.isExpanded) { _loadDatabases(); } } + @override + void didUpdateWidget(_MongoConnectionTile oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.isExpanded && !oldWidget.isExpanded) { + if (_databases.isEmpty && !_loading) { + _loadDatabases(); + } + } else if (!widget.isExpanded && oldWidget.isExpanded) { + setState(() { + _databases = []; + _loading = false; + _error = null; + }); + } + } + + void _toggle() { + widget.onExpandedChanged?.call(!widget.isExpanded); + } + Future _loadDatabases() async { if (!mounted) return; setState(() { diff --git a/lib/features/connections/connections_panel_mysql.dart b/lib/features/connections/connections_panel_mysql.dart index 10c67383..2e7d34eb 100644 --- a/lib/features/connections/connections_panel_mysql.dart +++ b/lib/features/connections/connections_panel_mysql.dart @@ -12,6 +12,8 @@ class _MysqlConnectionTile extends StatefulWidget { this.onTap, this.onMysqlObjectSelected, this.onMysqlOpenSqlWorkspace, + this.isExpanded = false, + this.onExpandedChanged, }); final ConnectionRow connection; @@ -27,24 +29,47 @@ class _MysqlConnectionTile extends StatefulWidget { MysqlObjectKind kind, )? onMysqlObjectSelected; final void Function(ConnectionRow connection)? onMysqlOpenSqlWorkspace; + final bool isExpanded; + final ValueChanged? onExpandedChanged; @override State<_MysqlConnectionTile> createState() => _MysqlConnectionTileState(); } class _MysqlConnectionTileState extends State<_MysqlConnectionTile> { - bool _expanded = false; + bool get _expanded => widget.isExpanded; bool _loading = false; String? _error; List _databases = []; - void _toggle() { - setState(() => _expanded = !_expanded); - if (_expanded && _databases.isEmpty && !_loading) { + @override + void initState() { + super.initState(); + if (widget.isExpanded) { _loadDatabases(); } } + @override + void didUpdateWidget(_MysqlConnectionTile oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.isExpanded && !oldWidget.isExpanded) { + if (_databases.isEmpty && !_loading) { + _loadDatabases(); + } + } else if (!widget.isExpanded && oldWidget.isExpanded) { + setState(() { + _databases = []; + _loading = false; + _error = null; + }); + } + } + + void _toggle() { + widget.onExpandedChanged?.call(!widget.isExpanded); + } + Future _loadDatabases() async { if (!mounted) return; setState(() { diff --git a/lib/features/connections/connections_panel_postgres_connection.dart b/lib/features/connections/connections_panel_postgres_connection.dart index 925849a8..9bc2a359 100644 --- a/lib/features/connections/connections_panel_postgres_connection.dart +++ b/lib/features/connections/connections_panel_postgres_connection.dart @@ -12,6 +12,8 @@ class _PostgresConnectionTile extends StatefulWidget { this.onTap, this.onPostgresObjectSelected, this.onPostgresOpenSqlWorkspace, + this.isExpanded = false, + this.onExpandedChanged, }); final ConnectionRow connection; @@ -28,6 +30,8 @@ class _PostgresConnectionTile extends StatefulWidget { PostgresObjectKind kind, )? onPostgresObjectSelected; final OnPostgresOpenSqlWorkspace? onPostgresOpenSqlWorkspace; + final bool isExpanded; + final ValueChanged? onExpandedChanged; @override State<_PostgresConnectionTile> createState() => @@ -35,18 +39,39 @@ class _PostgresConnectionTile extends StatefulWidget { } class _PostgresConnectionTileState extends State<_PostgresConnectionTile> { - bool _expanded = false; + bool get _expanded => widget.isExpanded; bool _loading = false; String? _error; List _databases = []; - void _toggle() { - setState(() => _expanded = !_expanded); - if (_expanded && _databases.isEmpty && !_loading) { + @override + void initState() { + super.initState(); + if (widget.isExpanded) { _loadDatabases(); } } + @override + void didUpdateWidget(_PostgresConnectionTile oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.isExpanded && !oldWidget.isExpanded) { + if (_databases.isEmpty && !_loading) { + _loadDatabases(); + } + } else if (!widget.isExpanded && oldWidget.isExpanded) { + setState(() { + _databases = []; + _loading = false; + _error = null; + }); + } + } + + void _toggle() { + widget.onExpandedChanged?.call(!widget.isExpanded); + } + Future _loadDatabases() async { if (!mounted) return; setState(() { diff --git a/lib/features/connections/connections_panel_redis.dart b/lib/features/connections/connections_panel_redis.dart index efee18af..cc6d687c 100644 --- a/lib/features/connections/connections_panel_redis.dart +++ b/lib/features/connections/connections_panel_redis.dart @@ -11,6 +11,8 @@ class _RedisConnectionTile extends StatefulWidget { required this.onRemove, this.onTap, this.onDatabaseTap, + this.isExpanded = false, + this.onExpandedChanged, }); final ConnectionRow connection; @@ -20,25 +22,48 @@ class _RedisConnectionTile extends StatefulWidget { final VoidCallback onRemove; final VoidCallback? onTap; final void Function(int database)? onDatabaseTap; + final bool isExpanded; + final ValueChanged? onExpandedChanged; @override State<_RedisConnectionTile> createState() => _RedisConnectionTileState(); } class _RedisConnectionTileState extends State<_RedisConnectionTile> { - bool _expanded = false; + bool get _expanded => widget.isExpanded; bool _loading = false; String? _error; // All 16 databases (db0–db15) with key counts List<({int index, int keys})> _databases = []; - void _toggle() { - setState(() => _expanded = !_expanded); - if (_expanded && _databases.isEmpty && !_loading) { + @override + void initState() { + super.initState(); + if (widget.isExpanded) { _loadDatabases(); } } + @override + void didUpdateWidget(_RedisConnectionTile oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.isExpanded && !oldWidget.isExpanded) { + if (_databases.isEmpty && !_loading) { + _loadDatabases(); + } + } else if (!widget.isExpanded && oldWidget.isExpanded) { + setState(() { + _databases = []; + _loading = false; + _error = null; + }); + } + } + + void _toggle() { + widget.onExpandedChanged?.call(!widget.isExpanded); + } + Future _loadDatabases() async { if (!mounted) return; setState(() { diff --git a/lib/features/connections/connections_panel_sqlite.dart b/lib/features/connections/connections_panel_sqlite.dart index d02cd014..b403fb6b 100644 --- a/lib/features/connections/connections_panel_sqlite.dart +++ b/lib/features/connections/connections_panel_sqlite.dart @@ -15,6 +15,8 @@ class _SqliteConnectionTile extends StatefulWidget { this.onTap, this.onSqliteObjectSelected, this.onSqliteOpenSqlWorkspace, + this.isExpanded = false, + this.onExpandedChanged, }); final ConnectionRow connection; @@ -29,25 +31,49 @@ class _SqliteConnectionTile extends StatefulWidget { SqliteObjectKind kind, )? onSqliteObjectSelected; final void Function(ConnectionRow connection)? onSqliteOpenSqlWorkspace; + final bool isExpanded; + final ValueChanged? onExpandedChanged; @override State<_SqliteConnectionTile> createState() => _SqliteConnectionTileState(); } class _SqliteConnectionTileState extends State<_SqliteConnectionTile> { - bool _expanded = false; + bool get _expanded => widget.isExpanded; bool _loading = false; String? _error; List _tables = []; List _views = []; - void _toggle() { - setState(() => _expanded = !_expanded); - if (_expanded && _tables.isEmpty && _views.isEmpty && !_loading) { + @override + void initState() { + super.initState(); + if (widget.isExpanded) { _loadTables(); } } + @override + void didUpdateWidget(_SqliteConnectionTile oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.isExpanded && !oldWidget.isExpanded) { + if (_tables.isEmpty && _views.isEmpty && !_loading) { + _loadTables(); + } + } else if (!widget.isExpanded && oldWidget.isExpanded) { + setState(() { + _tables = []; + _views = []; + _loading = false; + _error = null; + }); + } + } + + void _toggle() { + widget.onExpandedChanged?.call(!widget.isExpanded); + } + Future _loadTables() async { if (!mounted) return; setState(() { diff --git a/lib/features/main_screen/main_screen.dart b/lib/features/main_screen/main_screen.dart index fab3619c..8caa2953 100644 --- a/lib/features/main_screen/main_screen.dart +++ b/lib/features/main_screen/main_screen.dart @@ -149,8 +149,35 @@ class _MainScreenState extends State { width: 1, child: Column( children: [ - QueryaWindowTitleBar( - onNewDatabaseConnection: _onNewDatabaseConnectionFromMenu, + ValueListenableBuilder( + valueListenable: _workspace, + builder: (context, workspace, _) { + return QueryaWindowTitleBar( + onNewDatabaseConnection: _onNewDatabaseConnectionFromMenu, + activeConnection: workspace.activeConnection, + onConnect: () { + final active = workspace.activeConnection; + if (active != null && active.id != null) { + _connectionsPanelKey.currentState?.connect(active.id!); + } + }, + onDisconnect: () { + final active = workspace.activeConnection; + if (active != null) { + _connectionsPanelKey.currentState?.disconnect(active); + } + }, + onDisconnectAll: () { + _connectionsPanelKey.currentState?.disconnectAll(); + }, + onDisconnectOthers: () { + final active = workspace.activeConnection; + if (active != null) { + _connectionsPanelKey.currentState?.disconnectOthers(active); + } + }, + ); + }, ), Divider(height: 1, color: wb.borderSubtle.withValues(alpha: 0.22)), Expanded( diff --git a/lib/features/main_screen/querya_window_title_bar.dart b/lib/features/main_screen/querya_window_title_bar.dart index 2bfe0e9d..2929459b 100644 --- a/lib/features/main_screen/querya_window_title_bar.dart +++ b/lib/features/main_screen/querya_window_title_bar.dart @@ -1,6 +1,7 @@ import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/material.dart' as material show BuildContext, Container, Icon, Icons, MainAxisSize, Widget; +import 'package:querya_desktop/core/storage/local_db.dart'; import 'package:querya_desktop/core/theme/querya_theme_scope.dart'; import 'package:querya_desktop/features/connections/driver_manager_dialog.dart'; import 'package:querya_desktop/features/settings/preferences_dialog.dart'; @@ -12,9 +13,19 @@ class QueryaWindowTitleBar extends StatelessWidget { const QueryaWindowTitleBar({ super.key, required this.onNewDatabaseConnection, + this.activeConnection, + this.onConnect, + this.onDisconnect, + this.onDisconnectAll, + this.onDisconnectOthers, }); final Future Function() onNewDatabaseConnection; + final ConnectionRow? activeConnection; + final VoidCallback? onConnect; + final VoidCallback? onDisconnect; + final VoidCallback? onDisconnectAll; + final VoidCallback? onDisconnectOthers; @visibleForTesting static Color titleBarBackground(BuildContext context) => @@ -147,11 +158,11 @@ class QueryaWindowTitleBar extends StatelessWidget { ), const MenuDivider(), MenuButton( - enabled: false, + enabled: activeConnection != null, leading: const material.Icon( material.Icons.power_rounded, size: 18), - onPressed: (_) {}, + onPressed: (_) => onConnect?.call(), child: const Text('Connect'), ), MenuButton( @@ -162,17 +173,19 @@ class QueryaWindowTitleBar extends StatelessWidget { child: const Text('Invalidate/Reconnect'), ), MenuButton( + enabled: activeConnection != null, leading: const material.Icon( material.Icons.power_off_rounded, size: 18), - onPressed: (_) {}, + onPressed: (_) => onDisconnect?.call(), child: const Text('Disconnect'), ), MenuButton( - onPressed: (_) {}, + onPressed: (_) => onDisconnectAll?.call(), child: const Text('Disconnect All')), MenuButton( - onPressed: (_) {}, + enabled: activeConnection != null, + onPressed: (_) => onDisconnectOthers?.call(), child: const Text('Disconnect Others')), const MenuDivider(), MenuButton( diff --git a/test/features/connections/connections_panel_layout_test.dart b/test/features/connections/connections_panel_layout_test.dart index 3f68e14b..aefe4bcb 100644 --- a/test/features/connections/connections_panel_layout_test.dart +++ b/test/features/connections/connections_panel_layout_test.dart @@ -246,4 +246,113 @@ void main() { _expectTextCount('Mongo local', 1); }); }); + + group('ConnectionsPanel state control methods', () { + late Directory stateTempDir; + + setUp(() async { + stateTempDir = await Directory.systemTemp.createTemp('querya_conn_state_test_'); + PathProviderPlatform.instance = _FakePathProvider(stateTempDir.path); + await LocalDb.instance.close(); + await LocalDb.instance.addConnection( + ConnectionRow( + type: 'generic', + name: 'Conn 1', + createdAt: _isoNow(), + ), + ); + await LocalDb.instance.addConnection( + ConnectionRow( + type: 'generic', + name: 'Conn 2', + createdAt: _isoNow(), + ), + ); + await FoldersStorage.instance.reload(); + }); + + tearDown(() async { + await LocalDb.instance.close(); + if (await stateTempDir.exists()) { + await stateTempDir.delete(recursive: true); + } + }); + + testWidgets('connect, disconnect, disconnectAll, and disconnectOthers update state', (tester) async { + await tester.pumpWidget( + ShadcnApp( + theme: AppTheme.dark, + home: material.SizedBox.expand( + child: ConnectionsPanel( + skipInitialDbLoadForTest: true, + onPostgresOpenSqlWorkspace: (_, {database, schema, name, kind}) {}, + ), + ), + ), + ); + await tester.pump(); + + final panelState = tester.state( + find.byType(ConnectionsPanel), + ); + + await tester.runAsync(() async { + await panelState.reloadConnectionsFromDb(); + }); + await tester.pump(); + + late final List conns; + await tester.runAsync(() async { + conns = await LocalDb.instance.getConnections(); + }); + final conn1 = conns.firstWhere((c) => c.name == 'Conn 1'); + final conn2 = conns.firstWhere((c) => c.name == 'Conn 2'); + final id1 = conn1.id!; + final id2 = conn2.id!; + + // 1. Initial state + expect(panelState.isConnectionExpanded(id1), false); + expect(panelState.isConnectionExpanded(id2), false); + + // 2. Connect + panelState.connect(id1); + await tester.pump(); + expect(panelState.isConnectionExpanded(id1), true); + expect(panelState.isConnectionExpanded(id2), false); + + // 3. Disconnect Others + panelState.connect(id2); + await tester.pump(); + expect(panelState.isConnectionExpanded(id1), true); + expect(panelState.isConnectionExpanded(id2), true); + + await tester.runAsync(() async { + await panelState.disconnectOthers(conn1); + }); + await tester.pump(); + expect(panelState.isConnectionExpanded(id1), true); + expect(panelState.isConnectionExpanded(id2), false); + + // 4. Disconnect + await tester.runAsync(() async { + await panelState.disconnect(conn1); + }); + await tester.pump(); + expect(panelState.isConnectionExpanded(id1), false); + + // 5. Disconnect All + panelState.connect(id1); + panelState.connect(id2); + await tester.pump(); + expect(panelState.isConnectionExpanded(id1), true); + expect(panelState.isConnectionExpanded(id2), true); + + await tester.runAsync(() async { + await panelState.disconnectAll(); + }); + await tester.pump(); + expect(panelState.isConnectionExpanded(id1), false); + expect(panelState.isConnectionExpanded(id2), false); + }); + }); } From d9737773091d9651242affcbd0c7a36cbba17eef Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Mon, 22 Jun 2026 04:18:44 +0300 Subject: [PATCH 2/4] feat(connection): implement Invalidate/Reconnect menu item --- lib/features/connections/connections_panel.dart | 9 +++++++++ lib/features/main_screen/main_screen.dart | 6 ++++++ lib/features/main_screen/querya_window_title_bar.dart | 5 ++++- .../connections/connections_panel_layout_test.dart | 11 +++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/features/connections/connections_panel.dart b/lib/features/connections/connections_panel.dart index cadae7bf..3dca1577 100644 --- a/lib/features/connections/connections_panel.dart +++ b/lib/features/connections/connections_panel.dart @@ -369,6 +369,15 @@ class ConnectionsPanelState extends State { } } + Future reconnect(ConnectionRow conn) async { + final id = conn.id!; + await disconnect(conn); + await Future.delayed(const Duration(milliseconds: 50)); + if (mounted) { + connect(id); + } + } + /// Icon for a connection type (matches New Connection dialog). material.IconData _iconForType(String type) { return switch (type) { diff --git a/lib/features/main_screen/main_screen.dart b/lib/features/main_screen/main_screen.dart index 8caa2953..abc53579 100644 --- a/lib/features/main_screen/main_screen.dart +++ b/lib/features/main_screen/main_screen.dart @@ -161,6 +161,12 @@ class _MainScreenState extends State { _connectionsPanelKey.currentState?.connect(active.id!); } }, + onReconnect: () { + final active = workspace.activeConnection; + if (active != null) { + _connectionsPanelKey.currentState?.reconnect(active); + } + }, onDisconnect: () { final active = workspace.activeConnection; if (active != null) { diff --git a/lib/features/main_screen/querya_window_title_bar.dart b/lib/features/main_screen/querya_window_title_bar.dart index 2929459b..536d57f2 100644 --- a/lib/features/main_screen/querya_window_title_bar.dart +++ b/lib/features/main_screen/querya_window_title_bar.dart @@ -15,6 +15,7 @@ class QueryaWindowTitleBar extends StatelessWidget { required this.onNewDatabaseConnection, this.activeConnection, this.onConnect, + this.onReconnect, this.onDisconnect, this.onDisconnectAll, this.onDisconnectOthers, @@ -23,6 +24,7 @@ class QueryaWindowTitleBar extends StatelessWidget { final Future Function() onNewDatabaseConnection; final ConnectionRow? activeConnection; final VoidCallback? onConnect; + final VoidCallback? onReconnect; final VoidCallback? onDisconnect; final VoidCallback? onDisconnectAll; final VoidCallback? onDisconnectOthers; @@ -166,10 +168,11 @@ class QueryaWindowTitleBar extends StatelessWidget { child: const Text('Connect'), ), MenuButton( + enabled: activeConnection != null, leading: const material.Icon( material.Icons.refresh_rounded, size: 18), - onPressed: (_) {}, + onPressed: (_) => onReconnect?.call(), child: const Text('Invalidate/Reconnect'), ), MenuButton( diff --git a/test/features/connections/connections_panel_layout_test.dart b/test/features/connections/connections_panel_layout_test.dart index aefe4bcb..4a67b096 100644 --- a/test/features/connections/connections_panel_layout_test.dart +++ b/test/features/connections/connections_panel_layout_test.dart @@ -353,6 +353,17 @@ void main() { await tester.pump(); expect(panelState.isConnectionExpanded(id1), false); expect(panelState.isConnectionExpanded(id2), false); + + // 6. Reconnect + panelState.connect(id1); + await tester.pump(); + expect(panelState.isConnectionExpanded(id1), true); + + await tester.runAsync(() async { + await panelState.reconnect(conn1); + }); + await tester.pump(const Duration(milliseconds: 100)); + expect(panelState.isConnectionExpanded(id1), true); }); }); } From 483a73cefae31f52ea0a42dcb38cf7938e4f5be1 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Mon, 22 Jun 2026 04:30:46 +0300 Subject: [PATCH 3/4] feat: implement Connection -> Read-only mode for database connections --- lib/features/main_screen/main_screen.dart | 5 +++ .../main_screen_workspace_state.dart | 32 ++++++++++++++++++- .../main_screen/querya_window_title_bar.dart | 12 ++++++- lib/features/main_screen/workspace_panel.dart | 5 +++ lib/features/mysql/mysql_sql_workspace.dart | 15 +++++++-- lib/features/mysql/mysql_workspace_home.dart | 11 +++++++ .../postgresql/postgres_sql_workspace.dart | 9 ++++-- .../postgresql/postgres_workspace_home.dart | 11 +++++++ lib/features/sqlite/sqlite_sql_workspace.dart | 13 +++++++- .../sqlite/sqlite_workspace_home.dart | 11 +++++++ .../main_screen_workspace_state_test.dart | 18 +++++++++++ .../querya_window_title_bar_test.dart | 1 + 12 files changed, 136 insertions(+), 7 deletions(-) diff --git a/lib/features/main_screen/main_screen.dart b/lib/features/main_screen/main_screen.dart index abc53579..2e5b0d1c 100644 --- a/lib/features/main_screen/main_screen.dart +++ b/lib/features/main_screen/main_screen.dart @@ -155,6 +155,10 @@ class _MainScreenState extends State { return QueryaWindowTitleBar( onNewDatabaseConnection: _onNewDatabaseConnectionFromMenu, activeConnection: workspace.activeConnection, + isReadOnly: workspace.isReadOnly, + onReadOnlyChanged: () { + _workspace.value = _workspace.value.toggleReadOnly(); + }, onConnect: () { final active = workspace.activeConnection; if (active != null && active.id != null) { @@ -336,6 +340,7 @@ class _MainContentSplitState extends State<_MainContentSplit> { mysqlSqlTabRequestToken: ws.mysqlSqlTabRequestToken, selectedSqliteObject: ws.selectedSqliteObject, sqliteSqlTabRequestToken: ws.sqliteSqlTabRequestToken, + isReadOnly: ws.isReadOnly, onRequestNewConnection: widget.onRequestNewConnection, ); }, diff --git a/lib/features/main_screen/main_screen_workspace_state.dart b/lib/features/main_screen/main_screen_workspace_state.dart index d11f74fa..a973d4a8 100644 --- a/lib/features/main_screen/main_screen_workspace_state.dart +++ b/lib/features/main_screen/main_screen_workspace_state.dart @@ -19,6 +19,7 @@ class MainScreenWorkspaceState { this.mysqlSqlTabRequestToken = 0, this.selectedSqliteObject, this.sqliteSqlTabRequestToken = 0, + this.isReadOnly = false, }); final ConnectionRow? activeConnection; @@ -53,9 +54,27 @@ class MainScreenWorkspaceState { SqliteObjectKind kind })? selectedSqliteObject; final int sqliteSqlTabRequestToken; + final bool isReadOnly; static const empty = MainScreenWorkspaceState(); + MainScreenWorkspaceState toggleReadOnly() { + return MainScreenWorkspaceState( + activeConnection: activeConnection, + activeRedisDb: activeRedisDb, + activeMongoDB: activeMongoDB, + selectedPostgresObject: selectedPostgresObject, + postgresSqlTabRequestToken: postgresSqlTabRequestToken, + postgresSqlEditorContext: postgresSqlEditorContext, + postgresSqlEditorContextToken: postgresSqlEditorContextToken, + selectedMysqlObject: selectedMysqlObject, + mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, + selectedSqliteObject: selectedSqliteObject, + sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: !isReadOnly, + ); + } + MainScreenWorkspaceState selectConnection(ConnectionRow connection) { return MainScreenWorkspaceState( activeConnection: connection, @@ -69,6 +88,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: false, ); } @@ -96,6 +116,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: isReadOnly, ); } @@ -121,6 +142,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: isReadOnly, ); } @@ -144,6 +166,7 @@ class MainScreenWorkspaceState { kind: kind, ), sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: isReadOnly, ); } @@ -160,6 +183,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: isReadOnly, ); } @@ -177,6 +201,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: isReadOnly, ); } @@ -235,6 +260,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: isReadOnly, ); } @@ -251,6 +277,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken + 1, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken, + isReadOnly: isReadOnly, ); } @@ -267,6 +294,7 @@ class MainScreenWorkspaceState { mysqlSqlTabRequestToken: mysqlSqlTabRequestToken, selectedSqliteObject: null, sqliteSqlTabRequestToken: sqliteSqlTabRequestToken + 1, + isReadOnly: isReadOnly, ); } @@ -284,7 +312,8 @@ class MainScreenWorkspaceState { _mysqlEquals(selectedMysqlObject, other.selectedMysqlObject) && mysqlSqlTabRequestToken == other.mysqlSqlTabRequestToken && _sqliteEquals(selectedSqliteObject, other.selectedSqliteObject) && - sqliteSqlTabRequestToken == other.sqliteSqlTabRequestToken; + sqliteSqlTabRequestToken == other.sqliteSqlTabRequestToken && + isReadOnly == other.isReadOnly; } @override @@ -325,6 +354,7 @@ class MainScreenWorkspaceState { selectedSqliteObject!.kind, ), sqliteSqlTabRequestToken, + isReadOnly, ); } diff --git a/lib/features/main_screen/querya_window_title_bar.dart b/lib/features/main_screen/querya_window_title_bar.dart index 536d57f2..bba9a8e3 100644 --- a/lib/features/main_screen/querya_window_title_bar.dart +++ b/lib/features/main_screen/querya_window_title_bar.dart @@ -19,6 +19,8 @@ class QueryaWindowTitleBar extends StatelessWidget { this.onDisconnect, this.onDisconnectAll, this.onDisconnectOthers, + this.isReadOnly = false, + this.onReadOnlyChanged, }); final Future Function() onNewDatabaseConnection; @@ -28,6 +30,8 @@ class QueryaWindowTitleBar extends StatelessWidget { final VoidCallback? onDisconnect; final VoidCallback? onDisconnectAll; final VoidCallback? onDisconnectOthers; + final bool isReadOnly; + final VoidCallback? onReadOnlyChanged; @visibleForTesting static Color titleBarBackground(BuildContext context) => @@ -192,10 +196,16 @@ class QueryaWindowTitleBar extends StatelessWidget { child: const Text('Disconnect Others')), const MenuDivider(), MenuButton( + enabled: activeConnection != null, leading: const material.Icon( material.Icons.lock_outline_rounded, size: 18), - onPressed: (_) {}, + trailing: isReadOnly + ? const material.Icon( + material.Icons.check_rounded, + size: 16) + : null, + onPressed: (_) => onReadOnlyChanged?.call(), child: const Text('Read-only'), ), ], diff --git a/lib/features/main_screen/workspace_panel.dart b/lib/features/main_screen/workspace_panel.dart index 9e5acd11..80d89b72 100644 --- a/lib/features/main_screen/workspace_panel.dart +++ b/lib/features/main_screen/workspace_panel.dart @@ -60,11 +60,13 @@ class WorkspacePanel extends StatefulWidget { this.mysqlSqlTabRequestToken = 0, this.selectedSqliteObject, this.sqliteSqlTabRequestToken = 0, + this.isReadOnly = false, this.onRequestNewConnection, }); /// Currently selected connection from the sidebar. final ConnectionRow? activeConnection; + final bool isReadOnly; /// When set, the user selected a specific Redis database in the sidebar tree. /// null = show stats, non-null = show data explorer for that db. @@ -159,6 +161,7 @@ class _WorkspacePanelState extends State { postgresSqlEditorContextToken: widget.postgresSqlEditorContextToken, sqlTabRequestToken: widget.postgresSqlTabRequestToken, + isReadOnly: widget.isReadOnly, ) : buildPostgresObjectWorkspace( connection: activeConn, @@ -172,6 +175,7 @@ class _WorkspacePanelState extends State { key: ValueKey('mysql_home_${activeConn.id}'), connectionRow: activeConn, sqlTabRequestToken: widget.mysqlSqlTabRequestToken, + isReadOnly: widget.isReadOnly, ) : MysqlTableView( key: ValueKey( @@ -216,6 +220,7 @@ class _WorkspacePanelState extends State { key: ValueKey('sqlite_home_${activeConn.id}'), connectionRow: activeConn, sqlTabRequestToken: widget.sqliteSqlTabRequestToken, + isReadOnly: widget.isReadOnly, ) : SqliteTableView( key: ValueKey( diff --git a/lib/features/mysql/mysql_sql_workspace.dart b/lib/features/mysql/mysql_sql_workspace.dart index 339128c3..42c0aac1 100644 --- a/lib/features/mysql/mysql_sql_workspace.dart +++ b/lib/features/mysql/mysql_sql_workspace.dart @@ -25,9 +25,11 @@ class MysqlSqlWorkspace extends material.StatefulWidget { const MysqlSqlWorkspace({ super.key, required this.connectionRow, + this.isReadOnly = false, }); final ConnectionRow connectionRow; + final bool isReadOnly; @override material.State createState() => _MysqlSqlWorkspaceState(); @@ -66,6 +68,15 @@ class _MysqlSqlWorkspaceState extends material.State { }); } + @override + void didUpdateWidget(covariant MysqlSqlWorkspace oldWidget) { + super.didUpdateWidget(oldWidget); + if (oldWidget.isReadOnly != widget.isReadOnly) { + _lease?.release(); + _lease = null; + } + } + Future _loadWorkspaceSettings() async { final t = await AppSettings.instance.getMysqlSqlStmtTimeoutSeconds(); final rows = await AppSettings.instance.getSqlResultMaxRows(); @@ -94,7 +105,7 @@ class _MysqlSqlWorkspaceState extends material.State { final lease = await MysqlService.instance.acquire( widget.connectionRow, database: _poolDatabaseKey(), - mode: MysqlSessionMode.readWrite, + mode: widget.isReadOnly ? MysqlSessionMode.readOnly : MysqlSessionMode.readWrite, ); if (!mounted) { lease.release(); @@ -116,7 +127,7 @@ class _MysqlSqlWorkspaceState extends material.State { MysqlService.instance.interrupt( widget.connectionRow, database: _poolDatabaseKey(), - mode: MysqlSessionMode.readWrite, + mode: widget.isReadOnly ? MysqlSessionMode.readOnly : MysqlSessionMode.readWrite, ); } _lease?.release(); diff --git a/lib/features/mysql/mysql_workspace_home.dart b/lib/features/mysql/mysql_workspace_home.dart index 81f9f8ad..9005ad9a 100644 --- a/lib/features/mysql/mysql_workspace_home.dart +++ b/lib/features/mysql/mysql_workspace_home.dart @@ -15,9 +15,11 @@ class MysqlWorkspaceHome extends material.StatefulWidget { super.key, required this.connectionRow, this.sqlTabRequestToken = 0, + this.isReadOnly = false, }); final ConnectionRow connectionRow; + final bool isReadOnly; /// Parent increments to switch to the SQL tab (e.g. context menu on connection). final int sqlTabRequestToken; @@ -74,6 +76,14 @@ class _MysqlWorkspaceHomeState extends material.State { child: material.Row( children: [ const Text('MySQL').semiBold().small(), + if (widget.isReadOnly) ...[ + const Gap(6), + material.Icon( + material.Icons.lock_outline_rounded, + size: 14, + color: theme.colorScheme.mutedForeground, + ), + ], const Spacer(), ...List.generate(2, (i) { final labels = ['Server', 'SQL']; @@ -120,6 +130,7 @@ class _MysqlWorkspaceHomeState extends material.State { MysqlSqlWorkspace( key: ValueKey('mysql_sql_${widget.connectionRow.id}'), connectionRow: widget.connectionRow, + isReadOnly: widget.isReadOnly, ), ], ), diff --git a/lib/features/postgresql/postgres_sql_workspace.dart b/lib/features/postgresql/postgres_sql_workspace.dart index f6ecb83f..22bc209f 100644 --- a/lib/features/postgresql/postgres_sql_workspace.dart +++ b/lib/features/postgresql/postgres_sql_workspace.dart @@ -37,9 +37,11 @@ class PostgresSqlWorkspace extends material.StatefulWidget { this.transactionOpenNotifier, this.postgresSqlEditorContext, this.postgresSqlEditorContextToken = 0, + this.isReadOnly = false, }); final ConnectionRow connectionRow; + final bool isReadOnly; /// Updated when transaction state changes (for tab-switch warnings). final material.ValueNotifier? transactionOpenNotifier; @@ -113,6 +115,9 @@ class _PostgresSqlWorkspaceState extends material.State { if (oldWidget.connectionRow.id != widget.connectionRow.id) { _lastAppliedSqlContextToken = -1; } + if (oldWidget.isReadOnly != widget.isReadOnly) { + _dropLease(); + } _syncPostgresSqlTreeContext(); } @@ -178,7 +183,7 @@ class _PostgresSqlWorkspaceState extends material.State { final lease = await PostgresService.instance.acquire( widget.connectionRow, database: db, - mode: PgSessionMode.readWrite, + mode: widget.isReadOnly ? PgSessionMode.readOnly : PgSessionMode.readWrite, ); if (!mounted) { lease.release(); @@ -259,7 +264,7 @@ class _PostgresSqlWorkspaceState extends material.State { PostgresService.instance.interrupt( widget.connectionRow, database: _interruptDatabase ?? _effectiveSessionDatabase(), - mode: PgSessionMode.readWrite, + mode: widget.isReadOnly ? PgSessionMode.readOnly : PgSessionMode.readWrite, ); } _dropLease(); diff --git a/lib/features/postgresql/postgres_workspace_home.dart b/lib/features/postgresql/postgres_workspace_home.dart index e2cea5b7..bcf1b99f 100644 --- a/lib/features/postgresql/postgres_workspace_home.dart +++ b/lib/features/postgresql/postgres_workspace_home.dart @@ -18,9 +18,11 @@ class PostgresWorkspaceHome extends material.StatefulWidget { this.postgresSqlEditorContext, this.postgresSqlEditorContextToken = 0, this.sqlTabRequestToken = 0, + this.isReadOnly = false, }); final ConnectionRow connectionRow; + final bool isReadOnly; /// Set when opening SQL from the tree (e.g. "Open in SQL") to seed session DB + template. final ({ @@ -120,6 +122,14 @@ class _PostgresWorkspaceHomeState child: material.Row( children: [ const Text('PostgreSQL').semiBold().small(), + if (widget.isReadOnly) ...[ + const Gap(6), + material.Icon( + material.Icons.lock_outline_rounded, + size: 14, + color: theme.colorScheme.mutedForeground, + ), + ], const Spacer(), ...List.generate(2, (i) { final labels = ['Server', 'SQL']; @@ -170,6 +180,7 @@ class _PostgresWorkspaceHomeState postgresSqlEditorContext: widget.postgresSqlEditorContext, postgresSqlEditorContextToken: widget.postgresSqlEditorContextToken, + isReadOnly: widget.isReadOnly, ), ], ), diff --git a/lib/features/sqlite/sqlite_sql_workspace.dart b/lib/features/sqlite/sqlite_sql_workspace.dart index 45d38d52..2f34b117 100644 --- a/lib/features/sqlite/sqlite_sql_workspace.dart +++ b/lib/features/sqlite/sqlite_sql_workspace.dart @@ -21,9 +21,11 @@ class SqliteSqlWorkspace extends material.StatefulWidget { const SqliteSqlWorkspace({ super.key, required this.connectionRow, + this.isReadOnly = false, }); final ConnectionRow connectionRow; + final bool isReadOnly; @override material.State createState() => _SqliteSqlWorkspaceState(); @@ -60,6 +62,15 @@ class _SqliteSqlWorkspaceState extends material.State { }); } + @override + void didUpdateWidget(covariant SqliteSqlWorkspace oldWidget) { + super.didUpdateWidget(oldWidget); + if (oldWidget.isReadOnly != widget.isReadOnly) { + _lease?.release(); + _lease = null; + } + } + Future _loadWorkspaceSettings() async { final rows = await AppSettings.instance.getSqlResultMaxRows(); final hist = await AppSettings.instance.getSqlHistoryMaxEntries(); @@ -78,7 +89,7 @@ class _SqliteSqlWorkspaceState extends material.State { _lease = null; final lease = await SqliteService.instance.acquire( widget.connectionRow, - mode: SqliteSessionMode.readWrite, + mode: widget.isReadOnly ? SqliteSessionMode.readOnly : SqliteSessionMode.readWrite, ); if (!mounted) { lease.release(); diff --git a/lib/features/sqlite/sqlite_workspace_home.dart b/lib/features/sqlite/sqlite_workspace_home.dart index 67991e09..94fc438a 100644 --- a/lib/features/sqlite/sqlite_workspace_home.dart +++ b/lib/features/sqlite/sqlite_workspace_home.dart @@ -8,10 +8,12 @@ class SqliteWorkspaceHome extends material.StatefulWidget { super.key, required this.connectionRow, this.sqlTabRequestToken = 0, + this.isReadOnly = false, }); final ConnectionRow connectionRow; final int sqlTabRequestToken; + final bool isReadOnly; @override material.State createState() => _SqliteWorkspaceHomeState(); @@ -33,6 +35,14 @@ class _SqliteWorkspaceHomeState extends material.State { child: material.Row( children: [ const Text('SQLite').semiBold().small(), + if (widget.isReadOnly) ...[ + const Gap(6), + material.Icon( + material.Icons.lock_outline_rounded, + size: 14, + color: theme.colorScheme.mutedForeground, + ), + ], const Spacer(), material.Container( padding: const material.EdgeInsets.symmetric(horizontal: 12, vertical: 8), @@ -50,6 +60,7 @@ class _SqliteWorkspaceHomeState extends material.State { child: SqliteSqlWorkspace( key: ValueKey('sqlite_sql_${widget.connectionRow.id}'), connectionRow: widget.connectionRow, + isReadOnly: widget.isReadOnly, ), ), ], diff --git a/test/features/main_screen/main_screen_workspace_state_test.dart b/test/features/main_screen/main_screen_workspace_state_test.dart index 4023ef9e..411eac6c 100644 --- a/test/features/main_screen/main_screen_workspace_state_test.dart +++ b/test/features/main_screen/main_screen_workspace_state_test.dart @@ -166,5 +166,23 @@ void main() { ); expect(a, isNot(c)); }); + + test('read-only state toggle and reset', () { + var state = MainScreenWorkspaceState.empty; + expect(state.isReadOnly, isFalse); + + state = state.toggleReadOnly(); + expect(state.isReadOnly, isTrue); + + state = state.toggleReadOnly(); + expect(state.isReadOnly, isFalse); + + state = state.toggleReadOnly(); + expect(state.isReadOnly, isTrue); + + // Selecting a new connection should reset isReadOnly to false + state = state.selectConnection(mysqlConn); + expect(state.isReadOnly, isFalse); + }); }); } diff --git a/test/features/main_screen/querya_window_title_bar_test.dart b/test/features/main_screen/querya_window_title_bar_test.dart index 835f4a69..219c56e3 100644 --- a/test/features/main_screen/querya_window_title_bar_test.dart +++ b/test/features/main_screen/querya_window_title_bar_test.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/material.dart' as material; import 'package:flutter_test/flutter_test.dart'; +import 'package:querya_desktop/core/storage/local_db.dart'; import 'package:querya_desktop/core/theme/querya_theme.dart'; import 'package:querya_desktop/core/theme/querya_workbench_theme.dart'; import 'package:querya_desktop/features/main_screen/querya_window_title_bar.dart'; From 65572dcc47921040c578b59d9eab81b78eee8a8f Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Mon, 22 Jun 2026 04:37:20 +0300 Subject: [PATCH 4/4] fix ci --- lib/features/connections/connections_panel.dart | 1 - test/features/main_screen/querya_window_title_bar_test.dart | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/features/connections/connections_panel.dart b/lib/features/connections/connections_panel.dart index 3dca1577..40bbfa6e 100644 --- a/lib/features/connections/connections_panel.dart +++ b/lib/features/connections/connections_panel.dart @@ -57,7 +57,6 @@ import 'package:querya_desktop/core/database/mongodb_service.dart'; import 'package:querya_desktop/core/database/mysql_service.dart'; import 'package:querya_desktop/core/database/postgres_service.dart'; import 'package:querya_desktop/core/database/redis_connection.dart'; -import 'package:meta/meta.dart' show visibleForTesting; import 'package:querya_desktop/core/database/redis_info.dart'; import 'package:querya_desktop/core/database/sqlite_service.dart'; import 'package:querya_desktop/core/storage/folders_storage.dart'; diff --git a/test/features/main_screen/querya_window_title_bar_test.dart b/test/features/main_screen/querya_window_title_bar_test.dart index 219c56e3..835f4a69 100644 --- a/test/features/main_screen/querya_window_title_bar_test.dart +++ b/test/features/main_screen/querya_window_title_bar_test.dart @@ -3,7 +3,6 @@ import 'dart:ui'; import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/material.dart' as material; import 'package:flutter_test/flutter_test.dart'; -import 'package:querya_desktop/core/storage/local_db.dart'; import 'package:querya_desktop/core/theme/querya_theme.dart'; import 'package:querya_desktop/core/theme/querya_workbench_theme.dart'; import 'package:querya_desktop/features/main_screen/querya_window_title_bar.dart';