mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
coremodels: Update to latest Thema with generics (#56602)
* Update thema to latest * Deal with s/Library/*Runtime/ * Commit new, working results of codegen
This commit is contained in:
@@ -1018,8 +1018,8 @@ var currentVersion = thema.SV(0, 0)
|
||||
// The lineage is the canonical specification of the current dashboard schema,
|
||||
// all prior schema versions, and the mappings that allow migration between
|
||||
// schema versions.
|
||||
func Lineage(lib thema.Library, opts ...thema.BindOption) (thema.Lineage, error) {
|
||||
return cuectx.LoadGrafanaInstancesWithThema(filepath.Join("pkg", "coremodel", "dashboard"), cueFS, lib, opts...)
|
||||
func Lineage(rt *thema.Runtime, opts ...thema.BindOption) (thema.Lineage, error) {
|
||||
return cuectx.LoadGrafanaInstancesWithThema(filepath.Join("pkg", "coremodel", "dashboard"), cueFS, rt, opts...)
|
||||
}
|
||||
|
||||
var _ thema.LineageFactory = Lineage
|
||||
@@ -1052,8 +1052,8 @@ func (c *Coremodel) GoType() interface{} {
|
||||
// Note that this function does not cache, and initially loading a Thema lineage
|
||||
// can be expensive. As such, the Grafana backend should prefer to access this
|
||||
// coremodel through a registry (pkg/framework/coremodel/registry), which does cache.
|
||||
func New(lib thema.Library) (*Coremodel, error) {
|
||||
lin, err := Lineage(lib)
|
||||
func New(rt *thema.Runtime) (*Coremodel, error) {
|
||||
lin, err := Lineage(rt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestDevenvDashboardValidity(t *testing.T) {
|
||||
|
||||
m, err := themaTestableDashboards(os.DirFS(path))
|
||||
require.NoError(t, err)
|
||||
cm, err := dashboard.New(cuectx.ProvideThemaLibrary())
|
||||
cm, err := dashboard.New(cuectx.GrafanaThemaRuntime())
|
||||
require.NoError(t, err)
|
||||
|
||||
for path, b := range m {
|
||||
|
||||
@@ -90,8 +90,8 @@ var currentVersion = thema.SV(0, 0)
|
||||
// The lineage is the canonical specification of the current playlist schema,
|
||||
// all prior schema versions, and the mappings that allow migration between
|
||||
// schema versions.
|
||||
func Lineage(lib thema.Library, opts ...thema.BindOption) (thema.Lineage, error) {
|
||||
return cuectx.LoadGrafanaInstancesWithThema(filepath.Join("pkg", "coremodel", "playlist"), cueFS, lib, opts...)
|
||||
func Lineage(rt *thema.Runtime, opts ...thema.BindOption) (thema.Lineage, error) {
|
||||
return cuectx.LoadGrafanaInstancesWithThema(filepath.Join("pkg", "coremodel", "playlist"), cueFS, rt, opts...)
|
||||
}
|
||||
|
||||
var _ thema.LineageFactory = Lineage
|
||||
@@ -124,8 +124,8 @@ func (c *Coremodel) GoType() interface{} {
|
||||
// Note that this function does not cache, and initially loading a Thema lineage
|
||||
// can be expensive. As such, the Grafana backend should prefer to access this
|
||||
// coremodel through a registry (pkg/framework/coremodel/registry), which does cache.
|
||||
func New(lib thema.Library) (*Coremodel, error) {
|
||||
lin, err := Lineage(lib)
|
||||
func New(rt *thema.Runtime) (*Coremodel, error) {
|
||||
lin, err := Lineage(rt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -560,8 +560,8 @@ var currentVersion = thema.SV(0, 0)
|
||||
// The lineage is the canonical specification of the current pluginmeta schema,
|
||||
// all prior schema versions, and the mappings that allow migration between
|
||||
// schema versions.
|
||||
func Lineage(lib thema.Library, opts ...thema.BindOption) (thema.Lineage, error) {
|
||||
return cuectx.LoadGrafanaInstancesWithThema(filepath.Join("pkg", "coremodel", "pluginmeta"), cueFS, lib, opts...)
|
||||
func Lineage(rt *thema.Runtime, opts ...thema.BindOption) (thema.Lineage, error) {
|
||||
return cuectx.LoadGrafanaInstancesWithThema(filepath.Join("pkg", "coremodel", "pluginmeta"), cueFS, rt, opts...)
|
||||
}
|
||||
|
||||
var _ thema.LineageFactory = Lineage
|
||||
@@ -594,8 +594,8 @@ func (c *Coremodel) GoType() interface{} {
|
||||
// Note that this function does not cache, and initially loading a Thema lineage
|
||||
// can be expensive. As such, the Grafana backend should prefer to access this
|
||||
// coremodel through a registry (pkg/framework/coremodel/registry), which does cache.
|
||||
func New(lib thema.Library) (*Coremodel, error) {
|
||||
lin, err := Lineage(lib)
|
||||
func New(rt *thema.Runtime) (*Coremodel, error) {
|
||||
lin, err := Lineage(rt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user