From aed8208d780cbfe68030ec94575cbdb8c61a5dd9 Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 13 Sep 2018 15:15:42 +0200 Subject: [PATCH] renames PartialMatch to MatchAny --- pkg/api/annotations.go | 22 +++++++++---------- pkg/services/annotations/annotations.go | 2 +- pkg/services/sqlstore/annotation.go | 2 +- pkg/services/sqlstore/annotation_test.go | 10 ++++----- .../plugins/datasource/grafana/datasource.ts | 2 +- .../grafana/partials/annotations.editor.html | 10 ++++----- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pkg/api/annotations.go b/pkg/api/annotations.go index eec07bb9f819..242b5531f510 100644 --- a/pkg/api/annotations.go +++ b/pkg/api/annotations.go @@ -14,17 +14,17 @@ import ( func GetAnnotations(c *m.ReqContext) Response { query := &annotations.ItemQuery{ - From: c.QueryInt64("from"), - To: c.QueryInt64("to"), - OrgId: c.OrgId, - UserId: c.QueryInt64("userId"), - AlertId: c.QueryInt64("alertId"), - DashboardId: c.QueryInt64("dashboardId"), - PanelId: c.QueryInt64("panelId"), - Limit: c.QueryInt64("limit"), - Tags: c.QueryStrings("tags"), - Type: c.Query("type"), - PartialMatch: c.QueryBool("partialMatch"), + From: c.QueryInt64("from"), + To: c.QueryInt64("to"), + OrgId: c.OrgId, + UserId: c.QueryInt64("userId"), + AlertId: c.QueryInt64("alertId"), + DashboardId: c.QueryInt64("dashboardId"), + PanelId: c.QueryInt64("panelId"), + Limit: c.QueryInt64("limit"), + Tags: c.QueryStrings("tags"), + Type: c.Query("type"), + MatchAny: c.QueryBool("matchAny"), } repo := annotations.GetRepository() diff --git a/pkg/services/annotations/annotations.go b/pkg/services/annotations/annotations.go index daea43863f42..60a92aa897a2 100644 --- a/pkg/services/annotations/annotations.go +++ b/pkg/services/annotations/annotations.go @@ -21,7 +21,7 @@ type ItemQuery struct { RegionId int64 `json:"regionId"` Tags []string `json:"tags"` Type string `json:"type"` - PartialMatch bool `json:"partialMatch"` + MatchAny bool `json:"matchAny"` Limit int64 `json:"limit"` } diff --git a/pkg/services/sqlstore/annotation.go b/pkg/services/sqlstore/annotation.go index 6e25ce432f3d..ceafaaad0e34 100644 --- a/pkg/services/sqlstore/annotation.go +++ b/pkg/services/sqlstore/annotation.go @@ -211,7 +211,7 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I ) `, strings.Join(keyValueFilters, " OR ")) - if query.PartialMatch { + if query.MatchAny { sql.WriteString(fmt.Sprintf(" AND (%s) > 0 ", tagsSubQuery)) } else { sql.WriteString(fmt.Sprintf(" AND (%s) = %d ", tagsSubQuery, len(tags))) diff --git a/pkg/services/sqlstore/annotation_test.go b/pkg/services/sqlstore/annotation_test.go index 4c31e0442c81..d3459527e7db 100644 --- a/pkg/services/sqlstore/annotation_test.go +++ b/pkg/services/sqlstore/annotation_test.go @@ -199,11 +199,11 @@ func TestAnnotations(t *testing.T) { Convey("Should find two annotations using partial match", func() { items, err := repo.Find(&annotations.ItemQuery{ - OrgId: 1, - From: 1, - To: 25, - PartialMatch: true, - Tags: []string{"rollback", "deploy"}, + OrgId: 1, + From: 1, + To: 25, + MatchAny: true, + Tags: []string{"rollback", "deploy"}, }) So(err, ShouldBeNil) diff --git a/public/app/plugins/datasource/grafana/datasource.ts b/public/app/plugins/datasource/grafana/datasource.ts index 4ddfa8df40d9..3bf772d160ce 100644 --- a/public/app/plugins/datasource/grafana/datasource.ts +++ b/public/app/plugins/datasource/grafana/datasource.ts @@ -40,7 +40,7 @@ class GrafanaDatasource { to: options.range.to.valueOf(), limit: options.annotation.limit, tags: options.annotation.tags, - partialMatch: options.annotation.partialMatch, + matchAny: options.annotation.matchAny, }; if (options.annotation.type === 'dashboard') { diff --git a/public/app/plugins/datasource/grafana/partials/annotations.editor.html b/public/app/plugins/datasource/grafana/partials/annotations.editor.html index ba68a08cefdc..e5a67d6a7dc7 100644 --- a/public/app/plugins/datasource/grafana/partials/annotations.editor.html +++ b/public/app/plugins/datasource/grafana/partials/annotations.editor.html @@ -26,11 +26,11 @@
-