app_plugin.go 745 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package plugins
  2. import (
  3. "encoding/json"
  4. "github.com/grafana/grafana/pkg/models"
  5. )
  6. type AppPluginPage struct {
  7. Text string `json:"text"`
  8. Icon string `json:"icon"`
  9. Url string `json:"url"`
  10. ReqRole models.RoleType `json:"reqRole"`
  11. }
  12. type AppPluginCss struct {
  13. Light string `json:"light"`
  14. Dark string `json:"dark"`
  15. }
  16. type AppPlugin struct {
  17. FrontendPluginBase
  18. Css *AppPluginCss `json:"css"`
  19. Page *AppPluginPage `json:"page"`
  20. Pinned bool `json:"-"`
  21. Enabled bool `json:"-"`
  22. }
  23. func (p *AppPlugin) Load(decoder *json.Decoder, pluginDir string) error {
  24. if err := decoder.Decode(&p); err != nil {
  25. return err
  26. }
  27. p.PluginDir = pluginDir
  28. p.initFrontendPlugin()
  29. Apps[p.Id] = p
  30. return nil
  31. }