diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index 1357fccb127..813dc9d0b89 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -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}) } diff --git a/public/app/core/services/backend_srv.js b/public/app/core/services/backend_srv.js index 43b5193e66e..5d6ce8e0fe4 100644 --- a/public/app/core/services/backend_srv.js +++ b/public/app/core/services/backend_srv.js @@ -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; }); }; diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index 1e64fcc0061..9e44a50c81f 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -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,8 +134,12 @@ _.each(rangeOptions, function (frame) { return from.fromNow() + ' to ' + formatDate(range.to); } - var res = describeTextRange(range.from); - return res.display; + if (range.to.toString() === 'now') { + var res = describeTextRange(range.from); + return res.display; + } + + return range.from.toString() + ' to ' + range.to.toString(); } export = { diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index 63ecd00adcf..133886971bd 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -146,6 +146,23 @@
+