Commit 02a37d67 by Mitsuhiro Tanda

sort namespaces by alphabetical order

parent a7deca1d
...@@ -2,6 +2,7 @@ package cloudwatch ...@@ -2,6 +2,7 @@ package cloudwatch
import ( import (
"encoding/json" "encoding/json"
"sort"
"github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/util" "github.com/grafana/grafana/pkg/util"
...@@ -82,8 +83,14 @@ func handleGetRegions(req *cwRequest, c *middleware.Context) { ...@@ -82,8 +83,14 @@ func handleGetRegions(req *cwRequest, c *middleware.Context) {
} }
func handleGetNamespaces(req *cwRequest, c *middleware.Context) { func handleGetNamespaces(req *cwRequest, c *middleware.Context) {
result := []interface{}{} keys := []string{}
for key := range metricsMap { 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}) result = append(result, util.DynMap{"text": key, "value": key})
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment