Add a button to clear filter input in JSON inspector
Categories
(DevTools :: JSON Viewer, enhancement, P3)
Tracking
(firefox101 fixed)
Tracking | Status | |
---|---|---|
firefox101 | --- | fixed |
People
(Reporter: aakumykov, Assigned: colin.cazabet)
Details
Attachments
(3 files, 3 obsolete files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0 Steps to reproduce: 1) go to URL that returns pure JSON, for example "https://2ch.hk/mo/res/212281.json" 2) JSON inspector/viewer appears on site response; 3) where is JSON filter text input near top right corner (in JSON tab); 4) enter some text in filter field; Actual results: You have to make several manipulations to clear filter field and see full JSON tree again. Expected results: Please, add "clear" constol element to filter text input (as it is done in HTML inspector) to clear filter by one click.
I add "cleare" control in graphics editor to show how it should be. There is no "circle with cross" originally.
Hi reporter, Thank you for taking the time to add this report. This seems to be more of an enhancement than an issue in my opinion. The "Clear" button is not displayed on any of the Firefox versions or OS-es. I have edited the title to better reflect the enhancement suggestion. However, I am assigning this to DevTools:JSON Viewer component to this issue in order to involve the development team and get an opinion on this. If this is not the proper component for this report, please move it to a more appropriate one.
Comment 3•4 years ago
|
||
It could use something like the filter in CSS Rules Inspector: <div class="devtools-searchbox has-clear-btn"> <input class="searchBox devtools-filterinput" placeholder="..."> <button class="devtools-searchinput-clear"></button> </div> and hide the button when the input is empty.
Assignee | ||
Comment 4•1 year ago
|
||
Hello,
If this is still up to date, I would be happy to do this enhancement
Thank you
Awesome, thank you for the help, Colin!
Assigned to you.
The SearchBox (React) component is implemented here:
https://searchfox.org/mozilla-central/rev/bd25b1ca76dd5d323ffc69557f6cf759ba76ba23/devtools/client/jsonview/components/SearchBox.js#21
Honza
Assignee | ||
Comment 6•1 year ago
|
||
Hello Jan,
I've added the button but I have two questions:
- Should I also erase the input when the escape key is pressed ?
- Should the input still have the focus after clicking on the erase button (currently the searchbox loses focus when i click) ?
Thank you
Hi Colin, I like the ideas, yes for both.
Assignee | ||
Comment 8•1 year ago
|
||
Assignee | ||
Comment 9•1 year ago
|
||
Hello Jan Honza,
I have updated the patch with unit tests.
Thank you
Comment 10•1 year ago
|
||
Pushed by jodvarko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d1e6410ead1d [devtools] Add a button to clear filter input in JSON inspector r=Honza
Comment 11•1 year ago
|
||
Backed out for causing failures on browser_jsonview_filter_clear.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/5e718536225ed4afe6ee1cfd298272a707720a13
Link to failure log: https://treeherder.mozilla.org/logviewer?job_id=369441717&repo=autoland&lineNumber=2901
Failure message : TEST-UNEXPECTED-FAIL | devtools/client/jsonview/test/browser_jsonview_filter_clear.js | Filter input should be empty - Got "honza", expected ""
Colin, there are two failures (in the new test):
- TEST-UNEXPECTED-FAIL | devtools/client/jsonview/test/browser_jsonview_filter_clear.js | Filter input should be empty - Got "honza", expected ""
- TEST-UNEXPECTED-FAIL | devtools/client/jsonview/test/browser_jsonview_filter_clear.js | There must be expected number of rows - Got 4, expected +0
See the raw log: https://treeherder.mozilla.org/logviewer?job_id=369441717&repo=autoland&lineNumber=2901
Assignee | ||
Comment 13•1 year ago
|
||
Hello Jan Honza,
I tried to add a "sleep" after clicking on the clear button, I think the problem comes from here, I cannot reproduce it locally unfortunately.
Can we launch a new test with this little change?
Thank you for looking at this!
Try push:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e8f199ba752450284e923c87b9326bd931aa8564
Honza
I am still seeing failures related to the test (in the Try push)
TEST-UNEXPECTED-FAIL | devtools/client/jsonview/test/browser_jsonview_filter_clear.js | Filter input should be empty - Got "honza", expected ""
TEST-UNEXPECTED-FAIL | devtools/client/jsonview/test/browser_jsonview_filter_clear.js | There must be expected number of rows - Got 4, expected +0
I couldn't repro locally (Win10, Ubuntu)
Feel free to ping me anytime you'd like to push your changes to Try.
Honza
Assignee | ||
Comment 16•1 year ago
|
||
Hello Jan Honza ,
Unfortunately I did not find anything interesting in the log files I don't know how i could debug this.
Is there a way to take a screenshot like this one: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/SLdvkYM1RWysXO5cCdaB-Q/runs/0/artifacts/public/test_info/mozilla-test-fail-screenshot_dfwml1n2.png but at a specific line in the test file ?
Thank you
You might try to look at this code and get some inspiration (not perfect, but should work):
https://hg.mozilla.org/try/file/bd06124d04f68ce67f8154c836678133f86c5916/devtools/client/shared/test/shared-head.js#l1974
Assignee | ||
Comment 18•1 year ago
|
||
Hello,
I added some logs and I now take screenshots to help debug, can we launch a new test on try ?
Thank you
Perfect
Here is the try push:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2be2f83d527505b061b1d660dadf3f568078c925
Honza
Assignee | ||
Comment 20•1 year ago
|
||
Hello,
The bug disappeared probably because I increased the sleep value (I see in the logs that the test takes 2 seconds on OSX and 4 seconds on linux).
Instead of doing that I modified the patch to wait for mutations on the screen.
Instead of waiting for X seconds, I wait until the jsonview is back into its initial state before going to the next assertion, can we please try this new patch on TRY ?
Thank you
Thank you!
Try push:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2ddc7020c5e2a82967ccf6859bc310f877bd5b3c
Btw. Id you'd like to get Level 1 Access (used to push to Try), you can follow these instructions:
https://www.mozilla.org/en-US/about/governance/policies/commit/access-policy/
I'll vouch for you.
Honza
Assignee | ||
Comment 22•1 year ago
|
||
Hello,
Thank you, I asked for level access 1 here: https://bugzilla.mozilla.org/show_bug.cgi?id=1761574
I still don't understand why it times out on linux, I may have to push multiples times to TRY
Colin
Perfect, just vouched for you!
I still don't understand why it times out on linux, I may have to push multiples times to TRY
Yes, feel free to do it (not the first time when we could repro an issue only on the Try)
Honza
Assignee | ||
Comment 24•1 year ago
|
||
Hello,
Thank you for the access, when I try to login on try I get this error:
Access is not allowed because you are not enrolled in Duo. Please contact your organization's IT help desk.
What can I do to fix it ?
Comment 25•1 year ago
•
|
||
(In reply to colin.cazabet from comment #24)
Access is not allowed because you are not enrolled in Duo. Please contact your organization's IT help desk.
What can I do to fix it ?
Please, ask in the bug where you requested the Commit #1 level. They should be able to help you.
(it's related to two-factor authenticator that you should set up)
Assignee | ||
Comment 26•1 year ago
|
||
Hello,
For some reason, in some cases the BrowserTestUtils.synthesizeMouseAtCenter was not triggering the click on the button, I was able to fix this part by synthesizing a press on the escape key instead of a click on the clear button (both events trigger the same function).
All jobs are now error-free on TRY, do you think that's enough?
https://treeherder.mozilla.org/jobs?revision=f2d4d5beccd82eb9420224cd05445ea3a23dd8b2&repo=try
Thank you
Comment 27•1 year ago
|
||
(In reply to colin.cazabet from comment #26)
For some reason, in some cases the BrowserTestUtils.synthesizeMouseAtCenter was not triggering the click on the button, I was able to fix this part by synthesizing a press on the escape key instead of a click on the clear button (both events trigger the same function).
This method seems utterly broken, I also had problems as explained in bug 1720898 comment 1. If you want to specifically test the button, you can use .click()
in the content process like in https://phabricator.services.mozilla.com/D134660
Agree with Oriol.
Please see my comments in Phab.
Thank you!
Assignee | ||
Comment 29•1 year ago
|
||
Updated•1 year ago
|
Assignee | ||
Comment 30•1 year ago
|
||
Hello,
I put back the click on the button but with the right function and it now works.
Here is the TRY https://treeherder.mozilla.org/push-health/push?repo=try&revision=58b78eec319ec6abacee40cdc64c2e22aa1320f4&tab=tests&testGroup=pr
Thank you
Comment 31•1 year ago
|
||
Pushed by jodvarko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/03247a8340da [devtools] Add a button to clear filter input in JSON inspector r=Honza,Oriol
Comment 32•1 year ago
|
||
bugherder |
Description
•