Plugins: Remove unused funcs and re-use enum types (#63813)

plugins tidy
This commit is contained in:
Will Browne 2023-02-27 18:03:55 +00:00 committed by GitHub
parent 8484d0c4ef
commit 25b3abece9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ package plugins
import (
"context"
"encoding/json"
"errors"
"fmt"
"io/fs"
"os"
@ -20,7 +21,7 @@ import (
"github.com/grafana/grafana/pkg/util"
)
var ErrFileNotExist = fmt.Errorf("file does not exist")
var ErrFileNotExist = errors.New("file does not exist")
type Plugin struct {
JSONData
@ -90,14 +91,6 @@ func (p PluginDTO) IsCorePlugin() bool {
return p.Class == Core
}
func (p PluginDTO) IsExternalPlugin() bool {
return p.Class == External
}
func (p PluginDTO) IsSecretsManager() bool {
return p.JSONData.Type == SecretsManager
}
func (p PluginDTO) File(name string) (fs.File, error) {
cleanPath, err := util.CleanRelativePath(name)
if err != nil {
@ -403,23 +396,15 @@ func (p *Plugin) StaticRoute() *StaticRoute {
}
func (p *Plugin) IsRenderer() bool {
return p.Type == "renderer"
return p.Type == Renderer
}
func (p *Plugin) IsSecretsManager() bool {
return p.Type == "secretsmanager"
}
func (p *Plugin) IsDataSource() bool {
return p.Type == "datasource"
}
func (p *Plugin) IsPanel() bool {
return p.Type == "panel"
return p.Type == SecretsManager
}
func (p *Plugin) IsApp() bool {
return p.Type == "app"
return p.Type == App
}
func (p *Plugin) IsCorePlugin() bool {