-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Show gRPCs in requests dialog #4127
Show gRPCs in requests dialog #4127
Conversation
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 for the PR! We do need to add some UI for GRPC requests in the request switcher as well. For instance, the following is what I see when hitting cmd + p
.
Ideally we follow a similar pattern to REST requests.
I also noticed the following lines: https://github.com/vincendep/insomnia/blob/21047c818165a63c79d9484edf723e39cd85416b/packages/insomnia-app/app/ui/components/modals/request-switcher-modal.tsx#L34-L35
We'll need to remove this (now that GRPC requests have been introduced to the request switcher), and determine whether there are any implications. I couldn't see any while browsing this file.
Lastly, could you also please (at the very least) add screenshots or gifs to PR descriptions? It really helps with code reviews. Thank you! 🙏🏽
Hi @develohpanda, so sorry for my lazyness 😄, I'll be more explicative for my next pull requests. Speaking of UI changes, do you think would be ok to show only "gRPC" (as Add Request dropdown), or maybe we should include the selected gRPC method some how? |
No worries at all! It would be nice to show the url + selected grpc method name. Should be fairly straightforward to get that information I think |
@vincendep, in case you are interested you could achieve what @develohpanda mentioned with something like: Near line 224: finalUrl = joinUrlAndQueryString(finalUrl, buildQueryStringFromParams(request.parameters));
}
+ if (isGrpcRequest(request)) {
+ finalUrl = request.url + request.protoMethodName;
+ }
+
const match = fuzzyMatchAll(
searchStrings,
[request.name, finalUrl, request.method || '', this._groupOf(request).join('/')], Near line 477: </div>
<div className="margin-left-xs faint">
{ isRequest(r) ? <MethodTag method={r.method} /> : null }
- <Highlight search={searchString} text={r.url} />
+ <Highlight
+ search={searchString}
+ text={ isGrpcRequest(r) ? r.url + r.protoMethodName : r.url }
+ />
</div>
</Button>
</li>
Example of how it would look like: |
Sorry about end of communications by I didn't found time to work on this. |
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, great work @vincendep 👍
FYI @dimitropoulos @develohpanda this PR would be a good candidate to get merged before the next release. |
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 for the updates @vincendep! I pushed a few small commits, please take a look!
These commits remove a redundant comment and improves some TS types that were incorrect after the changes in this PR (due to a quirk of TS and not your fault 🤗)
|
||
// OPTIMIZATION: This only filters if we have a filter | ||
let matchedRequests = workspaceChildren | ||
.filter(isRequest) | ||
.filter(child => isRequest(child) || isGrpcRequest(child)) |
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.
Unfortunately with this change we lose type safety (matchedRequest
should not be of type RequestGroup
). There's a known bug in TS regarding this, and I haven't seen any reliable workarounds for it.
I've updated some of the type definitions here to bring the as
cast alongside: e348696
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.
Hi @develohpanda. Thanks for the explanation, given thath I'm a beginner with TS every advice is welcome
changelog(Improvements): gRPC requests will now appear in the request switcher
Closes #3271