feat: enable filename search in admin dashboard#254
Conversation
Deploying tpic with
|
| Latest commit: |
a3fddb6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d72b72d7.tpic.pages.dev |
| Branch Preview URL: | https://codex-add-search-functionali.tpic.pages.dev |
There was a problem hiding this comment.
Pull Request Overview
This PR adds filename search functionality to the admin dashboard by enabling prefix-based filtering in the list API and implementing a debounced search feature in the frontend.
- Enhanced the list API to accept an optional
prefixparameter for filtering results - Implemented client-side search with debouncing to prevent excessive API calls
- Updated pagination logic to work correctly with search filtering
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| functions/api/manage/list.js | Added prefix parameter support to enable server-side filtering |
| admin.html | Implemented search input handler with debouncing and updated pagination to work with search |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| this.Number = this.tableData.length; | ||
| }) | ||
| .catch(() => alert("同步失败,请检查网络")); | ||
| }, 300); |
There was a problem hiding this comment.
[nitpick] The debounce delay of 300ms is a magic number. Consider defining it as a constant at the top of the data section for better maintainability.
| handleSearch() { | ||
| clearTimeout(this.searchTimer); | ||
| this.searchTimer = setTimeout(() => { | ||
| this.tableData = []; |
There was a problem hiding this comment.
Clearing tableData on every search creates a jarring UX where the table flickers empty before results load. Consider showing a loading state instead of clearing the data immediately.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Testing
npm testhttps://chatgpt.com/codex/tasks/task_b_689ea2db11cc832ab15dc68b2d91abde