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
696fad70
Commit
696fad70
authored
May 26, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v3.0.x'
Conflicts: public/app/features/templating/templateValuesSrv.js
parents
90c9c704
724a5119
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
12 deletions
+37
-12
public/app/features/templating/templateValuesSrv.js
+16
-12
public/test/specs/templateValuesSrv-specs.js
+21
-0
No files found.
public/app/features/templating/templateValuesSrv.js
View file @
696fad70
...
...
@@ -105,8 +105,6 @@ function (angular, _, kbn) {
return
op
.
text
===
urlValue
||
op
.
value
===
urlValue
;
});
option
=
option
||
{
text
:
urlValue
,
value
:
urlValue
};
self
.
updateAutoInterval
(
variable
);
return
self
.
setVariableValue
(
variable
,
option
,
true
);
});
...
...
@@ -127,8 +125,8 @@ function (angular, _, kbn) {
this
.
setVariableValue
=
function
(
variable
,
option
,
initPhase
)
{
variable
.
current
=
angular
.
copy
(
option
);
if
(
_
.
isArray
(
variable
.
current
.
value
))
{
variable
.
current
.
text
=
variable
.
current
.
value
.
join
(
' + '
);
if
(
_
.
isArray
(
variable
.
current
.
text
))
{
variable
.
current
.
text
=
variable
.
current
.
text
.
join
(
' + '
);
}
self
.
selectOptionsForCurrentValue
(
variable
);
...
...
@@ -226,6 +224,7 @@ function (angular, _, kbn) {
this
.
selectOptionsForCurrentValue
=
function
(
variable
)
{
var
i
,
y
,
value
,
option
;
var
selected
=
[];
for
(
i
=
0
;
i
<
variable
.
options
.
length
;
i
++
)
{
option
=
variable
.
options
[
i
];
...
...
@@ -235,12 +234,16 @@ function (angular, _, kbn) {
value
=
variable
.
current
.
value
[
y
];
if
(
option
.
value
===
value
)
{
option
.
selected
=
true
;
selected
.
push
(
option
);
}
}
}
else
if
(
option
.
value
===
variable
.
current
.
value
)
{
option
.
selected
=
true
;
selected
.
push
(
option
);
}
}
return
selected
;
};
this
.
validateVariableSelectionState
=
function
(
variable
)
{
...
...
@@ -250,17 +253,18 @@ function (angular, _, kbn) {
}
if
(
_
.
isArray
(
variable
.
current
.
value
))
{
self
.
selectOptionsForCurrentValue
(
variable
);
// updated selected value
var
selected
=
{
value
:
_
.
map
(
_
.
filter
(
variable
.
options
,
{
selected
:
true
}),
function
(
op
)
{
return
op
.
value
;
})
};
var
selected
=
self
.
selectOptionsForCurrentValue
(
variable
);
// if none pick first
if
(
selected
.
value
.
length
===
0
)
{
if
(
selected
.
length
===
0
)
{
selected
=
variable
.
options
[
0
];
}
else
{
selected
=
{
value
:
_
.
map
(
selected
,
function
(
val
)
{
return
val
.
value
;}),
text
:
_
.
map
(
selected
,
function
(
val
)
{
return
val
.
text
;}).
join
(
' + '
),
};
}
return
self
.
setVariableValue
(
variable
,
selected
,
false
);
}
else
{
var
currentOption
=
_
.
findWhere
(
variable
.
options
,
{
text
:
variable
.
current
.
text
});
...
...
public/test/specs/templateValuesSrv-specs.js
View file @
696fad70
...
...
@@ -166,6 +166,27 @@ define([
});
});
describeUpdateVariable
(
'query variable with multi select and $__all selected'
,
function
(
scenario
)
{
scenario
.
setup
(
function
()
{
scenario
.
variable
=
{
type
:
'query'
,
query
:
''
,
name
:
'test'
,
includeAll
:
true
,
current
:
{
value
:
[
'$__all'
],
text
:
'All'
}
};
scenario
.
queryResult
=
[{
text
:
'val5'
},
{
text
:
'val6'
}];
});
it
(
'should keep current All value'
,
function
()
{
expect
(
scenario
.
variable
.
current
.
value
).
to
.
eql
([
'$__all'
]);
expect
(
scenario
.
variable
.
current
.
text
).
to
.
eql
(
'All'
);
});
});
describeUpdateVariable
(
'query variable with numeric results'
,
function
(
scenario
)
{
scenario
.
setup
(
function
()
{
scenario
.
variable
=
{
type
:
'query'
,
query
:
''
,
name
:
'test'
,
current
:
{}
};
...
...
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