mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:53:10 +08:00
Dashboard: When saving a dashboard and another user has made changes inbetween, the user is promted with a warning if he really wants to overwrite the other's changes, Closes #718
This commit is contained in:
@ -77,14 +77,18 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) {
|
||||
err := bus.Dispatch(&cmd)
|
||||
if err != nil {
|
||||
if err == m.ErrDashboardWithSameNameExists {
|
||||
c.JsonApiErr(400, "Dashboard with the same title already exists", nil)
|
||||
c.JSON(412, util.DynMap{"status": "name-exists", "message": err.Error()})
|
||||
return
|
||||
}
|
||||
if err == m.ErrDashboardVersionMismatch {
|
||||
c.JSON(412, util.DynMap{"status": "version-mismatch", "message": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JsonApiErr(500, "Failed to save dashboard", err)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, util.DynMap{"status": "success", "slug": cmd.Result.Slug})
|
||||
c.JSON(200, util.DynMap{"status": "success", "slug": cmd.Result.Slug, "version": cmd.Result.Version})
|
||||
}
|
||||
|
||||
func GetHomeDashboard(c *middleware.Context) {
|
||||
|
Reference in New Issue
Block a user