[COMPASS-693] "Open in Compass" Button Created: 20/Jan/17 Updated: 31/Aug/22 Resolved: 30/Jun/22 |
|
| Status: | Closed |
| Project: | Compass |
| Component/s: | Connectivity, UI / UX |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Lucas Hrabovsky (Inactive) | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 1 |
| Labels: | ecosystem, internal, primordial, stagnant | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Story Points: | 5 | ||||||||||||||||
| Description |
|
This would allow us to add a seamless "Open in Compass" button from the Atlas Connect dialog. Aggregation of my notes for protocol handlers for "mongodb://" and "compass://". — IntroductionProtocol handlers are also sometimes referred to as custom URL schemes. For an excellent overview, please read this excellent blog post: How To Create Your Own URL Scheme. Spotify spotify://, iTunes itmms:// and Intercom intercom:// are just a few examples of protocol handlers in action you may have encountered in the past. If you've ever seen the "External Protocol Request" dialog in Chrome, you've used protocol handlers: User experienceAtlas short-termAllows for clicking on mongodb://localhost:27017 -> open compass with connect form pre-filled.
Atlas and docs long-termSee elastic' view in console on all code blocks: https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-scripting-painless.html Use compass://<route> like Atom does for internal app routing instead of location hashes directly. ImplementationThere is a bit of a confusing division when it comes to protocol handlers in electron. Three parts: OS registration, Electron registration, and protocol request handling 1. OS RegistrationDiffers by platform. Tells the OS clicks on mongodb:// in Chrome should be routed to Compass. macOSSpecified at build time and registration is part of the OS's installation process. We already specify for this in Compass master:
WindowsUnlike macOS, registration is not part of OS installation process. The application is responsible for protocol registration on first-run and on Windows that is done by updating the Windows Registry). For more details, see how webtorrent desktop does windows. LinuxLike Windows, the application takes responsibility . On Linux, this is done by creating/updating the user's .desktop file. For more details, see how webtorrent desktop does linux 2. Electron registrationThe protocol module in electron tells Electron that requests to the mongodb:// protocol in Compass should be routed to Compass. 3. Protocol request handlingapp.on('open-file', <callback>) and app.on('open-url', <callback>) See the Compass mongodb-protocol-handler branch.
Making it all work as a single user flow
Further ReadingWeb-based Protocol Handlers
|