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
b72eba1e
Commit
b72eba1e
authored
Apr 29, 2015
by
Anthony Woods
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor handling of refresh when urlValues being used for templates. fixes #1862
parent
b6a4db3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
public/app/features/templating/templateValuesSrv.js
+23
-10
No files found.
public/app/features/templating/templateValuesSrv.js
View file @
b72eba1e
...
...
@@ -28,17 +28,11 @@ function (angular, _, kbn) {
for
(
var
i
=
0
;
i
<
this
.
variables
.
length
;
i
++
)
{
var
variable
=
this
.
variables
[
i
];
var
urlValue
=
queryParams
[
'var-'
+
variable
.
name
];
if
(
variable
.
refresh
)
{
promises
.
push
(
this
.
updateOptions
(
variable
));
}
if
(
urlValue
!==
void
0
)
{
var
option
=
_
.
findWhere
(
variable
.
options
,
{
text
:
urlValue
});
option
=
option
||
{
text
:
urlValue
,
value
:
urlValue
};
var
promise
=
this
.
setVariableValue
(
variable
,
option
,
true
);
this
.
updateAutoInterval
(
variable
);
promises
.
push
(
promise
);
promises
.
push
(
this
.
setVariableFromUrl
(
variable
,
urlValue
));
}
else
if
(
variable
.
refresh
)
{
promises
.
push
(
this
.
updateOptions
(
variable
));
}
else
if
(
variable
.
type
===
'interval'
)
{
this
.
updateAutoInterval
(
variable
);
...
...
@@ -48,6 +42,25 @@ function (angular, _, kbn) {
return
$q
.
all
(
promises
);
};
this
.
setVariableFromUrl
=
function
(
variable
,
urlValue
)
{
if
(
variable
.
refresh
)
{
var
self
=
this
;
//refresh the list of options before setting the value
return
this
.
updateOptions
(
variable
).
then
(
function
()
{
var
option
=
_
.
findWhere
(
variable
.
options
,
{
text
:
urlValue
});
option
=
option
||
{
text
:
urlValue
,
value
:
urlValue
};
self
.
updateAutoInterval
(
variable
);
return
self
.
setVariableValue
(
variable
,
option
);
});
}
var
option
=
_
.
findWhere
(
variable
.
options
,
{
text
:
urlValue
});
option
=
option
||
{
text
:
urlValue
,
value
:
urlValue
};
this
.
updateAutoInterval
(
variable
);
return
this
.
setVariableValue
(
variable
,
option
);
};
this
.
updateAutoInterval
=
function
(
variable
)
{
if
(
!
variable
.
auto
)
{
return
;
}
...
...
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