Commit aed8208d by bergquist

renames PartialMatch to MatchAny

parent 835a7533
...@@ -14,17 +14,17 @@ import ( ...@@ -14,17 +14,17 @@ import (
func GetAnnotations(c *m.ReqContext) Response { func GetAnnotations(c *m.ReqContext) Response {
query := &annotations.ItemQuery{ query := &annotations.ItemQuery{
From: c.QueryInt64("from"), From: c.QueryInt64("from"),
To: c.QueryInt64("to"), To: c.QueryInt64("to"),
OrgId: c.OrgId, OrgId: c.OrgId,
UserId: c.QueryInt64("userId"), UserId: c.QueryInt64("userId"),
AlertId: c.QueryInt64("alertId"), AlertId: c.QueryInt64("alertId"),
DashboardId: c.QueryInt64("dashboardId"), DashboardId: c.QueryInt64("dashboardId"),
PanelId: c.QueryInt64("panelId"), PanelId: c.QueryInt64("panelId"),
Limit: c.QueryInt64("limit"), Limit: c.QueryInt64("limit"),
Tags: c.QueryStrings("tags"), Tags: c.QueryStrings("tags"),
Type: c.Query("type"), Type: c.Query("type"),
PartialMatch: c.QueryBool("partialMatch"), MatchAny: c.QueryBool("matchAny"),
} }
repo := annotations.GetRepository() repo := annotations.GetRepository()
......
...@@ -21,7 +21,7 @@ type ItemQuery struct { ...@@ -21,7 +21,7 @@ type ItemQuery struct {
RegionId int64 `json:"regionId"` RegionId int64 `json:"regionId"`
Tags []string `json:"tags"` Tags []string `json:"tags"`
Type string `json:"type"` Type string `json:"type"`
PartialMatch bool `json:"partialMatch"` MatchAny bool `json:"matchAny"`
Limit int64 `json:"limit"` Limit int64 `json:"limit"`
} }
......
...@@ -211,7 +211,7 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I ...@@ -211,7 +211,7 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I
) )
`, strings.Join(keyValueFilters, " OR ")) `, strings.Join(keyValueFilters, " OR "))
if query.PartialMatch { if query.MatchAny {
sql.WriteString(fmt.Sprintf(" AND (%s) > 0 ", tagsSubQuery)) sql.WriteString(fmt.Sprintf(" AND (%s) > 0 ", tagsSubQuery))
} else { } else {
sql.WriteString(fmt.Sprintf(" AND (%s) = %d ", tagsSubQuery, len(tags))) sql.WriteString(fmt.Sprintf(" AND (%s) = %d ", tagsSubQuery, len(tags)))
......
...@@ -199,11 +199,11 @@ func TestAnnotations(t *testing.T) { ...@@ -199,11 +199,11 @@ func TestAnnotations(t *testing.T) {
Convey("Should find two annotations using partial match", func() { Convey("Should find two annotations using partial match", func() {
items, err := repo.Find(&annotations.ItemQuery{ items, err := repo.Find(&annotations.ItemQuery{
OrgId: 1, OrgId: 1,
From: 1, From: 1,
To: 25, To: 25,
PartialMatch: true, MatchAny: true,
Tags: []string{"rollback", "deploy"}, Tags: []string{"rollback", "deploy"},
}) })
So(err, ShouldBeNil) So(err, ShouldBeNil)
......
...@@ -40,7 +40,7 @@ class GrafanaDatasource { ...@@ -40,7 +40,7 @@ class GrafanaDatasource {
to: options.range.to.valueOf(), to: options.range.to.valueOf(),
limit: options.annotation.limit, limit: options.annotation.limit,
tags: options.annotation.tags, tags: options.annotation.tags,
partialMatch: options.annotation.partialMatch, matchAny: options.annotation.matchAny,
}; };
if (options.annotation.type === 'dashboard') { if (options.annotation.type === 'dashboard') {
......
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
</div> </div>
<div class="gf-form-inline"> <div class="gf-form-inline">
<div class="gf-form" ng-if="ctrl.annotation.type === 'tags'"> <div class="gf-form" ng-if="ctrl.annotation.type === 'tags'">
<gf-form-switch <gf-form-switch
class="gf-form" class="gf-form"
label="Partial match" label="Match any"
label-class="width-9" label-class="width-9"
checked="ctrl.annotation.partialMatch" checked="ctrl.annotation.matchAny"
on-change="ctrl.refresh()" on-change="ctrl.refresh()"
tooltip="By default Grafana will only show annotation that matches all tags in the query. Enabling this will make Grafana return any annotation with the tags you specify."></gf-form-switch> tooltip="By default Grafana will only show annotation that matches all tags in the query. Enabling this will make Grafana return any annotation with the tags you specify."></gf-form-switch>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment