K8s/Dashboards: Pass the legacy internal ID into labels (#98311)
--------- Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com> Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
This commit is contained in:
co-authored by
Stephanie Hingtgen
Todd Treece
parent
54333473f7
commit
1a46039037
@@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
"github.com/grafana/authlib/claims"
|
||||
@@ -407,6 +408,15 @@ func (a *dashboardSqlAccess) SaveDashboard(ctx context.Context, orgId int64, das
|
||||
created = (out.Created.Unix() == out.Updated.Unix()) // and now?
|
||||
}
|
||||
dash, _, err = a.GetDashboard(ctx, orgId, out.UID, 0)
|
||||
|
||||
// stash the raw value in context (if requested)
|
||||
access := GetLegacyAccess(ctx)
|
||||
if access != nil {
|
||||
id, ok, _ := unstructured.NestedInt64(dash.Spec.Object, "id")
|
||||
if ok {
|
||||
access.DashboardID = id
|
||||
}
|
||||
}
|
||||
return dash, created, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user