Added validation to stop duplicate dashboards with same name from being saved

This commit is contained in:
Torkel Ödegaard
2015-01-05 17:04:29 +01:00
parent 4131b75562
commit 0e3f91508e
6 changed files with 88 additions and 5 deletions
+4
View File
@@ -69,6 +69,10 @@ func PostDashboard(c *middleware.Context) {
err := bus.Dispatch(&cmd)
if err != nil {
if err == m.ErrDashboardWithSameNameExists {
c.JsonApiErr(400, "Dashboard with the same title already exists", nil)
return
}
c.JsonApiErr(500, "Failed to save dashboard", err)
return
}