Skip to content

feat(services): filter routes/stream_routes by service_id#3111

Merged
SkyeYoung merged 3 commits intoapache:masterfrom
SkyeYoung:young/feat/support-routes-filter-by-service-id
Jun 12, 2025
Merged

feat(services): filter routes/stream_routes by service_id#3111
SkyeYoung merged 3 commits intoapache:masterfrom
SkyeYoung:young/feat/support-routes-filter-by-service-id

Conversation

@SkyeYoung
Copy link
Member

@SkyeYoung SkyeYoung commented Jun 10, 2025

Please answer these questions before submitting a pull request, or your PR will get closed.

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

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_id in the routes/stream_routes page list cannot be filtered out for now, because the API does not yet support providing multiple service_ids or other methods.

Screenshots

create one route test in services, create one route test_without_id with upstream in routes.

image image

@SkyeYoung SkyeYoung changed the title feat(services/routes): filter by service_id feat(services): filter routes/stream_routes by service_id Jun 10, 2025
@SkyeYoung SkyeYoung marked this pull request as ready for review June 12, 2025 06:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RouteList and StreamRouteList to accept defaultParams for initial filters
  • Pass filter: { service_id: id } into service-detail route lists
  • Update API types, requests, and the global paramsSerializer to handle a nested filter object

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 StreamRouteList on the service detail page correctly applies the service_id filter and only returns routes for that service.
defaultParams={{

src/routes/services/detail.$id/routes/index.tsx:35

  • Add a test to ensure the RouteList correctly filters by service_id on the service detail page.
defaultParams={{

Copy link
Member

@juzhiyuan juzhiyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SkyeYoung
Copy link
Member Author

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

@SkyeYoung SkyeYoung merged commit 63dd73d into apache:master Jun 12, 2025
6 checks passed
@SkyeYoung SkyeYoung deleted the young/feat/support-routes-filter-by-service-id branch June 12, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants