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
7d16307d
Commit
7d16307d
authored
Oct 28, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse string date format
parent
1626982a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
public/app/plugins/datasource/cloudwatch/datasource.js
+10
-6
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
7d16307d
...
@@ -2,10 +2,11 @@ define([
...
@@ -2,10 +2,11 @@ define([
'angular'
,
'angular'
,
'lodash'
,
'lodash'
,
'moment'
,
'moment'
,
'app/core/utils/datemath'
,
'./query_ctrl'
,
'./query_ctrl'
,
'./directives'
,
'./directives'
,
],
],
function
(
angular
,
_
)
{
function
(
angular
,
_
,
moment
,
dateMath
)
{
'use strict'
;
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
var
module
=
angular
.
module
(
'grafana.services'
);
...
@@ -21,8 +22,8 @@ function (angular, _) {
...
@@ -21,8 +22,8 @@ function (angular, _) {
}
}
CloudWatchDatasource
.
prototype
.
query
=
function
(
options
)
{
CloudWatchDatasource
.
prototype
.
query
=
function
(
options
)
{
var
start
=
convertToCloudWatchTime
(
options
.
range
.
from
);
var
start
=
convertToCloudWatchTime
(
options
.
range
.
from
,
false
);
var
end
=
convertToCloudWatchTime
(
options
.
range
.
to
);
var
end
=
convertToCloudWatchTime
(
options
.
range
.
to
,
true
);
var
queries
=
[];
var
queries
=
[];
options
=
angular
.
copy
(
options
);
options
=
angular
.
copy
(
options
);
...
@@ -253,8 +254,8 @@ function (angular, _) {
...
@@ -253,8 +254,8 @@ function (angular, _) {
this
.
performDescribeAlarmsForMetric
(
region
,
namespace
,
metricName
,
dimensions
,
statistic
,
period
).
then
(
function
(
alarms
)
{
this
.
performDescribeAlarmsForMetric
(
region
,
namespace
,
metricName
,
dimensions
,
statistic
,
period
).
then
(
function
(
alarms
)
{
var
eventList
=
[];
var
eventList
=
[];
var
start
=
convertToCloudWatchTime
(
range
.
from
);
var
start
=
convertToCloudWatchTime
(
range
.
from
,
false
);
var
end
=
convertToCloudWatchTime
(
range
.
to
);
var
end
=
convertToCloudWatchTime
(
range
.
to
,
true
);
_
.
each
(
alarms
.
MetricAlarms
,
function
(
alarm
)
{
_
.
each
(
alarms
.
MetricAlarms
,
function
(
alarm
)
{
self
.
performDescribeAlarmHistory
(
region
,
alarm
.
AlarmName
,
start
,
end
).
then
(
function
(
history
)
{
self
.
performDescribeAlarmHistory
(
region
,
alarm
.
AlarmName
,
start
,
end
).
then
(
function
(
history
)
{
_
.
each
(
history
.
AlarmHistoryItems
,
function
(
h
)
{
_
.
each
(
history
.
AlarmHistoryItems
,
function
(
h
)
{
...
@@ -344,7 +345,10 @@ function (angular, _) {
...
@@ -344,7 +345,10 @@ function (angular, _) {
});
});
}
}
function
convertToCloudWatchTime
(
date
)
{
function
convertToCloudWatchTime
(
date
,
roundUp
)
{
if
(
_
.
isString
(
date
))
{
date
=
dateMath
.
parse
(
date
,
roundUp
);
}
return
Math
.
round
(
date
.
valueOf
()
/
1000
);
return
Math
.
round
(
date
.
valueOf
()
/
1000
);
}
}
...
...
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