mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Import: fix dashboard imports with expressions (#43630)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"regexp"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/expr"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
)
|
||||
|
||||
@@ -47,6 +48,13 @@ func (e *DashTemplateEvaluator) Eval() (*simplejson.Json, error) {
|
||||
inputType := inputDefJson.Get("type").MustString()
|
||||
input := e.findInput(inputName, inputType)
|
||||
|
||||
// force expressions value to `__expr__`
|
||||
if inputDefJson.Get("pluginId").MustString() == expr.DatasourceType {
|
||||
input = &plugins.ImportDashboardInput{
|
||||
Value: expr.DatasourceType,
|
||||
}
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
return nil, &DashboardInputMissingError{VariableName: inputName}
|
||||
}
|
||||
|
Reference in New Issue
Block a user