Skip to content
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

Feature/connection loaders #9

Merged
merged 25 commits into from
May 25, 2023
Merged

Feature/connection loaders #9

merged 25 commits into from
May 25, 2023

Conversation

kndndrj
Copy link
Owner

@kndndrj kndndrj commented May 17, 2023

addresses #2.

Added more functionality to configure connections, save them to file, load from different sources.

Added secret injecting from environment.

kndndrj and others added 10 commits May 15, 2023 17:52
- expand env variables from connection strings
- moved layout to editor and handler
- node/layout organization more uniform
- fix non refreshing bug
- if go doesn't register, don't register in lua either
- fix typos
- add prompt mapping
- renamed loader functions
- updated readme and config
@cseickel
Copy link

This looks pretty awesome, I'll give it a try tonight and let you know how it works. Thanks!

@cseickel
Copy link

I was able to add a connection interactively, but I can't figure out how to open that connection or run a query. What do I do next?

@kndndrj
Copy link
Owner Author

kndndrj commented May 18, 2023

Hey, once you added the connection, it should appear in the drawer - except if there were any errors.

You should then be able to activate it (using da in the drawer) and every query that is executed (either from a scratchpad or using the require"dbee".execute()) will be ran on that connection.

there are still some issues with require"dbee".execute() and the error logging isn't the best - I already have a plan to address that in a future PR

@cseickel
Copy link

da doesn't do anything. Also, there is a > ? help line in the drawer but I can't get that to do anything either. I tried hitting <enter>, <space>, and da on both my connection and the help but nothing happens.

image

@kndndrj
Copy link
Owner Author

kndndrj commented May 18, 2023

@cseickel press "o" to toggle the node in tree. please reffer to the config.lua for other key bindings.

I'll add this to the readme aswell

@cseickel
Copy link

I finally got the connections to work. My suggestion on this feature is that you really need to add in the ability to view/edit connections. I ended up finding the persistence file in order to edit the connection. The good news is that using an env variable for the password worked as expected.

Also, I'm not clear on what happens when you specify connections in the config and interactively, it seems like my config connections were being ignored.

I did see the information_schema and pg_catalog when expanding the connection, but I still haven't been able to run a query. I tried using the main window to write a query and then used BB which I found in the config file as a command to execute but it didn't do anything.

I think you really need to focus on writing a manual to explain how this is supposed to work.

@kndndrj
Copy link
Owner Author

kndndrj commented May 18, 2023

hey, can you read the new "getting started" section in the readme and tell me if anything is still missing.

The view/edit functionality is sure interesting and I'll see what I can do.

The connections you specify in different formats are all mashed together once calling setup. The specifying connections section in readme is (I hope) pretty clear about different sources - the "add" and "remove" function are called when you add/remove connection interactively and they let you control what happens (or doesn't happen) with the connection - if you make them empty functions then nothing is written to persistence file.

I'll add the edit functionality and let you know. Thanks again for the feedback!

@cseickel
Copy link

This is a huge help. You might actually consider defaulting the help menu to being expanded to help first timers, then have a config option to default it to closed for people that don't need it anymore.

Also, I finally got it to work!

That edit functionality is huge though because it was really annoying to keep writing out all the details over and over because I made mistakes or accidentally closed the popup.

@cseickel
Copy link

You know, for me, I would prefer to just edit the entire lua or json file directly as opposed to typing it in one connection at a time. In a way you are creating a custom syntax anyhow the way you have implemented it, it might as well be a well known one that LSP/treesitter can help with.

@kndndrj
Copy link
Owner Author

kndndrj commented May 19, 2023

Hey, very nice suggestions, thanks. I am in the process of moving a lot of things around because I have seen that some stuff is pretty confusing (like the loaders I added).

At the end of the day, yeah it would probably make sense to add an "edit conns" in the tree and it just opens a json file or something.

Anyways I'll get back to you once I refactor this a bit!

- pulled result out of handler
- connections are maps to go side
- added handler lookup for connections and loaders
- handler just manages connections and loaders through lookup
- generalized drawer icons to candy
- handle keymaps in ui
- other fixes
- removed default keymaps from components
@kndndrj kndndrj force-pushed the feature/connection_loaders branch from 3294af7 to 94d2d9d Compare May 23, 2023 18:38
@kndndrj
Copy link
Owner Author

kndndrj commented May 23, 2023

@cseickel
Hey, I know it's been a while, but I finally came around to implementing some stuff for this. I updated the README.md with instructions.
There are some breaking changes in this PR now - refer to lua/dbee/config.lua for more info.

Essentially, you pass "sources" to setup and they provide the connections to dbee. this allows more modularity like encrypted file in the future.

please take a look at it and see if you like it and if you would replace anything :)

@cseickel
Copy link

This is great! I say ship it!

@kndndrj kndndrj force-pushed the feature/connection_loaders branch from 5fe800d to 16d57a3 Compare May 25, 2023 04:05
@kndndrj kndndrj merged commit 24ae34e into master May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants