dashboard folder search fix

This commit is contained in:
Torkel Ödegaard
2017-06-23 16:00:26 -04:00
parent 456225365f
commit fc69d59cae
19 changed files with 146 additions and 254 deletions

View File

@ -88,13 +88,13 @@ func GetDashboard(c *middleware.Context) Response {
Version: dash.Version,
HasAcl: dash.HasAcl,
IsFolder: dash.IsFolder,
FolderId: dash.ParentId,
FolderId: dash.FolderId,
FolderTitle: "Root",
}
// lookup folder title
if dash.ParentId > 0 {
query := m.GetDashboardQuery{Id: dash.ParentId, OrgId: c.OrgId}
if dash.FolderId > 0 {
query := m.GetDashboardQuery{Id: dash.FolderId, OrgId: c.OrgId}
if err := bus.Dispatch(&query); err != nil {
return ApiError(500, "Dashboard folder could not be read", err)
}
@ -170,7 +170,7 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) Response {
return dashboardGuardianResponse(err)
}
if dash.IsFolder && dash.ParentId > 0 {
if dash.IsFolder && dash.FolderId > 0 {
return ApiError(400, m.ErrDashboardFolderCannotHaveParent.Error(), nil)
}