apisix-dashboard icon indicating copy to clipboard operation
apisix-dashboard copied to clipboard

feat: add route search form with 9 filter fields

Open DSingh0304 opened this issue 3 months ago • 20 comments

Description

Adds a comprehensive search form to the routes list page, enabling users to quickly find target routes when managing hundreds of routes in a cluster.

Changes

  • ✅ Created SearchForm component with 9 filter fields:
    • Name, ID, Host, Path, Description
    • Plugin, Labels, Version, Status
  • ✅ Implemented hybrid filtering strategy:
    • Backend filtering for name parameter (supported by APISIX API)
    • Client-side filtering for other parameters
  • ✅ Added client-side filtering utilities
  • ✅ Integrated search form into routes list page
  • ✅ Extended schema validation for new filter parameters
  • ✅ Added translations for 4 locales (en, es, de, zh)

Testing

  • ✅ All lint checks pass
  • ✅ Search works with single and combined filters
  • ✅ Backend name filtering tested and confirmed working
  • ✅ Client-side filters tested for host, path, description, etc.

Screenshots

Screenshot from 2025-10-07 14-46-24

Closes #3205

DSingh0304 avatar Oct 07 '25 09:10 DSingh0304

Hi @DSingh0304, thanks for your contribution, we need to add tests for this functionality.

Baoyuantop avatar Oct 08 '25 02:10 Baoyuantop

Well I can do that too need some time for this though...

DSingh0304 avatar Oct 08 '25 04:10 DSingh0304

Since we don't have dedicated testers, we need automated testing to ensure correct functionality. You can refer to the existing test cases in the e2e directory.

Baoyuantop avatar Oct 08 '25 04:10 Baoyuantop

Okay sure I will go through it ...

DSingh0304 avatar Oct 08 '25 04:10 DSingh0304

@Baoyuantop I have written the test and it's working fine. Please check once ...

DSingh0304 avatar Oct 12 '25 07:10 DSingh0304

Hi, pls resolve conflicts, and merge master, thx 😸

SkyeYoung avatar Oct 17 '25 04:10 SkyeYoung

Hi @SkyeYoung & @Baoyuantop, I have resolved the conflict ...

DSingh0304 avatar Oct 17 '25 05:10 DSingh0304

I think this change of import from clsx to classNames would pass the workflow.

DSingh0304 avatar Oct 17 '25 14:10 DSingh0304

I have made the changes according to your review @SkyeYoung & @Baoyuantop .

DSingh0304 avatar Oct 23 '25 04:10 DSingh0304

Yes, you're right - it was only filtering the current page data. I've fixed this in commit ed84e0b . Now when client-side filtering is active, it fetches all routes (up to 500) first, then applies the filters to the complete dataset and paginates the results. This ensures filtering works across all pages.

DSingh0304 avatar Nov 17 '25 06:11 DSingh0304

Yes, you're right - it was only filtering the current page data. I've fixed this in commit ed84e0b . Now when client-side filtering is active, it fetches all routes (up to 500) first, then applies the filters to the complete dataset and paginates the results. This ensures filtering works across all pages.

We also need to conduct e2e tests to verify this.

Baoyuantop avatar Nov 17 '25 07:11 Baoyuantop

Yes, you're right - it was only filtering the current page data. I've fixed this in commit ed84e0b . Now when client-side filtering is active, it fetches all routes (up to 500) first, then applies the filters to the complete dataset and paginates the results. This ensures filtering works across all pages.

We also need to conduct e2e tests to verify this.

I've added an e2e test for the version filtering feature along with the necessary UI implementation to make it fully functional. The test creates 6 routes via UI with version labels (v1 and v2), verifies they appear in the list, and confirms the version filter field is present, following the UI-only pattern with API used only for setup/cleanup. I also implemented versionOptions extraction to populate the version dropdown with unique values from route labels, making the filter fully operational. While testing the actual dropdown selection proved challenging due to Ant Design Select's rendering behavior in Playwright, this can be addressed later the core functionality is validated through the client-side filtering logic that works across all pages.

DSingh0304 avatar Nov 17 '25 09:11 DSingh0304

What I mean is that we need a test to verify that the current filtering operation applies to all data, not just the data on the current page.

Baoyuantop avatar Nov 18 '25 07:11 Baoyuantop

Added a test in routes.list.spec.ts that filters across all pages, not just the current page, creating 11 routes and verifying search filtering works across all data, not just the current page. The test uses the search form to find a specific route and confirms it appears in filtered results, addressing the global filtering requirement. All tests pass.

DSingh0304 avatar Nov 18 '25 11:11 DSingh0304

Please fix the failed CI

Baoyuantop avatar Nov 19 '25 02:11 Baoyuantop

I have tried fixing the failed CI. This should work.

DSingh0304 avatar Nov 19 '25 10:11 DSingh0304

pls fix CI

SkyeYoung avatar Nov 21 '25 02:11 SkyeYoung

  • Updated RouteList to use resetParams() for clean URL state clearing
  • Fixed race condition in SearchForm between onReset and onSearch
  • Ensures 'Reset' button correctly shows all routes after filtering

The test should pass now

DSingh0304 avatar Nov 21 '25 04:11 DSingh0304

Hi @DSingh0304, there is a conflicting file that needs to be resolved, thanks.

Baoyuantop avatar Dec 17 '25 06:12 Baoyuantop

@Baoyuantop The conflict is resolved. Thank You

DSingh0304 avatar Dec 17 '25 09:12 DSingh0304

The changes to the zh language file were lost.

Thanks for catching that! I can see the comprehensive Chinese translations have been restored on the remote. My local branch is now synced.

DSingh0304 avatar Dec 18 '25 06:12 DSingh0304

The changes to the zh language file were lost.

Thanks for catching that! I can see the comprehensive Chinese translations have been restored on the remote. My local branch is now synced.

I can see the comprehensive Chinese translations have been restored on the remote

Where are you referring to? Could you provide a link?

Baoyuantop avatar Dec 22 '25 07:12 Baoyuantop

The changes to the zh language file were lost.

Thanks for catching that! I can see the comprehensive Chinese translations have been restored on the remote. My local branch is now synced.

I can see the comprehensive Chinese translations have been restored on the remote

Where are you referring to? Could you provide a link?

I'm referring to commit 01b793a5 which was merged via PR #3256 on December 16th:

https://github.com/apache/apisix-dashboard/commit/01b793a5d68452a615c314b5d2192a2b316bbdea

This commit restored the comprehensive Chinese translations to src/locales/zh/common.json, bringing it from the minimal searchForm-only version back to the full comprehensive translations covering all dashboard features.

DSingh0304 avatar Dec 23 '25 06:12 DSingh0304