2016-01-10 06:34:20 +08:00
|
|
|
package plugins
|
|
|
|
|
|
|
|
import "encoding/json"
|
|
|
|
|
|
|
|
type DataSourcePlugin struct {
|
|
|
|
FrontendPluginBase
|
2017-08-22 23:14:15 +08:00
|
|
|
Annotations bool `json:"annotations"`
|
|
|
|
Metrics bool `json:"metrics"`
|
|
|
|
Alerting bool `json:"alerting"`
|
|
|
|
BuiltIn bool `json:"builtIn"`
|
|
|
|
Mixed bool `json:"mixed"`
|
|
|
|
Routes []*AppPluginRoute `json:"routes"`
|
2016-01-10 06:34:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
|
|
|
if err := decoder.Decode(&p); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2016-02-10 18:03:12 +08:00
|
|
|
if err := p.registerPlugin(pluginDir); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2016-01-10 06:34:20 +08:00
|
|
|
|
2016-02-10 18:03:12 +08:00
|
|
|
DataSources[p.Id] = p
|
2016-01-10 06:34:20 +08:00
|
|
|
return nil
|
|
|
|
}
|