Skip to content

Feat: Activate or create connection via URL parameters#1811

Closed
andy-k-improving wants to merge 5 commits into
aws:mainfrom
andy-k-improving:ft-hf-ad-hoc-connections
Closed

Feat: Activate or create connection via URL parameters#1811
andy-k-improving wants to merge 5 commits into
aws:mainfrom
andy-k-improving:ft-hf-ad-hoc-connections

Conversation

@andy-k-improving

@andy-k-improving andy-k-improving commented Jun 8, 2026

Copy link
Copy Markdown

Issue: Closes #1788

Description:

Allows external applications to deep-link into Graph Explorer with a database connection pre-configured. On page load, URL search parameters are parsed and the user is prompted to either activate an existing matching connection or create a new one.

Example URL

https://localhost/explorer?graphDbUrl=https%3A%2F%2Fg-xxx.us-west-2.neptune-graph.amazonaws.com&queryEngine=openCypher&awsRegion=us-west-2&serviceType=neptune-graph&name=My%20Graph

Supported parameters

Parameter Required Default Description
graphDbUrl Yes Database endpoint (URL-encoded)
queryEngine No gremlin gremlin, openCypher, or sparql
awsRegion No AWS region for IAM signing
serviceType No neptune-db or neptune-graph
name No graphDbUrl Display label for the connection

Behavior

  • Match found → dialog shows "Activate Connection"; clicking Connect activates without resetting the graph session
  • No match → dialog shows "Create Connection"; clicking Create adds and activates
  • Cancel → dismisses dialog, strips URL params, no changes made
  • Dedup → deterministic ID prevents duplicates from repeated URL clicks
  • URL stripped → params removed via replaceState after user confirms or cancels

Files changed

File Description
src/core/AppStatusLoader.tsx Orchestration: parse params at module level, compute match/pending during render, delegate to dialog
src/core/UrlConnectionDialog.tsx Presentational dialog component
src/core/urlConnectionParams.ts Pure functions: parseUrlConnectionParams, findMatchingConnection, buildConnectionFromParams
src/core/urlConnectionParams.test.ts Unit tests (9 cases)

Testing

  • Unit tests: URL parsing (missing params, defaults, full params), matching (case-insensitive, engine mismatch, no match), building (IAM on/off, deterministic IDs)
  • Manual: new endpoint → Create dialog; existing endpoint → Connect dialog; no params → normal flow

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.
Screenshot 2026-06-08 at 3 57 13 PM Screenshot 2026-06-08 at 4 42 04 PM

@kmcginnes

Copy link
Copy Markdown
Collaborator
  • Match found → dialog shows "Activate Connection"; clicking Connect activates without resetting the graph session

You must reset the graph session when changing connections.

The reason is that any graph currently on the canvas has the potential to be expanded or the data to be refreshed. But if the connection changed, then the data might not exist in the new connection and will most likely break.

So any connection change should always reset everything.

@acarbonetto

Copy link
Copy Markdown
Contributor

The reason is that any graph currently on the canvas has the potential to be expanded or the data to be refreshed. But if the connection changed, then the data might not exist in the new connection and will most likely break.

I think this means the connection is already active? I'm not really sure why we would need to 'activate it'? I understand the 'match' strategy, but I think we should have a dialog with the following options:

  1. [Cancel] - change to [Ignore]?
  2. [Add Connection] - this adds the connection, but doesn't reset the graph session or activate it - this option is not available if the connection already exists (is a match)
  3. [Connect] - this adds the connection AND resets the graph session to activate it

@kmcginnes

Copy link
Copy Markdown
Collaborator

Good questions — I reworked this quite a bit; it's now #1828, which replaces this PR.

A connection link opens in a new tab/window — there's no way to push params into an already-loaded Graph Explorer tab, so every link starts a fresh session. That removes the "switching could clear a session you care about" concern: there's nothing on the canvas to lose.

That's what simplifies the dialog question:

resolve(link):
  matches the ACTIVE connection   -> do nothing, clean up the URL
  matches an INACTIVE connection  -> switch to it (no prompt)
  matches nothing                 -> open the create form, prefilled but editable
  invalid params                  -> toast + ignore

@acarbonetto — I dropped the 3-option dialog. Switching to a connection you already have needs no prompt (same as clicking it in the connections list), since the session is fresh anyway. The only friction I kept is the create form for an unknown endpoint — the one case where a link introduces something unvetted. No "add but don't activate" mode; a link's whole intent is to connect.

Matching now also considers auth posture (IAM/region/service type), so a link asking for IAM won't silently reuse a plaintext connection to the same URL.

Closing this in favor of #1828.

@kmcginnes kmcginnes closed this Jun 17, 2026
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.

Activate or create a connection via URL parameters

3 participants