mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Enable the "limit" param in /api/search
This commit is contained in:
parent
25899b72d2
commit
3d77685108
@ -44,6 +44,7 @@ func searchHandler(query *Query) error {
|
||||
IsStarred: query.IsStarred,
|
||||
OrgId: query.OrgId,
|
||||
DashboardIds: query.DashboardIds,
|
||||
Limit: query.Limit,
|
||||
}
|
||||
|
||||
if err := bus.Dispatch(&dashQuery); err != nil {
|
||||
|
@ -42,6 +42,7 @@ type FindPersistedDashboardsQuery struct {
|
||||
UserId int64
|
||||
IsStarred bool
|
||||
DashboardIds []int
|
||||
Limit int
|
||||
|
||||
Result HitList
|
||||
}
|
||||
|
@ -123,6 +123,11 @@ type DashboardSearchProjection struct {
|
||||
}
|
||||
|
||||
func SearchDashboards(query *search.FindPersistedDashboardsQuery) error {
|
||||
limit := query.Limit
|
||||
if limit == 0 {
|
||||
limit = 1000
|
||||
}
|
||||
|
||||
var sql bytes.Buffer
|
||||
params := make([]interface{}, 0)
|
||||
|
||||
@ -165,7 +170,8 @@ func SearchDashboards(query *search.FindPersistedDashboardsQuery) error {
|
||||
params = append(params, "%"+query.Title+"%")
|
||||
}
|
||||
|
||||
sql.WriteString(fmt.Sprintf(" ORDER BY dashboard.title ASC LIMIT 1000"))
|
||||
sql.WriteString(fmt.Sprintf(" ORDER BY dashboard.title ASC LIMIT ?"))
|
||||
params = append(params, limit)
|
||||
|
||||
var res []DashboardSearchProjection
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user