2015-11-19 05:55:13 -06:00
|
|
|
package plugins
|
|
|
|
|
2015-12-21 10:23:24 -06:00
|
|
|
import (
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
|
|
)
|
2015-11-19 05:55:13 -06:00
|
|
|
|
|
|
|
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-12-21 16:09:27 -06:00
|
|
|
PublicContent *PublicContent `json:"public"`
|
2015-11-21 06:46:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type PanelPlugin struct {
|
2015-12-21 16:09:27 -06:00
|
|
|
Type string `json:"type"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Module string `json:"module"`
|
|
|
|
PublicContent *PublicContent `json:"public"`
|
|
|
|
App string `json:"app"`
|
2015-11-19 09:50:17 -06:00
|
|
|
}
|
|
|
|
|
2015-12-21 16:09:27 -06:00
|
|
|
type PublicContent struct {
|
|
|
|
UrlFragment string `json:"urlFragment"`
|
|
|
|
Dir string `json:"dir"`
|
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-21 16:09:27 -06:00
|
|
|
type AppPluginPage struct {
|
2015-11-27 02:27:14 -06:00
|
|
|
Text string `json:"text"`
|
|
|
|
Icon string `json:"icon"`
|
2015-12-22 04:37:44 -06:00
|
|
|
Url string `json:"url"`
|
2015-11-27 02:27:14 -06:00
|
|
|
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 {
|
2015-12-21 16:09:27 -06:00
|
|
|
Type string `json:"type"`
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
Pinned bool `json:"pinned"`
|
|
|
|
Module string `json:"module"`
|
|
|
|
Css *AppPluginCss `json:"css"`
|
|
|
|
Page *AppPluginPage `json:"page"`
|
|
|
|
PublicContent *PublicContent `json:"public"`
|
2015-12-03 01:52:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type EnabledPlugins struct {
|
2015-12-21 16:09:27 -06:00
|
|
|
Panels []*PanelPlugin
|
|
|
|
DataSources map[string]*DataSourcePlugin
|
|
|
|
ApiList []*ApiPlugin
|
|
|
|
Apps []*AppPlugin
|
2015-12-03 01:52:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewEnabledPlugins() EnabledPlugins {
|
|
|
|
return EnabledPlugins{
|
2015-12-21 16:09:27 -06:00
|
|
|
Panels: make([]*PanelPlugin, 0),
|
|
|
|
DataSources: make(map[string]*DataSourcePlugin),
|
|
|
|
ApiList: make([]*ApiPlugin, 0),
|
|
|
|
Apps: make([]*AppPlugin, 0),
|
2015-12-03 01:52:37 -06:00
|
|
|
}
|
|
|
|
}
|