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
5bc194e1
Commit
5bc194e1
authored
Nov 12, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
d315ff2b
874a6e86
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
5 deletions
+60
-5
pkg/api/cloudwatch/metrics.go
+10
-3
public/app/core/services/backend_srv.js
+5
-0
public/app/core/utils/rangeutil.ts
+6
-1
public/app/features/templating/partials/editor.html
+17
-0
public/app/features/templating/templateValuesSrv.js
+5
-0
public/app/plugins/datasource/cloudwatch/datasource.js
+1
-1
public/test/core/utils/rangeutil_specs.ts
+16
-0
No files found.
pkg/api/cloudwatch/metrics.go
View file @
5bc194e1
...
...
@@ -2,6 +2,7 @@ package cloudwatch
import
(
"encoding/json"
"sort"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/util"
...
...
@@ -69,8 +70,8 @@ func init() {
// Please update the region list in public/app/plugins/datasource/cloudwatch/partials/config.html
func
handleGetRegions
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
regions
:=
[]
string
{
"
us-east-1"
,
"us-west-2"
,
"us-west-1"
,
"eu-west-1"
,
"eu-central-1"
,
"ap-southeast
-1"
,
"
ap-southeast-2"
,
"ap-northeast-1"
,
"sa-east-1"
,
"cn-north-1
"
,
"
ap-northeast-1"
,
"ap-southeast-1"
,
"ap-southeast-2"
,
"cn-north
-1"
,
"
eu-central-1"
,
"eu-west-1"
,
"sa-east-1"
,
"us-east-1"
,
"us-west-1"
,
"us-west-2
"
,
}
result
:=
[]
interface
{}{}
...
...
@@ -82,8 +83,14 @@ func handleGetRegions(req *cwRequest, c *middleware.Context) {
}
func
handleGetNamespaces
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
result
:=
[]
interface
{}
{}
keys
:=
[]
string
{}
for
key
:=
range
metricsMap
{
keys
=
append
(
keys
,
key
)
}
sort
.
Sort
(
sort
.
StringSlice
(
keys
))
result
:=
[]
interface
{}{}
for
_
,
key
:=
range
keys
{
result
=
append
(
result
,
util
.
DynMap
{
"text"
:
key
,
"value"
:
key
})
}
...
...
public/app/core/services/backend_srv.js
View file @
5bc194e1
...
...
@@ -105,6 +105,11 @@ function (angular, _, coreModule, config) {
});
}
// for Prometheus
if
(
!
err
.
data
.
message
&&
_
.
isString
(
err
.
data
.
error
))
{
err
.
data
.
message
=
err
.
data
.
error
;
}
throw
err
;
});
};
...
...
public/app/core/utils/rangeutil.ts
View file @
5bc194e1
...
...
@@ -34,11 +34,12 @@ var rangeOptions = [
{
from
:
'now-15m'
,
to
:
'now'
,
display
:
'Last 15 minutes'
,
section
:
3
},
{
from
:
'now-30m'
,
to
:
'now'
,
display
:
'Last 30 minutes'
,
section
:
3
},
{
from
:
'now-1h'
,
to
:
'now'
,
display
:
'Last 1 hour'
,
section
:
3
},
{
from
:
'now-3h'
,
to
:
'now'
,
display
:
'Last 3 hours'
,
section
:
3
},
{
from
:
'now-6h'
,
to
:
'now'
,
display
:
'Last 6 hours'
,
section
:
3
},
{
from
:
'now-12h'
,
to
:
'now'
,
display
:
'Last 12 hours'
,
section
:
3
},
{
from
:
'now-24h'
,
to
:
'now'
,
display
:
'Last 24 hours'
,
section
:
3
},
{
from
:
'now-7d'
,
to
:
'now'
,
display
:
'Last 7 days'
,
section
:
3
},
{
from
:
'now-7d'
,
to
:
'now'
,
display
:
'Last 7 days'
,
section
:
0
},
{
from
:
'now-30d'
,
to
:
'now'
,
display
:
'Last 30 days'
,
section
:
0
},
{
from
:
'now-60d'
,
to
:
'now'
,
display
:
'Last 60 days'
,
section
:
0
},
{
from
:
'now-90d'
,
to
:
'now'
,
display
:
'Last 90 days'
,
section
:
0
},
...
...
@@ -133,10 +134,14 @@ _.each(rangeOptions, function (frame) {
return
from
.
fromNow
()
+
' to '
+
formatDate
(
range
.
to
);
}
if
(
range
.
to
.
toString
()
===
'now'
)
{
var
res
=
describeTextRange
(
range
.
from
);
return
res
.
display
;
}
return
range
.
from
.
toString
()
+
' to '
+
range
.
to
.
toString
();
}
export
=
{
getRelativeTimesList
:
getRelativeTimesList
,
describeTextRange
:
describeTextRange
,
...
...
public/app/features/templating/partials/editor.html
View file @
5bc194e1
...
...
@@ -146,6 +146,23 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 100px;"
>
<editor-checkbox
text=
"All value"
model=
"current.includeAll"
change=
"runQuery()"
></editor-checkbox>
</li>
<li
ng-show=
"current.includeAll"
>
<input
type=
"text"
class=
"input-xlarge tight-form-input"
style=
"width:364px"
ng-model=
'current.options[0].value'
></input>
</li>
<li
class=
"tight-form-item"
ng-show=
"current.includeAll"
>
All format
</li>
<li
ng-show=
"current.includeAll"
>
<select
class=
"input-medium tight-form-input last"
ng-model=
"current.allFormat"
ng-change=
"runQuery()"
ng-options=
"f for f in ['glob', 'wildcard', 'regex wildcard', 'regex values', 'lucene', 'pipe']"
></select>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
</div>
<div
ng-show=
"current.type === 'query'"
>
...
...
public/app/features/templating/templateValuesSrv.js
View file @
5bc194e1
...
...
@@ -115,6 +115,11 @@ function (angular, _, kbn) {
if
(
variable
.
type
===
'interval'
)
{
self
.
updateAutoInterval
(
variable
);
}
if
(
variable
.
type
===
'custom'
&&
variable
.
includeAll
)
{
self
.
addAllOption
(
variable
);
}
};
this
.
updateOptions
=
function
(
variable
)
{
...
...
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
5bc194e1
...
...
@@ -204,7 +204,7 @@ function (angular, _) {
return
this
.
performEC2DescribeInstances
(
region
,
[],
instanceIds
).
then
(
function
(
result
)
{
var
volumeIds
=
_
.
map
(
result
.
Reservations
[
0
].
Instances
[
0
].
BlockDeviceMappings
,
function
(
mapping
)
{
return
mapping
.
E
BS
.
VolumeID
;
return
mapping
.
E
bs
.
VolumeId
;
});
return
transformSuggestData
(
volumeIds
);
...
...
public/test/core/utils/rangeutil_specs.ts
View file @
5bc194e1
...
...
@@ -80,6 +80,22 @@ describe("rangeUtil", () => {
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-13h'
,
to
:
'now'
});
expect
(
text
).
to
.
be
(
'Last 13 hours'
)
});
it
(
'Date range with from and to both are in now-* format'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-6h'
,
to
:
'now-3h'
});
expect
(
text
).
to
.
be
(
'now-6h to now-3h'
)
});
it
(
'Date range with from and to both are either in now-* or now/* format'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now/d+6h'
,
to
:
'now-3h'
});
expect
(
text
).
to
.
be
(
'now/d+6h to now-3h'
)
});
it
(
'Date range with from and to both are either in now-* or now+* format'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-6h'
,
to
:
'now+1h'
});
expect
(
text
).
to
.
be
(
'now-6h to now+1h'
)
});
});
});
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