-
Notifications
You must be signed in to change notification settings - Fork 27
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
Uast filtering #135
Uast filtering #135
Conversation
Woks like a charm! 👏 @smacker shall we add simple progress indicator in here? Nothing fancy, a simple clue to the user that it's in progress. On my local machine under heavy CPU load it took a while to UAST to get back and having no visual feedback in situation like this can be confusing |
Few other things that seems not to be related to the UAST filtering itself were moved to #137 |
Yes. You are right. I missed a loader somehow, my bad. Most probably it worked too fast on my laptop :) Thanks! |
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.
.then(uast => { | ||
this.setState({ uast: transformer(uast) }); | ||
}) | ||
.catch(err => this.state({ uast: null, error: err })); |
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.
should be setState
server/handler/query.go
Outdated
@@ -116,6 +116,7 @@ func Query(db service.SQLDB) RequestProcessFunc { | |||
nodes, err := service.UnmarshallUAST(val) | |||
if err == nil { | |||
colData[columnNames[i]] = nodes | |||
colData["__uast-protobufs"] = val |
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.
Using the same name does not work when you can have multiple uast columns.
For example:
select file_path, language(file_path, blob_content) as lang,
uast(blob_content, lang, '//*[@roleNumber and @roleLiteral]') as numbers,
uast(blob_content, lang, '//*[@roleString and @roleLiteral]') as strings
from files where lang = 'Go' limit 1
If you open the numbers column and search, you get results for the strings uast nodes.
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.
Great catch! thank you!
|
||
let content = null; | ||
if (searchResults && !searchResults.length) { | ||
content = <NotFound>Nothing found</NotFound>; |
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.
should this be content = <NotFound />;
?
|
||
resp := &uast.Node{InternalType: "Search results"} | ||
|
||
if req.Filter != "" { |
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.
Maybe an empty filter could be a bad request error, to simplify this part of the code.
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 open to this change. The only problem is then we will move complexity to frontend. Please let me know it's better to have it in JS than in Go.
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.
If you are talking about disabling the search button when the input is empty, I think it adds a nice feel to the interface and it's not that much complexity. I would make this change, but I'm also OK merging as it is. Up to you 👍
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 talking about how to return to full UAST.
Right now you can filter than just remove the filter query and get origin UAST back.
If we disable search button we would need one more button for it :) I personally use this feature.
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 for now I would keep current behavior to be consistent with dashboard. But feel free to create an issue if you see how to improve it! Thank you.
rebased 😢 😢 😢 |
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
rebase.
|
Maybe we could open a request to report different this error types? |
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.
👍 looks good to me
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.
👏
issue to client-go: https://github.com/bblfsh/client-go/issues/65 |
Based on: #128
Fix: #49
No protobuf decoding on FE. If we decided to go that way: we can implement it later.
Though I would experiment on dashboard first, not here.