diff --git a/pkg/api/datasources.go b/pkg/api/datasources.go
index 0982d73e88e..21c7ccf8bed 100644
--- a/pkg/api/datasources.go
+++ b/pkg/api/datasources.go
@@ -1,8 +1,11 @@
package api
import (
+ "sort"
+
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/bus"
+ "github.com/grafana/grafana/pkg/plugins"
//"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/middleware"
m "github.com/grafana/grafana/pkg/models"
@@ -17,9 +20,10 @@ func GetDataSources(c *middleware.Context) {
return
}
- result := make([]*dtos.DataSource, len(query.Result))
- for i, ds := range query.Result {
- result[i] = &dtos.DataSource{
+ result := make(dtos.DataSourceList, 0)
+ for _, ds := range query.Result {
+
+ dsItem := dtos.DataSource{
Id: ds.Id,
OrgId: ds.OrgId,
Name: ds.Name,
@@ -32,8 +36,17 @@ func GetDataSources(c *middleware.Context) {
BasicAuth: ds.BasicAuth,
IsDefault: ds.IsDefault,
}
+
+ if plugin, exists := plugins.DataSources[ds.Type]; exists {
+ dsItem.TypeLogoUrl = plugin.Info.Logos.Small
+ } else {
+ dsItem.TypeLogoUrl = "public/img/plugin-default-logo_dark.svg"
+ }
+
+ result = append(result, dsItem)
}
+ sort.Sort(result)
c.JSON(200, result)
}
diff --git a/pkg/api/dtos/models.go b/pkg/api/dtos/models.go
index 26295dd3d3c..8c1f85c9bd1 100644
--- a/pkg/api/dtos/models.go
+++ b/pkg/api/dtos/models.go
@@ -62,6 +62,7 @@ type DataSource struct {
OrgId int64 `json:"orgId"`
Name string `json:"name"`
Type string `json:"type"`
+ TypeLogoUrl string `json:"typeLogoUrl"`
Access m.DsAccess `json:"access"`
Url string `json:"url"`
Password string `json:"password"`
@@ -75,6 +76,20 @@ type DataSource struct {
JsonData *simplejson.Json `json:"jsonData,omitempty"`
}
+type DataSourceList []DataSource
+
+func (slice DataSourceList) Len() int {
+ return len(slice)
+}
+
+func (slice DataSourceList) Less(i, j int) bool {
+ return slice[i].Name < slice[j].Name
+}
+
+func (slice DataSourceList) Swap(i, j int) {
+ slice[i], slice[j] = slice[j], slice[i]
+}
+
type MetricQueryResultDto struct {
Data []MetricQueryResultDataDto `json:"data"`
}
diff --git a/public/app/features/plugins/partials/ds_list.html b/public/app/features/plugins/partials/ds_list.html
index 940927df688..314c165a3ac 100644
--- a/public/app/features/plugins/partials/ds_list.html
+++ b/public/app/features/plugins/partials/ds_list.html
@@ -13,55 +13,79 @@
-
+
+
-
- No data sources defined
-
-
-
-
-
- | name |
- type |
- url |
- |
- |
- |
-
-
-
-
-
+
+ -
+
|
-
- {{ds.type}}
- |
-
- {{ds.url}}
- |
-
-
- default
-
- |
-
-
-
- Edit
-
- |
-
-
-
-
- |
-
-
-
+
+
+
+
+
+
+
+ No data sources defined
+
+
+
+
+ | name |
+ type |
+ url |
+ |
+ |
+ |
+
+
+
+
+ |
+
+ {{ds.name}}
+
+ |
+
+ {{ds.type}}
+ |
+
+ {{ds.url}}
+ |
+
+
+ default
+
+ |
+
+
+
+ Edit
+
+ |
+
+
+
+
+ |
+
+
+
+
+
diff --git a/public/app/features/plugins/partials/plugin_list.html b/public/app/features/plugins/partials/plugin_list.html
index aa86e9e6dd2..344dbd65fcf 100644
--- a/public/app/features/plugins/partials/plugin_list.html
+++ b/public/app/features/plugins/partials/plugin_list.html
@@ -41,7 +41,7 @@
-
{{plugin.name}}
+
{{plugin.name}}
By {{plugin.info.author.name}}
diff --git a/public/sass/components/_cards.scss b/public/sass/components/_cards.scss
index 8272de2fa3b..eb5c6875ac0 100644
--- a/public/sass/components/_cards.scss
+++ b/public/sass/components/_cards.scss
@@ -56,7 +56,10 @@
.card-item-header {
color: $text-color-weak;
+ text-transform: uppercase;
margin-bottom: $spacer;
+ font-size: $font-size-sm;
+ font-weight: bold;
}
.card-item-name {