labs-postgis-preview
labs-postgis-preview copied to clipboard
Add database connection modal
Let's make this thing even more user-friendly and just have a modal for the database connection info.
I am not sure how to implement this.
- The credentials need to make their way back to the server and stored somewhere (new express endpoint?)
- They should persist when the server stops and starts again (manually edit .env file?)
- Let the user test the connection before closing the modal
Any ideas?
Here's a connection modal from Franchise we can use for inspiration. We should totally throw in an elephant or two.
I'm thinking about the following flow:
- User enters credentials into modal
- When the user is done entering their credentials, the credentials are sent to the express app (
/validate-connection?), where they are used to create a connection to Postgres. The error or ok status are then returned to the client. If there was an error, that is presented to the user. If the credentials were valid, aPOSTrequest with the credentials is sent to the express app (/save-credentials?) where they are stored in a JSON file. - This structure would also allow for a user to create multiple connections and name them, similar to what you see in something like Postico. In that case, the credential entering modal can also be repurposed for editing existing connections.
I think this is a great idea!