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
74 changes: 33 additions & 41 deletions lib/features/mongodb/mongo_aggregation_workspace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:querya_desktop/features/mongodb/mongo_aggregation_stage.dart';
import 'package:querya_desktop/features/mongodb/mongo_documents_json_view.dart';
import 'package:querya_desktop/features/mongodb/mongo_documents_table_view.dart';
import 'package:querya_desktop/shared/widgets/widgets.dart';
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';

/// Workspace for visually and interactively building, running, and inspecting
/// MongoDB Aggregation Pipelines step-by-step.
Expand Down Expand Up @@ -270,12 +271,11 @@ class _MongoAggregationWorkspaceState
mainAxisSize: material.MainAxisSize.min,
children: [
if (widget.onBack != null) ...[
OutlineButton(
QueryaButton.secondary(
label: 'Back to Documents',
icon: material.Icons.arrow_back_rounded,
onPressed: widget.onBack,
size: ButtonSize.small,
leading: const material.Icon(material.Icons.arrow_back_rounded,
size: 14),
child: const Text('Back to Documents'),
size: QueryaControlSize.sm,
),
const Gap(12),
],
Expand All @@ -301,30 +301,26 @@ class _MongoAggregationWorkspaceState
),
],
const Gap(16),
OutlineButton(
QueryaButton.secondary(
label: 'Add Stage',
icon: material.Icons.add_rounded,
onPressed: () => _addStage(),
size: ButtonSize.small,
leading:
const material.Icon(material.Icons.add_rounded, size: 14),
child: const Text('Add Stage'),
size: QueryaControlSize.sm,
),
const Gap(8),
OutlineButton(
QueryaButton.secondary(
label: 'Export Code',
icon: material.Icons.code_rounded,
onPressed: _showExportDialog,
size: ButtonSize.small,
leading:
const material.Icon(material.Icons.code_rounded, size: 14),
child: const Text('Export Code'),
size: QueryaControlSize.sm,
),
const Gap(8),
PrimaryButton(
QueryaButton.primary(
label: _executing ? 'Running...' : 'Run Pipeline',
icon: material.Icons.play_arrow_rounded,
loading: _executing,
onPressed: _executing ? null : () => _runPipeline(),
size: ButtonSize.small,
leading: _executing
? const QueryaSpinner(size: QueryaSpinnerSize.sm)
: const material.Icon(material.Icons.play_arrow_rounded,
size: 16),
child: Text(_executing ? 'Running...' : 'Run Pipeline'),
size: QueryaControlSize.sm,
),
],
),
Expand Down Expand Up @@ -357,14 +353,11 @@ class _MongoAggregationWorkspaceState
itemBuilder: (context, index) {
if (index == _stages.length) {
return material.Center(
child: OutlineButton(
child: QueryaButton.secondary(
label: 'Add Next Stage',
icon: material.Icons.add_circle_outline_rounded,
onPressed: () => _addStage(),
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.add_circle_outline_rounded,
size: 14,
),
child: const Text('Add Next Stage'),
size: QueryaControlSize.sm,
),
);
}
Expand Down Expand Up @@ -685,14 +678,11 @@ class _StageCardState extends material.State<_StageCard> {
// Footer actions: run up to here
material.Row(
children: [
GhostButton(
QueryaButton.ghost(
label: 'Run up to here',
icon: material.Icons.play_circle_outline_rounded,
onPressed: stage.isEnabled ? widget.onRunUpToHere : null,
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.play_circle_outline_rounded,
size: 14,
),
child: const Text('Run up to here'),
size: QueryaControlSize.sm,
),
const Gap(8),
material.Expanded(
Expand Down Expand Up @@ -830,11 +820,14 @@ class _ExportDialogState extends material.State<_ExportDialog> {
],
),
actions: [
OutlineButton(
QueryaButton.ghost(
label: 'Close',
onPressed: () => material.Navigator.of(context).pop(),
child: const Text('Close'),
size: QueryaControlSize.md,
),
PrimaryButton(
QueryaButton.primary(
label: 'Copy to Clipboard',
icon: material.Icons.copy_rounded,
onPressed: () async {
await Clipboard.setData(ClipboardData(text: code));
if (context.mounted) {
Expand All @@ -846,8 +839,7 @@ class _ExportDialogState extends material.State<_ExportDialog> {
material.Navigator.of(context).pop();
}
},
leading: const material.Icon(material.Icons.copy_rounded, size: 16),
child: const Text('Copy to Clipboard'),
size: QueryaControlSize.md,
),
],
);
Expand Down
29 changes: 13 additions & 16 deletions lib/features/mongodb/mongo_collections_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:querya_desktop/core/database/mongodb_service.dart';
import 'package:querya_desktop/features/workspace/destructive_query_dialog.dart';
import 'package:querya_desktop/shared/widgets/widgets.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart' as shadcn;
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';

/// Displays the list of collections in a MongoDB database.
class MongoCollectionsView extends material.StatefulWidget {
Expand Down Expand Up @@ -239,11 +240,11 @@ class _MongoCollectionsViewState extends material.State<MongoCollectionsView> {
style: material.TextStyle(
color: cs.mutedForeground, fontSize: 13)),
const Gap(24),
OutlineButton(
QueryaButton.secondary(
label: 'Retry',
icon: material.Icons.refresh_rounded,
onPressed: _load,
leading: const material.Icon(material.Icons.refresh_rounded,
size: 18),
child: const Text('Retry'),
size: QueryaControlSize.md,
),
],
),
Expand Down Expand Up @@ -305,14 +306,11 @@ class _MongoCollectionsViewState extends material.State<MongoCollectionsView> {
),
),
if (widget.onOpenQueryConsole != null) ...[
OutlineButton(
QueryaButton.secondary(
label: 'MQL Console',
icon: material.Icons.terminal_rounded,
onPressed: widget.onOpenQueryConsole,
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.terminal_rounded,
size: 14,
),
child: const Text('MQL Console'),
size: QueryaControlSize.sm,
),
const Gap(8),
],
Expand All @@ -324,12 +322,11 @@ class _MongoCollectionsViewState extends material.State<MongoCollectionsView> {
),
),
const Gap(8),
PrimaryButton(
QueryaButton.primary(
label: 'Create',
icon: material.Icons.add_rounded,
onPressed: _createCollection,
size: ButtonSize.small,
leading:
const material.Icon(material.Icons.add_rounded, size: 16),
child: const Text('Create'),
size: QueryaControlSize.sm,
),
],
),
Expand Down
32 changes: 14 additions & 18 deletions lib/features/mongodb/mongo_document_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:querya_desktop/features/mongodb/mongo_ejson.dart';
import 'package:querya_desktop/features/workspace/destructive_query_dialog.dart';
import 'package:querya_desktop/shared/widgets/widgets.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart' as shadcn;
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';

/// Full-screen JSON editor for a single MongoDB document.
class MongoDocumentEditor extends material.StatefulWidget {
Expand Down Expand Up @@ -281,33 +282,28 @@ class _MongoDocumentEditorState extends material.State<MongoDocumentEditor> {
child: Text(idStr).semiBold().small(),
),
// Format button
OutlineButton(
QueryaButton.secondary(
label: 'Format',
icon: material.Icons.format_align_left_rounded,
onPressed: _format,
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.format_align_left_rounded,
size: 14),
child: const Text('Format'),
size: QueryaControlSize.sm,
),
const Gap(8),
// Save button
PrimaryButton(
QueryaButton.primary(
label: _saving ? 'Saving...' : 'Save',
icon: material.Icons.save_rounded,
loading: _saving,
onPressed: _saving ? null : _save,
size: ButtonSize.small,
leading: _saving
? const QueryaSpinner(size: QueryaSpinnerSize.sm)
: const material.Icon(material.Icons.save_rounded,
size: 14),
child: Text(_saving ? 'Saving...' : 'Save'),
size: QueryaControlSize.sm,
),
const Gap(8),
// Delete button
DestructiveButton(
QueryaButton.destructive(
label: 'Delete',
icon: material.Icons.delete_rounded,
onPressed: _deleting ? null : _delete,
size: ButtonSize.small,
leading: const material.Icon(material.Icons.delete_rounded,
size: 14),
child: const Text('Delete'),
size: QueryaControlSize.sm,
),
],
),
Expand Down
34 changes: 14 additions & 20 deletions lib/features/mongodb/mongo_document_tree_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:querya_desktop/features/mongodb/mongo_ejson.dart';
import 'package:querya_desktop/features/mongodb/mongo_field_codec.dart';
import 'package:querya_desktop/shared/widgets/app_toast.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
import 'package:querya_desktop/shared/widgets/querya_button.dart';

/// Appends a key or list index to a JavaScript / JSON Path expression.
///
Expand Down Expand Up @@ -188,38 +190,30 @@ class _MongoDocumentTreeViewState extends State<MongoDocumentTreeView> {
),
const Gap(8),
if (_searchQuery.isNotEmpty)
GhostButton(
QueryaButton.icon(
icon: material.Icons.close_rounded,
tooltip: 'Clear search',
size: QueryaControlSize.sm,
onPressed: () {
_searchController.clear();
setState(() {
_searchQuery = '';
});
},
size: ButtonSize.small,
child: const material.Icon(
material.Icons.close_rounded,
size: 14,
),
),
const Spacer(),
OutlineButton(
QueryaButton.secondary(
label: 'Expand All',
icon: material.Icons.unfold_more_rounded,
onPressed: _expandAll,
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.unfold_more_rounded,
size: 14,
),
child: const Text('Expand All'),
size: QueryaControlSize.sm,
),
const Gap(8),
OutlineButton(
QueryaButton.secondary(
label: 'Collapse All',
icon: material.Icons.unfold_less_rounded,
onPressed: _collapseAll,
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.unfold_less_rounded,
size: 14,
),
child: const Text('Collapse All'),
size: QueryaControlSize.sm,
),
],
),
Expand Down
35 changes: 14 additions & 21 deletions lib/features/mongodb/mongo_documents_table_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:querya_desktop/features/mongodb/mongo_ejson.dart';
import 'package:querya_desktop/features/workspace/result_grid_view.dart';
import 'package:querya_desktop/shared/widgets/app_toast.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
import 'package:querya_desktop/shared/widgets/querya_button.dart';

/// Precomputed column and cell model for [MongoDocumentsTableView].
class MongoTableGridData {
Expand Down Expand Up @@ -201,36 +203,27 @@ class _MongoDocumentsTableViewState extends State<MongoDocumentsTableView> {
],
const Spacer(),
if (widget.onDocumentTap != null) ...[
OutlineButton(
QueryaButton.secondary(
label: 'View Document',
icon: material.Icons.open_in_new_rounded,
onPressed: () => widget.onDocumentTap!(selectedDoc),
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.open_in_new_rounded,
size: 13,
),
child: const Text('View Document'),
size: QueryaControlSize.sm,
),
const Gap(6),
],
OutlineButton(
QueryaButton.secondary(
label: 'Copy JSON',
icon: material.Icons.copy_rounded,
onPressed: () => _copySelectedDocJson(selectedDoc),
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.copy_rounded,
size: 13,
),
child: const Text('Copy JSON'),
size: QueryaControlSize.sm,
),
if (widget.onDeleteDocument != null) ...[
const Gap(6),
DestructiveButton(
QueryaButton.destructive(
label: 'Delete',
icon: material.Icons.delete_outline_rounded,
onPressed: () => widget.onDeleteDocument!(selectedDoc),
size: ButtonSize.small,
leading: const material.Icon(
material.Icons.delete_outline_rounded,
size: 13,
),
child: const Text('Delete'),
size: QueryaControlSize.sm,
),
],
] else ...[
Expand Down
Loading
Loading