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
d97f24cf
Commit
d97f24cf
authored
Jul 08, 2015
by
Espen Fjellvær Olsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update QueryController to conform with OpenTSDB Controller
parent
48975e65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
39 deletions
+13
-39
public/app/plugins/datasource/kairosdb/queryCtrl.js
+13
-39
No files found.
public/app/plugins/datasource/kairosdb/queryCtrl.js
View file @
d97f24cf
...
...
@@ -6,8 +6,6 @@ function (angular, _) {
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
var
metricList
=
[];
var
tagList
=
[];
module
.
controller
(
'KairosDBQueryCtrl'
,
function
(
$scope
)
{
...
...
@@ -48,50 +46,26 @@ function (angular, _) {
_
.
move
(
$scope
.
panel
.
targets
,
fromIndex
,
toIndex
);
};
$scope
.
getTextValues
=
function
(
metricFindResult
)
{
return
_
.
map
(
metricFindResult
,
function
(
value
)
{
return
value
.
text
;
});
};
$scope
.
suggestMetrics
=
function
(
query
,
callback
)
{
if
(
!
_
.
isEmpty
(
metricList
))
{
return
metricList
;
}
else
{
$scope
.
datasource
.
_performMetricSuggestQuery
().
then
(
function
(
result
)
{
metricList
=
result
;
callback
(
metricList
);
});
}
$scope
.
datasource
.
metricFindQuery
(
'metrics('
+
query
+
')'
)
.
then
(
$scope
.
getTextValues
)
.
then
(
callback
);
};
$scope
.
suggestTagKeys
=
function
(
query
,
callback
)
{
if
(
!
_
.
isEmpty
(
tagList
))
{
var
result
=
_
.
find
(
tagList
,
{
name
:
$scope
.
target
.
metric
});
if
(
!
_
.
isEmpty
(
result
))
{
return
_
.
keys
(
result
.
tags
);
}
}
$scope
.
datasource
.
_performTagSuggestQuery
(
$scope
.
target
.
metric
).
then
(
function
(
result
)
{
if
(
!
_
.
isEmpty
(
result
))
{
tagList
.
push
(
result
);
callback
(
_
.
keys
(
result
.
tags
));
}
});
$scope
.
datasource
.
metricFindQuery
(
'tag_names('
+
$scope
.
target
.
metric
+
')'
)
.
then
(
$scope
.
getTextValues
)
.
then
(
callback
);
};
$scope
.
suggestTagValues
=
function
(
query
,
callback
)
{
if
(
!
_
.
isEmpty
(
tagList
))
{
var
result
=
_
.
find
(
tagList
,
{
name
:
$scope
.
target
.
metric
});
if
(
!
_
.
isEmpty
(
result
))
{
return
result
.
tags
[
$scope
.
target
.
currentTagKey
];
}
}
$scope
.
datasource
.
performTagSuggestQuery
(
$scope
.
target
.
metric
).
then
(
function
(
result
)
{
if
(
!
_
.
isEmpty
(
result
))
{
tagList
.
push
(
result
);
callback
(
result
.
tags
[
$scope
.
target
.
currentTagKey
]);
}
});
$scope
.
datasource
.
metricFindQuery
(
'tag_values('
+
$scope
.
target
.
metric
+
','
+
$scope
.
target
.
currentTagKey
+
')'
)
.
then
(
$scope
.
getTextValues
)
.
then
(
callback
);
};
// Filter metric by tag
...
...
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