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
2202094e
Commit
2202094e
authored
May 20, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work on tags in variables
parent
25c6b64f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
4 deletions
+56
-4
public/app/directives/variableValueSelect.js
+4
-1
public/app/features/dashboard/partials/variableValueSelect.html
+2
-2
public/app/features/templating/partials/editor.html
+36
-0
public/app/features/templating/templateValuesSrv.js
+14
-1
No files found.
public/app/directives/variableValueSelect.js
View file @
2202094e
...
...
@@ -9,7 +9,7 @@ function (angular, app, _) {
angular
.
module
(
'grafana.directives'
)
.
directive
(
'variableValueSelect'
,
function
(
$compile
,
$window
,
$timeout
)
{
.
directive
(
'variableValueSelect'
,
function
(
$compile
,
$window
,
$timeout
,
datasourceSrv
)
{
return
{
scope
:
{
variable
:
"="
,
...
...
@@ -132,6 +132,9 @@ function (angular, app, _) {
}
};
scope
.
selectTag
=
function
(
tag
)
{
};
scope
.
hide
=
function
()
{
scope
.
selectorOpen
=
false
;
bodyEl
.
off
(
'click'
,
scope
.
bodyOnClick
);
...
...
public/app/features/dashboard/partials/variableValueSelect.html
View file @
2202094e
...
...
@@ -25,8 +25,8 @@
</div>
<div
class=
"variable-options-column"
ng-if=
"variable.tags"
>
<!-- <div class="variable-options-column-header">Tags</div> -->
<a
class=
"variable-option-tag pointer"
ng-repeat=
"
(key, values)
in variable.tags"
ng-click=
"selectTag(option, $event)"
>
<span
class=
"label-tag"
tag-color-from-name=
"
key"
>
{{key
}}
</span>
<a
class=
"variable-option-tag pointer"
ng-repeat=
"
tag
in variable.tags"
ng-click=
"selectTag(option, $event)"
>
<span
class=
"label-tag"
tag-color-from-name=
"
tag"
>
{{tag
}}
</span>
<span
class=
"fa fa-fw variable-option-icon"
></span>
</a>
</div>
...
...
public/app/features/templating/partials/editor.html
View file @
2202094e
...
...
@@ -226,6 +226,42 @@
</div>
</div>
<div
class=
"editor-row"
ng-if=
"current.type === 'query'"
>
<div
class=
"tight-form-section"
>
<h5>
Value Groups/Tags
</h5>
<div
class=
"tight-form"
ng-if=
"current.useTags"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 115px"
>
Tags query
</li>
<li>
<input
type=
"text"
style=
"width: 588px"
class=
"input-xxlarge tight-form-input last"
ng-model=
'current.tagsQuery'
placeholder=
"metric name or tags query"
ng-model-onblur
ng-change=
"runQuery()"
></input>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form"
ng-if=
"current.useTags"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 115px;"
>
Tags values query
</li>
<li>
<input
type=
"text"
style=
"width: 588px"
class=
"input tight-form-input last"
ng-model=
'current.tagValuesQuery'
placeholder=
"apps.$__tag.*"
ng-model-onblur
ng-change=
"runQuery()"
></input>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item last"
>
<editor-checkbox
text=
"Enable"
model=
"current.useTags"
change=
"runQuery()"
></editor-checkbox>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
<div
class=
"editor-row"
>
<div
class=
"tight-form-section"
>
<h5>
Preview of values (shows max 20)
</h5>
...
...
public/app/features/templating/templateValuesSrv.js
View file @
2202094e
...
...
@@ -120,7 +120,7 @@ function (angular, _, kbn) {
}
return
datasourceSrv
.
get
(
variable
.
datasource
).
then
(
function
(
datasource
)
{
return
datasource
.
metricFindQuery
(
variable
.
query
).
then
(
function
(
results
)
{
var
queryPromise
=
datasource
.
metricFindQuery
(
variable
.
query
).
then
(
function
(
results
)
{
variable
.
options
=
self
.
metricNamesToVariableValues
(
variable
,
results
);
if
(
variable
.
includeAll
)
{
...
...
@@ -138,6 +138,19 @@ function (angular, _, kbn) {
return
self
.
setVariableValue
(
variable
,
variable
.
options
[
0
]);
});
if
(
variable
.
useTags
)
{
return
queryPromise
.
then
(
function
()
{
datasource
.
metricFindQuery
(
variable
.
tagsQuery
).
then
(
function
(
results
)
{
variable
.
tags
=
[];
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
)
{
variable
.
tags
.
push
(
results
[
i
].
text
);
}
});
});
}
else
{
return
queryPromise
;
}
});
};
...
...
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