[OGUI-1917] Add shareable url button - #3586
Open
isaachilly wants to merge 13 commits into
Open
Conversation
Add a new share action to the toolbar that copies a URL for the current view (path + active query params) to the clipboard and displays a notification on success/error.
Add new tests to verify successful clipboard copying and correct error handling when the Clipboard API is missing or fails.
Replace manual per-field encoding in LogFilter with a single encodeURIComponent call on the full JSON query string in the router.
The share button now copies `window.location.href` directly instead of rebuilding the URL from parsed query params. This ensures the copied link exactly matches what the user sees in the address bar. Tests updated to validate exact URL copying, proper percent-encoding/round-trip of filters, and remove redundant test.
The `+` matched a run of consecutive quotes and collapsed it to a single escaped quote/ A backslash was encoded to `%5C` so JSON.Stringify saw nothing to escape. URLSearchParams then decoded it back to `\` and JSON.parse read it together with the character after it so something like `C:\temp` would be returned as `C:<tab>emp`. Both follow escaping before encoding, whilst JSON.parse runs only following the router's URLSearchParams decoding, unsymmetrical. Now that we encode the whole `q` parameter, this per-value pass is redundant and actively harmful, so it is removed.
Update expected URL params to use fully percent-encoded form.
Extend the InfoLogger filter action suite with a dedicated URL round-trip section. The new tests verify message filter values survive reloads across tricky cases (double quotes, valid/invalid backslash escapes, multiline input, and URL-special characters), and assert the model keeps unencoded values internally.
Extract query-string generation into `Model.buildQueryString()` and reuse it for route updates. Update the share action to build the URL from the model state instead of `window.location.href`, avoiding stale links when the address bar lags behind debounced filter changes.
Update the InfoLogger public tests to compare and reload against URLs built from `window.model.buildQueryString()` instead of `window.location.href`. This makes the assertions match the app's own URL generation logic.
Add a test case verifying that the share button copies the current in-memory filter state even when the address bar hasn't updated yet (due to the 500ms rate limit on route updates).
Extract repeated string literals into variables so each assertion compares against a single source of truth.
isaachilly
marked this pull request as ready for review
August 25, 2026 15:04
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I have JIRA issue created
INTEGRATION TEST
ilg-main.js:55:12WILL NEED TO BE UPDATED WITH RELEASE TO CHECK AGAINST?q=%7B%22severity%22%3A%7B%22in%22%3A%22I%20W%20E%20F%22%7D%7D.Additions
q=parameter is fully encoded not just each key's value in JSON string.Issues
location.hrefcan still hold the previous filters — you share a link to a view you're not looking at.LogFilter.toObject()ranencodeURIComponent()onmatch/excludevalues and escaped double quotes before the object was serialised into?q=. SinceURLSearchParamsdecodes the query value on the way back in, the round trip was asymmetric. Filters containing%,",\or+did not survive a reload.Fixes
Model.buildQueryString()is the single place that turns the current filter into a?=string applyingencodeURIComponentonce to the whole JSON payload.updateRouteOnModelChange()now uses it.commandLogs.jswhich reflects the model rather than a possibly stale address bar.LogFilter.toObject(). Encoding is the responsibility of whoever builds the URL.Tests
share-mocha.js- adds new tests for the button presence, clipboard content and stale-address-bar.log-filter-actions-mocha.js- filter IRL round-trip regression tests covering quotes, backslashes and percent signs; existing tests now build expected URLs from the model.