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
1c6b7203
Commit
1c6b7203
authored
Aug 18, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add template variable to drop down list
parent
28ccd632
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
public/app/plugins/datasource/cloudwatch/datasource.js
+9
-0
public/app/plugins/datasource/cloudwatch/queryCtrl.js
+7
-6
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
1c6b7203
...
@@ -312,6 +312,15 @@ function (angular, _, kbn) {
...
@@ -312,6 +312,15 @@ function (angular, _, kbn) {
return
d
.
promise
;
return
d
.
promise
;
};
};
CloudWatchDatasource
.
prototype
.
getTemplateVariableNames
=
function
()
{
var
variables
=
[];
templateSrv
.
fillVariableValuesForUrl
(
variables
);
return
_
.
map
(
_
.
keys
(
variables
),
function
(
k
)
{
return
k
.
replace
(
/var-/
,
'$'
);
});
};
CloudWatchDatasource
.
prototype
.
metricFindQuery
=
function
(
query
)
{
CloudWatchDatasource
.
prototype
.
metricFindQuery
=
function
(
query
)
{
var
region
;
var
region
;
var
namespace
;
var
namespace
;
...
...
public/app/plugins/datasource/cloudwatch/queryCtrl.js
View file @
1c6b7203
...
@@ -7,7 +7,7 @@ function (angular, _) {
...
@@ -7,7 +7,7 @@ function (angular, _) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'CloudWatchQueryCtrl'
,
function
(
$scope
)
{
module
.
controller
(
'CloudWatchQueryCtrl'
,
function
(
$scope
,
templateSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
$scope
.
target
.
namespace
=
$scope
.
target
.
namespace
||
''
;
$scope
.
target
.
namespace
=
$scope
.
target
.
namespace
||
''
;
...
@@ -40,19 +40,19 @@ function (angular, _) {
...
@@ -40,19 +40,19 @@ function (angular, _) {
};
};
$scope
.
suggestRegion
=
function
(
query
,
callback
)
{
// jshint unused:false
$scope
.
suggestRegion
=
function
(
query
,
callback
)
{
// jshint unused:false
return
$scope
.
datasource
.
performSuggestRegion
(
);
return
_
.
union
(
$scope
.
datasource
.
performSuggestRegion
(),
$scope
.
datasource
.
getTemplateVariableNames
()
);
};
};
$scope
.
suggestNamespace
=
function
(
query
,
callback
)
{
// jshint unused:false
$scope
.
suggestNamespace
=
function
(
query
,
callback
)
{
// jshint unused:false
return
$scope
.
datasource
.
performSuggestNamespace
(
);
return
_
.
union
(
$scope
.
datasource
.
performSuggestNamespace
(),
$scope
.
datasource
.
getTemplateVariableNames
()
);
};
};
$scope
.
suggestMetrics
=
function
(
query
,
callback
)
{
// jshint unused:false
$scope
.
suggestMetrics
=
function
(
query
,
callback
)
{
// jshint unused:false
return
$scope
.
datasource
.
performSuggestMetrics
(
$scope
.
target
.
namespace
);
return
_
.
union
(
$scope
.
datasource
.
performSuggestMetrics
(
$scope
.
target
.
namespace
),
$scope
.
datasource
.
getTemplateVariableNames
()
);
};
};
$scope
.
suggestDimensionKeys
=
function
(
query
,
callback
)
{
// jshint unused:false
$scope
.
suggestDimensionKeys
=
function
(
query
,
callback
)
{
// jshint unused:false
return
$scope
.
datasource
.
performSuggestDimensionKeys
(
$scope
.
target
.
namespace
);
return
_
.
union
(
$scope
.
datasource
.
performSuggestDimensionKeys
(
$scope
.
target
.
namespace
),
$scope
.
datasource
.
getTemplateVariableNames
()
);
};
};
$scope
.
suggestDimensionValues
=
function
(
query
,
callback
)
{
$scope
.
suggestDimensionValues
=
function
(
query
,
callback
)
{
...
@@ -70,12 +70,13 @@ function (angular, _) {
...
@@ -70,12 +70,13 @@ function (angular, _) {
var
suggestData
=
_
.
chain
(
result
)
var
suggestData
=
_
.
chain
(
result
)
.
flatten
(
true
)
.
flatten
(
true
)
.
filter
(
function
(
dimension
)
{
.
filter
(
function
(
dimension
)
{
return
dimension
.
Name
===
$scope
.
target
.
currentDimensionKey
;
return
dimension
.
Name
===
templateSrv
.
replace
(
$scope
.
target
.
currentDimensionKey
)
;
})
})
.
pluck
(
'Value'
)
.
pluck
(
'Value'
)
.
uniq
()
.
uniq
()
.
value
();
.
value
();
suggestData
=
_
.
union
(
suggestData
,
$scope
.
datasource
.
getTemplateVariableNames
());
callback
(
suggestData
);
callback
(
suggestData
);
},
function
()
{
},
function
()
{
callback
([]);
callback
([]);
...
...
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