Skip to content

feat: enable filename search in admin dashboard#254

Merged
xyTom merged 3 commits intomainfrom
codex/add-search-functionality-by-filename
Aug 15, 2025
Merged

feat: enable filename search in admin dashboard#254
xyTom merged 3 commits intomainfrom
codex/add-search-functionality-by-filename

Conversation

@cf-pages
Copy link
Owner

Summary

  • allow list API to filter files by prefix
  • add server-backed search to admin dashboard and update pagination

Testing

  • npm test

https://chatgpt.com/codex/tasks/task_b_689ea2db11cc832ab15dc68b2d91abde

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 15, 2025

Deploying tpic with  Cloudflare Pages  Cloudflare Pages

Latest commit: a3fddb6
Status: ✅  Deploy successful!
Preview URL: https://d72b72d7.tpic.pages.dev
Branch Preview URL: https://codex-add-search-functionali.tpic.pages.dev

View logs

@cf-pages cf-pages requested a review from Copilot August 15, 2025 03:15

This comment was marked as outdated.

@cf-pages cf-pages requested a review from Copilot August 15, 2025 04:02
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

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 prefix parameter 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);
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

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

[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.

Copilot uses AI. Check for mistakes.
handleSearch() {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.tableData = [];
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@xyTom xyTom merged commit 75a5b8d into main Aug 15, 2025
2 checks passed
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.

3 participants