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
56e53b83
Commit
56e53b83
authored
Oct 24, 2017
by
Sven Klemm
Committed by
Daniel Lee
Oct 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dont quote variables for mysql and postgres datasource (#9611)
parent
2f357593
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
5 deletions
+25
-5
public/app/plugins/datasource/mysql/datasource.ts
+1
-1
public/app/plugins/datasource/mysql/specs/datasource_specs.ts
+2
-2
public/app/plugins/datasource/postgres/datasource.ts
+2
-2
public/app/plugins/datasource/postgres/specs/datasource_specs.ts
+20
-0
No files found.
public/app/plugins/datasource/mysql/datasource.ts
View file @
56e53b83
...
...
@@ -17,7 +17,7 @@ export class MysqlDatasource {
interpolateVariable
(
value
)
{
if
(
typeof
value
===
'string'
)
{
return
'
\'
'
+
value
+
'
\'
'
;
return
value
;
}
if
(
typeof
value
===
'number'
)
{
...
...
public/app/plugins/datasource/mysql/specs/datasource_specs.ts
View file @
56e53b83
...
...
@@ -196,8 +196,8 @@ describe('MySQLDatasource', function() {
describe
(
'When interpolating variables'
,
()
=>
{
describe
(
'and value is a string'
,
()
=>
{
it
(
'should return a
quoted value'
,
()
=>
{
expect
(
ctx
.
ds
.
interpolateVariable
(
'abc'
)).
to
.
eql
(
'
\'
abc
\'
'
);
it
(
'should return a
n un
quoted value'
,
()
=>
{
expect
(
ctx
.
ds
.
interpolateVariable
(
'abc'
)).
to
.
eql
(
'
abc
'
);
});
});
...
...
public/app/plugins/datasource/postgres/datasource.ts
View file @
56e53b83
...
...
@@ -17,11 +17,11 @@ export class PostgresDatasource {
interpolateVariable
(
value
)
{
if
(
typeof
value
===
'string'
)
{
return
'
\'
'
+
value
+
'
\'
'
;
return
value
;
}
if
(
typeof
value
===
'number'
)
{
return
value
.
toString
()
;
return
value
;
}
var
quotedValues
=
_
.
map
(
value
,
function
(
val
)
{
...
...
public/app/plugins/datasource/postgres/specs/datasource_specs.ts
View file @
56e53b83
...
...
@@ -193,4 +193,24 @@ describe('PostgreSQLDatasource', function() {
expect
(
results
[
0
].
value
).
to
.
be
(
'same'
);
});
});
describe
(
'When interpolating variables'
,
()
=>
{
describe
(
'and value is a string'
,
()
=>
{
it
(
'should return an unquoted value'
,
()
=>
{
expect
(
ctx
.
ds
.
interpolateVariable
(
'abc'
)).
to
.
eql
(
'abc'
);
});
});
describe
(
'and value is a number'
,
()
=>
{
it
(
'should return an unquoted value'
,
()
=>
{
expect
(
ctx
.
ds
.
interpolateVariable
(
1000
)).
to
.
eql
(
1000
);
});
});
describe
(
'and value is an array of strings'
,
()
=>
{
it
(
'should return comma separated quoted values'
,
()
=>
{
expect
(
ctx
.
ds
.
interpolateVariable
([
'a'
,
'b'
,
'c'
])).
to
.
eql
(
'
\'
a
\'
,
\'
b
\'
,
\'
c
\'
'
);
});
});
});
});
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