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
f6845cd1
Commit
f6845cd1
authored
Jun 09, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Variable value select fixes and refactorings
parent
c20fa85b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
10 deletions
+39
-10
public/app/directives/all.js
+1
-1
public/app/directives/valueSelectDropdown.js
+11
-5
public/app/partials/submenu.html
+1
-1
public/app/partials/valueSelectDropdown.html
+0
-0
public/test/specs/valueSelectDropdown-specs.js
+25
-2
public/test/test-main.js
+1
-1
No files found.
public/app/directives/all.js
View file @
f6845cd1
...
...
@@ -11,7 +11,7 @@ define([
'./spectrumPicker'
,
'./tags'
,
'./bodyClass'
,
'./
selectDropD
own'
,
'./
valueSelectDropd
own'
,
'./metric.segment'
,
'./grafanaVersionCheck'
,
'./dropdown.typeahead'
,
...
...
public/app/directives/
selectDropD
own.js
→
public/app/directives/
valueSelectDropd
own.js
View file @
f6845cd1
...
...
@@ -9,7 +9,7 @@ function (angular, app, _) {
angular
.
module
(
'grafana.controllers'
)
.
controller
(
'SelectDropdownCtrl'
,
function
(
$q
)
{
.
controller
(
'
Value
SelectDropdownCtrl'
,
function
(
$q
)
{
var
vm
=
this
;
vm
.
show
=
function
()
{
...
...
@@ -31,7 +31,13 @@ function (angular, app, _) {
vm
.
selectedValues
=
_
.
filter
(
vm
.
options
,
{
selected
:
true
});
vm
.
tags
=
_
.
map
(
vm
.
variable
.
tags
,
function
(
value
)
{
return
{
text
:
value
,
selected
:
false
};
var
tag
=
{
text
:
value
,
selected
:
false
};
_
.
each
(
vm
.
variable
.
current
.
tags
,
function
(
tagObj
)
{
if
(
tagObj
.
text
===
value
)
{
tag
.
selected
=
true
;
}
});
return
tag
;
});
vm
.
search
=
{
query
:
''
,
options
:
vm
.
options
};
...
...
@@ -225,12 +231,12 @@ function (angular, app, _) {
angular
.
module
(
'grafana.directives'
)
.
directive
(
'
s
electDropdown'
,
function
(
$compile
,
$window
,
$timeout
)
{
.
directive
(
'
valueS
electDropdown'
,
function
(
$compile
,
$window
,
$timeout
)
{
return
{
scope
:
{
variable
:
"="
,
onUpdated
:
"&"
,
getValuesForTag
:
"&"
},
templateUrl
:
'app/partials/
s
electDropdown.html'
,
controller
:
'SelectDropdownCtrl'
,
templateUrl
:
'app/partials/
valueS
electDropdown.html'
,
controller
:
'
Value
SelectDropdownCtrl'
,
controllerAs
:
'vm'
,
bindToController
:
true
,
link
:
function
(
scope
,
elem
)
{
...
...
public/app/partials/submenu.html
View file @
f6845cd1
...
...
@@ -6,7 +6,7 @@
<span
class=
"template-variable tight-form-item"
ng-show=
"!variable.hideLabel"
style=
"padding-right: 5px"
>
{{variable.label || variable.name}}:
</span>
<
select-dropdown
variable=
"variable"
on-updated=
"variableUpdated(variable)"
get-values-for-tag=
"getValuesForTag(variable, tagKey)"
></
select-dropdown>
<
value-select-dropdown
variable=
"variable"
on-updated=
"variableUpdated(variable)"
get-values-for-tag=
"getValuesForTag(variable, tagKey)"
></value-
select-dropdown>
</li>
</ul>
...
...
public/app/partials/
s
electDropdown.html
→
public/app/partials/
valueS
electDropdown.html
View file @
f6845cd1
File moved
public/test/specs/
selectDropdownCtrl
-specs.js
→
public/test/specs/
valueSelectDropdown
-specs.js
View file @
f6845cd1
define
([
'directives/va
riableValueSelect
'
,
'directives/va
lueSelectDropdown
'
,
],
function
()
{
'use strict'
;
...
...
@@ -15,7 +15,7 @@ function () {
beforeEach
(
inject
(
function
(
$controller
,
$rootScope
,
$q
)
{
rootScope
=
$rootScope
;
scope
=
$rootScope
.
$new
();
ctrl
=
$controller
(
'SelectDropdownCtrl'
,
{
$scope
:
scope
});
ctrl
=
$controller
(
'
Value
SelectDropdownCtrl'
,
{
$scope
:
scope
});
ctrl
.
getValuesForTag
=
function
(
obj
)
{
return
$q
.
when
(
tagValuesMap
[
obj
.
tagKey
]);
};
...
...
@@ -134,5 +134,28 @@ function () {
});
});
});
describe
(
"Given variable with selected tags"
,
function
()
{
beforeEach
(
function
()
{
ctrl
.
variable
=
{
current
:
{
text
:
'server-1'
,
value
:
'server-1'
,
tags
:
[{
text
:
'key1'
}]
},
options
:
[
{
text
:
'server-1'
,
value
:
'server-1'
},
{
text
:
'server-2'
,
value
:
'server-2'
},
{
text
:
'server-3'
,
value
:
'server-3'
},
],
tags
:
[
"key1"
,
"key2"
,
"key3"
],
multi
:
true
};
ctrl
.
init
();
ctrl
.
show
();
});
it
(
"should set tag as selected"
,
function
()
{
expect
(
ctrl
.
tags
[
0
].
selected
).
to
.
be
(
true
);
});
});
});
});
public/test/test-main.js
View file @
f6845cd1
...
...
@@ -144,7 +144,7 @@ require([
'specs/singlestat-specs'
,
'specs/dynamicDashboardSrv-specs'
,
'specs/unsavedChangesSrv-specs'
,
'specs/
selectDropdownCtrl
-specs'
,
'specs/
valueSelectDropdown
-specs'
,
];
var
pluginSpecs
=
(
config
.
plugins
.
specs
||
[]).
map
(
function
(
spec
)
{
...
...
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