Skip to content

Commit

Permalink
wip: Use PUT endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehnri committed Nov 7, 2023
1 parent 9b6cb4e commit 5c92e2e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions controllers/dashboard_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,14 @@ func (r *GrafanaDashboardReconciler) UpdateHomeDashboard(ctx context.Context, gr
return err
}

_, err = grafanaClient.UpdateOrgPreferences(grapi.Preferences{
Theme: grafana.Spec.Preferences.Theme,
HomeDashboardUID: uid,
})
p, err := grafanaClient.OrgPreferences()
if err != nil {
r.Log.Error(err, "unable to fetch org preferences", "namespace", dashboard.Namespace, "name", dashboard.Name)
return err
}

p.HomeDashboardUID = uid
_, err = grafanaClient.UpdateAllOrgPreferences(p)
if err != nil {
r.Log.Error(err, "unable to update the home dashboard", "namespace", dashboard.Namespace, "name", dashboard.Name)
return err
Expand Down

0 comments on commit 5c92e2e

Please sign in to comment.