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>
This commit is contained in:
Marcus Efraimsson
2020-01-15 12:10:02 +01:00
committed by GitHub
parent 98bbdea69d
commit 54c9b11ae8
2 changed files with 5 additions and 1 deletions

View File

@ -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,