Dashboards: Use home dashboard from org again (#48244)

* Dashboards: Use home dashboard from org again

* Set homeDashboardID

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
Emil Tullstedt 2022-04-26 11:46:26 +02:00 committed by GitHub
parent c0ee94a04d
commit fc0346fe5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -409,7 +409,7 @@ func (hs *HTTPServer) postDashboard(c *models.ReqContext, cmd models.SaveDashboa
// GetHomeDashboard returns the home dashboard.
func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) response.Response {
prefsQuery := pref.GetPreferenceWithDefaultsQuery{UserID: c.SignedInUser.UserId}
prefsQuery := pref.GetPreferenceWithDefaultsQuery{OrgID: c.OrgId, UserID: c.SignedInUser.UserId}
homePage := hs.Cfg.HomePage
preference, err := hs.preferenceService.GetWithDefaults(c.Req.Context(), &prefsQuery)

View File

@ -100,12 +100,14 @@ func (s *Service) Save(ctx context.Context, cmd *pref.SavePreferenceCommand) err
}
return err
}
preference.Timezone = cmd.Timezone
preference.WeekStart = cmd.WeekStart
preference.Theme = cmd.Theme
preference.Updated = time.Now()
preference.Version += 1
preference.JSONData = &pref.PreferenceJSONData{}
preference.HomeDashboardID = cmd.HomeDashboardID
if cmd.Navbar != nil {
preference.JSONData.Navbar = *cmd.Navbar