From 3d776851082725a4e3b5780cd35bf888348b892f Mon Sep 17 00:00:00 2001 From: Thibault Chataigner Date: Mon, 6 Jun 2016 13:47:45 +0000 Subject: [PATCH 1/4] Enable the "limit" param in /api/search --- pkg/services/search/handlers.go | 1 + pkg/services/search/models.go | 1 + pkg/services/sqlstore/dashboard.go | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/services/search/handlers.go b/pkg/services/search/handlers.go index a4905d6fa58..a8344ba05a5 100644 --- a/pkg/services/search/handlers.go +++ b/pkg/services/search/handlers.go @@ -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 { diff --git a/pkg/services/search/models.go b/pkg/services/search/models.go index 159637013f5..ada3e1ccdfa 100644 --- a/pkg/services/search/models.go +++ b/pkg/services/search/models.go @@ -42,6 +42,7 @@ type FindPersistedDashboardsQuery struct { UserId int64 IsStarred bool DashboardIds []int + Limit int Result HitList } diff --git a/pkg/services/sqlstore/dashboard.go b/pkg/services/sqlstore/dashboard.go index ef36fd75ab6..d71eaeefa6e 100644 --- a/pkg/services/sqlstore/dashboard.go +++ b/pkg/services/sqlstore/dashboard.go @@ -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 From ffac5c12999eca55dbbed36a24cc8f6588dff8fa Mon Sep 17 00:00:00 2001 From: bergquist Date: Wed, 8 Jun 2016 09:35:34 +0200 Subject: [PATCH 2/4] docs(changelog): add note about changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b25f025d1d..eb1cb5c55ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * **InfluxDB**: Add spread function, closes [#5211](https://github.com/grafana/grafana/issues/5211) * **Scripts**: Use restart instead of start for deb package script, closes [#5282](https://github.com/grafana/grafana/pull/5282) * **Logging**: Moved to structured logging lib, and moved to component specific level filters via config file, closes [#4590](https://github.com/grafana/grafana/issues/4590) +* **Search**: Add search limit query parameter, closes [#5292](https://github.com/grafana/grafana/pull/5292) ## Breaking changes * **Logging** : Changed default logging output format (now structured into message, and key value pairs, with logger key acting as component). You can also no change in config to json log ouput. From 755ec552dea491e23cb2d2fc778da32234405b9d Mon Sep 17 00:00:00 2001 From: Mukesh Date: Thu, 9 Jun 2016 04:13:38 +0530 Subject: [PATCH 3/4] Bugfix: org select btn was not working on profile (#5317) --- public/app/features/org/partials/profile.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/org/partials/profile.html b/public/app/features/org/partials/profile.html index 811891ae317..02fa2878a17 100644 --- a/public/app/features/org/partials/profile.html +++ b/public/app/features/org/partials/profile.html @@ -51,7 +51,7 @@ Current - + Select From ced3bafa99fb81687428905b60521f2971ace51e Mon Sep 17 00:00:00 2001 From: Mark Baas Date: Thu, 9 Jun 2016 02:13:31 -0400 Subject: [PATCH 4/4] returns correct index (#5275) --- public/app/plugins/datasource/opentsdb/datasource.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/public/app/plugins/datasource/opentsdb/datasource.js b/public/app/plugins/datasource/opentsdb/datasource.js index b683aa02068..1d3db75658c 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.js +++ b/public/app/plugins/datasource/opentsdb/datasource.js @@ -403,10 +403,7 @@ function (angular, _, dateMath) { } else { return _.findIndex(options.targets, function(target) { if (target.filters && target.filters.length > 0) { - return target.metric === metricData.metric && - _.all(target.filters, function(filter) { - return filter.tagk === interpolatedTagValue === "*"; - }); + return target.metric === metricData.metric; } else { return target.metric === metricData.metric && _.all(target.tags, function(tagV, tagK) {