mirror of
https://github.com/grafana/grafana.git
synced 2025-01-09 23:53:25 -06:00
get apiPlugins working again.
This commit is contained in:
parent
7a26d309b1
commit
c4a0ec844c
31
pkg/plugins/api_plugin.go
Normal file
31
pkg/plugins/api_plugin.go
Normal file
@ -0,0 +1,31 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
type ApiPluginRoute struct {
|
||||
Path string `json:"path"`
|
||||
Method string `json:"method"`
|
||||
ReqSignedIn bool `json:"reqSignedIn"`
|
||||
ReqGrafanaAdmin bool `json:"reqGrafanaAdmin"`
|
||||
ReqRole models.RoleType `json:"reqRole"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type ApiPlugin struct {
|
||||
PluginBase
|
||||
Routes []*ApiPluginRoute `json:"routes"`
|
||||
}
|
||||
|
||||
func (app *ApiPlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
||||
if err := decoder.Decode(&app); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ApiPlugins[app.Id] = app
|
||||
return nil
|
||||
}
|
@ -73,3 +73,12 @@ func NewEnabledPlugins() EnabledPlugins {
|
||||
Apps: make([]*AppPlugin, 0),
|
||||
}
|
||||
}
|
||||
|
||||
func (app *ApiPlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
||||
if err := decoder.Decode(&app); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ApiPlugins[app.Id] = app
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user