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.
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
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
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) {