Browse Source

Merge branch 'master' of github.com:grafana/grafana

Torkel Ödegaard 9 years ago
parent
commit
1584dac00a

+ 1 - 0
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.

+ 1 - 0
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 {

+ 1 - 0
pkg/services/search/models.go

@@ -42,6 +42,7 @@ type FindPersistedDashboardsQuery struct {
 	UserId       int64
 	IsStarred    bool
 	DashboardIds []int
+	Limit        int
 
 	Result HitList
 }

+ 7 - 1
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
 

+ 1 - 1
public/app/features/org/partials/profile.html

@@ -51,7 +51,7 @@
 						<span class="btn btn-primary btn-mini" ng-show="org.orgId === contextSrv.user.orgId">
 							Current
 						</span>
-						<a ng-click="setUsingOrg(org)" class="btn btn-inverse btn-mini" ng-show="org.orgId !== contextSrv.user.orgId">
+						<a ng-click="ctrl.setUsingOrg(org)" class="btn btn-inverse btn-mini" ng-show="org.orgId !== contextSrv.user.orgId">
 							Select
 						</a>
 					</td>

+ 1 - 4
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) {