-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: service operations fetch by URL query params #932
Fix: service operations fetch by URL query params #932
Conversation
If query parameters are provided to the search page, the system now fetches the correct set of operations linked to the specified service. This fixes the current behavior on fetching the operations linked to the last searched service, ignoring all specified URL parameters. Signed-off-by: Alessandro Racheli <alessandroracheli@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #932 +/- ##
==========================================
- Coverage 95.50% 95.43% -0.07%
==========================================
Files 240 240
Lines 7518 7520 +2
Branches 1886 1887 +1
==========================================
- Hits 7180 7177 -3
- Misses 332 337 +5
Partials 6 6
Continue to review full report at Codecov.
|
@@ -62,7 +62,7 @@ export class SearchTracePageImpl extends Component { | |||
fetchMultipleTraces(needForDiffs); | |||
} | |||
fetchServices(); | |||
const { service } = store.get('lastSearch') || {}; | |||
const { service } = urlQueryParams || store.get('lastSearch') || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a JS expert, but this looks odd to me - queryParams is an object, right? So wouldn't it evaluate to true and short circuit the rest even if the objects doesn't have a 'service' property?
I would like to see a unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that urlQueryParams
can be undefined (if no query is passed) or an object otherwise. After this comment I played a bit with the UI and it seems that if a param is passed (i.e. end
), then the service
param is mandatory.
To be absolutely sure of this behavior though I updated the code to explicitly overwrite the service
variable only if the service
param is provided, in a way that supports both undefined
and {}
values of urlQueryParams
.
I also added and updated unit test to verify that:
- If
urlQueryParams={}
, the system fetches the operations for the stored service - If
urlQueryParams
includesservice
, the system works as expected
As I'm quite new to this project and to open source contributions in general, let me know if there's anything I should improve.
Thanks!
This commit ensures that the service to be used for fetching operations is overwritten only if it's really provided in the URL params. Signed-off-by: Alessandro Racheli <alessandroracheli@gmail.com>
This commit adds and updates unit tests to ensure that 1. If the "service" parameter is present on the search URL, the component fetches the correct operations set 2. If no "service" parameter is present, the component fetches the operations linked to the last service searched Signed-off-by: Alessandro Racheli <alessandroracheli@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Which problem is this PR solving?
Resolves #920
Short description of the changes
If query parameters are provided to the search page, the system now fetches the correct set of operations linked to the specified service.
This fixes the current behavior on fetching the operations linked to the last searched service, ignoring all specified URL parameters.