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
e36cdac5
Commit
e36cdac5
authored
Sep 22, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(templating): fixed issue with templating when initalizing variables without any existing value
parent
0fc7405b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
public/app/features/templating/templateSrv.js
+4
-0
public/app/features/templating/variable_srv.ts
+8
-10
No files found.
public/app/features/templating/templateSrv.js
View file @
e36cdac5
...
...
@@ -43,6 +43,10 @@ function (angular, _, kbn) {
}
};
this
.
variableInitialized
=
function
(
variable
)
{
this
.
_index
[
variable
.
name
]
=
variable
;
};
this
.
getAdhocFilters
=
function
(
datasourceName
)
{
var
variable
=
this
.
_adhocVariables
[
datasourceName
];
if
(
variable
)
{
...
...
public/app/features/templating/variable_srv.ts
View file @
e36cdac5
...
...
@@ -8,7 +8,6 @@ import {Variable, variableTypes} from './variable';
export
class
VariableSrv
{
dashboard
:
any
;
variables
:
any
;
variableLock
:
any
;
/** @ngInject */
constructor
(
private
$rootScope
,
private
$q
,
private
$location
,
private
$injector
,
private
templateSrv
)
{
...
...
@@ -18,7 +17,6 @@ export class VariableSrv {
}
init
(
dashboard
)
{
this
.
variableLock
=
{};
this
.
dashboard
=
dashboard
;
// create working class models representing variables
...
...
@@ -30,7 +28,7 @@ export class VariableSrv {
// init variables
for
(
let
variable
of
this
.
variables
)
{
this
.
variableLock
[
variable
.
name
]
=
this
.
$q
.
defer
();
variable
.
initLock
=
this
.
$q
.
defer
();
}
var
queryParams
=
this
.
$location
.
search
();
...
...
@@ -61,27 +59,27 @@ export class VariableSrv {
processVariable
(
variable
,
queryParams
)
{
var
dependencies
=
[];
var
lock
=
this
.
variableLock
[
variable
.
name
];
for
(
let
otherVariable
of
this
.
variables
)
{
if
(
variable
.
dependsOn
(
otherVariable
))
{
dependencies
.
push
(
this
.
variableLock
[
otherVariable
.
name
]
.
promise
);
dependencies
.
push
(
otherVariable
.
initLock
.
promise
);
}
}
return
this
.
$q
.
all
(
dependencies
).
then
(()
=>
{
var
urlValue
=
queryParams
[
'var-'
+
variable
.
name
];
if
(
urlValue
!==
void
0
)
{
return
variable
.
setValueFromUrl
(
urlValue
).
then
(
l
ock
.
resolve
);
return
variable
.
setValueFromUrl
(
urlValue
).
then
(
variable
.
initL
ock
.
resolve
);
}
if
(
variable
.
refresh
===
1
||
variable
.
refresh
===
2
)
{
return
variable
.
updateOptions
().
then
(
l
ock
.
resolve
);
return
variable
.
updateOptions
().
then
(
variable
.
initL
ock
.
resolve
);
}
l
ock
.
resolve
();
variable
.
initL
ock
.
resolve
();
}).
finally
(()
=>
{
delete
this
.
variableLock
[
variable
.
name
];
this
.
templateSrv
.
variableInitialized
(
variable
);
delete
variable
.
initLock
;
});
}
...
...
@@ -113,7 +111,7 @@ export class VariableSrv {
variableUpdated
(
variable
)
{
// if there is a variable lock ignore cascading update because we are in a boot up scenario
if
(
this
.
variableLock
[
variable
.
name
]
)
{
if
(
variable
.
initLock
)
{
return
this
.
$q
.
when
();
}
...
...
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