Core: Remove thema and kindsys dependencies (#84499)

* Move some thema code inside grafana

* Use new codegen instead of thema for core kinds

* Replace TS generator

* Use new generator for go types

* Remove thema from oapi generator

* Remove thema from generators

* Don't use kindsys/thema for core kinds

* Remove kindsys/thema from plugins

* Remove last thema related

* Remove most of cuectx and move utils_ts into codegen. It also deletes wire dependency

* Merge plugins generators

* Delete thema dependency 🎉

* Fix CODEOWNERS

* Fix package name

* Fix TS output names

* More path fixes

* Fix mod codeowners

* Use original plugin's name

* Remove kindsys dependency 🎉

* Modify oapi schema and create an apply function to fix elasticsearch errors

* cue.mod was deleted by mistake

* Fix TS panels

* sort imports

* Fixing elasticsearch output

* Downgrade oapi-codegen library

* Update output ts files

* More fixes

* Restore old elasticsearch generated file and skip its generation. Remove core imports into plugins

* More lint fixes

* Add codeowners

* restore embed.go file

* Fix embed.go
This commit is contained in:
Selene
2024-03-21 11:11:29 +01:00
committed by GitHub
parent 856e410480
commit 473898e47c
56 changed files with 1433 additions and 1631 deletions
+10 -8
View File
@@ -8,6 +8,7 @@ import (
"strings"
"github.com/grafana/codejen"
"github.com/grafana/grafana/pkg/plugins/pfs"
)
var registryPath = filepath.Join("pkg", "registry", "schemas")
@@ -27,21 +28,22 @@ func (jenny *PluginRegistryJenny) JennyName() string {
return "PluginRegistryJenny"
}
func (jenny *PluginRegistryJenny) Generate(files []string) (*codejen.File, error) {
if len(files) == 0 {
func (jenny *PluginRegistryJenny) Generate(decls ...*pfs.PluginDecl) (*codejen.File, error) {
if len(decls) == 0 {
return nil, nil
}
schemas := make([]Schema, len(files))
for i, file := range files {
name, err := getSchemaName(file)
schemas := make([]Schema, len(decls))
for i, decl := range decls {
variant := fmt.Sprintf("%s.cue", strings.ToLower(decl.SchemaInterface.Name))
name, err := getSchemaName(decl.PluginPath)
if err != nil {
return nil, fmt.Errorf("unable to find schema name: %s", err)
}
schemas[i] = Schema{
Name: name,
Filename: filepath.Base(file),
FilePath: file,
Filename: variant,
FilePath: "./" + filepath.Join("public", "app", "plugins", decl.PluginPath, variant),
}
}
@@ -65,7 +67,7 @@ func getSchemaName(path string) (string, error) {
if len(parts) < 2 {
return "", fmt.Errorf("path should contain more than 2 elements")
}
folderName := parts[len(parts)-2]
folderName := parts[len(parts)-1]
if renamed, ok := renamedPlugins[folderName]; ok {
folderName = renamed
}