Skip to content

Conversation

@ndg63276
Copy link
Collaborator

@ndg63276 ndg63276 commented Sep 8, 2025

JIRA ticket: LIMS-1876

Summary:

When viewing fault reports, if you apply a filter, you get a URL like https://ispyb.diamond.ac.uk/faults/bl/i03/sys/null/com/null/sub/null, but refreshing that URL gives an error.

Changes:

  • Add search parameter to URL
  • Fix passing of parameters from router to page
  • Force search parameter to end of the URL if a filter is selected
  • Don't put null's in the URL
  • Update the fault list if filters are selected on first load of the page

To test:

  • Go to the fault report list page /faults
  • Select a beamline (eg i03) from the dropdown, check the list filters correctly, and the list of systems populates
  • Check the URL becomes /faults/bl/i03, without any null values
  • Check that refreshing the page keeps the beamline field populated and the list filtered
  • Repeat the tests for Systems, Components and Subcomponents.
  • Check if you click into a fault report, and then click Back, the page loads correctly
  • Check the search bar behaves as expected, even if you change the filters after searching

_.each(frags, function(v, f) {
url = url.replace(new RegExp('\\/'+f+'\\/\\w+'), '')
if (this.ui[v].val() != 0) url += '/'+f+'/'+this.ui[v].val()
if (this.ui[v].val() && this.ui[v].val() != 0) url += '/'+f+'/'+this.ui[v].val()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (this.ui[v].val() && this.ui[v].val() != 0) url += '/'+f+'/'+this.ui[v].val()
if (!!this.ui[v].val()) url += '/'+f+'/'+this.ui[v].val()
Suggested change
if (this.ui[v].val() && this.ui[v].val() != 0) url += '/'+f+'/'+this.ui[v].val()
if (this.ui[v].val()) url += '/'+f+'/'+this.ui[v].val()

Is there any reason why we need the "!= 0"? As 0 is already falsy in JS

As an added measure of precaution, we can even cast the val to a bool with !! before evaluating (that means null, undefined, 0, false will all evaluate to false)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out it was "0" not 0, so it was truthy. So I've removed the value="0" from the dropdowns, and changed the PHP to handle that. Also removed some weirdness with a misnamed beamline "i04 1" and an arg called "array" which I can't find anywhere.

@ndg63276 ndg63276 changed the base branch from master to pre-release/2025-R4.4 October 14, 2025 09:09
@ndg63276 ndg63276 merged commit 75796d2 into pre-release/2025-R4.4 Oct 14, 2025
2 checks passed
@ndg63276 ndg63276 deleted the fix/LIMS-1876/fix-fault-report-url-parameters branch October 14, 2025 09:10
ndg63276 added a commit that referenced this pull request Oct 22, 2025
* LIMS-1924: Fix update of container owner (#988)

* LIMS-1923: Fix downstream accordion if files missing from disk (#987)

* LIMS-1876: Fix URL parameters on fault report list (#979)

* LIMS-1841: Link downstream jobs to their upstream counterpart (#985)

* LIMS-1836: Improvements to reprocessing (#978)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants