models.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package plugins
  2. import (
  3. "encoding/json"
  4. )
  5. type PluginLoader interface {
  6. Load(decoder *json.Decoder, pluginDir string) error
  7. }
  8. type PluginBase struct {
  9. Type string `json:"type"`
  10. Name string `json:"name"`
  11. Id string `json:"id"`
  12. Info PluginInfo `json:"info"`
  13. IncludedInAppId string `json:"-"`
  14. PluginDir string `json:"-"`
  15. }
  16. type PluginInfo struct {
  17. Author PluginInfoLink `json:"author"`
  18. Description string `json:"description"`
  19. Links []PluginInfoLink `json:"links"`
  20. Logos PluginLogos `json:"logos"`
  21. Version string `json:"version"`
  22. Updated string `json:"updated"`
  23. }
  24. type PluginInfoLink struct {
  25. Name string `json:"name"`
  26. Url string `json:"url"`
  27. }
  28. type PluginLogos struct {
  29. Small string `json:"small"`
  30. Large string `json:"large"`
  31. }
  32. type PluginStaticRoute struct {
  33. Directory string
  34. PluginId string
  35. }
  36. type EnabledPlugins struct {
  37. Panels []*PanelPlugin
  38. DataSources map[string]*DataSourcePlugin
  39. ApiList []*ApiPlugin
  40. Apps []*AppPlugin
  41. }
  42. func NewEnabledPlugins() EnabledPlugins {
  43. return EnabledPlugins{
  44. Panels: make([]*PanelPlugin, 0),
  45. DataSources: make(map[string]*DataSourcePlugin),
  46. ApiList: make([]*ApiPlugin, 0),
  47. Apps: make([]*AppPlugin, 0),
  48. }
  49. }