-
Notifications
You must be signed in to change notification settings - Fork 38
feat(cli): add elide db studio command
#1699
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
franklinfollis
wants to merge
92
commits into
main
Choose a base branch
from
feat/database-ui
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.
Open
Changes from all commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
b10f0e6
initial skeleton for db studio command
franklinfollis 551796f
feat(database-ui): have `elide db studio` be a simple wrapper around …
franklinfollis b3ec20a
feat(database-ui): have db studio init a react ssr template for studi…
franklinfollis 7f47320
feat(database-ui): discover db files on disk and select between them
franklinfollis a1b9ca1
feat(database-ui): static react app calling on database json api
franklinfollis a3630e3
feat(database-ui): consolidate api and ui for db studio into one folder
franklinfollis 18fa796
feat(database-ui): add shadcn and tailwind to studio frontend
franklinfollis 163a063
feat(database-ui): standardize json api paths
franklinfollis f9428bf
feat(database-ui): denote columns that are primary keys in tables
franklinfollis b8c6b43
fix(database-ui): add primaryKeys to TableData type
franklinfollis abe822f
fix(database-ui): move built db studio code under .dev
franklinfollis 86f9b47
fix(database-ui): use new elide http server
franklinfollis bd34832
feat(database-ui): cleanup server.ts
franklinfollis 0f965d5
fix(database-ui): use byte length for content length header
franklinfollis 1a6872c
feat(database-ui): provide directory as well as db file path for data…
franklinfollis 78f78a8
feat(database-ui): use code mirror for query editor
franklinfollis fa06349
feat(database-ui): move db-studio src out of samples
franklinfollis 7dc4779
feat(database-ui): setup elide.pkl manifest for api
franklinfollis fecfd76
feat(database-ui): spread server routes and handlers out to separate …
franklinfollis d5b54dc
feat(database-ui): add tsconfig to resolve elide:sqlite types
franklinfollis 4b6b6d8
chore(database-ui): cleanup responses and router code
franklinfollis 7ea1760
feat(database-ui): format null values in table
franklinfollis d0b255d
feat(database-ui): escape table names with spaces in them
franklinfollis 81a212e
feat(database-ui): use tanstack table for viewing query results
franklinfollis 6a1aa91
feat(database-ui): show views from databases as well
franklinfollis e0d045e
feat(database-ui): refactor api response to include query metadata
franklinfollis 559155f
feat(database-ui): update query hooks to use new format
franklinfollis 3543da6
feat(database-ui): show detailed column info on hover
franklinfollis 29bb8b8
feat(database-ui): add support for views
franklinfollis 1bf5d83
chore(database-ui): clean up context passed in routes
franklinfollis 595feac
feat(database-ui): use limit and offset as query params for pagination
franklinfollis 847b527
fix(database-ui): fix up loading state for rows when changing offset
franklinfollis 2671635
fix(database-ui): highlight selected table in sidebar
franklinfollis 3146301
feat(database-ui): sticky toolbar and column headers
franklinfollis ab9d8fa
chore(database-ui): prettierrc
franklinfollis 02564a0
fix(database-ui): show key info first on column description
franklinfollis 71d94cf
feat(database-ui): add props for hiding tools in data table
franklinfollis 51c5b0b
feat(database-ui): send sort column and direction as url parameter
franklinfollis 0b81426
feat(database-ui): Move table name to toolbar
franklinfollis 442c65c
feat(database-ui): add filtering for data table
franklinfollis d866f7b
feat(database-ui): show active where and column filters
franklinfollis fb21815
feat(database-ui): add refresh handler for table data
franklinfollis 17eabae
refactor(database-ui): separate components out of data table
franklinfollis 8ae85d2
feat(database-ui): move contents of navbar to sidebar
franklinfollis cfe2d04
fix(database-ui): remove memo on DataTableGrid
franklinfollis dfab8d0
feat(database-ui): create provider for DataTable
franklinfollis 84ec8ea
fix(database-ui): various lint fix ups
franklinfollis ea93677
feat(database-ui): add resizable panels
franklinfollis 48afdb2
feat(database-ui): standardize theme for ui
franklinfollis 9992cbf
feat(database-ui): simplify theme
franklinfollis b62a4dc
fix(database-ui): fix stale state in columns dropdown
franklinfollis 5a91212
feat(database-ui): functionality for deleting rows
franklinfollis 45aad6c
feat(database-ui): use zod for parsing responses
franklinfollis efaa4dc
feat(database-ui): call sub tasks within db studio command
franklinfollis 0589431
fix(database-ui): run elide build and install before running api server
franklinfollis b687be1
fix(database-ui): exclude .dev in prepareDbStudio task
franklinfollis 142cd52
fix(database-ui): exclude server node_modules in build output
franklinfollis bd16e36
fix(database-ui): hide delete button for views
franklinfollis f486c36
feat(database-ui): add refresh tables button
franklinfollis 6010c01
fix(database-ui): fix styling of column names in query editor
franklinfollis e503b97
feat(database-ui): add drop and truncate table actions
franklinfollis 9350335
test(database-ui): initial playwright config
franklinfollis d4de911
fix(database-ui): import elide:sqlite directly into middleware
franklinfollis b2fc80d
fix(database-ui): add CORS to api responses
franklinfollis 9ef95c4
fix(database-ui): refactor data table components
franklinfollis e2f1708
test(database-ui): shorten test commands
franklinfollis 1a075d2
fix(database-ui): small ui fixes
franklinfollis 621a701
fix(database-ui): make sidebar content more consistent
franklinfollis acbd1d4
feat(database-ui): cell selection
franklinfollis 5f8d000
feat(database-ui): add rows feature
franklinfollis 33c221a
fix(database-ui): incredibly clear drop and truncate warning dialogs
franklinfollis 5943797
fix(database-ui): unsaved changes dialog only on navigate out
franklinfollis 8a4a5fe
fix(database-ui): show proper SQL errors in ui
franklinfollis 09d59eb
fix(database-ui): only show table edit results on success/failure
franklinfollis d6b2c03
feat(database-ui): edit and update cells
franklinfollis 60b160e
feat(database-ui): remove retry for failed queries
franklinfollis 9472a9e
feat(database-ui): allow selecting NULL and EMPTY STRING for editable…
franklinfollis 789651f
feat(database-ui): generate unique id's for databases
franklinfollis 58ccc49
fix(database-ui): make cells still selectable in edit mode
franklinfollis 9bac9a4
fix(database-ui): show all columns when adding new rows
franklinfollis 55c9d0b
fix(database-ui): correctly delete when primary key is NULL
franklinfollis b81ad3f
feat(database-ui): show version number in footer
franklinfollis 9685505
feat(database-ui): save query and limit to local storage
franklinfollis 9112c9b
feat(database-ui): initial table creator/editor
franklinfollis eb13cbd
chore(database-ui): build ui assets
franklinfollis 8e373fc
fix(database-ui): log significant sql statements in api
franklinfollis 68ccc90
fix(database-ui): save local storage values per db
franklinfollis 8ca15de
docs(database-ui): add README and remove legacy run-db-studio script
franklinfollis 96633ad
fix(database-ui): latest static build of ui
franklinfollis 5d6e00e
fix(database-ui): remove flag for api-port for now
franklinfollis d1abed5
fix(database-ui): clean up terminal output
franklinfollis 08b0989
chore(database-ui): remove test db files from repo
franklinfollis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Database Studio | ||
|
|
||
| Web-based database management UI that runs on the Elide runtime. At the moment it only supports SQLite with Elide's `elide:sqlite` js bindings. We assume that an existing valid database file exists for the `elide db studio` command to find. If you need a database file to run this on, [Northwind](https://github.com/jpwhite3/northwind-SQLite3) and [Chinook](https://github.com/lerocha/chinook-database/releases) are some good prepopulated examples. | ||
|
|
||
| ## Directory Structure | ||
|
|
||
| ``` | ||
| db-studio/ | ||
| ├── api/ # TypeScript REST API server | ||
| │ ├── ... | ||
| │ ├── index.ts # Server entrypoint | ||
| │ └── elide.pkl | ||
| └── ui/ # React frontend application | ||
| ├── src/ | ||
| └── dist/ # Vite production build | ||
| ``` | ||
|
|
||
| ## Running Locally | ||
|
|
||
| ### Using the Gradle Command | ||
|
|
||
| The best way to run this locally is through the CLI in JVM mode. Simply passing `db studio` as args. | ||
|
|
||
| **Note:** In order to see UI changes you've made, you'll need to run `pnpm build` in the `ui/` directory first. | ||
|
|
||
| ```bash | ||
| # Build the UI | ||
| cd packages/cli/src/db-studio/ui | ||
| pnpm build | ||
|
|
||
| # Go back to the elide repo root | ||
| # Then run the db studio command | ||
| ./gradlew :packages:cli:run --args="db studio" | ||
|
|
||
| # With a specific database | ||
| ./gradlew :packages:cli:run --args="db studio path/to/database.db" | ||
| ``` | ||
|
|
||
| ### Running api or ui independently | ||
|
|
||
| Database Studio consists of two separate projects that can be run independently: | ||
|
|
||
| - `api`: run directly by calling `elide run index.ts` within the directory. | ||
| - `ui`: using `pnpm dev` within the directory. |
1 change: 1 addition & 0 deletions
1
packages/cli/src/db-studio/api/.dev/dependencies/npm/package-lock.kdl
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /Users/francis/code/millpointlabs/elide/elide/packages/cli/src/db-studio/api/package-lock.kdl |
13 changes: 13 additions & 0 deletions
13
packages/cli/src/db-studio/api/.dev/dependencies/npm/package.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "name": "db-studio-api", | ||
| "version": "1.0.0", | ||
| "description": "Database Studio API Server", | ||
| "main": "index.ts", | ||
| "scripts": {}, | ||
| "dependencies": { | ||
| "zod": "4" | ||
| }, | ||
| "devDependencies": { | ||
| "@elide-dev/types": "1.0.0-beta10" | ||
| } | ||
| } |
Binary file not shown.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import type { DiscoveredDatabase } from "./database.ts"; | ||
|
|
||
| /** | ||
| * Database Studio Configuration | ||
| * | ||
| * This is a sample configuration file. In production, this would be | ||
| * generated by DbStudioCommand.kt based on discovered databases. | ||
| */ | ||
|
|
||
| const config = { | ||
| port: 4984, | ||
| databases: [ | ||
| { | ||
| path: "./sample.db", | ||
| name: "sample.db", | ||
| size: 0, | ||
| lastModified: Date.now(), | ||
| } | ||
| ] as DiscoveredDatabase[], | ||
| }; | ||
|
|
||
| export default config; |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolute symlink? or what's up with this