Commit 2465fcbd by Torkel Ödegaard

fix: FolderId and IsFolder when saving dashboard

parent d3858d88
...@@ -23,14 +23,12 @@ func SetRepository(rep Repository) { ...@@ -23,14 +23,12 @@ func SetRepository(rep Repository) {
} }
type SaveDashboardItem struct { type SaveDashboardItem struct {
TitleLower string OrgId int64
OrgId int64 UpdatedAt time.Time
Folder string UserId int64
UpdatedAt time.Time Message string
UserId int64 Overwrite bool
Message string Dashboard *models.Dashboard
Overwrite bool
Dashboard *models.Dashboard
} }
type DashboardRepository struct{} type DashboardRepository struct{}
...@@ -57,6 +55,8 @@ func (dr *DashboardRepository) SaveDashboard(json *SaveDashboardItem) (*models.D ...@@ -57,6 +55,8 @@ func (dr *DashboardRepository) SaveDashboard(json *SaveDashboardItem) (*models.D
OrgId: json.OrgId, OrgId: json.OrgId,
Overwrite: json.Overwrite, Overwrite: json.Overwrite,
UserId: json.UserId, UserId: json.UserId,
FolderId: dashboard.FolderId,
IsFolder: dashboard.IsFolder,
} }
if !json.UpdatedAt.IsZero() { if !json.UpdatedAt.IsZero() {
......
package dashboards package dashboards
import ( import (
"strings"
"time" "time"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
...@@ -23,11 +22,9 @@ func createDashboardJson(data *simplejson.Json, lastModified time.Time, cfg *Das ...@@ -23,11 +22,9 @@ func createDashboardJson(data *simplejson.Json, lastModified time.Time, cfg *Das
dash := &dashboards.SaveDashboardItem{} dash := &dashboards.SaveDashboardItem{}
dash.Dashboard = models.NewDashboardFromJson(data) dash.Dashboard = models.NewDashboardFromJson(data)
dash.TitleLower = strings.ToLower(dash.Dashboard.Title)
dash.UpdatedAt = lastModified dash.UpdatedAt = lastModified
dash.Overwrite = true dash.Overwrite = true
dash.OrgId = cfg.OrgId dash.OrgId = cfg.OrgId
dash.Folder = cfg.Folder
dash.Dashboard.Data.Set("editable", cfg.Editable) dash.Dashboard.Data.Set("editable", cfg.Editable)
if dash.Dashboard.Title == "" { if dash.Dashboard.Title == "" {
......
...@@ -9,7 +9,6 @@ export class SearchResultsCtrl { ...@@ -9,7 +9,6 @@ export class SearchResultsCtrl {
/** @ngInject */ /** @ngInject */
constructor(private $location) { constructor(private $location) {
} }
toggleFolderExpand(section) { toggleFolderExpand(section) {
......
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