feat(services): filter routes/stream_routes by service_id#3111
Conversation
service_idservice_id
There was a problem hiding this comment.
Pull Request Overview
Adds the ability to filter both HTTP and stream routes by service_id on service detail pages by extending list components, hooks, and request serialization.
- Extend
RouteListandStreamRouteListto acceptdefaultParamsfor initial filters - Pass
filter: { service_id: id }into service-detail route lists - Update API types, requests, and the global
paramsSerializerto handle a nestedfilterobject
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/stream_routes/index.tsx | Added defaultParams prop to wire through service_id filtering |
| src/routes/services/detail.$id/stream_routes/index.tsx | Passed service_id filter to StreamRouteList |
| src/routes/services/detail.$id/routes/index.tsx | Passed service_id filter to RouteList |
| src/routes/routes/index.tsx | Added defaultParams prop to RouteList component |
| src/config/req.ts | Enhanced paramsSerializer to serialize nested filter |
| src/apis/stream_routes.ts | Updated getStreamRouteListReq to use WithServiceIdFilter |
| src/apis/routes.ts | Defined WithServiceIdFilter and updated request signature |
| src/apis/hooks.ts | Extended genUseList to accept and merge defaultParams |
Comments suppressed due to low confidence (2)
src/routes/services/detail.$id/stream_routes/index.tsx:42
- Add a test to verify that the
StreamRouteListon the service detail page correctly applies theservice_idfilter and only returns routes for that service.
defaultParams={{
src/routes/services/detail.$id/routes/index.tsx:35
- Add a test to ensure the
RouteListcorrectly filters byservice_idon the service detail page.
defaultParams={{
juzhiyuan
left a comment
There was a problem hiding this comment.
I understand why it's written this way (it could be optional), but the name WithServiceIdFilter makes me think it must contain the ServiceId. No better suggestions.
Let's keep pushing forward, not being blocked by a better type name |
Please answer these questions before submitting a pull request, or your PR will get closed.
Why submit this pull request?
What changes will this PR take into?
Depend on apache/apisix#12291
According to apache/apisix#12291, we can now filter out all routes/stream_routes that are not for the current service in the service's routes/stream_routes.
This can reduce user confusion.
However, those containing
service_idin the routes/stream_routes page list cannot be filtered out for now, because the API does not yet support providing multipleservice_ids or other methods.Screenshots
create one route
testin services, create one routetest_without_idwith upstream in routes.