Skip to content

[OGUI-1917] Add shareable url button - #3586

Open
isaachilly wants to merge 13 commits into
devfrom
feature/ILG/OGUI-1917/Add-shareable-url-button
Open

[OGUI-1917] Add shareable url button#3586
isaachilly wants to merge 13 commits into
devfrom
feature/ILG/OGUI-1917/Add-shareable-url-button

Conversation

@isaachilly

@isaachilly isaachilly commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

I have JIRA issue created

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

INTEGRATION TEST ilg-main.js:55:12 WILL 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

  • Adds a share button to the InfoLogger toolbar that copies a link reproducing the current filter criteria to the clipboard, and fixes a URL-encoding bug in the filter serialisation.
  • Whole q= parameter is fully encoded not just each key's value in JSON string.

Issues

  • The address bar is updated on model change via a debounced router call, so right after a filter edit location.href can still hold the previous filters — you share a link to a view you're not looking at.
  • LogFilter.toObject() ran encodeURIComponent() on match/exclude values and escaped double quotes before the object was serialised into ?q=. Since URLSearchParams decodes 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 applying encodeURIComponent once to the whole JSON payload. updateRouteOnModelChange() now uses it.
  • Share button added to commandLogs.js which reflects the model rather than a possibly stale address bar.
  • Removed the per-field encoding/escaping in 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.

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.
@isaachilly isaachilly self-assigned this Aug 21, 2026
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
isaachilly marked this pull request as ready for review August 25, 2026 15:04
@isaachilly
isaachilly requested a review from graduta as a code owner August 25, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant