grafana/pkg/plugins/models.go
woodsaj f953033ba7 add support for screenshots in plugins.
Allow plugin creators to include screenshots of their plugin
in action. Primarily for use in Grafana.net info pages.
2016-02-09 22:36:42 +08:00

64 lines
1.4 KiB
Go

package plugins
import (
"encoding/json"
)
type PluginLoader interface {
Load(decoder *json.Decoder, pluginDir string) error
}
type PluginBase struct {
Type string `json:"type"`
Name string `json:"name"`
Id string `json:"id"`
Info PluginInfo `json:"info"`
IncludedInAppId string `json:"-"`
PluginDir string `json:"-"`
}
type PluginInfo struct {
Author PluginInfoLink `json:"author"`
Description string `json:"description"`
Links []PluginInfoLink `json:"links"`
Logos PluginLogos `json:"logos"`
Screenshots []PluginScreenshots `json:"screenshots"`
Version string `json:"version"`
Updated string `json:"updated"`
}
type PluginInfoLink struct {
Name string `json:"name"`
Url string `json:"url"`
}
type PluginLogos struct {
Small string `json:"small"`
Large string `json:"large"`
}
type PluginScreenshots struct {
Path string `json:"path"`
Name string `json:"name"`
}
type PluginStaticRoute struct {
Directory string
PluginId string
}
type EnabledPlugins struct {
Panels []*PanelPlugin
DataSources map[string]*DataSourcePlugin
Apps []*AppPlugin
}
func NewEnabledPlugins() EnabledPlugins {
return EnabledPlugins{
Panels: make([]*PanelPlugin, 0),
DataSources: make(map[string]*DataSourcePlugin),
Apps: make([]*AppPlugin, 0),
}
}