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
0d4b00df
Commit
0d4b00df
authored
Oct 11, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): add template validation for influxdb
closes #6230
parent
2e21613b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
1 deletions
+27
-1
public/app/features/alerting/alert_tab_ctrl.ts
+1
-1
public/app/plugins/datasource/graphite/datasource.ts
+4
-0
public/app/plugins/datasource/influxdb/datasource.ts
+18
-0
public/app/plugins/datasource/prometheus/datasource.ts
+4
-0
No files found.
public/app/features/alerting/alert_tab_ctrl.ts
View file @
0d4b00df
...
...
@@ -231,7 +231,7 @@ export class AlertTabCtrl {
this
.
datasourceSrv
.
get
(
datasourceName
).
then
(
ds
=>
{
if
(
!
ds
.
meta
.
alerting
)
{
this
.
error
=
'The datasource does not support alerting queries'
;
}
else
if
(
this
.
templateSrv
.
variableExists
(
foundTarget
.
t
arget
))
{
}
else
if
(
ds
.
targetContainsTemplate
(
foundT
arget
))
{
this
.
error
=
'Template variables are not supported in alert queries'
;
}
else
{
this
.
error
=
''
;
...
...
public/app/plugins/datasource/graphite/datasource.ts
View file @
0d4b00df
...
...
@@ -126,6 +126,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
}
};
this
.
targetContainsTemplate
=
function
(
target
)
{
return
templateSrv
.
variableExists
(
target
.
target
);
};
this
.
translateTime
=
function
(
date
,
roundUp
)
{
if
(
_
.
isString
(
date
))
{
if
(
date
===
'now'
)
{
...
...
public/app/plugins/datasource/influxdb/datasource.ts
View file @
0d4b00df
...
...
@@ -139,6 +139,24 @@ export default class InfluxDatasource {
});
};
targetContainsTemplate
(
target
)
{
for
(
let
group
of
target
.
groupBy
)
{
for
(
let
param
of
group
.
params
)
{
if
(
this
.
templateSrv
.
variableExists
(
param
))
{
return
true
;
}
}
}
for
(
let
i
in
target
.
tags
)
{
if
(
this
.
templateSrv
.
variableExists
(
target
.
tags
[
i
].
value
))
{
return
true
;
}
}
return
false
;
};
metricFindQuery
(
query
)
{
var
interpolated
=
this
.
templateSrv
.
replace
(
query
,
null
,
'regex'
);
...
...
public/app/plugins/datasource/prometheus/datasource.ts
View file @
0d4b00df
...
...
@@ -58,6 +58,10 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
return
escapedValues
.
join
(
'|'
);
};
this
.
targetContainsTemplate
=
function
(
target
)
{
return
templateSrv
.
variableExists
(
target
.
expr
);
};
// Called once per panel (graph)
this
.
query
=
function
(
options
)
{
var
self
=
this
;
...
...
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