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
040dd91d
Commit
040dd91d
authored
May 09, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(templating): fixed issue with current data source variable value, fixes #4934
parent
c6c07599
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
CHANGELOG.md
+4
-0
public/app/features/templating/templateValuesSrv.js
+2
-3
public/test/specs/templateValuesSrv-specs.js
+12
-2
No files found.
CHANGELOG.md
View file @
040dd91d
# 3.0.0 stable (unreleased)
*
**Templating**
: Fixed issue with new data source variable not persisting current selected value, fixes
[
#4934
](
https://github.com/grafana/grafana/issues/4934
)
# 3.0.0-beta7 (2016-05-02)
### Bug fixes
...
...
public/app/features/templating/templateValuesSrv.js
View file @
040dd91d
...
...
@@ -213,8 +213,7 @@ function (angular, _, kbn) {
this
.
updateOptions
=
function
(
variable
)
{
if
(
variable
.
type
!==
'query'
)
{
self
.
_updateNonQueryVariable
(
variable
);
self
.
setVariableValue
(
variable
,
variable
.
options
[
0
]);
return
$q
.
when
([]);
return
self
.
validateVariableSelectionState
(
variable
);
}
return
datasourceSrv
.
get
(
variable
.
datasource
)
...
...
@@ -251,7 +250,7 @@ function (angular, _, kbn) {
if
(
_
.
isArray
(
variable
.
current
.
value
))
{
self
.
selectOptionsForCurrentValue
(
variable
);
}
else
{
var
currentOption
=
_
.
findWhere
(
variable
.
options
,
{
text
:
variable
.
current
.
text
});
var
currentOption
=
_
.
findWhere
(
variable
.
options
,
{
text
:
variable
.
current
.
text
});
if
(
currentOption
)
{
return
self
.
setVariableValue
(
variable
,
currentOption
,
true
);
}
else
{
...
...
public/test/specs/templateValuesSrv-specs.js
View file @
040dd91d
...
...
@@ -166,7 +166,7 @@ define([
describeUpdateVariable
(
'update custom variable'
,
function
(
scenario
)
{
scenario
.
setup
(
function
()
{
scenario
.
variable
=
{
type
:
'custom'
,
query
:
'hej, hop, asd'
,
name
:
'test'
};
scenario
.
variable
=
{
type
:
'custom'
,
query
:
'hej, hop, asd'
,
name
:
'test'
};
});
it
(
'should update options array'
,
function
()
{
...
...
@@ -286,7 +286,13 @@ define([
describeUpdateVariable
(
'datasource variable with regex filter'
,
function
(
scenario
)
{
scenario
.
setup
(
function
()
{
scenario
.
variable
=
{
type
:
'datasource'
,
query
:
'graphite'
,
name
:
'test'
,
current
:
{},
regex
:
'/pee$/'
};
scenario
.
variable
=
{
type
:
'datasource'
,
query
:
'graphite'
,
name
:
'test'
,
current
:
{
value
:
'backend4_pee'
,
text
:
'backend4_pee'
},
regex
:
'/pee$/'
};
scenario
.
metricSources
=
[
{
name
:
'backend1'
,
meta
:
{
id
:
'influx'
}},
{
name
:
'backend2_pee'
,
meta
:
{
id
:
'graphite'
}},
...
...
@@ -300,6 +306,10 @@ define([
expect
(
scenario
.
variable
.
options
[
0
].
value
).
to
.
be
(
'backend2_pee'
);
expect
(
scenario
.
variable
.
options
[
1
].
value
).
to
.
be
(
'backend4_pee'
);
});
it
(
'should keep current value if available'
,
function
()
{
expect
(
scenario
.
variable
.
current
.
value
).
to
.
be
(
'backend4_pee'
);
});
});
});
...
...
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