mirror of https://github.com/grafana/grafana.git
Dashboards: Make conversion data optional (#109965)
This commit is contained in:
parent
da5209be1e
commit
27c92a6644
|
|
@ -4,7 +4,7 @@ go 1.24.6
|
|||
|
||||
require (
|
||||
github.com/grafana/grafana-app-sdk v0.40.3
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3
|
||||
k8s.io/apimachinery v0.33.3
|
||||
k8s.io/apiserver v0.33.3
|
||||
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5T
|
|||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 h1:uGoIog/wiQHI9GAxXO5TJbT0wWKH3O9HhOJW1F9c3fY=
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@ go 1.24.6
|
|||
require (
|
||||
cuelang.org/go v0.11.1
|
||||
github.com/grafana/grafana-app-sdk v0.40.3
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3
|
||||
github.com/grafana/grafana-plugin-sdk-go v0.278.0
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e
|
||||
github.com/prometheus/client_golang v1.23.0
|
||||
github.com/stretchr/testify v1.10.0
|
||||
k8s.io/apimachinery v0.33.3
|
||||
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
@ -45,7 +47,6 @@ require (
|
|||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // indirect
|
||||
github.com/grafana/otel-profiling-go v0.5.1 // indirect
|
||||
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect
|
||||
|
|
@ -129,7 +130,6 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/client-go v0.33.3 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
|||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-plugin-sdk-go v0.278.0 h1:5/rIYparLi02pofdaag8wnjspMMVNCi8cZhC4cdC3Ho=
|
||||
github.com/grafana/grafana-plugin-sdk-go v0.278.0/go.mod h1:+8NXT/XUJ/89GV6FxGQ366NZ3nU+cAXDMd0OUESF9H4=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e h1:BTKk7LHuG1kmAkucwTA7DuMbKpKvJTKrGdBmUNO4dfQ=
|
||||
|
|
@ -314,12 +314,14 @@ golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aC
|
|||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
|
||||
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
|
||||
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
|
@ -339,10 +341,13 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
||||
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
|
||||
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
|
|
@ -351,6 +356,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
|
|||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
|
||||
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ ConversionStatus: {
|
|||
// and the caller should instead fetch the stored version.
|
||||
failed: bool
|
||||
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion: string
|
||||
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
error: string
|
||||
error?: string
|
||||
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion?: string
|
||||
}
|
||||
|
||||
dashboard: {
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ type DashboardConversionStatus struct {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
Failed bool `json:"failed"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion string `json:"storedVersion"`
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
Error string `json:"error"`
|
||||
Error *string `json:"error,omitempty"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion *string `json:"storedVersion,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardConversionStatus creates a new DashboardConversionStatus object.
|
||||
|
|
|
|||
|
|
@ -236,24 +236,22 @@ func schema_pkg_apis_dashboard_v0alpha1_DashboardConversionStatus(ref common.Ref
|
|||
Format: "",
|
||||
},
|
||||
},
|
||||
"storedVersion": {
|
||||
"error": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Default: "",
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"error": {
|
||||
"storedVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Default: "",
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"failed", "storedVersion", "error"},
|
||||
Required: []string{"failed"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ type DashboardConversionStatus struct {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
Failed bool `json:"failed"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion string `json:"storedVersion"`
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
Error string `json:"error"`
|
||||
Error *string `json:"error,omitempty"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion *string `json:"storedVersion,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardConversionStatus creates a new DashboardConversionStatus object.
|
||||
|
|
|
|||
|
|
@ -229,24 +229,22 @@ func schema_pkg_apis_dashboard_v1beta1_DashboardConversionStatus(ref common.Refe
|
|||
Format: "",
|
||||
},
|
||||
},
|
||||
"storedVersion": {
|
||||
"error": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Default: "",
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"error": {
|
||||
"storedVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Default: "",
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"failed", "storedVersion", "error"},
|
||||
Required: []string{"failed"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ type DashboardConversionStatus struct {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
Failed bool `json:"failed"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion string `json:"storedVersion"`
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
Error string `json:"error"`
|
||||
Error *string `json:"error,omitempty"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion *string `json:"storedVersion,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardConversionStatus creates a new DashboardConversionStatus object.
|
||||
|
|
|
|||
|
|
@ -1210,24 +1210,22 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardConversionStatus(ref common.Ref
|
|||
Format: "",
|
||||
},
|
||||
},
|
||||
"storedVersion": {
|
||||
"error": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Default: "",
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"error": {
|
||||
"storedVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Default: "",
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"failed", "storedVersion", "error"},
|
||||
Required: []string{"failed"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ type DashboardConversionStatus struct {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
Failed bool `json:"failed"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion string `json:"storedVersion"`
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
Error string `json:"error"`
|
||||
Error *string `json:"error,omitempty"`
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
StoredVersion *string `json:"storedVersion,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardConversionStatus creates a new DashboardConversionStatus object.
|
||||
|
|
|
|||
|
|
@ -1215,24 +1215,22 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardConversionStatus(ref common.Refe
|
|||
Format: "",
|
||||
},
|
||||
},
|
||||
"storedVersion": {
|
||||
"error": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Default: "",
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"error": {
|
||||
"storedVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
Default: "",
|
||||
Description: "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"failed", "storedVersion", "error"},
|
||||
Required: []string{"failed"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ import (
|
|||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/logging"
|
||||
dashv0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
|
||||
dashv1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
|
||||
dashv2alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1"
|
||||
dashv2beta1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2beta1"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
)
|
||||
|
||||
var logger = log.New("dashboard.conversion")
|
||||
var logger = logging.DefaultLogger.With("logger", "dashboard.conversion")
|
||||
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
// v0 conversions
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis"
|
||||
dashv0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
|
||||
|
|
@ -27,7 +28,7 @@ func TestConversionMatrixExist(t *testing.T) {
|
|||
// Initialize the migrator with a test data source provider
|
||||
migration.Initialize(testutil.GetTestDataSourceProvider(), testutil.GetTestPanelProvider())
|
||||
|
||||
versions := []v1.Object{
|
||||
versions := []metav1.Object{
|
||||
&dashv0.Dashboard{Spec: common.Unstructured{Object: map[string]any{"title": "dashboardV0"}}},
|
||||
&dashv1.Dashboard{Spec: common.Unstructured{Object: map[string]any{"title": "dashboardV1"}}},
|
||||
&dashv2alpha1.Dashboard{Spec: dashv2alpha1.DashboardSpec{Title: "dashboardV2alpha1"}},
|
||||
|
|
@ -110,13 +111,13 @@ func TestDashboardConversionToAllVersions(t *testing.T) {
|
|||
require.True(t, ok, "apiVersion not found or not a string")
|
||||
|
||||
// Parse group and version from apiVersion (format: "group/version")
|
||||
parts := strings.Split(apiVersion, "/")
|
||||
require.Equal(t, 2, len(parts), "apiVersion should be in format 'group/version'")
|
||||
sourceVersion := parts[1]
|
||||
gv, err := schema.ParseGroupVersion(apiVersion)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, dashv0.GROUP, gv.Group)
|
||||
|
||||
// Create source object based on version
|
||||
var sourceDash v1.Object
|
||||
switch sourceVersion {
|
||||
var sourceDash metav1.Object
|
||||
switch gv.Version {
|
||||
case "v0alpha1":
|
||||
var dash dashv0.Dashboard
|
||||
err = json.Unmarshal(inputData, &dash)
|
||||
|
|
@ -134,7 +135,7 @@ func TestDashboardConversionToAllVersions(t *testing.T) {
|
|||
err = json.Unmarshal(inputData, &dash)
|
||||
sourceDash = &dash
|
||||
default:
|
||||
t.Fatalf("Unsupported source version: %s", sourceVersion)
|
||||
t.Fatalf("Unsupported source version: %s", gv.Version)
|
||||
}
|
||||
require.NoError(t, err, "Failed to unmarshal dashboard into typed object")
|
||||
|
||||
|
|
@ -157,22 +158,26 @@ func TestDashboardConversionToAllVersions(t *testing.T) {
|
|||
if kind.Kind == "Dashboard" {
|
||||
for _, version := range kind.Versions {
|
||||
// Skip converting to the same version
|
||||
if version.VersionName == sourceVersion {
|
||||
if version.VersionName == gv.Version {
|
||||
continue
|
||||
}
|
||||
|
||||
filename := fmt.Sprintf("%s.%s.json", originalName, version.VersionName)
|
||||
typeMeta := metav1.TypeMeta{
|
||||
APIVersion: fmt.Sprintf("%s/%s", dashv0.APIGroup, version.VersionName),
|
||||
Kind: kind.Kind, // Dashboard
|
||||
}
|
||||
|
||||
// Create target object based on version
|
||||
switch version.VersionName {
|
||||
case "v0alpha1":
|
||||
targetVersions[filename] = &dashv0.Dashboard{}
|
||||
targetVersions[filename] = &dashv0.Dashboard{TypeMeta: typeMeta}
|
||||
case "v1beta1":
|
||||
targetVersions[filename] = &dashv1.Dashboard{}
|
||||
targetVersions[filename] = &dashv1.Dashboard{TypeMeta: typeMeta}
|
||||
case "v2alpha1":
|
||||
targetVersions[filename] = &dashv2alpha1.Dashboard{}
|
||||
targetVersions[filename] = &dashv2alpha1.Dashboard{TypeMeta: typeMeta}
|
||||
case "v2beta1":
|
||||
targetVersions[filename] = &dashv2beta1.Dashboard{}
|
||||
targetVersions[filename] = &dashv2beta1.Dashboard{TypeMeta: typeMeta}
|
||||
default:
|
||||
t.Logf("Unknown version %s, skipping", version.VersionName)
|
||||
}
|
||||
|
|
@ -192,14 +197,14 @@ func TestDashboardConversionToAllVersions(t *testing.T) {
|
|||
require.NoError(t, err, "Conversion failed for %s", filename)
|
||||
|
||||
// Test the changes in the conversion result
|
||||
testConversion(t, target.(v1.Object), filename, outDir)
|
||||
testConversion(t, target.(metav1.Object), filename, outDir)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func testConversion(t *testing.T, convertedDash v1.Object, filename, outputDir string) {
|
||||
func testConversion(t *testing.T, convertedDash metav1.Object, filename, outputDir string) {
|
||||
t.Helper()
|
||||
|
||||
outPath := filepath.Join(outputDir, filename)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v0alpha1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-complete",
|
||||
"creationTimestamp": null,
|
||||
|
|
@ -13,8 +15,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-complete",
|
||||
"creationTimestamp": null,
|
||||
|
|
@ -13,8 +15,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -504,8 +504,7 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": false,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": ""
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v0alpha1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-annotations",
|
||||
"creationTimestamp": null
|
||||
|
|
@ -7,8 +9,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-annotations",
|
||||
"creationTimestamp": null
|
||||
|
|
@ -7,8 +9,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1087,8 +1087,7 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": false,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": ""
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v0alpha1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-groupby-adhoc-vars",
|
||||
"creationTimestamp": null
|
||||
|
|
@ -7,8 +9,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-groupby-adhoc-vars",
|
||||
"creationTimestamp": null
|
||||
|
|
@ -7,8 +9,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -93,8 +93,7 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": false,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": ""
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v0alpha1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-viz-config",
|
||||
"creationTimestamp": null
|
||||
|
|
@ -7,8 +9,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"kind": "Dashboard",
|
||||
"apiVersion": "dashboard.grafana.app/v1beta1",
|
||||
"metadata": {
|
||||
"name": "test-v2alpha1-viz-config",
|
||||
"creationTimestamp": null
|
||||
|
|
@ -7,8 +9,8 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": true,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": "backend conversion not yet implemented"
|
||||
"error": "backend conversion not yet implemented",
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -215,8 +215,7 @@
|
|||
"status": {
|
||||
"conversion": {
|
||||
"failed": false,
|
||||
"storedVersion": "v2alpha1",
|
||||
"error": ""
|
||||
"storedVersion": "v2alpha1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
dashv0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
|
||||
dashv1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
|
||||
|
|
@ -21,13 +22,13 @@ func Convert_V0_to_V1(in *dashv0.Dashboard, out *dashv1.Dashboard, scope convers
|
|||
|
||||
out.Status = dashv1.DashboardStatus{
|
||||
Conversion: &dashv1.DashboardConversionStatus{
|
||||
StoredVersion: dashv0.VERSION,
|
||||
StoredVersion: ptr.To(dashv0.VERSION),
|
||||
},
|
||||
}
|
||||
|
||||
if err := migration.Migrate(out.Spec.Object, schemaversion.LATEST_VERSION); err != nil {
|
||||
out.Status.Conversion.Failed = true
|
||||
out.Status.Conversion.Error = err.Error()
|
||||
out.Status.Conversion.Error = ptr.To(err.Error())
|
||||
|
||||
// Classify error type for metrics
|
||||
errorType := "conversion_error"
|
||||
|
|
@ -92,9 +93,9 @@ func Convert_V0_to_V2alpha1(in *dashv0.Dashboard, out *dashv2alpha1.Dashboard, s
|
|||
|
||||
out.Status = dashv2alpha1.DashboardStatus{
|
||||
Conversion: &dashv2alpha1.DashboardConversionStatus{
|
||||
StoredVersion: dashv0.VERSION,
|
||||
StoredVersion: ptr.To(dashv0.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -108,9 +109,9 @@ func Convert_V0_to_V2beta1(in *dashv0.Dashboard, out *dashv2beta1.Dashboard, sco
|
|||
|
||||
out.Status = dashv2beta1.DashboardStatus{
|
||||
Conversion: &dashv2beta1.DashboardConversionStatus{
|
||||
StoredVersion: dashv0.VERSION,
|
||||
StoredVersion: ptr.To(dashv0.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package conversion
|
|||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
dashv0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
|
||||
dashv1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
|
||||
|
|
@ -16,7 +17,7 @@ func Convert_V1_to_V0(in *dashv1.Dashboard, out *dashv0.Dashboard, scope convers
|
|||
|
||||
out.Status = dashv0.DashboardStatus{
|
||||
Conversion: &dashv0.DashboardConversionStatus{
|
||||
StoredVersion: dashv1.VERSION,
|
||||
StoredVersion: ptr.To(dashv1.VERSION),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -45,9 +46,9 @@ func Convert_V1_to_V2alpha1(in *dashv1.Dashboard, out *dashv2alpha1.Dashboard, s
|
|||
|
||||
out.Status = dashv2alpha1.DashboardStatus{
|
||||
Conversion: &dashv2alpha1.DashboardConversionStatus{
|
||||
StoredVersion: dashv1.VERSION,
|
||||
StoredVersion: ptr.To(dashv1.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -61,9 +62,9 @@ func Convert_V1_to_V2beta1(in *dashv1.Dashboard, out *dashv2beta1.Dashboard, sco
|
|||
|
||||
out.Status = dashv2beta1.DashboardStatus{
|
||||
Conversion: &dashv2beta1.DashboardConversionStatus{
|
||||
StoredVersion: dashv1.VERSION,
|
||||
StoredVersion: ptr.To(dashv1.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package conversion
|
|||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
dashv0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
|
||||
dashv1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
|
||||
|
|
@ -16,9 +17,9 @@ func Convert_V2alpha1_to_V0(in *dashv2alpha1.Dashboard, out *dashv0.Dashboard, s
|
|||
|
||||
out.Status = dashv0.DashboardStatus{
|
||||
Conversion: &dashv0.DashboardConversionStatus{
|
||||
StoredVersion: dashv2alpha1.VERSION,
|
||||
StoredVersion: ptr.To(dashv2alpha1.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -32,9 +33,9 @@ func Convert_V2alpha1_to_V1(in *dashv2alpha1.Dashboard, out *dashv1.Dashboard, s
|
|||
|
||||
out.Status = dashv1.DashboardStatus{
|
||||
Conversion: &dashv1.DashboardConversionStatus{
|
||||
StoredVersion: dashv2alpha1.VERSION,
|
||||
StoredVersion: ptr.To(dashv2alpha1.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -48,9 +49,9 @@ func Convert_V2alpha1_to_V2beta1(in *dashv2alpha1.Dashboard, out *dashv2beta1.Da
|
|||
if err := ConvertDashboard_V2alpha1_to_V2beta1(in, out, scope); err != nil {
|
||||
out.Status = dashv2beta1.DashboardStatus{
|
||||
Conversion: &dashv2beta1.DashboardConversionStatus{
|
||||
StoredVersion: dashv2alpha1.VERSION,
|
||||
StoredVersion: ptr.To(dashv2alpha1.VERSION),
|
||||
Failed: true,
|
||||
Error: err.Error(),
|
||||
Error: ptr.To(err.Error()),
|
||||
},
|
||||
}
|
||||
return err
|
||||
|
|
@ -59,7 +60,7 @@ func Convert_V2alpha1_to_V2beta1(in *dashv2alpha1.Dashboard, out *dashv2beta1.Da
|
|||
// Set successful conversion status
|
||||
out.Status = dashv2beta1.DashboardStatus{
|
||||
Conversion: &dashv2beta1.DashboardConversionStatus{
|
||||
StoredVersion: dashv2alpha1.VERSION,
|
||||
StoredVersion: ptr.To(dashv2alpha1.VERSION),
|
||||
Failed: false,
|
||||
},
|
||||
}
|
||||
|
|
@ -74,9 +75,9 @@ func Convert_V2beta1_to_V0(in *dashv2beta1.Dashboard, out *dashv0.Dashboard, sco
|
|||
|
||||
out.Status = dashv0.DashboardStatus{
|
||||
Conversion: &dashv0.DashboardConversionStatus{
|
||||
StoredVersion: dashv2beta1.VERSION,
|
||||
StoredVersion: ptr.To(dashv2beta1.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -90,9 +91,9 @@ func Convert_V2beta1_to_V1(in *dashv2beta1.Dashboard, out *dashv1.Dashboard, sco
|
|||
|
||||
out.Status = dashv1.DashboardStatus{
|
||||
Conversion: &dashv1.DashboardConversionStatus{
|
||||
StoredVersion: dashv2beta1.VERSION,
|
||||
StoredVersion: ptr.To(dashv2beta1.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -106,9 +107,9 @@ func Convert_V2beta1_to_V2alpha1(in *dashv2beta1.Dashboard, out *dashv2alpha1.Da
|
|||
|
||||
out.Status = dashv2alpha1.DashboardStatus{
|
||||
Conversion: &dashv2alpha1.DashboardConversionStatus{
|
||||
StoredVersion: dashv2beta1.VERSION,
|
||||
StoredVersion: ptr.To(dashv2beta1.VERSION),
|
||||
Failed: true,
|
||||
Error: "backend conversion not yet implemented",
|
||||
Error: ptr.To("backend conversion not yet implemented"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ require (
|
|||
github.com/go-test/deep v1.1.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/google/gnostic-models v0.6.9 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e h1:BTKk7LHuG1kmAkucwTA7DuMbKpKvJTKrGdBmUNO4dfQ=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e/go.mod h1:IA4SOwun8QyST9c5UNs/fN37XL6boXXDvRYFcFwbipg=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ require (
|
|||
github.com/grafana/authlib v0.0.0-20250710201142-9542f2f28d43
|
||||
github.com/grafana/grafana v0.0.0-00010101000000-000000000000
|
||||
github.com/grafana/grafana-app-sdk v0.40.3
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3
|
||||
github.com/grafana/grafana-app-sdk/plugin v0.40.3
|
||||
github.com/grafana/grafana/apps/folder v0.0.0
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0
|
||||
|
|
|
|||
|
|
@ -687,8 +687,8 @@ github.com/grafana/dskit v0.0.0-20250611075409-46f51e1ce914 h1:qcSGhr691f1mmPHwg
|
|||
github.com/grafana/dskit v0.0.0-20250611075409-46f51e1ce914/go.mod h1:OiN4P4aC6LwLzLbEupH3Ue83VfQoNMfG48rsna8jI/E=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/plugin v0.40.3 h1:uH0oFZnYOUL+OXcyhd5NVYwoM+Wa0WUXvZ2Om1M91r0=
|
||||
github.com/grafana/grafana-app-sdk/plugin v0.40.3/go.mod h1:+ylwE0P8WgPu5zURK5aDnVJpwRpuK3573rwrVV28qzQ=
|
||||
github.com/grafana/grafana-aws-sdk v1.1.0 h1:G0fvwbQmHw14c5RXPd7Gnw9ZQcgzl139LtMDoe0KhmE=
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ require (
|
|||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ require (
|
|||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ require (
|
|||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grafana/authlib v0.0.0-20250710201142-9542f2f28d43 // indirect
|
||||
github.com/grafana/dskit v0.0.0-20250611075409-46f51e1ce914 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ github.com/grafana/dskit v0.0.0-20250611075409-46f51e1ce914 h1:qcSGhr691f1mmPHwg
|
|||
github.com/grafana/dskit v0.0.0-20250611075409-46f51e1ce914/go.mod h1:OiN4P4aC6LwLzLbEupH3Ue83VfQoNMfG48rsna8jI/E=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250428110029-a8ea72012bde h1:ydSrBIOCxJQ84+JU+cyYsOLL40QeXrB7rYfsY/ezU4w=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250428110029-a8ea72012bde/go.mod h1:3MwgP0ISxGviTy3ZUJZsNz/56NNtHztMlH+gcxDt6Tw=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ require (
|
|||
github.com/go-test/deep v1.1.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/google/gnostic-models v0.6.9 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250710134100-1f3dc0533caf h1:BBGDHffvVNLoYQlXEpbXcxE0vbpq7pm/8OWF5I+UDZg=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250710134100-1f3dc0533caf/go.mod h1:eAlOam2uWhrsEZlOoAr7XZ9hbBP7SyYGYn31/aQAPs8=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ require (
|
|||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // indirect
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -96,7 +96,7 @@ require (
|
|||
github.com/grafana/gomemcache v0.0.0-20250318131618-74242eea118d // @grafana/grafana-operator-experience-squad
|
||||
github.com/grafana/grafana-api-golang-client v0.27.0 // @grafana/alerting-backend
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 // @grafana/grafana-app-platform-squad
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 // @grafana/grafana-app-platform-squad
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 // @grafana/grafana-app-platform-squad
|
||||
github.com/grafana/grafana-aws-sdk v1.1.0 // @grafana/aws-datasources
|
||||
github.com/grafana/grafana-azure-sdk-go/v2 v2.2.0 // @grafana/partner-datasources
|
||||
github.com/grafana/grafana-cloud-migration-snapshot v1.9.0 // @grafana/grafana-operator-experience-squad
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -1603,8 +1603,8 @@ github.com/grafana/grafana-api-golang-client v0.27.0 h1:zIwMXcbCB4n588i3O2N6HfNc
|
|||
github.com/grafana/grafana-api-golang-client v0.27.0/go.mod h1:uNLZEmgKtTjHBtCQMwNn3qsx2mpMb8zU+7T4Xv3NR9Y=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU=
|
||||
github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-aws-sdk v1.1.0 h1:G0fvwbQmHw14c5RXPd7Gnw9ZQcgzl139LtMDoe0KhmE=
|
||||
github.com/grafana/grafana-aws-sdk v1.1.0/go.mod h1:7e+47EdHynteYWGoT5Ere9KeOXQObsk8F0vkOLQ1tz8=
|
||||
github.com/grafana/grafana-azure-sdk-go/v2 v2.2.0 h1:0TYrkzAc3u0HX+9GK86cGrLTUAcmQfl3/LEB3tL+SOA=
|
||||
|
|
|
|||
|
|
@ -1003,8 +1003,7 @@ github.com/grafana/grafana-app-sdk/logging v0.39.0 h1:3GgN5+dUZYqq74Q+GT9/ET+yo+
|
|||
github.com/grafana/grafana-app-sdk/logging v0.39.0/go.mod h1:WhDENSnaGHtyVVwZGVnAR7YLvh2xlLDYR3D7E6h7XVk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.39.1/go.mod h1:WhDENSnaGHtyVVwZGVnAR7YLvh2xlLDYR3D7E6h7XVk=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.0/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/plugin v0.41.0 h1:ShUvGpAVzM3UxcsfwS6l/lwW4ytDeTbCQXf8w2P8Yp8=
|
||||
github.com/grafana/grafana-app-sdk/plugin v0.41.0/go.mod h1:YIhimVfAqtOp3kdhxOanaSZjypVKh/bYxf9wfFfhDm0=
|
||||
github.com/grafana/grafana-aws-sdk v0.38.2 h1:TzQD0OpWsNjtldi5G5TLDlBRk8OyDf+B5ujcoAu4Dp0=
|
||||
|
|
|
|||
|
|
@ -6,18 +6,16 @@ export interface ConversionStatus {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
failed: boolean;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion: string;
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
error: string;
|
||||
error?: string;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion?: string;
|
||||
}
|
||||
|
||||
export const defaultConversionStatus = (): ConversionStatus => ({
|
||||
failed: false,
|
||||
storedVersion: "",
|
||||
error: "",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
|
|
|
|||
|
|
@ -6,18 +6,16 @@ export interface ConversionStatus {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
failed: boolean;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion: string;
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
error: string;
|
||||
error?: string;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion?: string;
|
||||
}
|
||||
|
||||
export const defaultConversionStatus = (): ConversionStatus => ({
|
||||
failed: false,
|
||||
storedVersion: "",
|
||||
error: "",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
|
|
|
|||
|
|
@ -6,18 +6,16 @@ export interface ConversionStatus {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
failed: boolean;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion: string;
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
error: string;
|
||||
error?: string;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion?: string;
|
||||
}
|
||||
|
||||
export const defaultConversionStatus = (): ConversionStatus => ({
|
||||
failed: false,
|
||||
storedVersion: "",
|
||||
error: "",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
|
|
|
|||
|
|
@ -6,18 +6,16 @@ export interface ConversionStatus {
|
|||
// If true, means that the dashboard is not valid,
|
||||
// and the caller should instead fetch the stored version.
|
||||
failed: boolean;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion: string;
|
||||
// The error message from the conversion.
|
||||
// Empty if the conversion has not failed.
|
||||
error: string;
|
||||
error?: string;
|
||||
// The version which was stored when the dashboard was created / updated.
|
||||
// Fetching this version should always succeed.
|
||||
storedVersion?: string;
|
||||
}
|
||||
|
||||
export const defaultConversionStatus = (): ConversionStatus => ({
|
||||
failed: false,
|
||||
storedVersion: "",
|
||||
error: "",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ go 1.24.6
|
|||
require (
|
||||
github.com/google/go-cmp v0.7.0
|
||||
github.com/grafana/authlib/types v0.0.0-20250710201142-9542f2f28d43
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e
|
||||
github.com/prometheus/client_golang v1.23.0
|
||||
github.com/stretchr/testify v1.10.0
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ github.com/grafana/authlib/types v0.0.0-20250710201142-9542f2f28d43 h1:NlkGMnVi/
|
|||
github.com/grafana/authlib/types v0.0.0-20250710201142-9542f2f28d43/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw=
|
||||
github.com/grafana/dskit v0.0.0-20250611075409-46f51e1ce914 h1:qcSGhr691f1mmPHwg2svGyO40Ex92G02aOyHzP6XHCE=
|
||||
github.com/grafana/dskit v0.0.0-20250611075409-46f51e1ce914/go.mod h1:OiN4P4aC6LwLzLbEupH3Ue83VfQoNMfG48rsna8jI/E=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2 h1:HQ1+y9Od92iMbWWB54QxiYpNtCvYGUVpyxvxZ7ywB1k=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.2/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE=
|
||||
github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e h1:BTKk7LHuG1kmAkucwTA7DuMbKpKvJTKrGdBmUNO4dfQ=
|
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e/go.mod h1:IA4SOwun8QyST9c5UNs/fN37XL6boXXDvRYFcFwbipg=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"k8s.io/apiserver/pkg/admission"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
dashboardV0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
|
||||
dashboardV1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
|
||||
|
|
@ -43,6 +44,7 @@ func (b *DashboardsAPIBuilder) Mutate(ctx context.Context, a admission.Attribute
|
|||
internalID = int64(id)
|
||||
}
|
||||
resourceInfo = dashboardV0.DashboardResourceInfo
|
||||
|
||||
case *dashboardV1.Dashboard:
|
||||
delete(v.Spec.Object, "uid")
|
||||
delete(v.Spec.Object, "version")
|
||||
|
|
@ -55,7 +57,7 @@ func (b *DashboardsAPIBuilder) Mutate(ctx context.Context, a admission.Attribute
|
|||
if migrationErr != nil {
|
||||
v.Status.Conversion = &dashboardV1.DashboardConversionStatus{
|
||||
Failed: true,
|
||||
Error: migrationErr.Error(),
|
||||
Error: ptr.To(migrationErr.Error()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +70,6 @@ func (b *DashboardsAPIBuilder) Mutate(ctx context.Context, a admission.Attribute
|
|||
Spec: dashboardV2alpha1.DashboardGridLayoutSpec{},
|
||||
}
|
||||
}
|
||||
|
||||
resourceInfo = dashboardV2alpha1.DashboardResourceInfo
|
||||
|
||||
case *dashboardV2beta1.Dashboard:
|
||||
|
|
@ -80,7 +81,6 @@ func (b *DashboardsAPIBuilder) Mutate(ctx context.Context, a admission.Attribute
|
|||
Spec: dashboardV2beta1.DashboardGridLayoutSpec{},
|
||||
}
|
||||
}
|
||||
|
||||
resourceInfo = dashboardV2beta1.DashboardResourceInfo
|
||||
|
||||
// Noop for V2
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/apiserver/pkg/storage"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
authlib "github.com/grafana/authlib/types"
|
||||
dashv1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
|
||||
|
|
@ -159,7 +160,7 @@ func TestPrepareObjectForStorage(t *testing.T) {
|
|||
err = meta.SetStatus(dashv1.DashboardStatus{
|
||||
Conversion: &dashv1.DashboardConversionStatus{
|
||||
Failed: true,
|
||||
Error: "test",
|
||||
Error: ptr.To("test"),
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import (
|
|||
"k8s.io/apiserver/pkg/storage/storagebackend"
|
||||
|
||||
claims "github.com/grafana/authlib/types"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
storagetesting "github.com/grafana/grafana/pkg/apiserver/storage/testing"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/apistore"
|
||||
|
|
|
|||
|
|
@ -1233,15 +1233,12 @@
|
|||
"description": "ConversionStatus is the status of the conversion of the dashboard.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"failed",
|
||||
"storedVersion",
|
||||
"error"
|
||||
"failed"
|
||||
],
|
||||
"properties": {
|
||||
"error": {
|
||||
"description": "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
"type": "string"
|
||||
},
|
||||
"failed": {
|
||||
"description": "Whether from another version has failed. If true, means that the dashboard is not valid, and the caller should instead fetch the stored version.",
|
||||
|
|
@ -1250,8 +1247,7 @@
|
|||
},
|
||||
"storedVersion": {
|
||||
"description": "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1063,15 +1063,12 @@
|
|||
"description": "ConversionStatus is the status of the conversion of the dashboard.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"failed",
|
||||
"storedVersion",
|
||||
"error"
|
||||
"failed"
|
||||
],
|
||||
"properties": {
|
||||
"error": {
|
||||
"description": "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
"type": "string"
|
||||
},
|
||||
"failed": {
|
||||
"description": "Whether from another version has failed. If true, means that the dashboard is not valid, and the caller should instead fetch the stored version.",
|
||||
|
|
@ -1080,8 +1077,7 @@
|
|||
},
|
||||
"storedVersion": {
|
||||
"description": "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1655,15 +1655,12 @@
|
|||
"description": "ConversionStatus is the status of the conversion of the dashboard.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"failed",
|
||||
"storedVersion",
|
||||
"error"
|
||||
"failed"
|
||||
],
|
||||
"properties": {
|
||||
"error": {
|
||||
"description": "The error message from the conversion. Empty if the conversion has not failed.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
"type": "string"
|
||||
},
|
||||
"failed": {
|
||||
"description": "Whether from another version has failed. If true, means that the dashboard is not valid, and the caller should instead fetch the stored version.",
|
||||
|
|
@ -1672,8 +1669,7 @@
|
|||
},
|
||||
"storedVersion": {
|
||||
"description": "The version which was stored when the dashboard was created / updated. Fetching this version should always succeed.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ export interface DashboardVersionError extends Error {
|
|||
}
|
||||
|
||||
export class DashboardVersionError extends Error {
|
||||
constructor(storedVersion: string, message = 'Dashboard version mismatch') {
|
||||
constructor(storedVersion: string | undefined, message = 'Dashboard version mismatch') {
|
||||
super(message);
|
||||
this.name = 'DashboardVersionError';
|
||||
this.status = 200;
|
||||
this.data = {
|
||||
storedVersion,
|
||||
storedVersion: storedVersion ?? 'unknown',
|
||||
message,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { SaveDashboardCommand } from '../components/SaveDashboard/types';
|
|||
|
||||
import { DashboardWithAccessInfo } from './types';
|
||||
|
||||
export function isV2StoredVersion(version: string): boolean {
|
||||
export function isV2StoredVersion(version: string | undefined): boolean {
|
||||
return version === 'v2alpha1' || version === 'v2beta1';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue