2015-11-19 05:55:13 -06:00
|
|
|
package plugins
|
|
|
|
|
|
|
|
import "github.com/grafana/grafana/pkg/models"
|
|
|
|
|
|
|
|
type DataSourcePlugin struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
ServiceName string `json:"serviceName"`
|
|
|
|
Module string `json:"module"`
|
|
|
|
Partials map[string]interface{} `json:"partials"`
|
|
|
|
DefaultMatchFormat string `json:"defaultMatchFormat"`
|
|
|
|
Annotations bool `json:"annotations"`
|
|
|
|
Metrics bool `json:"metrics"`
|
|
|
|
BuiltIn bool `json:"builtIn"`
|
2015-12-17 09:53:58 -06:00
|
|
|
App string `json:"app"`
|
2015-11-19 09:50:17 -06:00
|
|
|
StaticRootConfig *StaticRootConfig `json:"staticRoot"`
|
2015-11-21 06:46:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type PanelPlugin struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Module string `json:"module"`
|
|
|
|
StaticRootConfig *StaticRootConfig `json:"staticRoot"`
|
2015-12-17 09:53:58 -06:00
|
|
|
App string `json:"app"`
|
2015-11-19 09:50:17 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type StaticRootConfig struct {
|
2015-11-19 11:44:07 -06:00
|
|
|
Url string `json:"url"`
|
|
|
|
Path string `json:"path"`
|
2015-11-19 05:55:13 -06:00
|
|
|
}
|
|
|
|
|
2015-12-17 09:53:58 -06:00
|
|
|
type ApiPluginRoute struct {
|
2015-11-19 05:55:13 -06:00
|
|
|
Path string `json:"path"`
|
|
|
|
Method string `json:"method"`
|
2015-11-19 11:44:07 -06:00
|
|
|
ReqSignedIn bool `json:"reqSignedIn"`
|
|
|
|
ReqGrafanaAdmin bool `json:"reqGrafanaAdmin"`
|
|
|
|
ReqRole models.RoleType `json:"reqRole"`
|
2015-11-19 05:55:13 -06:00
|
|
|
Url string `json:"url"`
|
2015-12-17 09:53:58 -06:00
|
|
|
App string `json:"app"`
|
2015-11-19 05:55:13 -06:00
|
|
|
}
|
|
|
|
|
2015-12-17 09:53:58 -06:00
|
|
|
type AppPluginJs struct {
|
2015-12-03 09:43:55 -06:00
|
|
|
Module string `json:"module"`
|
2015-11-19 05:55:13 -06:00
|
|
|
}
|
|
|
|
|
2015-12-17 09:53:58 -06:00
|
|
|
type AppPluginNavLink struct {
|
2015-11-27 02:27:14 -06:00
|
|
|
Text string `json:"text"`
|
|
|
|
Icon string `json:"icon"`
|
|
|
|
Href string `json:"href"`
|
|
|
|
ReqRole models.RoleType `json:"reqRole"`
|
2015-11-19 05:55:13 -06:00
|
|
|
}
|
|
|
|
|
2015-12-17 09:53:58 -06:00
|
|
|
type AppPluginCss struct {
|
2015-12-02 22:29:57 -06:00
|
|
|
Light string `json:"light"`
|
|
|
|
Dark string `json:"dark"`
|
2015-11-19 05:55:13 -06:00
|
|
|
}
|
|
|
|
|
2015-12-17 09:53:58 -06:00
|
|
|
type ApiPlugin struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Routes []*ApiPluginRoute `json:"routes"`
|
|
|
|
App string `json:"app"`
|
2015-11-19 05:55:13 -06:00
|
|
|
}
|
2015-12-03 01:52:37 -06:00
|
|
|
|
2015-12-17 09:53:58 -06:00
|
|
|
type AppPlugin struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
PanelPlugins []string `json:"panelPlugins"`
|
|
|
|
DatasourcePlugins []string `json:"datasourcePlugins"`
|
|
|
|
ApiPlugins []string `json:"apiPlugins"`
|
|
|
|
Module string `json:"module"`
|
|
|
|
Js []*AppPluginJs `json:"js"`
|
|
|
|
Css []*AppPluginCss `json:"css"`
|
|
|
|
MainNavLinks []*AppPluginNavLink `json:"mainNavLinks"`
|
|
|
|
StaticRootConfig *StaticRootConfig `json:"staticRoot"`
|
2015-12-03 01:52:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type EnabledPlugins struct {
|
|
|
|
PanelPlugins []*PanelPlugin
|
|
|
|
DataSourcePlugins map[string]*DataSourcePlugin
|
2015-12-17 09:53:58 -06:00
|
|
|
ApiPlugins []*ApiPlugin
|
|
|
|
AppPlugins []*AppPlugin
|
2015-12-03 01:52:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewEnabledPlugins() EnabledPlugins {
|
|
|
|
return EnabledPlugins{
|
|
|
|
PanelPlugins: make([]*PanelPlugin, 0),
|
|
|
|
DataSourcePlugins: make(map[string]*DataSourcePlugin),
|
2015-12-17 09:53:58 -06:00
|
|
|
ApiPlugins: make([]*ApiPlugin, 0),
|
|
|
|
AppPlugins: make([]*AppPlugin, 0),
|
2015-12-03 01:52:37 -06:00
|
|
|
}
|
|
|
|
}
|