Skip to content

Commit

Permalink
Use PATCH endpoint instead of GET + PUT in home dashboard config (#1345)
Browse files Browse the repository at this point in the history
Signed-off-by: João Henri <joao.henri.cr@gmail.com>
Co-authored-by: Hubert Stefanski <35736504+HubertStefanski@users.noreply.github.com>
  • Loading branch information
jaehnri and HVBE committed Dec 12, 2023
1 parent c2c5dd4 commit 172fa66
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
9 changes: 1 addition & 8 deletions controllers/dashboard_controller.go
Expand Up @@ -750,14 +750,7 @@ func (r *GrafanaDashboardReconciler) UpdateHomeDashboard(ctx context.Context, gr
return err
}

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)
_, err = grafanaClient.UpdateOrgPreferences(grapi.Preferences{HomeDashboardUID: uid})
if err != nil {
r.Log.Error(err, "unable to update the home dashboard", "namespace", dashboard.Namespace, "name", dashboard.Name)
return err
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -9,7 +9,7 @@ require (
github.com/blang/semver v3.5.1+incompatible
github.com/go-logr/logr v1.3.0
github.com/google/go-jsonnet v0.20.0
github.com/grafana/grafana-api-golang-client v0.26.0
github.com/grafana/grafana-api-golang-client v0.27.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.30.0
github.com/openshift/api v3.9.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -72,8 +72,8 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJY
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grafana/grafana-api-golang-client v0.26.0 h1:Eu2YsfUezYngy8ifvmLybgluIcn/2IS9u1xkzuYstEM=
github.com/grafana/grafana-api-golang-client v0.26.0/go.mod h1:uNLZEmgKtTjHBtCQMwNn3qsx2mpMb8zU+7T4Xv3NR9Y=
github.com/grafana/grafana-api-golang-client v0.27.0 h1:zIwMXcbCB4n588i3O2N6HfNcQogCNTd/vPkEXTr7zX8=
github.com/grafana/grafana-api-golang-client v0.27.0/go.mod h1:uNLZEmgKtTjHBtCQMwNn3qsx2mpMb8zU+7T4Xv3NR9Y=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down

0 comments on commit 172fa66

Please sign in to comment.