Kindsys: Unify plugins, pfs with kind framework (#61192)

* New pfs impl

* Reached codegen parity with old system

* Update all models.cue inputs

* Rename all models.cue files

* Remove unused prefixfs

* Changes Queries->DataQuery schema interface

* Recodegen

* All tests passing, nearly good now

* Add SchemaInterface to kindsys props

* Add pascal name deriver

* Relocate plugin cue files again

* Clarify use of injected fields

* Remove unnecessary aliasing

* Move DataQuery into mudball

* Allow forcing ExpandReferences on go type generation

* Move DataQuery def into kindsys, add generator to copy it to common

* Fix copy generator to replace package name correctly

* Fix duplicate type, test failure

* Fix linting issues
This commit is contained in:
sam boyer
2023-01-20 09:41:35 +00:00
committed by GitHub
parent 6a7cbeae6c
commit 3b3059c9ce
91 changed files with 2192 additions and 1870 deletions
@@ -0,0 +1,25 @@
package grafanaplugin
import (
"github.com/grafana/thema"
"github.com/grafana/grafana/kinds/dashboard:kind"
)
_dummy: coremodel.slots
composableKinds: PanelCfg: {
lineage: {
name: "disallowed_cue_import"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
},
]
},
]
}
}
@@ -1,23 +0,0 @@
package grafanaplugin
import (
"github.com/grafana/thema"
"github.com/grafana/grafana/kinds/dashboard:kind"
)
_dummy: coremodel.slots
Panel: thema.#Lineage & {
name: "disallowed_cue_import"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
},
]
},
]
}
-14
View File
@@ -1,14 +0,0 @@
{
"type": "panel",
"name": "Slot impl testing",
"id": "mismatch-panel",
"backend": true,
"state": "alpha",
"info": {
"description": "Test",
"author": {
"name": "Grafana Labs",
"url": "https://grafana.com"
}
}
}
@@ -1,9 +1,6 @@
package grafanaplugin
import "github.com/grafana/thema"
Query: thema.#Lineage & {
name: "missing_kind_datasource"
composableKinds: DataQuery: lineage: {
seqs: [
{
schemas: [
@@ -1,8 +1,6 @@
package grafanaplugin
import "github.com/grafana/thema"
Panel: thema.#Lineage & {
composableKinds: PanelCfg: lineage: {
name: "doesnamatch"
seqs: [
{
@@ -0,0 +1,25 @@
package grafanaplugin
import "github.com/grafana/thema"
composableKinds: PanelCfg: {
lineage: {
joinSchema: {
PanelOptions: {...}
PanelFieldConfig: string
}
name: "panel_conflicting_joinschema"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
PanelFieldConfig: string
},
]
},
]
}
}
@@ -1,23 +0,0 @@
package grafanaplugin
import "github.com/grafana/thema"
Panel: thema.#Lineage & {
joinSchema: {
PanelOptions: {...}
PanelFieldConfig: string
}
name: "panel_conflicting_joinschema"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
PanelFieldConfig: string
},
]
},
]
}
@@ -0,0 +1,21 @@
package grafanaplugin
import "github.com/grafana/thema"
composableKinds: PanelCfg: {
lineage: {
name: "panel_does_not_follow_slot_joinschema"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
PanelFieldConfig: string
},
]
},
]
}
}
@@ -1,19 +0,0 @@
package grafanaplugin
import "github.com/grafana/thema"
Panel: thema.#Lineage & {
name: "panel_does_not_follow_slot_joinschema"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
PanelFieldConfig: string
},
]
},
]
}
@@ -0,0 +1,13 @@
package grafanaplugin
composableKinds: DataQuery: lineage: {
seqs: [
{
schemas: [
{
foo: string
},
]
},
]
}
@@ -0,0 +1,18 @@
package grafanaplugin
composableKinds: DataSourceCfg: lineage: {
seqs: [
{
schemas: [
{
Options: {
foo: string
}
SecureOptions: {
bar: string
}
},
]
},
]
}
@@ -1,34 +0,0 @@
package grafanaplugin
import "github.com/grafana/thema"
Query: thema.#Lineage & {
name: "valid_model_datasource"
seqs: [
{
schemas: [
{
foo: string
},
]
},
]
}
DSOptions: thema.#Lineage & {
name: "valid_model_datasource"
seqs: [
{
schemas: [
{
Options: {
foo: string
}
SecureOptions: {
bar: string
}
},
]
},
]
}
@@ -1,9 +1,6 @@
package grafanaplugin
import "github.com/grafana/thema"
Panel: thema.#Lineage & {
name: "mismatch"
composableKinds: PanelCfg: lineage: {
seqs: [
{
schemas: [
@@ -1,18 +0,0 @@
package grafanaplugin
import "github.com/grafana/thema"
Panel: thema.#Lineage & {
name: "valid_model_panel"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
},
]
},
]
}
@@ -1,31 +0,0 @@
package grafanaplugin
import "github.com/grafana/thema"
Query: thema.#Lineage & {
name: "wrong_slot_panel"
seqs: [
{
schemas: [
{
foo: string
},
]
},
]
}
Panel: thema.#Lineage & {
name: "wrong_slot_panel"
seqs: [
{
schemas: [
{
PanelOptions: {
foo: string
} @cuetsy(kind="interface")
},
]
},
]
}
@@ -1,14 +0,0 @@
{
"type": "panel",
"name": "Wrong slot for type",
"id": "wrong-slot-panel",
"backend": true,
"state": "alpha",
"info": {
"description": "Test",
"author": {
"name": "Grafana Labs",
"url": "https://grafana.com"
}
}
}