Resource Tree Bytes and Strings Search Bar #334
Conversation
| on:keyup|preventDefault="{async (e) => { | ||
| if (searchType == 'String') { | ||
| searchFilter = await rootResource.search_for_string( | ||
| searchQuery, | ||
| regex, | ||
| caseIgnore | ||
| ); | ||
| } else if (searchType == 'Bytes') { | ||
| searchFilter = await rootResource.search_for_bytes(searchQuery, false); | ||
| } | ||
| }}" |
There was a problem hiding this comment.
This should probably have some form of try/catch type error handling if the query fails with an exception. Does it make sense to use alert and pop up an error? Or does it make sense to just log to the console? Something else?
There was a problem hiding this comment.
pop up alert doesn't make sense now that i'm using on:keyup, it would probably spam the browser.
| offsets = await resource.search_data(string_query) | ||
| if string_query == "": | ||
| return json_response(None) |
There was a problem hiding this comment.
Is there a reason to return None instead of an empty list here?
Also, if string_query == "", I think it makes sense to return earlier than this. Not only does it make sense to return before actually doing the search (to avoid the expensive operation of searching for an empty string that will be present between every single character), but it probably makes sense to return before compiling the regular expression as well.
There was a problem hiding this comment.
On the first part, yes. An empty list should be the result of a search with no results. Otherwise it isn't apparent that your search is empty. And yeah you're correct, I did this fast this morning.
There was a problem hiding this comment.
First part sounds good, makes sense to return None. I'll leave this thread unresolved until the second part is fixed.
Co-authored-by: Jacob Strieb <99368685+rbs-jacob@users.noreply.github.com>
Co-authored-by: Edward Larson <wasabiofip@gmail.com>
Co-authored-by: Jacob Strieb <99368685+rbs-jacob@users.noreply.github.com>
|
Folded into #345 |
One sentence summary of this PR (This should go in the CHANGELOG!)
Add a search bar to the ResourceTreeView to filter resources by string and bytes.
Link to Related Issue(s)
Please describe the changes in your request.
Anyone you think should look at this, specifically?
@rbs-jacob @Edward-Larson