mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 11:52:28 +08:00
Plugins: Standardize Golang enum naming convention (#69449)
* standardize enum pattern * fix up
This commit is contained in:
@ -101,11 +101,11 @@ func (p PluginDTO) Base() string {
|
||||
}
|
||||
|
||||
func (p PluginDTO) IsApp() bool {
|
||||
return p.Type == App
|
||||
return p.Type == TypeApp
|
||||
}
|
||||
|
||||
func (p PluginDTO) IsCorePlugin() bool {
|
||||
return p.Class == Core
|
||||
return p.Class == ClassCore
|
||||
}
|
||||
|
||||
// JSONData represents the plugin's plugin.json
|
||||
@ -459,35 +459,35 @@ func (p *Plugin) StaticRoute() *StaticRoute {
|
||||
}
|
||||
|
||||
func (p *Plugin) IsRenderer() bool {
|
||||
return p.Type == Renderer
|
||||
return p.Type == TypeRenderer
|
||||
}
|
||||
|
||||
func (p *Plugin) IsSecretsManager() bool {
|
||||
return p.Type == SecretsManager
|
||||
return p.Type == TypeSecretsManager
|
||||
}
|
||||
|
||||
func (p *Plugin) IsApp() bool {
|
||||
return p.Type == App
|
||||
return p.Type == TypeApp
|
||||
}
|
||||
|
||||
func (p *Plugin) IsCorePlugin() bool {
|
||||
return p.Class == Core
|
||||
return p.Class == ClassCore
|
||||
}
|
||||
|
||||
func (p *Plugin) IsBundledPlugin() bool {
|
||||
return p.Class == Bundled
|
||||
return p.Class == ClassBundled
|
||||
}
|
||||
|
||||
func (p *Plugin) IsExternalPlugin() bool {
|
||||
return p.Class == External
|
||||
return p.Class == ClassExternal
|
||||
}
|
||||
|
||||
type Class string
|
||||
|
||||
const (
|
||||
Core Class = "core"
|
||||
Bundled Class = "bundled"
|
||||
External Class = "external"
|
||||
ClassCore Class = "core"
|
||||
ClassBundled Class = "bundled"
|
||||
ClassExternal Class = "external"
|
||||
)
|
||||
|
||||
func (c Class) String() string {
|
||||
@ -495,26 +495,26 @@ func (c Class) String() string {
|
||||
}
|
||||
|
||||
var PluginTypes = []Type{
|
||||
DataSource,
|
||||
Panel,
|
||||
App,
|
||||
Renderer,
|
||||
SecretsManager,
|
||||
TypeDataSource,
|
||||
TypePanel,
|
||||
TypeApp,
|
||||
TypeRenderer,
|
||||
TypeSecretsManager,
|
||||
}
|
||||
|
||||
type Type string
|
||||
|
||||
const (
|
||||
DataSource Type = "datasource"
|
||||
Panel Type = "panel"
|
||||
App Type = "app"
|
||||
Renderer Type = "renderer"
|
||||
SecretsManager Type = "secretsmanager"
|
||||
TypeDataSource Type = "datasource"
|
||||
TypePanel Type = "panel"
|
||||
TypeApp Type = "app"
|
||||
TypeRenderer Type = "renderer"
|
||||
TypeSecretsManager Type = "secretsmanager"
|
||||
)
|
||||
|
||||
func (pt Type) IsValid() bool {
|
||||
switch pt {
|
||||
case DataSource, Panel, App, Renderer, SecretsManager:
|
||||
case TypeDataSource, TypePanel, TypeApp, TypeRenderer, TypeSecretsManager:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
Reference in New Issue
Block a user