mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
Adding search on paths list
This commit is contained in:
parent
078b3aa29b
commit
2f4d8f3eb0
1 changed files with 12 additions and 0 deletions
|
|
@ -560,6 +560,18 @@ func (a *API) onPathsList(ctx *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter by search parameter if provided
|
||||||
|
search := ctx.Query("search")
|
||||||
|
if search != "" {
|
||||||
|
filteredItems := make([]*defs.APIPath, 0, len(data.Items))
|
||||||
|
for _, item := range data.Items {
|
||||||
|
if strings.Contains(strings.ToLower(item.Name), strings.ToLower(search)) {
|
||||||
|
filteredItems = append(filteredItems, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.Items = filteredItems
|
||||||
|
}
|
||||||
|
|
||||||
data.ItemCount = len(data.Items)
|
data.ItemCount = len(data.Items)
|
||||||
pageCount, err := paginate(&data.Items, ctx.Query("itemsPerPage"), ctx.Query("page"))
|
pageCount, err := paginate(&data.Items, ctx.Query("itemsPerPage"), ctx.Query("page"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue