sort namespaces by alphabetical order

This commit is contained in:
Mitsuhiro Tanda 2015-11-11 14:15:20 +09:00
parent a7deca1df5
commit 02a37d670c

View File

@ -2,6 +2,7 @@ package cloudwatch
import (
"encoding/json"
"sort"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/util"
@ -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})
}