mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 03:02:44 +08:00
ref: remove alias check - moved to gcom (#95955)
This commit is contained in:
@ -144,26 +144,8 @@ func ReadPluginJSON(reader io.Reader) (JSONData, error) {
|
|||||||
return JSONData{}, err
|
return JSONData{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hardcoded changes
|
if plugin.ID == "grafana-piechart-panel" {
|
||||||
switch plugin.ID {
|
|
||||||
case "grafana-piechart-panel":
|
|
||||||
plugin.Name = "Pie Chart (old)"
|
plugin.Name = "Pie Chart (old)"
|
||||||
case "grafana-pyroscope-datasource":
|
|
||||||
fallthrough
|
|
||||||
case "grafana-testdata-datasource":
|
|
||||||
fallthrough
|
|
||||||
case "grafana-postgresql-datasource":
|
|
||||||
fallthrough
|
|
||||||
case "annolist":
|
|
||||||
fallthrough
|
|
||||||
case "debug":
|
|
||||||
if len(plugin.AliasIDs) == 0 {
|
|
||||||
return plugin, fmt.Errorf("expected alias to be set")
|
|
||||||
}
|
|
||||||
default: // TODO: when gcom validates the alias, this condition can be removed
|
|
||||||
if len(plugin.AliasIDs) > 0 {
|
|
||||||
return plugin, ErrUnsupportedAlias
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(plugin.Dependencies.Plugins) == 0 {
|
if len(plugin.Dependencies.Plugins) == 0 {
|
||||||
|
@ -159,24 +159,6 @@ func Test_ReadPluginJSON(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "do not allow alias except for our hardcoded set",
|
|
||||||
pluginJSON: func(t *testing.T) io.ReadCloser {
|
|
||||||
pJSON := `{
|
|
||||||
"id": "my-custom-app",
|
|
||||||
"type": "app",
|
|
||||||
"aliasIDs": ["phlare"]
|
|
||||||
}`
|
|
||||||
return io.NopCloser(strings.NewReader(pJSON))
|
|
||||||
},
|
|
||||||
err: ErrUnsupportedAlias,
|
|
||||||
expected: JSONData{
|
|
||||||
ID: "my-custom-app",
|
|
||||||
AliasIDs: []string{"phlare"}, // Hardcoded from the parser
|
|
||||||
Type: "app",
|
|
||||||
Dependencies: Dependencies{},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "can read the latest versions of extensions information (v2)",
|
name: "can read the latest versions of extensions information (v2)",
|
||||||
pluginJSON: func(t *testing.T) io.ReadCloser {
|
pluginJSON: func(t *testing.T) io.ReadCloser {
|
||||||
|
Reference in New Issue
Block a user