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
ca42d976
Commit
ca42d976
authored
Jun 26, 2015
by
David Raifaizen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fix for template variables when no options are available to select
parent
20d5d0ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
public/app/features/templating/templateSrv.js
+1
-1
public/app/features/templating/templateValuesSrv.js
+4
-0
public/test/specs/templateValuesSrv-specs.js
+3
-2
No files found.
public/app/features/templating/templateSrv.js
View file @
ca42d976
...
@@ -27,7 +27,7 @@ function (angular, _) {
...
@@ -27,7 +27,7 @@ function (angular, _) {
this
.
_texts
=
{};
this
.
_texts
=
{};
_
.
each
(
this
.
variables
,
function
(
variable
)
{
_
.
each
(
this
.
variables
,
function
(
variable
)
{
if
(
!
variable
.
current
||
!
variable
.
current
.
value
)
{
return
;
}
if
(
!
variable
.
current
||
!
variable
.
current
.
isNone
&&
!
variable
.
current
.
value
)
{
return
;
}
this
.
_values
[
variable
.
name
]
=
this
.
renderVariableValue
(
variable
);
this
.
_values
[
variable
.
name
]
=
this
.
renderVariableValue
(
variable
);
this
.
_texts
[
variable
.
name
]
=
variable
.
current
.
text
;
this
.
_texts
[
variable
.
name
]
=
variable
.
current
.
text
;
...
...
public/app/features/templating/templateValuesSrv.js
View file @
ca42d976
...
@@ -10,6 +10,7 @@ function (angular, _, kbn) {
...
@@ -10,6 +10,7 @@ function (angular, _, kbn) {
module
.
service
(
'templateValuesSrv'
,
function
(
$q
,
$rootScope
,
datasourceSrv
,
$location
,
templateSrv
,
timeSrv
)
{
module
.
service
(
'templateValuesSrv'
,
function
(
$q
,
$rootScope
,
datasourceSrv
,
$location
,
templateSrv
,
timeSrv
)
{
var
self
=
this
;
var
self
=
this
;
function
getNoneOption
()
{
return
{
text
:
'None'
,
value
:
''
,
isNone
:
true
};
}
$rootScope
.
onAppEvent
(
'time-range-changed'
,
function
()
{
$rootScope
.
onAppEvent
(
'time-range-changed'
,
function
()
{
var
variable
=
_
.
findWhere
(
self
.
variables
,
{
type
:
'interval'
});
var
variable
=
_
.
findWhere
(
self
.
variables
,
{
type
:
'interval'
});
...
@@ -175,6 +176,9 @@ function (angular, _, kbn) {
...
@@ -175,6 +176,9 @@ function (angular, _, kbn) {
if
(
variable
.
includeAll
)
{
if
(
variable
.
includeAll
)
{
self
.
addAllOption
(
variable
);
self
.
addAllOption
(
variable
);
}
}
if
(
!
variable
.
options
.
length
)
{
variable
.
options
.
push
(
getNoneOption
());
}
return
datasource
;
return
datasource
;
});
});
};
};
...
...
public/test/specs/templateValuesSrv-specs.js
View file @
ca42d976
...
@@ -224,8 +224,9 @@ define([
...
@@ -224,8 +224,9 @@ define([
scenario
.
queryResult
=
[{
text
:
'apps.backend.backend_01.counters.req'
},
{
text
:
'apps.backend.backend_02.counters.req'
}];
scenario
.
queryResult
=
[{
text
:
'apps.backend.backend_01.counters.req'
},
{
text
:
'apps.backend.backend_02.counters.req'
}];
});
});
it
(
'should not add non matching items'
,
function
()
{
it
(
'should not add non matching items, None option should be added instead'
,
function
()
{
expect
(
scenario
.
variable
.
options
.
length
).
to
.
be
(
0
);
expect
(
scenario
.
variable
.
options
.
length
).
to
.
be
(
1
);
expect
(
scenario
.
variable
.
options
[
0
].
isNone
).
to
.
be
(
true
);
});
});
});
});
...
...
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