renames PartialMatch to MatchAny

This commit is contained in:
bergquist
2018-09-13 15:15:42 +02:00
parent 835a75335c
commit aed8208d78
6 changed files with 24 additions and 24 deletions

View File

@@ -24,7 +24,7 @@ func GetAnnotations(c *m.ReqContext) Response {
Limit: c.QueryInt64("limit"),
Tags: c.QueryStrings("tags"),
Type: c.Query("type"),
PartialMatch: c.QueryBool("partialMatch"),
MatchAny: c.QueryBool("matchAny"),
}
repo := annotations.GetRepository()

View File

@@ -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"`
}

View File

@@ -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)))

View File

@@ -202,7 +202,7 @@ func TestAnnotations(t *testing.T) {
OrgId: 1,
From: 1,
To: 25,
PartialMatch: true,
MatchAny: true,
Tags: []string{"rollback", "deploy"},
})

View File

@@ -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') {

View File

@@ -28,9 +28,9 @@
<div class="gf-form" ng-if="ctrl.annotation.type === 'tags'">
<gf-form-switch
class="gf-form"
label="Partial match"
label="Match any"
label-class="width-9"
checked="ctrl.annotation.partialMatch"
checked="ctrl.annotation.matchAny"
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>
</div>