added setting top hide plugins in alpha state

This commit is contained in:
Torkel Ödegaard
2018-10-09 17:47:43 +02:00
parent d2bdf8cff1
commit 565edc1ed3
14 changed files with 99 additions and 85 deletions
+7 -3
View File
@@ -11,7 +11,7 @@ import (
"github.com/grafana/grafana/pkg/util"
)
func getFrontendSettingsMap(c *m.ReqContext) (map[string]interface{}, error) {
func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interface{}, error) {
orgDataSources := make([]*m.DataSource, 0)
if c.OrgId != 0 {
@@ -120,6 +120,10 @@ func getFrontendSettingsMap(c *m.ReqContext) (map[string]interface{}, error) {
panels := map[string]interface{}{}
for _, panel := range enabledPlugins.Panels {
if panel.State == "alpha" && !hs.Cfg.EnableAlphaPanels {
continue
}
panels[panel.Id] = map[string]interface{}{
"module": panel.Module,
"baseUrl": panel.BaseUrl,
@@ -183,8 +187,8 @@ func getPanelSort(id string) int {
return sort
}
func GetFrontendSettings(c *m.ReqContext) {
settings, err := getFrontendSettingsMap(c)
func (hs *HTTPServer) GetFrontendSettings(c *m.ReqContext) {
settings, err := hs.getFrontendSettingsMap(c)
if err != nil {
c.JsonApiErr(400, "Failed to get frontend settings", err)
return