mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 14:22:46 +08:00
filter out alpha plugins in api call, fixes #14030
This commit is contained in:
@ -242,7 +242,7 @@ func (hs *HTTPServer) registerRoutes() {
|
|||||||
|
|
||||||
apiRoute.Get("/datasources/id/:name", Wrap(GetDataSourceIdByName), reqSignedIn)
|
apiRoute.Get("/datasources/id/:name", Wrap(GetDataSourceIdByName), reqSignedIn)
|
||||||
|
|
||||||
apiRoute.Get("/plugins", Wrap(GetPluginList))
|
apiRoute.Get("/plugins", Wrap(hs.GetPluginList))
|
||||||
apiRoute.Get("/plugins/:pluginId/settings", Wrap(GetPluginSettingByID))
|
apiRoute.Get("/plugins/:pluginId/settings", Wrap(GetPluginSettingByID))
|
||||||
apiRoute.Get("/plugins/:pluginId/markdown/:name", Wrap(GetPluginMarkdown))
|
apiRoute.Get("/plugins/:pluginId/markdown/:name", Wrap(GetPluginMarkdown))
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ type PluginSetting struct {
|
|||||||
JsonData map[string]interface{} `json:"jsonData"`
|
JsonData map[string]interface{} `json:"jsonData"`
|
||||||
DefaultNavUrl string `json:"defaultNavUrl"`
|
DefaultNavUrl string `json:"defaultNavUrl"`
|
||||||
|
|
||||||
LatestVersion string `json:"latestVersion"`
|
LatestVersion string `json:"latestVersion"`
|
||||||
HasUpdate bool `json:"hasUpdate"`
|
HasUpdate bool `json:"hasUpdate"`
|
||||||
State string `json:"state"`
|
State plugins.PluginState `json:"state"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PluginListItem struct {
|
type PluginListItem struct {
|
||||||
@ -34,7 +34,7 @@ type PluginListItem struct {
|
|||||||
LatestVersion string `json:"latestVersion"`
|
LatestVersion string `json:"latestVersion"`
|
||||||
HasUpdate bool `json:"hasUpdate"`
|
HasUpdate bool `json:"hasUpdate"`
|
||||||
DefaultNavUrl string `json:"defaultNavUrl"`
|
DefaultNavUrl string `json:"defaultNavUrl"`
|
||||||
State string `json:"state"`
|
State plugins.PluginState `json:"state"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PluginList []PluginListItem
|
type PluginList []PluginListItem
|
||||||
|
@ -133,7 +133,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interf
|
|||||||
|
|
||||||
panels := map[string]interface{}{}
|
panels := map[string]interface{}{}
|
||||||
for _, panel := range enabledPlugins.Panels {
|
for _, panel := range enabledPlugins.Panels {
|
||||||
if panel.State == "alpha" && !hs.Cfg.EnableAlphaPanels {
|
if panel.State == plugins.PluginStateAlpha && !hs.Cfg.EnableAlphaPanels {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetPluginList(c *m.ReqContext) Response {
|
func (hs *HTTPServer) GetPluginList(c *m.ReqContext) Response {
|
||||||
typeFilter := c.Query("type")
|
typeFilter := c.Query("type")
|
||||||
enabledFilter := c.Query("enabled")
|
enabledFilter := c.Query("enabled")
|
||||||
embeddedFilter := c.Query("embedded")
|
embeddedFilter := c.Query("embedded")
|
||||||
@ -39,6 +39,10 @@ func GetPluginList(c *m.ReqContext) Response {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pluginDef.State == plugins.PluginStateAlpha && !hs.Cfg.EnableAlphaPanels {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
listItem := dtos.PluginListItem{
|
listItem := dtos.PluginListItem{
|
||||||
Id: pluginDef.Id,
|
Id: pluginDef.Id,
|
||||||
Name: pluginDef.Name,
|
Name: pluginDef.Name,
|
||||||
|
@ -17,6 +17,13 @@ var (
|
|||||||
PluginTypeDashboard = "dashboard"
|
PluginTypeDashboard = "dashboard"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type PluginState string
|
||||||
|
|
||||||
|
var (
|
||||||
|
PluginStateAlpha PluginState = "alpha"
|
||||||
|
PluginStateBeta PluginState = "beta"
|
||||||
|
)
|
||||||
|
|
||||||
type PluginNotFoundError struct {
|
type PluginNotFoundError struct {
|
||||||
PluginId string
|
PluginId string
|
||||||
}
|
}
|
||||||
@ -39,7 +46,7 @@ type PluginBase struct {
|
|||||||
Module string `json:"module"`
|
Module string `json:"module"`
|
||||||
BaseUrl string `json:"baseUrl"`
|
BaseUrl string `json:"baseUrl"`
|
||||||
HideFromList bool `json:"hideFromList,omitempty"`
|
HideFromList bool `json:"hideFromList,omitempty"`
|
||||||
State string `json:"state,omitempty"`
|
State PluginState `json:"state,omitempty"`
|
||||||
|
|
||||||
IncludedInAppId string `json:"-"`
|
IncludedInAppId string `json:"-"`
|
||||||
PluginDir string `json:"-"`
|
PluginDir string `json:"-"`
|
||||||
|
Reference in New Issue
Block a user