panel_plugin.go 454 B

12345678910111213141516171819202122232425
  1. package plugins
  2. import "encoding/json"
  3. type PanelPlugin struct {
  4. FrontendPluginBase
  5. DataFormats []string `json:"dataFormats"`
  6. }
  7. func (p *PanelPlugin) Load(decoder *json.Decoder, pluginDir string) error {
  8. if err := decoder.Decode(&p); err != nil {
  9. return err
  10. }
  11. if err := p.registerPlugin(pluginDir); err != nil {
  12. return err
  13. }
  14. if p.DataFormats == nil {
  15. p.DataFormats = []string{"time_series", "table"}
  16. }
  17. Panels[p.Id] = p
  18. return nil
  19. }