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
bc328cbe
Commit
bc328cbe
authored
Jan 09, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(plugins): upgraded Cloudwatch to new plugin schema
parent
7ae81a21
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
99 deletions
+47
-99
public/app/plugins/datasource/cloudwatch/datasource.d.ts
+3
-0
public/app/plugins/datasource/cloudwatch/datasource.js
+24
-29
public/app/plugins/datasource/cloudwatch/module.js
+9
-1
public/app/plugins/datasource/cloudwatch/partials/edit_view.html
+0
-0
public/app/plugins/datasource/cloudwatch/plugin.json
+1
-3
public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts
+10
-10
public/app/plugins/datasource/elasticsearch/directives.js
+0
-56
No files found.
public/app/plugins/datasource/cloudwatch/datasource.d.ts
0 → 100644
View file @
bc328cbe
declare
var
Datasource
:
any
;
export
default
Datasource
;
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
bc328cbe
...
...
@@ -4,24 +4,19 @@ define([
'moment'
,
'app/core/utils/datemath'
,
'./query_ctrl'
,
'./directives'
,
],
function
(
angular
,
_
,
moment
,
dateMath
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
/** @ngInject */
function
CloudWatchDatasource
(
instanceSettings
,
$q
,
backendSrv
,
templateSrv
)
{
this
.
type
=
'cloudwatch'
;
this
.
name
=
instanceSettings
.
name
;
this
.
supportMetrics
=
true
;
this
.
proxyUrl
=
instanceSettings
.
url
;
this
.
defaultRegion
=
instanceSettings
.
jsonData
.
defaultRegion
;
module
.
factory
(
'CloudWatchDatasource'
,
function
(
$q
,
backendSrv
,
templateSrv
)
{
function
CloudWatchDatasource
(
datasource
)
{
this
.
type
=
'cloudwatch'
;
this
.
name
=
datasource
.
name
;
this
.
supportMetrics
=
true
;
this
.
proxyUrl
=
datasource
.
url
;
this
.
defaultRegion
=
datasource
.
jsonData
.
defaultRegion
;
}
CloudWatchDatasource
.
prototype
.
query
=
function
(
options
)
{
this
.
query
=
function
(
options
)
{
var
start
=
convertToCloudWatchTime
(
options
.
range
.
from
,
false
);
var
end
=
convertToCloudWatchTime
(
options
.
range
.
to
,
true
);
...
...
@@ -72,7 +67,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
performTimeSeriesQuery
=
function
(
query
,
start
,
end
)
{
this
.
performTimeSeriesQuery
=
function
(
query
,
start
,
end
)
{
return
this
.
awsRequest
({
region
:
query
.
region
,
action
:
'GetMetricStatistics'
,
...
...
@@ -88,15 +83,15 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
getRegions
=
function
()
{
this
.
getRegions
=
function
()
{
return
this
.
awsRequest
({
action
:
'__GetRegions'
});
};
CloudWatchDatasource
.
prototype
.
getNamespaces
=
function
()
{
this
.
getNamespaces
=
function
()
{
return
this
.
awsRequest
({
action
:
'__GetNamespaces'
});
};
CloudWatchDatasource
.
prototype
.
getMetrics
=
function
(
namespace
)
{
this
.
getMetrics
=
function
(
namespace
)
{
return
this
.
awsRequest
({
action
:
'__GetMetrics'
,
parameters
:
{
...
...
@@ -105,7 +100,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
getDimensionKeys
=
function
(
namespace
)
{
this
.
getDimensionKeys
=
function
(
namespace
)
{
return
this
.
awsRequest
({
action
:
'__GetDimensions'
,
parameters
:
{
...
...
@@ -114,7 +109,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
getDimensionValues
=
function
(
region
,
namespace
,
metricName
,
dimensionKey
,
filterDimensions
)
{
this
.
getDimensionValues
=
function
(
region
,
namespace
,
metricName
,
dimensionKey
,
filterDimensions
)
{
var
request
=
{
region
:
templateSrv
.
replace
(
region
),
action
:
'ListMetrics'
,
...
...
@@ -141,7 +136,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
performEC2DescribeInstances
=
function
(
region
,
filters
,
instanceIds
)
{
this
.
performEC2DescribeInstances
=
function
(
region
,
filters
,
instanceIds
)
{
return
this
.
awsRequest
({
region
:
region
,
action
:
'DescribeInstances'
,
...
...
@@ -149,7 +144,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
metricFindQuery
=
function
(
query
)
{
this
.
metricFindQuery
=
function
(
query
)
{
var
region
;
var
namespace
;
var
metricName
;
...
...
@@ -210,7 +205,7 @@ function (angular, _, moment, dateMath) {
return
$q
.
when
([]);
};
CloudWatchDatasource
.
prototype
.
performDescribeAlarmsForMetric
=
function
(
region
,
namespace
,
metricName
,
dimensions
,
statistic
,
period
)
{
this
.
performDescribeAlarmsForMetric
=
function
(
region
,
namespace
,
metricName
,
dimensions
,
statistic
,
period
)
{
return
this
.
awsRequest
({
region
:
region
,
action
:
'DescribeAlarmsForMetric'
,
...
...
@@ -218,7 +213,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
performDescribeAlarmHistory
=
function
(
region
,
alarmName
,
startDate
,
endDate
)
{
this
.
performDescribeAlarmHistory
=
function
(
region
,
alarmName
,
startDate
,
endDate
)
{
return
this
.
awsRequest
({
region
:
region
,
action
:
'DescribeAlarmHistory'
,
...
...
@@ -226,7 +221,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
annotationQuery
=
function
(
options
)
{
this
.
annotationQuery
=
function
(
options
)
{
var
annotation
=
options
.
annotation
;
var
region
=
templateSrv
.
replace
(
annotation
.
region
);
var
namespace
=
templateSrv
.
replace
(
annotation
.
namespace
);
...
...
@@ -278,7 +273,7 @@ function (angular, _, moment, dateMath) {
return
d
.
promise
;
};
CloudWatchDatasource
.
prototype
.
testDatasource
=
function
()
{
this
.
testDatasource
=
function
()
{
/* use billing metrics for test */
var
region
=
this
.
defaultRegion
;
var
namespace
=
'AWS/Billing'
;
...
...
@@ -290,7 +285,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
awsRequest
=
function
(
data
)
{
this
.
awsRequest
=
function
(
data
)
{
var
options
=
{
method
:
'POST'
,
url
:
this
.
proxyUrl
,
...
...
@@ -302,7 +297,7 @@ function (angular, _, moment, dateMath) {
});
};
CloudWatchDatasource
.
prototype
.
getDefaultRegion
=
function
()
{
this
.
getDefaultRegion
=
function
()
{
return
this
.
defaultRegion
;
};
...
...
@@ -361,7 +356,7 @@ function (angular, _, moment, dateMath) {
});
}
return
CloudWatchDatasource
;
});
}
return
CloudWatchDatasource
;
});
public/app/plugins/datasource/cloudwatch/
directives
.js
→
public/app/plugins/datasource/cloudwatch/
module
.js
View file @
bc328cbe
define
([
'angular'
,
'./datasource'
,
'./query_parameter_ctrl'
,
],
function
(
angular
)
{
function
(
angular
,
CloudWatchDatasource
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.directives'
);
...
...
@@ -28,4 +29,11 @@ function (angular) {
};
});
module
.
directive
(
'datasourceCustomSettingsViewCloudwatch'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/cloudwatch/partials/edit_view.html'
};
});
return
{
Datasource
:
CloudWatchDatasource
};
});
public/app/plugins/datasource/cloudwatch/partials/
config
.html
→
public/app/plugins/datasource/cloudwatch/partials/
edit_view
.html
View file @
bc328cbe
File moved
public/app/plugins/datasource/cloudwatch/plugin.json
View file @
bc328cbe
...
...
@@ -3,9 +3,7 @@
"name"
:
"CloudWatch"
,
"id"
:
"cloudwatch"
,
"serviceName"
:
"CloudWatchDatasource"
,
"module"
:
"app/plugins/datasource/cloudwatch/datasource"
,
"module"
:
"app/plugins/datasource/cloudwatch/module"
,
"partials"
:
{
"config"
:
"app/plugins/datasource/cloudwatch/partials/config.html"
,
...
...
public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts
View file @
bc328cbe
...
...
@@ -3,25 +3,25 @@ import "../datasource";
import
{
describe
,
beforeEach
,
it
,
sinon
,
expect
,
angularMocks
}
from
'test/lib/common'
;
import
moment
from
'moment'
;
import
helpers
from
'test/specs/helpers'
;
import
Datasource
from
"../datasource"
;
describe
(
'CloudWatchDatasource'
,
function
()
{
var
ctx
=
new
helpers
.
ServiceTestContext
();
var
instanceSettings
=
{
jsonData
:
{
defaultRegion
:
'us-east-1'
,
access
:
'proxy'
},
};
beforeEach
(
angularMocks
.
module
(
'grafana.core'
));
beforeEach
(
angularMocks
.
module
(
'grafana.services'
));
beforeEach
(
angularMocks
.
module
(
'grafana.controllers'
));
beforeEach
(
ctx
.
providePhase
([
'templateSrv'
,
'backendSrv'
]));
beforeEach
(
ctx
.
createService
(
'CloudWatchDatasource'
));
beforeEach
(
function
()
{
ctx
.
ds
=
new
ctx
.
service
({
jsonData
:
{
defaultRegion
:
'us-east-1'
,
access
:
'proxy'
}
});
});
beforeEach
(
angularMocks
.
inject
(
function
(
$q
,
$rootScope
,
$httpBackend
,
$injector
)
{
ctx
.
$q
=
$q
;
ctx
.
$httpBackend
=
$httpBackend
;
ctx
.
$rootScope
=
$rootScope
;
ctx
.
ds
=
$injector
.
instantiate
(
Datasource
,
{
instanceSettings
:
instanceSettings
});
}));
describe
(
'When performing CloudWatch query'
,
function
()
{
var
requestParams
;
...
...
public/app/plugins/datasource/elasticsearch/directives.js
deleted
100644 → 0
View file @
7ae81a21
define
([
'angular'
,
'./bucket_agg'
,
'./metric_agg'
,
],
function
(
angular
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.directives'
);
module
.
directive
(
'metricQueryEditorElasticsearch'
,
function
()
{
return
{
controller
:
'ElasticQueryCtrl'
,
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/query.editor.html'
};
});
module
.
directive
(
'metricQueryOptionsElasticsearch'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/query.options.html'
};
});
module
.
directive
(
'annotationsQueryEditorElasticsearch'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/annotations.editor.html'
};
});
module
.
directive
(
'datasourceCustomSettingsViewElasticsearch'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/config.html'
};
});
module
.
directive
(
'elasticMetricAgg'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/metric_agg.html'
,
controller
:
'ElasticMetricAggCtrl'
,
restrict
:
'E'
,
scope
:
{
target
:
"="
,
index
:
"="
,
onChange
:
"&"
,
getFields
:
"&"
,
esVersion
:
'='
}
};
});
module
.
directive
(
'elasticBucketAgg'
,
function
()
{
return
{
templateUrl
:
'app/plugins/datasource/elasticsearch/partials/bucket_agg.html'
,
controller
:
'ElasticBucketAggCtrl'
,
restrict
:
'E'
,
scope
:
{
target
:
"="
,
index
:
"="
,
onChange
:
"&"
,
getFields
:
"&"
,
}
};
});
});
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