From 6f7062fa52a321cc28611464f58a1481cb71753e Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Sun, 11 Oct 2026 12:05:42 +0300 Subject: [PATCH] fix(connections): Remove connection is drawn as a destructive menu item The context menu showed Remove connection in the same muted style as the harmless entries. Its icon and label now use the destructive colour in every connection menu (PostgreSQL, MySQL, SQLite, Redis, MongoDB, extension and the generic tile); an e2e check reads the label colour. --- .../connections_panel_extension.dart | 7 ++++-- .../connections/connections_panel_mongo.dart | 7 ++++-- .../connections/connections_panel_mysql.dart | 7 ++++-- ...connections_panel_postgres_connection.dart | 7 ++++-- .../connections/connections_panel_redis.dart | 7 ++++-- .../connections_panel_sidebar.dart | 7 ++++-- .../connections/connections_panel_sqlite.dart | 7 ++++-- .../e2e_connection_crud_test.dart | 24 ++++++++++++++++++- 8 files changed, 58 insertions(+), 15 deletions(-) diff --git a/lib/features/connections/connections_panel_extension.dart b/lib/features/connections/connections_panel_extension.dart index 31141c26..6c10711b 100644 --- a/lib/features/connections/connections_panel_extension.dart +++ b/lib/features/connections/connections_panel_extension.dart @@ -200,9 +200,12 @@ class _ExtensionConnectionTileState extends State<_ExtensionConnectionTile> { ...widget.moveItems, MenuButton( leading: material.Icon(material.Icons.delete_outline_rounded, - size: 18, color: theme.colorScheme.mutedForeground), + size: 18, color: theme.colorScheme.destructive), onPressed: (_) => widget.onRemove(), - child: const Text('Remove connection'), + child: Text( + 'Remove connection', + style: material.TextStyle(color: theme.colorScheme.destructive), + ), ), ], child: material.Padding( diff --git a/lib/features/connections/connections_panel_mongo.dart b/lib/features/connections/connections_panel_mongo.dart index 16695639..18ed1acc 100644 --- a/lib/features/connections/connections_panel_mongo.dart +++ b/lib/features/connections/connections_panel_mongo.dart @@ -179,9 +179,12 @@ class _MongoConnectionTileState extends State<_MongoConnectionTile> { ...widget.moveItems, MenuButton( leading: material.Icon(material.Icons.delete_outline_rounded, - size: 18, color: theme.colorScheme.mutedForeground), + size: 18, color: theme.colorScheme.destructive), onPressed: (_) => widget.onRemove(), - child: const Text('Remove connection'), + child: Text( + 'Remove connection', + style: material.TextStyle(color: theme.colorScheme.destructive), + ), ), ], child: material.Padding( diff --git a/lib/features/connections/connections_panel_mysql.dart b/lib/features/connections/connections_panel_mysql.dart index 11ce6791..f073653e 100644 --- a/lib/features/connections/connections_panel_mysql.dart +++ b/lib/features/connections/connections_panel_mysql.dart @@ -156,9 +156,12 @@ class _MysqlConnectionTileState extends State<_MysqlConnectionTile> { ...widget.moveItems, MenuButton( leading: material.Icon(material.Icons.delete_outline_rounded, - size: 18, color: theme.colorScheme.mutedForeground), + size: 18, color: theme.colorScheme.destructive), onPressed: (_) => widget.onRemove(), - child: const Text('Remove connection'), + child: Text( + 'Remove connection', + style: material.TextStyle(color: theme.colorScheme.destructive), + ), ), ], child: material.Padding( diff --git a/lib/features/connections/connections_panel_postgres_connection.dart b/lib/features/connections/connections_panel_postgres_connection.dart index 7319e05f..0e8cd8e6 100644 --- a/lib/features/connections/connections_panel_postgres_connection.dart +++ b/lib/features/connections/connections_panel_postgres_connection.dart @@ -151,9 +151,12 @@ class _PostgresConnectionTileState extends State<_PostgresConnectionTile> { ...widget.moveItems, MenuButton( leading: material.Icon(material.Icons.delete_outline_rounded, - size: 18, color: theme.colorScheme.mutedForeground), + size: 18, color: theme.colorScheme.destructive), onPressed: (_) => widget.onRemove(), - child: const Text('Remove connection'), + child: Text( + 'Remove connection', + style: material.TextStyle(color: theme.colorScheme.destructive), + ), ), ], child: material.Padding( diff --git a/lib/features/connections/connections_panel_redis.dart b/lib/features/connections/connections_panel_redis.dart index a8b2423f..06ef3e8c 100644 --- a/lib/features/connections/connections_panel_redis.dart +++ b/lib/features/connections/connections_panel_redis.dart @@ -161,9 +161,12 @@ class _RedisConnectionTileState extends State<_RedisConnectionTile> { ...widget.moveItems, MenuButton( leading: material.Icon(material.Icons.delete_outline_rounded, - size: 18, color: theme.colorScheme.mutedForeground), + size: 18, color: theme.colorScheme.destructive), onPressed: (_) => widget.onRemove(), - child: const Text('Remove connection'), + child: Text( + 'Remove connection', + style: material.TextStyle(color: theme.colorScheme.destructive), + ), ), ], child: material.Padding( diff --git a/lib/features/connections/connections_panel_sidebar.dart b/lib/features/connections/connections_panel_sidebar.dart index 0025b00b..48dac237 100644 --- a/lib/features/connections/connections_panel_sidebar.dart +++ b/lib/features/connections/connections_panel_sidebar.dart @@ -124,9 +124,12 @@ class _ConnectionTile extends StatelessWidget { ...moveItems, MenuButton( leading: material.Icon(material.Icons.delete_outline_rounded, - size: 18, color: theme.colorScheme.mutedForeground), + size: 18, color: theme.colorScheme.destructive), onPressed: (_) => onRemove(), - child: const Text('Remove connection'), + child: Text( + 'Remove connection', + style: material.TextStyle(color: theme.colorScheme.destructive), + ), ), ], child: material.Padding( diff --git a/lib/features/connections/connections_panel_sqlite.dart b/lib/features/connections/connections_panel_sqlite.dart index b6b308a7..2fbde8b8 100644 --- a/lib/features/connections/connections_panel_sqlite.dart +++ b/lib/features/connections/connections_panel_sqlite.dart @@ -182,9 +182,12 @@ class _SqliteConnectionTileState extends State<_SqliteConnectionTile> { ...widget.moveItems, MenuButton( leading: material.Icon(material.Icons.delete_outline_rounded, - size: 18, color: theme.colorScheme.mutedForeground), + size: 18, color: theme.colorScheme.destructive), onPressed: (_) => widget.onRemove(), - child: const Text('Remove connection'), + child: Text( + 'Remove connection', + style: material.TextStyle(color: theme.colorScheme.destructive), + ), ), ], child: material.Padding( diff --git a/test/e2e/01_connection_lifecycle/e2e_connection_crud_test.dart b/test/e2e/01_connection_lifecycle/e2e_connection_crud_test.dart index f001f951..c60dbd30 100644 --- a/test/e2e/01_connection_lifecycle/e2e_connection_crud_test.dart +++ b/test/e2e/01_connection_lifecycle/e2e_connection_crud_test.dart @@ -1,9 +1,10 @@ import 'package:flutter/gestures.dart' show kSecondaryButton; -import 'package:flutter/widgets.dart' show Draggable, ValueKey; +import 'package:flutter/widgets.dart' show Draggable, Text, ValueKey; import 'package:flutter_test/flutter_test.dart'; import 'package:querya_desktop/core/storage/app_settings.dart'; import 'package:querya_desktop/core/storage/folders_storage.dart'; 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/connections_panel.dart'; import '../helpers/e2e_app_harness.dart'; @@ -99,6 +100,27 @@ void main() { await app.close(tester); }); + testWidgets('Remove connection is drawn as a destructive menu item', + (tester) async { + await app.launch(tester); + final id = await E2eConnections.add( + tester, E2eConnections.redis('E2E Remover')); + await E2eConnections.reloadSidebar(tester); + + await tester.tap(inSidebar('E2E Remover').first, + buttons: kSecondaryButton); + await tester.pump(const Duration(milliseconds: 300)); + + final label = tester.widget(find.text('Remove connection').last); + final destructive = QueryaThemeScope.of( + tester.element(find.text('Remove connection').last), + ).workbench.destructive; + expect(label.style?.color, destructive); + + await E2eConnections.remove(tester, id); + await app.close(tester); + }); + testWidgets('Move to folder in the connection menu puts it in the folder', (tester) async { await app.launch(tester);