mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 21:52:14 +08:00
feat(plugins): major improvement in plugins golang code
This commit is contained in:
25
pkg/plugins/datasource_plugin.go
Normal file
25
pkg/plugins/datasource_plugin.go
Normal file
@ -0,0 +1,25 @@
|
||||
package plugins
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type DataSourcePlugin struct {
|
||||
FrontendPluginBase
|
||||
DefaultMatchFormat string `json:"defaultMatchFormat"`
|
||||
Annotations bool `json:"annotations"`
|
||||
Metrics bool `json:"metrics"`
|
||||
BuiltIn bool `json:"builtIn"`
|
||||
Mixed bool `json:"mixed"`
|
||||
App string `json:"app"`
|
||||
}
|
||||
|
||||
func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
||||
if err := decoder.Decode(&p); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p.PluginDir = pluginDir
|
||||
p.initFrontendPlugin()
|
||||
DataSources[p.Id] = p
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user