feat: add backend image filter with debounced search
Backend: - Add filter query parameter to /api/v1/registry/image/list - Filter repositories by name using SQL LIKE query Frontend: - Add filter input field above image list table - Implement 300ms debounce to reduce backend requests - Use AbortController to cancel pending requests - Show appropriate message when no images match filter 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
@@ -13,6 +13,9 @@ import (
|
||||
// RegistryImageList returns the list of images/repositories
|
||||
func RegistryImageList(ctx context.Context, db *gorm.DB, store store.Store) fiber.Handler {
|
||||
return func(c fiber.Ctx) error {
|
||||
// Get filter parameter from query string
|
||||
filter := c.Query("filter", "")
|
||||
|
||||
// Get current registry_address setting
|
||||
var registryConfig model.RegistryConfig
|
||||
registryAddress := ""
|
||||
@@ -26,7 +29,11 @@ func RegistryImageList(ctx context.Context, db *gorm.DB, store store.Store) fibe
|
||||
var repositories []model.Repository
|
||||
|
||||
// Query all repositories from the database
|
||||
if err := db.Find(&repositories).Error; err != nil {
|
||||
query := db
|
||||
if filter != "" {
|
||||
query = query.Where("name LIKE ?", "%"+filter+"%")
|
||||
}
|
||||
if err := query.Find(&repositories).Error; err != nil {
|
||||
return resp.R500(c, "", nil, err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user