Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions lib/features/connections/connections_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async' show Timer;

import 'package:flutter/material.dart' as material
show
AlertDialog,
TextEditingValue,
ValueListenableBuilder,
BuildContext,
Expand Down Expand Up @@ -44,7 +43,6 @@ import 'package:flutter/material.dart' as material
Colors,
Padding,
Widget,
Navigator,
ValueKey,
FontWeight,
VoidCallback,
Expand All @@ -58,7 +56,8 @@ import 'package:flutter/material.dart' as material
InputBorder,
TextEditingController,
FocusNode;
import 'package:flutter/services.dart' show LogicalKeyboardKey;
import 'package:flutter/services.dart'
show Clipboard, ClipboardData, LogicalKeyboardKey;
import 'package:querya_desktop/core/actions/querya_schema_object.dart';
import 'package:querya_desktop/core/actions/querya_schema_object_cache.dart';
import 'package:querya_desktop/core/actions/querya_schema_object_loader.dart';
Expand Down Expand Up @@ -330,6 +329,7 @@ class _ConnectionsTreeSelection {
this.selectedExtensionObject,
this.selectedRedisDb,
this.selectedMongoDb,
this.selectedMongoCollection,
});

static const empty = _ConnectionsTreeSelection();
Expand All @@ -350,6 +350,7 @@ class _ConnectionsTreeSelection {
final ({String database, String name})? selectedExtensionObject;
final int? selectedRedisDb;
final String? selectedMongoDb;
final String? selectedMongoCollection;

@override
bool operator ==(Object other) {
Expand All @@ -361,7 +362,8 @@ class _ConnectionsTreeSelection {
selectedSqliteObject == other.selectedSqliteObject &&
selectedExtensionObject == other.selectedExtensionObject &&
selectedRedisDb == other.selectedRedisDb &&
selectedMongoDb == other.selectedMongoDb;
selectedMongoDb == other.selectedMongoDb &&
selectedMongoCollection == other.selectedMongoCollection;
}

@override
Expand All @@ -373,6 +375,7 @@ class _ConnectionsTreeSelection {
selectedExtensionObject,
selectedRedisDb,
selectedMongoDb,
selectedMongoCollection,
);
}

Expand Down Expand Up @@ -462,9 +465,11 @@ class ConnectionsPanel extends StatefulWidget {
this.selectedExtensionObject,
this.selectedRedisDb,
this.selectedMongoDb,
this.selectedMongoCollection,
this.onConnectionSelected,
this.onRedisDatabaseSelected,
this.onMongoDBDatabaseSelected,
this.onMongoCollectionSelected,
this.onPostgresObjectSelected,
this.onPostgresOpenSqlWorkspace,
this.onMysqlObjectSelected,
Expand Down Expand Up @@ -492,6 +497,7 @@ class ConnectionsPanel extends StatefulWidget {
final ({String database, String name})? selectedExtensionObject;
final int? selectedRedisDb;
final String? selectedMongoDb;
final String? selectedMongoCollection;

/// Called when the user taps a connection tile.
final void Function(ConnectionRow connection)? onConnectionSelected;
Expand All @@ -504,6 +510,13 @@ class ConnectionsPanel extends StatefulWidget {
final void Function(ConnectionRow connection, String database)?
onMongoDBDatabaseSelected;

/// Called when the user taps a MongoDB collection node in the tree.
final void Function(
ConnectionRow connection,
String database,
String collection,
)? onMongoCollectionSelected;

/// Called when the user taps a PostgreSQL table, view, function, or sequence.
final void Function(
ConnectionRow connection,
Expand Down Expand Up @@ -603,6 +616,7 @@ class ConnectionsPanelState extends State<ConnectionsPanel> {
selectedExtensionObject: widget.selectedExtensionObject,
selectedRedisDb: widget.selectedRedisDb,
selectedMongoDb: widget.selectedMongoDb,
selectedMongoCollection: widget.selectedMongoCollection,
);
}

Expand Down Expand Up @@ -840,6 +854,8 @@ class ConnectionsPanelState extends State<ConnectionsPanel> {
onEdit: () => _editConnection(conn),
onTap: () => widget.onConnectionSelected?.call(conn),
onDatabaseTap: (db) => widget.onMongoDBDatabaseSelected?.call(conn, db),
onCollectionTap: (db, col) =>
widget.onMongoCollectionSelected?.call(conn, db, col),
isExpanded: isExpanded,
onExpandedChanged: handleExpandedChanged,
);
Expand Down
Loading
Loading