Commit 54c9b11a by Marcus Efraimsson Committed by GitHub

Fix importing plugin dashboards (#21501)

#21350 introduced a bug regarding import of plugin dashboards. 
This should fix this and add custom validation if not importing 
plugin dashboard and dashboard property is missing.

Ref #21350

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
parent 98bbdea6
......@@ -56,7 +56,7 @@ type ImportDashboardCommand struct {
PluginId string `json:"pluginId"`
Path string `json:"path"`
Overwrite bool `json:"overwrite"`
Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
Dashboard *simplejson.Json `json:"dashboard"`
Inputs []plugins.ImportDashboardInput `json:"inputs"`
FolderId int64 `json:"folderId"`
}
......@@ -179,6 +179,10 @@ func GetPluginMarkdown(c *m.ReqContext) Response {
}
func ImportDashboard(c *m.ReqContext, apiCmd dtos.ImportDashboardCommand) Response {
if apiCmd.PluginId == "" && apiCmd.Dashboard == nil {
return Error(422, "Dashboard must be set", nil)
}
cmd := plugins.ImportDashboardCommand{
OrgId: c.OrgId,
User: c.SignedInUser,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment