-
Notifications
You must be signed in to change notification settings - Fork 4
Add query panel to control and command (ampcc) #1589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fordN
wants to merge
13
commits into
main
Choose a base branch
from
ford/ampcc-query-panel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,015
−22
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, expanding a dataset in Local mode would show no versions because fetch_versions() returned an empty vector. This fix calls the admin-client's list_versions() API to fetch actual version data. Changes: - Construct FQN from namespace/name for the API call - Map VersionsResponse to VersionEntry structs - Determine latest version using special_tags.latest - Handle errors gracefully with eprintln and empty fallback Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add ability to export SQL query results to CSV files: - Press E in QueryResult pane to export results - CSV includes headers and all rows - Filename includes timestamp (query_results_YYYYMMDD_HHMMSS.csv) - Success message displays for 3 seconds (green) - Error handling for write failures and empty results - Export hint shown in QueryResult title and footer Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add shell-style query history to the SQL query panel, allowing users to recall and reuse previously executed queries during their session. Features: - Up/Down arrows navigate through query history - Current input preserved as draft when entering history - Consecutive duplicate queries are not added - History capped at 100 entries (oldest removed first) - UI shows history position and entry count - Editing resets navigation to current input Co-Authored-By: Claude Opus 4.5 <[email protected]>
Save query history to ~/.config/ampcc/history.json on shutdown and load on startup. History survives across sessions, respects the 100 entry limit, and handles errors gracefully without crashing. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add ability to export SQL query results to CSV files: - Press E in QueryResult pane to export results - CSV includes headers and all rows - Filename includes timestamp (query_results_YYYYMMDD_HHMMSS.csv) - Success message displays for 3 seconds (green) - Error handling for write failures and empty results - Export hint shown in QueryResult title and footer Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add syntax highlighting for SQL queries in the query input panel: - SQL keywords highlighted in purple (The Graph accent color) - String literals highlighted in green - Numbers highlighted in yellow - Operators and punctuation in secondary gray - Identifiers in primary white Includes tokenizer that handles: - SQL keywords (SELECT, FROM, WHERE, etc.) - String literals (single and double quoted) - Numbers (integers and decimals) - Operators (=, <, >, !=, <=, >=, <>, +, -, *, /, %) - Punctuation (parentheses, commas, semicolons, dots) The highlight_sql_with_cursor() function integrates with the existing multiline input system to show both highlighting and cursor position. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add automatic column width calculation based on data content: - Columns auto-size based on header and cell content widths - Minimum width of 5 chars, maximum of 50 chars - Proportional scaling when total exceeds available space - Column numbers shown in headers (e.g., "[1] column_name") - Cell truncation respects calculated column widths This replaces the previous fixed-percentage/minimum width approach with a more adaptive layout that better handles varying data widths. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add query template system for common SQL patterns:
- 6 built-in templates (preview, count, filter, group by, distinct, describe)
- Placeholders auto-filled from current dataset context
- Template picker popup (press T in query mode)
- Up/Down navigation, Enter to select, Esc to cancel
Templates include:
- "SELECT * FROM {table} LIMIT 10" - Preview data
- "SELECT COUNT(*) FROM {table}" - Row count
- "SELECT * FROM {table} WHERE {column} = '?'" - Filter by column
- "SELECT {column}, COUNT(*) FROM {table} GROUP BY {column}" - Group by
- "SELECT DISTINCT {column} FROM {table}" - Unique values
- "DESCRIBE {table}" - Table schema
Placeholders {table} and {column} are resolved using the current
dataset's schema information.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add interactive sorting for SQL query results: - Press 's' in QueryResult pane to enter sort mode - Press 1-9 to sort by that column number - Press same column number again to reverse sort direction - Press 'S' to clear sorting and restore original order Features: - Numeric-aware sorting (numbers sorted numerically, not lexically) - Sort indicators in column headers (▲ ascending, ▼ descending) - Sort info shown in title bar - Context-sensitive footer hints The sorted indices are computed on-demand and applied during rendering, preserving the original data order for export. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add ability to save and manage favorite SQL queries: - Press * or F in query mode to toggle favorite status - Press Ctrl+F to open favorites panel (if any favorites exist) - Favorites panel supports Up/Down navigation, Enter to load, d to delete - Star indicator (★) in query title when current query is favorited Features: - Favorites persisted to ~/.config/ampcc/favorites.json - Favorites loaded on startup, saved on quit - Empty favorites handled gracefully with helpful message - Query truncation in favorites panel for long queries The favorites complement query history by providing explicit user-curated list of frequently used queries. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Store query history separately for each dataset instead of globally. History is now keyed by dataset name, with "global" as fallback. Changes: - Update HistoryFile to version 2 with dataset_history HashMap - Add current_history_key() and current_history() methods - Add add_to_history() method for dataset-aware history management - Update load_history() to migrate from v1 format - Update main.rs to use new per-dataset history methods - Update ui.rs to use current_history() for display Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add bash-style reverse history search to the SQL query panel: - Ctrl+R enters search mode, cycles through matches - Case-insensitive filtering of query history - Works with per-dataset history (with global fallback) - Shows match count (e.g., "1/5") or "failing" when no matches - Enter accepts, Esc cancels and restores original input Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add user-facing documentation for the SQL query panel features: - Multi-line input and keyboard shortcuts - SQL syntax highlighting - Query history with per-dataset support - Query templates with placeholder resolution - Favorite queries - Result sorting and CSV export - Column auto-sizing Also add CLAUDE.md with developer documentation covering: - Architecture and module structure - Key components and data flow - Development guidelines - Troubleshooting guide Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
|
Nice! Some concerns,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds an interactive SQL query panel to ampcc for exploring dataset data
Features
Documentation