Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
aed8208d
Commit
aed8208d
authored
Sep 13, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renames PartialMatch to MatchAny
parent
835a7533
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
24 deletions
+24
-24
pkg/api/annotations.go
+11
-11
pkg/services/annotations/annotations.go
+1
-1
pkg/services/sqlstore/annotation.go
+1
-1
pkg/services/sqlstore/annotation_test.go
+5
-5
public/app/plugins/datasource/grafana/datasource.ts
+1
-1
public/app/plugins/datasource/grafana/partials/annotations.editor.html
+5
-5
No files found.
pkg/api/annotations.go
View file @
aed8208d
...
...
@@ -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
()
...
...
pkg/services/annotations/annotations.go
View file @
aed8208d
...
...
@@ -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"`
}
...
...
pkg/services/sqlstore/annotation.go
View file @
aed8208d
...
...
@@ -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
)))
...
...
pkg/services/sqlstore/annotation_test.go
View file @
aed8208d
...
...
@@ -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
)
...
...
public/app/plugins/datasource/grafana/datasource.ts
View file @
aed8208d
...
...
@@ -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'
)
{
...
...
public/app/plugins/datasource/grafana/partials/annotations.editor.html
View file @
aed8208d
...
...
@@ -26,11 +26,11 @@
</div>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form"
ng-if=
"ctrl.annotation.type === 'tags'"
>
<gf-form-switch
class=
"gf-form"
label=
"
Partial match"
label-class=
"width-9"
checked=
"ctrl.annotation.
partialMatch"
<gf-form-switch
class=
"gf-form"
label=
"
Match any"
label-class=
"width-9"
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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment