Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,18 @@ func (a *API) onPathsList(ctx *gin.Context) {
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)
pageCount, err := paginate(&data.Items, ctx.Query("itemsPerPage"), ctx.Query("page"))
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions internal/conf/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ type Path struct {
RunOnUnread string `json:"runOnUnread"`
RunOnRecordSegmentCreate string `json:"runOnRecordSegmentCreate"`
RunOnRecordSegmentComplete string `json:"runOnRecordSegmentComplete"`

// Custom metadata
Metadata map[string]any `json:"metadata"`
}

func (pconf *Path) setDefaults() {
Expand Down
1 change: 1 addition & 0 deletions internal/core/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ func (pa *path) doAPIPathsGet(req pathAPIPathsGetReq) {
}
return ret
}(),
Metadata: pa.conf.Metadata,
},
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/defs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ type APIPath struct {
BytesReceived uint64 `json:"bytesReceived"`
BytesSent uint64 `json:"bytesSent"`
Readers []APIPathSourceOrReader `json:"readers"`
Metadata map[string]any `json:"metadata" yaml:"metadata"`
}

// APIPathList is a list of paths.
Expand Down