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
8f17a84f
Commit
8f17a84f
authored
Apr 23, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql: added basic templating support
parent
253b8be4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
public/app/plugins/datasource/mysql/datasource.ts
+13
-2
No files found.
public/app/plugins/datasource/mysql/datasource.ts
View file @
8f17a84f
...
@@ -7,11 +7,22 @@ export class MysqlDatasource {
...
@@ -7,11 +7,22 @@ export class MysqlDatasource {
name
:
any
;
name
:
any
;
/** @ngInject */
/** @ngInject */
constructor
(
instanceSettings
,
private
backendSrv
,
private
$q
)
{
constructor
(
instanceSettings
,
private
backendSrv
,
private
$q
,
private
templateSrv
)
{
this
.
name
=
instanceSettings
.
name
;
this
.
name
=
instanceSettings
.
name
;
this
.
id
=
instanceSettings
.
id
;
this
.
id
=
instanceSettings
.
id
;
}
}
interpolateVariable
(
value
)
{
if
(
typeof
value
===
'string'
)
{
return
'
\
"'
+
value
+
'
\
"'
;
}
var
quotedValues
=
_
.
map
(
value
,
function
(
val
)
{
return
'
\
"'
+
val
+
'
\
"'
;
});
return
quotedValues
.
join
(
','
);
}
query
(
options
)
{
query
(
options
)
{
var
queries
=
_
.
filter
(
options
.
targets
,
item
=>
{
var
queries
=
_
.
filter
(
options
.
targets
,
item
=>
{
return
item
.
hide
!==
true
;
return
item
.
hide
!==
true
;
...
@@ -21,7 +32,7 @@ export class MysqlDatasource {
...
@@ -21,7 +32,7 @@ export class MysqlDatasource {
intervalMs
:
options
.
intervalMs
,
intervalMs
:
options
.
intervalMs
,
maxDataPoints
:
options
.
maxDataPoints
,
maxDataPoints
:
options
.
maxDataPoints
,
datasourceId
:
this
.
id
,
datasourceId
:
this
.
id
,
rawSql
:
item
.
rawSql
,
rawSql
:
this
.
templateSrv
.
replace
(
item
.
rawSql
,
options
.
scopedVars
,
this
.
interpolateVariable
)
,
format
:
item
.
format
,
format
:
item
.
format
,
};
};
});
});
...
...
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