From 275ccf994b0bab9ec6ad817b2fe9f84bc792ac1f Mon Sep 17 00:00:00 2001 From: Selene Date: Mon, 11 Mar 2024 12:51:44 +0100 Subject: [PATCH] Schemas: Reduce duplicated jenny code (#84061) * Remove jenny_ts_resources and use jenny_ts_types for all cases * Unify TS generated files into one jenny * Add missing imports to versioned files * Update Parca plugin * Fix loki * Use LokiQuery * Fix pyroscope tests * Fix prettier * :unamused: fix default pyroscope value name * Set the LokiQuery * Update Elasticsearch and TestData * Missed files from testdata * Order imports --- kinds/gen.go | 50 ++++++++- .../accesspolicy/x/accesspolicy_types.gen.ts | 2 +- .../x/AlertGroupsPanelCfg_types.gen.ts | 3 +- .../x/AnnotationsListPanelCfg_types.gen.ts | 3 +- .../x/AzureMonitorDataQuery_types.gen.ts | 3 +- .../panelcfg/x/BarChartPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/BarGaugePanelCfg_types.gen.ts | 3 +- .../x/CandlestickPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/CanvasPanelCfg_types.gen.ts | 3 +- .../x/CloudWatchDataQuery_types.gen.ts | 3 +- .../x/DashboardListPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/DatagridPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/DebugPanelCfg_types.gen.ts | 3 +- .../x/ElasticsearchDataQuery_types.gen.ts | 3 +- .../panelcfg/x/GaugePanelCfg_types.gen.ts | 3 +- .../panelcfg/x/GeomapPanelCfg_types.gen.ts | 3 +- ...oogleCloudMonitoringDataQuery_types.gen.ts | 3 +- .../x/GrafanaPyroscopeDataQuery_types.gen.ts | 3 +- .../panelcfg/x/HeatmapPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/HistogramPanelCfg_types.gen.ts | 3 +- .../logs/panelcfg/x/LogsPanelCfg_types.gen.ts | 3 +- .../dataquery/x/LokiDataQuery_types.gen.ts | 3 +- .../news/panelcfg/x/NewsPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/NodeGraphPanelCfg_types.gen.ts | 3 +- .../dataquery/x/ParcaDataQuery_types.gen.ts | 3 +- .../panelcfg/x/PieChartPanelCfg_types.gen.ts | 3 +- .../stat/panelcfg/x/StatPanelCfg_types.gen.ts | 3 +- .../x/StateTimelinePanelCfg_types.gen.ts | 3 +- .../x/StatusHistoryPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/TablePanelCfg_types.gen.ts | 3 +- .../dataquery/x/TempoDataQuery_types.gen.ts | 3 +- .../x/TestDataDataQuery_types.gen.ts | 3 +- .../text/panelcfg/x/TextPanelCfg_types.gen.ts | 3 +- .../x/TimeSeriesPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/TrendPanelCfg_types.gen.ts | 3 +- .../panelcfg/x/XYChartPanelCfg_types.gen.ts | 3 +- .../raw/dashboard/x/dashboard_types.gen.ts | 2 +- .../librarypanel/x/librarypanel_types.gen.ts | 2 +- .../preferences/x/preferences_types.gen.ts | 2 +- .../x/publicdashboard_types.gen.ts | 2 +- .../src/raw/role/x/role_types.gen.ts | 2 +- .../rolebinding/x/rolebinding_types.gen.ts | 2 +- .../src/raw/team/x/team_types.gen.ts | 2 +- pkg/codegen/jenny_eachmajor.go | 64 +++-------- pkg/codegen/jenny_ts_resources.go | 85 --------------- pkg/codegen/jenny_ts_types.go | 12 ++- pkg/plugins/codegen/jenny_pluginseachmajor.go | 101 ------------------ pkg/plugins/codegen/jenny_plugintstypes.go | 86 ++++++++++++--- .../datasource/azuremonitor/dataquery.gen.ts | 4 +- .../cloud-monitoring/dataquery.gen.ts | 4 +- .../datasource/cloudwatch/dataquery.gen.ts | 4 +- .../datasource/elasticsearch/dataquery.gen.ts | 6 +- .../plugins/datasource/elasticsearch/types.ts | 6 +- .../dataquery.gen.ts | 6 +- .../datasource.ts | 4 +- .../grafana-pyroscope-datasource/types.ts | 4 +- .../MetaDataInspector.tsx | 4 +- .../QueryEditor.tsx | 10 +- .../components/NodeGraphEditor.tsx | 4 +- .../components/RandomWalkEditor.tsx | 4 +- .../grafana-testdata-datasource/constants.ts | 4 +- .../dataquery.gen.ts | 6 +- .../grafana-testdata-datasource/datasource.ts | 54 ++++++---- .../grafana-testdata-datasource/runStreams.ts | 25 +++-- .../grafana-testdata-datasource/variables.ts | 4 +- .../plugins/datasource/loki/dataquery.gen.ts | 4 +- public/app/plugins/datasource/loki/types.ts | 7 +- .../parca/QueryEditor/QueryEditor.tsx | 4 +- .../plugins/datasource/parca/dataquery.gen.ts | 6 +- public/app/plugins/datasource/parca/types.ts | 2 +- .../plugins/datasource/tempo/dataquery.gen.ts | 4 +- public/app/plugins/gen.go | 3 +- .../plugins/panel/alertGroups/panelcfg.gen.ts | 2 +- .../plugins/panel/annolist/panelcfg.gen.ts | 2 +- .../plugins/panel/barchart/panelcfg.gen.ts | 2 +- .../plugins/panel/bargauge/panelcfg.gen.ts | 2 +- .../plugins/panel/candlestick/panelcfg.gen.ts | 2 +- .../app/plugins/panel/canvas/panelcfg.gen.ts | 2 +- .../plugins/panel/dashlist/panelcfg.gen.ts | 2 +- .../plugins/panel/datagrid/panelcfg.gen.ts | 2 +- .../app/plugins/panel/debug/panelcfg.gen.ts | 2 +- .../app/plugins/panel/gauge/panelcfg.gen.ts | 2 +- .../app/plugins/panel/geomap/panelcfg.gen.ts | 2 +- .../app/plugins/panel/heatmap/panelcfg.gen.ts | 2 +- .../plugins/panel/histogram/panelcfg.gen.ts | 2 +- public/app/plugins/panel/logs/panelcfg.gen.ts | 2 +- public/app/plugins/panel/news/panelcfg.gen.ts | 2 +- .../plugins/panel/nodeGraph/panelcfg.gen.ts | 2 +- .../plugins/panel/piechart/panelcfg.gen.ts | 2 +- public/app/plugins/panel/stat/panelcfg.gen.ts | 2 +- .../panel/state-timeline/panelcfg.gen.ts | 2 +- .../panel/status-history/panelcfg.gen.ts | 2 +- .../app/plugins/panel/table/panelcfg.gen.ts | 2 +- public/app/plugins/panel/text/panelcfg.gen.ts | 2 +- .../plugins/panel/timeseries/panelcfg.gen.ts | 2 +- .../app/plugins/panel/trend/panelcfg.gen.ts | 2 +- .../app/plugins/panel/xychart/panelcfg.gen.ts | 2 +- 97 files changed, 320 insertions(+), 429 deletions(-) delete mode 100644 pkg/codegen/jenny_ts_resources.go delete mode 100644 pkg/plugins/codegen/jenny_pluginseachmajor.go diff --git a/kinds/gen.go b/kinds/gen.go index 006b89eaf5d..57abd5cc5d2 100644 --- a/kinds/gen.go +++ b/kinds/gen.go @@ -19,6 +19,8 @@ import ( "cuelang.org/go/cue/errors" "github.com/grafana/codejen" "github.com/grafana/cuetsy" + "github.com/grafana/cuetsy/ts" + "github.com/grafana/cuetsy/ts/ast" "github.com/grafana/kindsys" "github.com/grafana/grafana/pkg/codegen" @@ -44,8 +46,7 @@ func main() { codegen.BaseCoreRegistryJenny(filepath.Join("pkg", "registry", "corekind"), cuectx.GoCoreKindParentPath), codegen.LatestMajorsOrXJenny( cuectx.TSCoreKindParentPath, - true, // forcing group so that we ignore the top level resource (for now) - codegen.TSResourceJenny{}), + codegen.TSTypesJenny{ApplyFuncs: []codegen.ApplyFunc{renameSpecNode}}), codegen.TSVeneerIndexJenny(filepath.Join("packages", "grafana-schema", "src")), ) @@ -232,3 +233,48 @@ func loadCueFiles(dirs []os.DirEntry) []cue.Value { return values } + +// renameSpecNode rename spec node from the TS file result +func renameSpecNode(sfg codegen.SchemaForGen, tf *ast.File) { + specidx, specdefidx := -1, -1 + for idx, def := range tf.Nodes { + // Peer through export keywords + if ex, is := def.(ast.ExportKeyword); is { + def = ex.Decl + } + + switch x := def.(type) { + case ast.TypeDecl: + if x.Name.Name == "spec" { + specidx = idx + x.Name.Name = sfg.Name + tf.Nodes[idx] = x + } + case ast.VarDecl: + // Before: + // export const defaultspec: Partial = { + // After: + // / export const defaultPlaylist: Partial = { + if x.Names.Idents[0].Name == "defaultspec" { + specdefidx = idx + x.Names.Idents[0].Name = "default" + sfg.Name + tt := x.Type.(ast.TypeTransformExpr) + tt.Expr = ts.Ident(sfg.Name) + x.Type = tt + tf.Nodes[idx] = x + } + } + } + + if specidx != -1 { + decl := tf.Nodes[specidx] + tf.Nodes = append(append(tf.Nodes[:specidx], tf.Nodes[specidx+1:]...), decl) + } + if specdefidx != -1 { + if specdefidx > specidx { + specdefidx-- + } + decl := tf.Nodes[specdefidx] + tf.Nodes = append(append(tf.Nodes[:specdefidx], tf.Nodes[specdefidx+1:]...), decl) + } +} diff --git a/packages/grafana-schema/src/raw/accesspolicy/x/accesspolicy_types.gen.ts b/packages/grafana-schema/src/raw/accesspolicy/x/accesspolicy_types.gen.ts index 814c5cf3eaf..7e18ea50777 100644 --- a/packages/grafana-schema/src/raw/accesspolicy/x/accesspolicy_types.gen.ts +++ b/packages/grafana-schema/src/raw/accesspolicy/x/accesspolicy_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/alertgroups/panelcfg/x/AlertGroupsPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/alertgroups/panelcfg/x/AlertGroupsPanelCfg_types.gen.ts index 06806b81de0..712215d30cf 100644 --- a/packages/grafana-schema/src/raw/composable/alertgroups/panelcfg/x/AlertGroupsPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/alertgroups/panelcfg/x/AlertGroupsPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/annotationslist/panelcfg/x/AnnotationsListPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/annotationslist/panelcfg/x/AnnotationsListPanelCfg_types.gen.ts index 00ad8874bc7..e10efab2613 100644 --- a/packages/grafana-schema/src/raw/composable/annotationslist/panelcfg/x/AnnotationsListPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/annotationslist/panelcfg/x/AnnotationsListPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/azuremonitor/dataquery/x/AzureMonitorDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/azuremonitor/dataquery/x/AzureMonitorDataQuery_types.gen.ts index a22f7674cbf..d6d068b7e1e 100644 --- a/packages/grafana-schema/src/raw/composable/azuremonitor/dataquery/x/AzureMonitorDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/azuremonitor/dataquery/x/AzureMonitorDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen.ts index 595b7075eca..2a50f0f9e9c 100644 --- a/packages/grafana-schema/src/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen.ts index e06085a7434..be73664fe46 100644 --- a/packages/grafana-schema/src/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/candlestick/panelcfg/x/CandlestickPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/candlestick/panelcfg/x/CandlestickPanelCfg_types.gen.ts index 5ab9a15028b..9a89d9b2d94 100644 --- a/packages/grafana-schema/src/raw/composable/candlestick/panelcfg/x/CandlestickPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/candlestick/panelcfg/x/CandlestickPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/canvas/panelcfg/x/CanvasPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/canvas/panelcfg/x/CanvasPanelCfg_types.gen.ts index 7a11db51c32..c29f34f2170 100644 --- a/packages/grafana-schema/src/raw/composable/canvas/panelcfg/x/CanvasPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/canvas/panelcfg/x/CanvasPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/cloudwatch/dataquery/x/CloudWatchDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/cloudwatch/dataquery/x/CloudWatchDataQuery_types.gen.ts index b9488a5bd8a..f184ea7b493 100644 --- a/packages/grafana-schema/src/raw/composable/cloudwatch/dataquery/x/CloudWatchDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/cloudwatch/dataquery/x/CloudWatchDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/dashboardlist/panelcfg/x/DashboardListPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/dashboardlist/panelcfg/x/DashboardListPanelCfg_types.gen.ts index e3c41bb3c7d..2fba962cd85 100644 --- a/packages/grafana-schema/src/raw/composable/dashboardlist/panelcfg/x/DashboardListPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/dashboardlist/panelcfg/x/DashboardListPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/datagrid/panelcfg/x/DatagridPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/datagrid/panelcfg/x/DatagridPanelCfg_types.gen.ts index 051a38d9a45..77016b81efb 100644 --- a/packages/grafana-schema/src/raw/composable/datagrid/panelcfg/x/DatagridPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/datagrid/panelcfg/x/DatagridPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/debug/panelcfg/x/DebugPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/debug/panelcfg/x/DebugPanelCfg_types.gen.ts index 874944a2d39..8634d6e0b85 100644 --- a/packages/grafana-schema/src/raw/composable/debug/panelcfg/x/DebugPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/debug/panelcfg/x/DebugPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/elasticsearch/dataquery/x/ElasticsearchDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/elasticsearch/dataquery/x/ElasticsearchDataQuery_types.gen.ts index 76aa76dedf3..2aeca4e52f3 100644 --- a/packages/grafana-schema/src/raw/composable/elasticsearch/dataquery/x/ElasticsearchDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/elasticsearch/dataquery/x/ElasticsearchDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/gauge/panelcfg/x/GaugePanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/gauge/panelcfg/x/GaugePanelCfg_types.gen.ts index 1bd5575b109..dc146513394 100644 --- a/packages/grafana-schema/src/raw/composable/gauge/panelcfg/x/GaugePanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/gauge/panelcfg/x/GaugePanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/geomap/panelcfg/x/GeomapPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/geomap/panelcfg/x/GeomapPanelCfg_types.gen.ts index ae79a22fb00..a842a04bbf9 100644 --- a/packages/grafana-schema/src/raw/composable/geomap/panelcfg/x/GeomapPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/geomap/panelcfg/x/GeomapPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/googlecloudmonitoring/dataquery/x/GoogleCloudMonitoringDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/googlecloudmonitoring/dataquery/x/GoogleCloudMonitoringDataQuery_types.gen.ts index fd333a2f0e2..0185e3000b1 100644 --- a/packages/grafana-schema/src/raw/composable/googlecloudmonitoring/dataquery/x/GoogleCloudMonitoringDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/googlecloudmonitoring/dataquery/x/GoogleCloudMonitoringDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/grafanapyroscope/dataquery/x/GrafanaPyroscopeDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/grafanapyroscope/dataquery/x/GrafanaPyroscopeDataQuery_types.gen.ts index 2be0dcface6..1c5e39ee716 100644 --- a/packages/grafana-schema/src/raw/composable/grafanapyroscope/dataquery/x/GrafanaPyroscopeDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/grafanapyroscope/dataquery/x/GrafanaPyroscopeDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/heatmap/panelcfg/x/HeatmapPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/heatmap/panelcfg/x/HeatmapPanelCfg_types.gen.ts index b0a369a3af6..97ef088e2c6 100644 --- a/packages/grafana-schema/src/raw/composable/heatmap/panelcfg/x/HeatmapPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/heatmap/panelcfg/x/HeatmapPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/histogram/panelcfg/x/HistogramPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/histogram/panelcfg/x/HistogramPanelCfg_types.gen.ts index ed246a7a646..3d1b420d49b 100644 --- a/packages/grafana-schema/src/raw/composable/histogram/panelcfg/x/HistogramPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/histogram/panelcfg/x/HistogramPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts index 449bebb7580..6c53480ae0f 100644 --- a/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/logs/panelcfg/x/LogsPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/loki/dataquery/x/LokiDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/loki/dataquery/x/LokiDataQuery_types.gen.ts index 704c53846ff..738ccee4c15 100644 --- a/packages/grafana-schema/src/raw/composable/loki/dataquery/x/LokiDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/loki/dataquery/x/LokiDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/news/panelcfg/x/NewsPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/news/panelcfg/x/NewsPanelCfg_types.gen.ts index 17906a95d11..22c3031560c 100644 --- a/packages/grafana-schema/src/raw/composable/news/panelcfg/x/NewsPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/news/panelcfg/x/NewsPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/nodegraph/panelcfg/x/NodeGraphPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/nodegraph/panelcfg/x/NodeGraphPanelCfg_types.gen.ts index f1765fff6b1..b1b404140b4 100644 --- a/packages/grafana-schema/src/raw/composable/nodegraph/panelcfg/x/NodeGraphPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/nodegraph/panelcfg/x/NodeGraphPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/parca/dataquery/x/ParcaDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/parca/dataquery/x/ParcaDataQuery_types.gen.ts index a4d6fd645a3..61aeb06a3d1 100644 --- a/packages/grafana-schema/src/raw/composable/parca/dataquery/x/ParcaDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/parca/dataquery/x/ParcaDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/piechart/panelcfg/x/PieChartPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/piechart/panelcfg/x/PieChartPanelCfg_types.gen.ts index d51f2ddba21..5b1987582b7 100644 --- a/packages/grafana-schema/src/raw/composable/piechart/panelcfg/x/PieChartPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/piechart/panelcfg/x/PieChartPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/stat/panelcfg/x/StatPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/stat/panelcfg/x/StatPanelCfg_types.gen.ts index 64c0081af96..03a4a6db040 100644 --- a/packages/grafana-schema/src/raw/composable/stat/panelcfg/x/StatPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/stat/panelcfg/x/StatPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/statetimeline/panelcfg/x/StateTimelinePanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/statetimeline/panelcfg/x/StateTimelinePanelCfg_types.gen.ts index d42e8c3db88..f4cbf92bc07 100644 --- a/packages/grafana-schema/src/raw/composable/statetimeline/panelcfg/x/StateTimelinePanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/statetimeline/panelcfg/x/StateTimelinePanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/statushistory/panelcfg/x/StatusHistoryPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/statushistory/panelcfg/x/StatusHistoryPanelCfg_types.gen.ts index bdb705b2523..a9900905d19 100644 --- a/packages/grafana-schema/src/raw/composable/statushistory/panelcfg/x/StatusHistoryPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/statushistory/panelcfg/x/StatusHistoryPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/table/panelcfg/x/TablePanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/table/panelcfg/x/TablePanelCfg_types.gen.ts index 263ab247001..dc2f9f23d80 100644 --- a/packages/grafana-schema/src/raw/composable/table/panelcfg/x/TablePanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/table/panelcfg/x/TablePanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts index 3371fbaa7b9..2b6825e4607 100644 --- a/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts index 91f7cbe3bdb..329a6feafdc 100644 --- a/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/text/panelcfg/x/TextPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/text/panelcfg/x/TextPanelCfg_types.gen.ts index 0bf302eda0b..0c6d63f1ccb 100644 --- a/packages/grafana-schema/src/raw/composable/text/panelcfg/x/TextPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/text/panelcfg/x/TextPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/timeseries/panelcfg/x/TimeSeriesPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/timeseries/panelcfg/x/TimeSeriesPanelCfg_types.gen.ts index 3a5d60e3189..cc065b62af3 100644 --- a/packages/grafana-schema/src/raw/composable/timeseries/panelcfg/x/TimeSeriesPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/timeseries/panelcfg/x/TimeSeriesPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/trend/panelcfg/x/TrendPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/trend/panelcfg/x/TrendPanelCfg_types.gen.ts index b30275ca3b3..2e196719417 100644 --- a/packages/grafana-schema/src/raw/composable/trend/panelcfg/x/TrendPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/trend/panelcfg/x/TrendPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts index ba3a3686d61..c9a7b21117b 100644 --- a/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts @@ -4,8 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// LatestMajorsOrXJenny -// PluginEachMajorJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts index 886dd0e3466..9b3d3b54504 100644 --- a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts +++ b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts b/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts index d3b967e7a76..97cba2a5c5e 100644 --- a/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts +++ b/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts b/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts index 033e4233d4b..b685f299f2e 100644 --- a/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts +++ b/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts b/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts index 9a1ae8596fd..b94e4baefe3 100644 --- a/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts +++ b/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/role/x/role_types.gen.ts b/packages/grafana-schema/src/raw/role/x/role_types.gen.ts index 781665e9250..88cadf639fe 100644 --- a/packages/grafana-schema/src/raw/role/x/role_types.gen.ts +++ b/packages/grafana-schema/src/raw/role/x/role_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/rolebinding/x/rolebinding_types.gen.ts b/packages/grafana-schema/src/raw/rolebinding/x/rolebinding_types.gen.ts index a41535cc5df..ea6d65fbf4e 100644 --- a/packages/grafana-schema/src/raw/rolebinding/x/rolebinding_types.gen.ts +++ b/packages/grafana-schema/src/raw/rolebinding/x/rolebinding_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/packages/grafana-schema/src/raw/team/x/team_types.gen.ts b/packages/grafana-schema/src/raw/team/x/team_types.gen.ts index fef0a47a874..4f136372c37 100644 --- a/packages/grafana-schema/src/raw/team/x/team_types.gen.ts +++ b/packages/grafana-schema/src/raw/team/x/team_types.gen.ts @@ -3,7 +3,7 @@ // Generated by: // kinds/gen.go // Using jennies: -// TSResourceJenny +// TSTypesJenny // LatestMajorsOrXJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/pkg/codegen/jenny_eachmajor.go b/pkg/codegen/jenny_eachmajor.go index 0bc3d1b8c21..e2c60648e32 100644 --- a/pkg/codegen/jenny_eachmajor.go +++ b/pkg/codegen/jenny_eachmajor.go @@ -11,22 +11,20 @@ import ( // LatestMajorsOrXJenny returns a jenny that repeats the input for the latest in each major version. // // TODO remove forceGroup option, it's a temporary hack to accommodate core kinds -func LatestMajorsOrXJenny(parentdir string, forceGroup bool, inner codejen.OneToOne[SchemaForGen]) OneToMany { +func LatestMajorsOrXJenny(parentdir string, inner codejen.OneToOne[SchemaForGen]) OneToMany { if inner == nil { panic("inner jenny must not be nil") } return &lmox{ - parentdir: parentdir, - inner: inner, - forceGroup: forceGroup, + parentdir: parentdir, + inner: inner, } } type lmox struct { - parentdir string - inner codejen.OneToOne[SchemaForGen] - forceGroup bool + parentdir string + inner codejen.OneToOne[SchemaForGen] } func (j *lmox) JennyName() string { @@ -42,49 +40,19 @@ func (j *lmox) Generate(kind kindsys.Kind) (codejen.Files, error) { comm := kind.Props().Common() sfg := SchemaForGen{ Name: comm.Name, - IsGroup: comm.LineageIsGroup, + IsGroup: true, + Schema: kind.Lineage().Latest(), } - if j.forceGroup { - sfg.IsGroup = true + f, err := j.inner.Generate(sfg) + if err != nil { + return nil, fmt.Errorf("%s jenny failed on %s schema for %s: %w", j.inner.JennyName(), sfg.Schema.Version(), kind.Props().Common().Name, err) + } + if f == nil || !f.Exists() { + return nil, nil } - do := func(sfg SchemaForGen, infix string) (codejen.Files, error) { - f, err := j.inner.Generate(sfg) - if err != nil { - return nil, fmt.Errorf("%s jenny failed on %s schema for %s: %w", j.inner.JennyName(), sfg.Schema.Version(), kind.Props().Common().Name, err) - } - if f == nil || !f.Exists() { - return nil, nil - } - - f.RelativePath = filepath.Join(j.parentdir, comm.MachineName, infix, f.RelativePath) - f.From = append(f.From, j) - return codejen.Files{*f}, nil - } - - if comm.Maturity.Less(kindsys.MaturityStable) { - sfg.Schema = kind.Lineage().Latest() - return do(sfg, "x") - } - - var fl codejen.Files - major := -1 - for sch := kind.Lineage().First(); sch != nil; sch = sch.Successor() { - if int(sch.Version()[0]) == major { - continue - } - major = int(sch.Version()[0]) - - sfg.Schema = sch.LatestInMajor() - files, err := do(sfg, fmt.Sprintf("v%v", sch.Version()[0])) - if err != nil { - return nil, err - } - fl = append(fl, files...) - } - if fl.Validate() != nil { - return nil, fl.Validate() - } - return fl, nil + f.RelativePath = filepath.Join(j.parentdir, comm.MachineName, "x", f.RelativePath) + f.From = append(f.From, j) + return codejen.Files{*f}, nil } diff --git a/pkg/codegen/jenny_ts_resources.go b/pkg/codegen/jenny_ts_resources.go deleted file mode 100644 index 9e3391a6276..00000000000 --- a/pkg/codegen/jenny_ts_resources.go +++ /dev/null @@ -1,85 +0,0 @@ -package codegen - -import ( - "github.com/grafana/codejen" - "github.com/grafana/cuetsy" - "github.com/grafana/cuetsy/ts" - "github.com/grafana/cuetsy/ts/ast" - "github.com/grafana/grafana/pkg/cuectx" - "github.com/grafana/thema/encoding/typescript" -) - -// TSResourceJenny is a [OneToOne] that produces TypeScript types and -// defaults for a Thema schema. -// -// Thema's generic TS jenny will be able to replace this one once -// https://github.com/grafana/thema/issues/89 is complete. -type TSResourceJenny struct{} - -var _ codejen.OneToOne[SchemaForGen] = &TSResourceJenny{} - -func (j TSResourceJenny) JennyName() string { - return "TSResourceJenny" -} - -func (j TSResourceJenny) Generate(sfg SchemaForGen) (*codejen.File, error) { - // TODO allow using name instead of machine name in thema generator - f, err := typescript.GenerateTypes(sfg.Schema, &typescript.TypeConfig{ - RootName: sfg.Name, - Group: sfg.IsGroup, - CuetsyConfig: &cuetsy.Config{ - Export: true, - ImportMapper: cuectx.MapCUEImportToTS, - }, - }) - if err != nil { - return nil, err - } - renameSpecNode(sfg.Name, f) - - return codejen.NewFile(sfg.Schema.Lineage().Name()+"_types.gen.ts", []byte(f.String()), j), nil -} - -func renameSpecNode(name string, tf *ast.File) { - specidx, specdefidx := -1, -1 - for idx, def := range tf.Nodes { - // Peer through export keywords - if ex, is := def.(ast.ExportKeyword); is { - def = ex.Decl - } - - switch x := def.(type) { - case ast.TypeDecl: - if x.Name.Name == "spec" { - specidx = idx - x.Name.Name = name - tf.Nodes[idx] = x - } - case ast.VarDecl: - // Before: - // export const defaultspec: Partial = { - // After: - /// export const defaultPlaylist: Partial = { - if x.Names.Idents[0].Name == "defaultspec" { - specdefidx = idx - x.Names.Idents[0].Name = "default" + name - tt := x.Type.(ast.TypeTransformExpr) - tt.Expr = ts.Ident(name) - x.Type = tt - tf.Nodes[idx] = x - } - } - } - - if specidx != -1 { - decl := tf.Nodes[specidx] - tf.Nodes = append(append(tf.Nodes[:specidx], tf.Nodes[specidx+1:]...), decl) - } - if specdefidx != -1 { - if specdefidx > specidx { - specdefidx-- - } - decl := tf.Nodes[specdefidx] - tf.Nodes = append(append(tf.Nodes[:specdefidx], tf.Nodes[specdefidx+1:]...), decl) - } -} diff --git a/pkg/codegen/jenny_ts_types.go b/pkg/codegen/jenny_ts_types.go index d16968a45cf..3eb5b078d65 100644 --- a/pkg/codegen/jenny_ts_types.go +++ b/pkg/codegen/jenny_ts_types.go @@ -3,16 +3,21 @@ package codegen import ( "github.com/grafana/codejen" "github.com/grafana/cuetsy" + "github.com/grafana/cuetsy/ts/ast" "github.com/grafana/grafana/pkg/cuectx" "github.com/grafana/thema/encoding/typescript" ) +type ApplyFunc func(sfg SchemaForGen, file *ast.File) + // TSTypesJenny is a [OneToOne] that produces TypeScript types and // defaults for a Thema schema. // // Thema's generic TS jenny will be able to replace this one once // https://github.com/grafana/thema/issues/89 is complete. -type TSTypesJenny struct{} +type TSTypesJenny struct { + ApplyFuncs []ApplyFunc +} var _ codejen.OneToOne[SchemaForGen] = &TSTypesJenny{} @@ -30,6 +35,11 @@ func (j TSTypesJenny) Generate(sfg SchemaForGen) (*codejen.File, error) { RootName: sfg.Name, Group: sfg.IsGroup, }) + + for _, renameFunc := range j.ApplyFuncs { + renameFunc(sfg, f) + } + if err != nil { return nil, err } diff --git a/pkg/plugins/codegen/jenny_pluginseachmajor.go b/pkg/plugins/codegen/jenny_pluginseachmajor.go deleted file mode 100644 index e90a11a984b..00000000000 --- a/pkg/plugins/codegen/jenny_pluginseachmajor.go +++ /dev/null @@ -1,101 +0,0 @@ -package codegen - -import ( - "fmt" - "os" - "path" - "path/filepath" - - "github.com/grafana/codejen" - tsast "github.com/grafana/cuetsy/ts/ast" - "github.com/grafana/grafana/pkg/build" - corecodegen "github.com/grafana/grafana/pkg/codegen" - "github.com/grafana/grafana/pkg/cuectx" - "github.com/grafana/grafana/pkg/plugins/pfs" - "github.com/grafana/kindsys" - "github.com/grafana/thema" -) - -func PluginTSEachMajor(rt *thema.Runtime) codejen.OneToMany[*pfs.PluginDecl] { - latestMajorsOrX := corecodegen.LatestMajorsOrXJenny(filepath.Join("packages", "grafana-schema", "src", "raw", "composable"), false, corecodegen.TSTypesJenny{}) - return &pleJenny{ - inner: kinds2pd(rt, latestMajorsOrX), - } -} - -type pleJenny struct { - inner codejen.OneToMany[*pfs.PluginDecl] -} - -func (*pleJenny) JennyName() string { - return "PluginEachMajorJenny" -} - -func (j *pleJenny) Generate(decl *pfs.PluginDecl) (codejen.Files, error) { - if !decl.HasSchema() { - return nil, nil - } - - jf, err := j.inner.Generate(decl) - if err != nil { - return nil, err - } - - version := "export const pluginVersion = \"%s\";" - if decl.PluginMeta.Version != nil { - version = fmt.Sprintf(version, *decl.PluginMeta.Version) - } else { - version = fmt.Sprintf(version, getGrafanaVersion()) - } - - files := make(codejen.Files, len(jf)) - for i, file := range jf { - tsf := &tsast.File{} - for _, im := range decl.Imports { - if tsim, err := cuectx.ConvertImport(im); err != nil { - return nil, err - } else if tsim.From.Value != "" { - tsf.Imports = append(tsf.Imports, tsim) - } - } - - tsf.Nodes = append(tsf.Nodes, tsast.Raw{ - Data: version, - }) - - tsf.Nodes = append(tsf.Nodes, tsast.Raw{ - Data: string(file.Data), - }) - - data := []byte(tsf.String()) - data = data[:len(data)-1] // remove the additional line break added by the inner jenny - - files[i] = *codejen.NewFile(file.RelativePath, data, append(file.From, j)...) - } - - return files, nil -} - -func kinds2pd(rt *thema.Runtime, j codejen.OneToMany[kindsys.Kind]) codejen.OneToMany[*pfs.PluginDecl] { - return codejen.AdaptOneToMany(j, func(pd *pfs.PluginDecl) kindsys.Kind { - kd, err := kindsys.BindComposable(rt, pd.KindDecl) - if err != nil { - return nil - } - return kd - }) -} - -func getGrafanaVersion() string { - dir, err := os.Getwd() - if err != nil { - return "" - } - - pkg, err := build.OpenPackageJSON(path.Join(dir, "../../../")) - if err != nil { - return "" - } - - return pkg.Version -} diff --git a/pkg/plugins/codegen/jenny_plugintstypes.go b/pkg/plugins/codegen/jenny_plugintstypes.go index 23c00a5ca55..c82f1be00f7 100644 --- a/pkg/plugins/codegen/jenny_plugintstypes.go +++ b/pkg/plugins/codegen/jenny_plugintstypes.go @@ -2,19 +2,25 @@ package codegen import ( "fmt" + "os" + "path" "path/filepath" "strings" "github.com/grafana/codejen" tsast "github.com/grafana/cuetsy/ts/ast" + "github.com/grafana/grafana/pkg/build" + "github.com/grafana/grafana/pkg/codegen" "github.com/grafana/grafana/pkg/cuectx" "github.com/grafana/grafana/pkg/plugins/pfs" ) -func PluginTSTypesJenny(root string, inner codejen.OneToOne[*pfs.PluginDecl]) codejen.OneToOne[*pfs.PluginDecl] { +var versionedPluginPath = filepath.Join("packages", "grafana-schema", "src", "raw", "composable") + +func PluginTSTypesJenny(root string) codejen.OneToMany[*pfs.PluginDecl] { return &ptsJenny{ root: root, - inner: inner, + inner: adaptToPipeline(codegen.TSTypesJenny{}), } } @@ -24,21 +30,23 @@ type ptsJenny struct { } func (j *ptsJenny) JennyName() string { - return "PluginTSTypesJenny" + return "PluginTsTypesJenny" } -func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) { +func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (codejen.Files, error) { if !decl.HasSchema() { return nil, nil } - tsf := &tsast.File{} + genFile := &tsast.File{} + versionedFile := &tsast.File{} for _, im := range decl.Imports { if tsim, err := cuectx.ConvertImport(im); err != nil { return nil, err } else if tsim.From.Value != "" { - tsf.Imports = append(tsf.Imports, tsim) + genFile.Imports = append(genFile.Imports, tsim) + versionedFile.Imports = append(versionedFile.Imports, tsim) } } @@ -47,13 +55,67 @@ func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) { return nil, err } - tsf.Nodes = append(tsf.Nodes, tsast.Raw{ - Data: string(jf.Data), - }) + rawData := tsast.Raw{Data: string(jf.Data)} + rawVersion := tsast.Raw{ + Data: getPluginVersion(decl.PluginMeta.Version), + } - path := filepath.Join(j.root, decl.PluginPath, fmt.Sprintf("%s.gen.ts", strings.ToLower(decl.SchemaInterface.Name))) - data := []byte(tsf.String()) + genFile.Nodes = append(genFile.Nodes, rawData) + + genPath := filepath.Join(j.root, decl.PluginPath, fmt.Sprintf("%s.gen.ts", strings.ToLower(decl.SchemaInterface.Name))) + data := []byte(genFile.String()) data = data[:len(data)-1] // remove the additional line break added by the inner jenny - return codejen.NewFile(path, data, append(jf.From, j)...), nil + files := make(codejen.Files, 2) + files[0] = *codejen.NewFile(genPath, data, append(jf.From, j)...) + + versionedFile.Nodes = append(versionedFile.Nodes, rawVersion, rawData) + + versionedData := []byte(versionedFile.String()) + versionedData = versionedData[:len(versionedData)-1] + + pluginFolder := strings.ReplaceAll(strings.ToLower(decl.PluginMeta.Name), " ", "") + versionedPath := filepath.Join(versionedPluginPath, pluginFolder, strings.ToLower(decl.SchemaInterface.Name), "x", jf.RelativePath) + files[1] = *codejen.NewFile(versionedPath, versionedData, append(jf.From, j)...) + + return files, nil +} + +func getPluginVersion(pluginVersion *string) string { + version := "export const pluginVersion = \"%s\";" + if pluginVersion != nil { + version = fmt.Sprintf(version, *pluginVersion) + } else { + version = fmt.Sprintf(version, getGrafanaVersion()) + } + + return version +} + +func adaptToPipeline(j codejen.OneToOne[codegen.SchemaForGen]) codejen.OneToOne[*pfs.PluginDecl] { + return codejen.AdaptOneToOne(j, func(pd *pfs.PluginDecl) codegen.SchemaForGen { + name := strings.ReplaceAll(pd.PluginMeta.Name, " ", "") + if pd.SchemaInterface.Name == "DataQuery" { + name = name + "DataQuery" + } + return codegen.SchemaForGen{ + Name: name, + Schema: pd.Lineage.Latest(), + IsGroup: pd.SchemaInterface.IsGroup, + } + }) +} + +func getGrafanaVersion() string { + dir, err := os.Getwd() + if err != nil { + return "" + } + + pkg, err := build.OpenPackageJSON(path.Join(dir, "../../../")) + if err != nil { + return "" + } + + return pkg.Version } diff --git a/public/app/plugins/datasource/azuremonitor/dataquery.gen.ts b/public/app/plugins/datasource/azuremonitor/dataquery.gen.ts index b9f234a9a3c..8616ca3ac59 100644 --- a/public/app/plugins/datasource/azuremonitor/dataquery.gen.ts +++ b/public/app/plugins/datasource/azuremonitor/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -372,4 +372,4 @@ export interface WorkspacesQuery extends BaseGrafanaTemplateVariableQuery { export type GrafanaTemplateVariableQuery = (AppInsightsMetricNameQuery | AppInsightsGroupByQuery | SubscriptionsQuery | ResourceGroupsQuery | ResourceNamesQuery | MetricNamespaceQuery | MetricDefinitionsQuery | MetricNamesQuery | WorkspacesQuery | UnknownQuery); -export interface AzureMonitor {} +export interface AzureMonitorDataQuery {} diff --git a/public/app/plugins/datasource/cloud-monitoring/dataquery.gen.ts b/public/app/plugins/datasource/cloud-monitoring/dataquery.gen.ts index 8fe1f6b79d9..a4d0755cb72 100644 --- a/public/app/plugins/datasource/cloud-monitoring/dataquery.gen.ts +++ b/public/app/plugins/datasource/cloud-monitoring/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -375,4 +375,4 @@ export enum MetricFindQueryTypes { Services = 'services', } -export interface GoogleCloudMonitoring {} +export interface GoogleCloudMonitoringDataQuery {} diff --git a/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts b/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts index ba62f4b1297..9cf62e4b588 100644 --- a/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts +++ b/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -304,4 +304,4 @@ export interface CloudWatchAnnotationQuery extends common.DataQuery, MetricStat queryMode: CloudWatchQueryMode; } -export interface CloudWatch {} +export interface CloudWatchDataQuery {} diff --git a/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts b/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts index f9f394294f6..f18c10029c0 100644 --- a/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts +++ b/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -376,7 +376,7 @@ export type PipelineMetricAggregation = (MovingAverage | Derivative | Cumulative export type MetricAggregationWithSettings = (BucketScript | CumulativeSum | Derivative | SerialDiff | RawData | RawDocument | UniqueCount | Percentiles | ExtendedStats | Min | Max | Sum | Average | MovingAverage | MovingFunction | Logs | Rate | TopMetrics); -export interface Elasticsearch extends common.DataQuery { +export interface ElasticsearchDataQuery extends common.DataQuery { /** * Alias pattern */ @@ -399,7 +399,7 @@ export interface Elasticsearch extends common.DataQuery { timeField?: string; } -export const defaultElasticsearch: Partial = { +export const defaultElasticsearchDataQuery: Partial = { bucketAggs: [], metrics: [], }; diff --git a/public/app/plugins/datasource/elasticsearch/types.ts b/public/app/plugins/datasource/elasticsearch/types.ts index f462f43ad09..9e3a610b895 100644 --- a/public/app/plugins/datasource/elasticsearch/types.ts +++ b/public/app/plugins/datasource/elasticsearch/types.ts @@ -15,11 +15,11 @@ import { MovingAverage as SchemaMovingAverage, BucketAggregation, Logs as SchemaLogs, - Elasticsearch, + ElasticsearchDataQuery, } from './dataquery.gen'; export * from './dataquery.gen'; -export { Elasticsearch as ElasticsearchQuery } from './dataquery.gen'; +export { ElasticsearchDataQuery as ElasticsearchQuery } from './dataquery.gen'; // We want to extend the settings of the Logs query with additional properties that // are not part of the schema. This is a workaround, because exporting LogsSettings @@ -127,7 +127,7 @@ export type DataLinkConfig = { }; export interface ElasticsearchAnnotationQuery { - target: Elasticsearch; + target: ElasticsearchDataQuery; timeField?: string; titleField?: string; timeEndField?: string; diff --git a/public/app/plugins/datasource/grafana-pyroscope-datasource/dataquery.gen.ts b/public/app/plugins/datasource/grafana-pyroscope-datasource/dataquery.gen.ts index b6e39ae2c7d..4a3595c3a35 100644 --- a/public/app/plugins/datasource/grafana-pyroscope-datasource/dataquery.gen.ts +++ b/public/app/plugins/datasource/grafana-pyroscope-datasource/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -14,7 +14,7 @@ export type PyroscopeQueryType = ('metrics' | 'profile' | 'both'); export const defaultPyroscopeQueryType: PyroscopeQueryType = 'both'; -export interface GrafanaPyroscope extends common.DataQuery { +export interface GrafanaPyroscopeDataQuery extends common.DataQuery { /** * Allows to group the results. */ @@ -37,7 +37,7 @@ export interface GrafanaPyroscope extends common.DataQuery { spanSelector?: Array; } -export const defaultGrafanaPyroscope: Partial = { +export const defaultGrafanaPyroscopeDataQuery: Partial = { groupBy: [], labelSelector: '{}', spanSelector: [], diff --git a/public/app/plugins/datasource/grafana-pyroscope-datasource/datasource.ts b/public/app/plugins/datasource/grafana-pyroscope-datasource/datasource.ts index 460f32b10fe..52d50b6995a 100644 --- a/public/app/plugins/datasource/grafana-pyroscope-datasource/datasource.ts +++ b/public/app/plugins/datasource/grafana-pyroscope-datasource/datasource.ts @@ -12,7 +12,7 @@ import { import { DataSourceWithBackend, getTemplateSrv, TemplateSrv } from '@grafana/runtime'; import { VariableSupport } from './VariableSupport'; -import { defaultGrafanaPyroscope, defaultPyroscopeQueryType } from './dataquery.gen'; +import { defaultGrafanaPyroscopeDataQuery, defaultPyroscopeQueryType } from './dataquery.gen'; import { PyroscopeDataSourceOptions, Query, ProfileTypeMessage } from './types'; import { extractLabelMatchers, toPromLikeExpr } from './utils'; @@ -115,7 +115,7 @@ export class PyroscopeDataSource extends DataSourceWithBackend = { - ...defaultGrafanaPyroscope, + ...defaultGrafanaPyroscopeDataQuery, queryType: defaultPyroscopeQueryType, }; diff --git a/public/app/plugins/datasource/grafana-pyroscope-datasource/types.ts b/public/app/plugins/datasource/grafana-pyroscope-datasource/types.ts index 04aa2f9a9bd..1570edd34b8 100644 --- a/public/app/plugins/datasource/grafana-pyroscope-datasource/types.ts +++ b/public/app/plugins/datasource/grafana-pyroscope-datasource/types.ts @@ -1,8 +1,8 @@ import { DataSourceJsonData } from '@grafana/data'; -import { GrafanaPyroscope, PyroscopeQueryType } from './dataquery.gen'; +import { GrafanaPyroscopeDataQuery, PyroscopeQueryType } from './dataquery.gen'; -export interface Query extends GrafanaPyroscope { +export interface Query extends GrafanaPyroscopeDataQuery { queryType: PyroscopeQueryType; } diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/MetaDataInspector.tsx b/public/app/plugins/datasource/grafana-testdata-datasource/MetaDataInspector.tsx index 79b2b4fb28a..de58ecd4381 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/MetaDataInspector.tsx +++ b/public/app/plugins/datasource/grafana-testdata-datasource/MetaDataInspector.tsx @@ -3,10 +3,10 @@ import React from 'react'; import { MetadataInspectorProps } from '@grafana/data'; import { Stack } from '@grafana/ui'; -import { TestData } from './dataquery.gen'; +import { TestDataDataQuery } from './dataquery.gen'; import { TestDataDataSource } from './datasource'; -export type Props = MetadataInspectorProps; +export type Props = MetadataInspectorProps; export function MetaDataInspector({ data }: Props) { return ( diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx b/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx index c6cf280a5be..55b93f217a9 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx +++ b/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx @@ -17,7 +17,7 @@ import { RawFrameEditor } from './components/RawFrameEditor'; import { SimulationQueryEditor } from './components/SimulationQueryEditor'; import { USAQueryEditor, usaQueryModes } from './components/USAQueryEditor'; import { defaultCSVWaveQuery, defaultPulseQuery, defaultQuery } from './constants'; -import { CSVWave, NodesQuery, TestData, TestDataQueryType, USAQuery } from './dataquery.gen'; +import { CSVWave, NodesQuery, TestDataDataQuery, TestDataQueryType, USAQuery } from './dataquery.gen'; import { TestDataDataSource } from './datasource'; import { defaultStreamQuery } from './runStreams'; @@ -31,11 +31,11 @@ const selectors = editorSelectors.components.DataSource.TestData.QueryTab; export interface EditorProps { onChange: (value: any) => void; - query: TestData; + query: TestDataDataQuery; ds: TestDataDataSource; } -export type Props = QueryEditorProps; +export type Props = QueryEditorProps; export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props) => { query = { ...defaultQuery, ...query }; @@ -63,7 +63,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props) })); }, []); - const onUpdate = (query: TestData) => { + const onUpdate = (query: TestDataDataQuery) => { onChange(query); onRunQuery(); }; @@ -83,7 +83,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props) } // Clear model from existing props that belong to other scenarios - const update: TestData = { + const update: TestDataDataQuery = { scenarioId: item.value! as TestDataQueryType, refId: query.refId, alias: query.alias, diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/components/NodeGraphEditor.tsx b/public/app/plugins/datasource/grafana-testdata-datasource/components/NodeGraphEditor.tsx index 4421fe6627e..9e1c3d626ea 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/components/NodeGraphEditor.tsx +++ b/public/app/plugins/datasource/grafana-testdata-datasource/components/NodeGraphEditor.tsx @@ -2,11 +2,11 @@ import React from 'react'; import { Input, InlineFieldRow, InlineField, Select } from '@grafana/ui'; -import { NodesQuery, TestData } from '../dataquery.gen'; +import { NodesQuery, TestDataDataQuery } from '../dataquery.gen'; export interface Props { onChange: (value: NodesQuery) => void; - query: TestData; + query: TestDataDataQuery; } export function NodeGraphEditor({ query, onChange }: Props) { const type = query.nodes?.type || 'random'; diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx b/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx index 2296c6c0fd0..1c5085f7b09 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx +++ b/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx @@ -4,7 +4,7 @@ import { selectors } from '@grafana/e2e-selectors'; import { InlineField, InlineFieldRow, Input } from '@grafana/ui'; import { EditorProps } from '../QueryEditor'; -import { TestData } from '../dataquery.gen'; +import { TestDataDataQuery } from '../dataquery.gen'; const randomWalkFields: Array<{ label: string; @@ -49,7 +49,7 @@ export const RandomWalkEditor = ({ onChange, query }: EditorProps) => { id={`randomWalk-${id}-${query.refId}`} min={min} step={step} - value={(query as any)[id as keyof TestData] || placeholder} + value={(query as any)[id as keyof TestDataDataQuery] || placeholder} placeholder={placeholder} onChange={onChange} /> diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/constants.ts b/public/app/plugins/datasource/grafana-testdata-datasource/constants.ts index 3acb06f3c53..a1ec6211b7a 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/constants.ts +++ b/public/app/plugins/datasource/grafana-testdata-datasource/constants.ts @@ -1,4 +1,4 @@ -import { CSVWave, PulseWaveQuery, TestData, TestDataQueryType } from './dataquery.gen'; +import { CSVWave, PulseWaveQuery, TestDataDataQuery, TestDataQueryType } from './dataquery.gen'; export const defaultPulseQuery: PulseWaveQuery = { timeStep: 60, @@ -15,7 +15,7 @@ export const defaultCSVWaveQuery: CSVWave[] = [ }, ]; -export const defaultQuery: TestData = { +export const defaultQuery: TestDataDataQuery = { scenarioId: TestDataQueryType.RandomWalk, refId: '', }; diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/dataquery.gen.ts b/public/app/plugins/datasource/grafana-testdata-datasource/dataquery.gen.ts index ed487a37c29..f7fc07ecb35 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/dataquery.gen.ts +++ b/public/app/plugins/datasource/grafana-testdata-datasource/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -106,7 +106,7 @@ export interface Scenario { stringInput: string; } -export interface TestData extends common.DataQuery { +export interface TestDataDataQuery extends common.DataQuery { alias?: string; channel?: string; csvContent?: string; @@ -134,7 +134,7 @@ export interface TestData extends common.DataQuery { usa?: USAQuery; } -export const defaultTestData: Partial = { +export const defaultTestDataDataQuery: Partial = { csvWave: [], points: [], scenarioId: TestDataQueryType.RandomWalk, diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/datasource.ts b/public/app/plugins/datasource/grafana-testdata-datasource/datasource.ts index e290b34a022..7c486ddacb8 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/datasource.ts +++ b/public/app/plugins/datasource/grafana-testdata-datasource/datasource.ts @@ -20,14 +20,14 @@ import { } from '@grafana/data'; import { DataSourceWithBackend, getBackendSrv, getGrafanaLiveSrv, getTemplateSrv, TemplateSrv } from '@grafana/runtime'; -import { Scenario, TestData, TestDataQueryType } from './dataquery.gen'; +import { Scenario, TestDataDataQuery, TestDataQueryType } from './dataquery.gen'; import { queryMetricTree } from './metricTree'; import { generateRandomEdges, generateRandomNodes, savedNodesResponse } from './nodeGraphUtils'; import { runStream } from './runStreams'; import { flameGraphData, flameGraphDataDiff } from './testData/flameGraphResponse'; import { TestDataVariableSupport } from './variables'; -export class TestDataDataSource extends DataSourceWithBackend { +export class TestDataDataSource extends DataSourceWithBackend { scenariosCache?: Promise; constructor( @@ -40,7 +40,7 @@ export class TestDataDataSource extends DataSourceWithBackend { getDefaultQuery: () => ({ scenarioId: TestDataQueryType.Annotations, lines: 10 }), // Make sure annotations have scenarioId set - prepareAnnotation: (old: AnnotationQuery) => { + prepareAnnotation: (old: AnnotationQuery) => { if (old.target?.scenarioId?.length) { return old; } @@ -56,15 +56,15 @@ export class TestDataDataSource extends DataSourceWithBackend { }; } - getDefaultQuery(): Partial { + getDefaultQuery(): Partial { return { scenarioId: TestDataQueryType.RandomWalk, seriesCount: 1, }; } - query(options: DataQueryRequest): Observable { - const backendQueries: TestData[] = []; + query(options: DataQueryRequest): Observable { + const backendQueries: TestDataDataQuery[] = []; const streams: Array> = []; // Start streams and prepare queries @@ -141,7 +141,7 @@ export class TestDataDataSource extends DataSourceWithBackend { return merge(...streams); } - resolveTemplateVariables(query: TestData, scopedVars: ScopedVars) { + resolveTemplateVariables(query: TestDataDataQuery, scopedVars: ScopedVars) { if (query.labels) { query.labels = this.templateSrv.replace(query.labels, scopedVars); } @@ -162,12 +162,15 @@ export class TestDataDataSource extends DataSourceWithBackend { } } - applyTemplateVariables(query: TestData, scopedVars: ScopedVars): TestData { + applyTemplateVariables(query: TestDataDataQuery, scopedVars: ScopedVars): TestDataDataQuery { this.resolveTemplateVariables(query, scopedVars); return query; } - annotationDataTopicTest(target: TestData, req: DataQueryRequest): Observable { + annotationDataTopicTest( + target: TestDataDataQuery, + req: DataQueryRequest + ): Observable { const events = this.buildFakeAnnotationEvents(req.range, target.lines ?? 10); const dataFrame = new ArrayDataFrame(events); dataFrame.meta = { dataTopic: DataTopic.Annotations }; @@ -192,7 +195,7 @@ export class TestDataDataSource extends DataSourceWithBackend { return events; } - getQueryDisplayText(query: TestData) { + getQueryDisplayText(query: TestDataDataQuery) { const scenario = query.scenarioId ?? 'Default scenario'; if (query.alias) { @@ -217,7 +220,10 @@ export class TestDataDataSource extends DataSourceWithBackend { return this.scenariosCache; } - variablesQuery(target: TestData, options: DataQueryRequest): Observable { + variablesQuery( + target: TestDataDataQuery, + options: DataQueryRequest + ): Observable { const query = target.stringInput ?? ''; const interpolatedQuery = this.templateSrv.replace(query, getSearchFilterScopedVar({ query, wildcardChar: '*' })); const children = queryMetricTree(interpolatedQuery); @@ -227,7 +233,7 @@ export class TestDataDataSource extends DataSourceWithBackend { return of({ data: [dataFrame] }).pipe(delay(100)); } - nodesQuery(target: TestData, options: DataQueryRequest): Observable { + nodesQuery(target: TestDataDataQuery, options: DataQueryRequest): Observable { const type = target.nodes?.type || 'random'; let frames: DataFrame[]; switch (type) { @@ -250,12 +256,12 @@ export class TestDataDataSource extends DataSourceWithBackend { return of({ data: frames }).pipe(delay(100)); } - flameGraphQuery(target: TestData): Observable { + flameGraphQuery(target: TestDataDataQuery): Observable { const data = target.flamegraphDiff ? flameGraphDataDiff : flameGraphData; return of({ data: [{ ...data, refId: target.refId }] }).pipe(delay(100)); } - trace(options: DataQueryRequest): Observable { + trace(options: DataQueryRequest): Observable { const frame = new MutableDataFrame({ meta: { preferredVisualisationType: 'trace', @@ -317,7 +323,10 @@ export class TestDataDataSource extends DataSourceWithBackend { return of({ data: [frame] }).pipe(delay(100)); } - rawFrameQuery(target: TestData, options: DataQueryRequest): Observable { + rawFrameQuery( + target: TestDataDataQuery, + options: DataQueryRequest + ): Observable { try { const data = JSON.parse(target.rawFrameContent ?? '[]').map((v: any) => { const f = toDataFrame(v); @@ -333,7 +342,10 @@ export class TestDataDataSource extends DataSourceWithBackend { } } - serverErrorQuery(target: TestData, options: DataQueryRequest): Observable | null { + serverErrorQuery( + target: TestDataDataQuery, + options: DataQueryRequest + ): Observable | null { const { errorType } = target; if (errorType === 'server_panic') { @@ -353,7 +365,10 @@ export class TestDataDataSource extends DataSourceWithBackend { } } -function runGrafanaAPI(target: TestData, req: DataQueryRequest): Observable { +function runGrafanaAPI( + target: TestDataDataQuery, + req: DataQueryRequest +): Observable { const url = `/api/${target.stringInput}`; return from( getBackendSrv() @@ -370,7 +385,10 @@ function runGrafanaAPI(target: TestData, req: DataQueryRequest): Obser let liveQueryCounter = 1000; -function runGrafanaLiveQuery(target: TestData, req: DataQueryRequest): Observable { +function runGrafanaLiveQuery( + target: TestDataDataQuery, + req: DataQueryRequest +): Observable { if (!target.channel) { throw new Error(`Missing channel config`); } diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts b/public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts index fb0c0797280..ea98e96636c 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts +++ b/public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts @@ -20,7 +20,7 @@ import { } from '@grafana/data'; import { getRandomLine } from './LogIpsum'; -import { TestData, StreamingQuery } from './dataquery.gen'; +import { TestDataDataQuery, StreamingQuery } from './dataquery.gen'; export const defaultStreamQuery: StreamingQuery = { type: 'signal', @@ -30,7 +30,10 @@ export const defaultStreamQuery: StreamingQuery = { bands: 1, }; -export function runStream(target: TestData, req: DataQueryRequest): Observable { +export function runStream( + target: TestDataDataQuery, + req: DataQueryRequest +): Observable { const query = defaults(target.stream, defaultStreamQuery); switch (query.type) { case 'signal': @@ -46,9 +49,9 @@ export function runStream(target: TestData, req: DataQueryRequest): Ob } export function runSignalStream( - target: TestData, + target: TestDataDataQuery, query: StreamingQuery, - req: DataQueryRequest + req: DataQueryRequest ): Observable { return new Observable((subscriber) => { const streamId = `signal-${req.panelId || 'explore'}-${target.refId}`; @@ -128,9 +131,9 @@ export function runSignalStream( } export function runLogsStream( - target: TestData, + target: TestDataDataQuery, query: StreamingQuery, - req: DataQueryRequest + req: DataQueryRequest ): Observable { return new Observable((subscriber) => { const streamId = `logs-${req.panelId || 'explore'}-${target.refId}`; @@ -174,9 +177,9 @@ export function runLogsStream( } export function runFetchStream( - target: TestData, + target: TestDataDataQuery, query: StreamingQuery, - req: DataQueryRequest + req: DataQueryRequest ): Observable { return new Observable((subscriber) => { const streamId = `fetch-${req.panelId || 'explore'}-${target.refId}`; @@ -252,9 +255,9 @@ export function runFetchStream( } export function runTracesStream( - target: TestData, + target: TestDataDataQuery, query: StreamingQuery, - req: DataQueryRequest + req: DataQueryRequest ): Observable { return new Observable((subscriber) => { const streamId = `traces-${req.panelId || 'explore'}-${target.refId}`; @@ -285,7 +288,7 @@ export function runTracesStream( }); } -function createMainTraceFrame(target: TestData, maxDataPoints = 1000) { +function createMainTraceFrame(target: TestDataDataQuery, maxDataPoints = 1000) { const data = new CircularDataFrame({ append: 'head', capacity: maxDataPoints, diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/variables.ts b/public/app/plugins/datasource/grafana-testdata-datasource/variables.ts index 0668a00e6c7..16b604896e1 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/variables.ts +++ b/public/app/plugins/datasource/grafana-testdata-datasource/variables.ts @@ -1,10 +1,10 @@ import { StandardVariableQuery, StandardVariableSupport } from '@grafana/data'; -import { TestData, TestDataQueryType } from './dataquery.gen'; +import { TestDataDataQuery, TestDataQueryType } from './dataquery.gen'; import { TestDataDataSource } from './datasource'; export class TestDataVariableSupport extends StandardVariableSupport { - toDataQuery(query: StandardVariableQuery): TestData { + toDataQuery(query: StandardVariableQuery): TestDataDataQuery { return { refId: 'TestDataDataSource-QueryVariable', stringInput: query.query, diff --git a/public/app/plugins/datasource/loki/dataquery.gen.ts b/public/app/plugins/datasource/loki/dataquery.gen.ts index e9f78618566..063deb3ee2f 100644 --- a/public/app/plugins/datasource/loki/dataquery.gen.ts +++ b/public/app/plugins/datasource/loki/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -33,7 +33,7 @@ export enum LokiQueryDirection { Forward = 'forward', } -export interface Loki extends common.DataQuery { +export interface LokiDataQuery extends common.DataQuery { editorMode?: QueryEditorMode; /** * The LogQL query. diff --git a/public/app/plugins/datasource/loki/types.ts b/public/app/plugins/datasource/loki/types.ts index c0e55bf1d1b..806e7e81434 100644 --- a/public/app/plugins/datasource/loki/types.ts +++ b/public/app/plugins/datasource/loki/types.ts @@ -1,6 +1,11 @@ import { DataQuery, DataQueryRequest, DataSourceJsonData, TimeRange } from '@grafana/data'; -import { Loki as LokiQueryFromSchema, LokiQueryType, SupportingQueryType, LokiQueryDirection } from './dataquery.gen'; +import { + LokiDataQuery as LokiQueryFromSchema, + LokiQueryType, + SupportingQueryType, + LokiQueryDirection, +} from './dataquery.gen'; export { LokiQueryDirection, LokiQueryType, SupportingQueryType }; diff --git a/public/app/plugins/datasource/parca/QueryEditor/QueryEditor.tsx b/public/app/plugins/datasource/parca/QueryEditor/QueryEditor.tsx index 561eb26f747..d470a5d5e0d 100644 --- a/public/app/plugins/datasource/parca/QueryEditor/QueryEditor.tsx +++ b/public/app/plugins/datasource/parca/QueryEditor/QueryEditor.tsx @@ -5,7 +5,7 @@ import { useMount } from 'react-use'; import { CoreApp, QueryEditorProps } from '@grafana/data'; import { ButtonCascader, CascaderOption } from '@grafana/ui'; -import { defaultParca, defaultParcaQueryType, Parca } from '../dataquery.gen'; +import { defaultParcaDataQuery, defaultParcaQueryType, ParcaDataQuery as Parca } from '../dataquery.gen'; import { ParcaDataSource } from '../datasource'; import { ParcaDataSourceOptions, ProfileTypeMessage, Query } from '../types'; @@ -17,7 +17,7 @@ import { QueryOptions } from './QueryOptions'; export type Props = QueryEditorProps; export const defaultQuery: Partial = { - ...defaultParca, + ...defaultParcaDataQuery, queryType: defaultParcaQueryType, }; diff --git a/public/app/plugins/datasource/parca/dataquery.gen.ts b/public/app/plugins/datasource/parca/dataquery.gen.ts index 7542d11ac44..e39bfa7d766 100644 --- a/public/app/plugins/datasource/parca/dataquery.gen.ts +++ b/public/app/plugins/datasource/parca/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -14,7 +14,7 @@ export type ParcaQueryType = ('metrics' | 'profile' | 'both'); export const defaultParcaQueryType: ParcaQueryType = 'both'; -export interface Parca extends common.DataQuery { +export interface ParcaDataQuery extends common.DataQuery { /** * Specifies the query label selectors. */ @@ -25,6 +25,6 @@ export interface Parca extends common.DataQuery { profileTypeId: string; } -export const defaultParca: Partial = { +export const defaultParcaDataQuery: Partial = { labelSelector: '{}', }; diff --git a/public/app/plugins/datasource/parca/types.ts b/public/app/plugins/datasource/parca/types.ts index 4c039b5fdbb..c149c9ef5f3 100644 --- a/public/app/plugins/datasource/parca/types.ts +++ b/public/app/plugins/datasource/parca/types.ts @@ -1,6 +1,6 @@ import { DataSourceJsonData } from '@grafana/data'; -import { Parca as ParcaBase, ParcaQueryType } from './dataquery.gen'; +import { ParcaDataQuery as ParcaBase, ParcaQueryType } from './dataquery.gen'; export interface Query extends ParcaBase { queryType: ParcaQueryType; diff --git a/public/app/plugins/datasource/tempo/dataquery.gen.ts b/public/app/plugins/datasource/tempo/dataquery.gen.ts index 1d915860b01..1f8c3781219 100644 --- a/public/app/plugins/datasource/tempo/dataquery.gen.ts +++ b/public/app/plugins/datasource/tempo/dataquery.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. @@ -127,4 +127,4 @@ export interface TraceqlFilter { valueType?: string; } -export interface Tempo {} +export interface TempoDataQuery {} diff --git a/public/app/plugins/gen.go b/public/app/plugins/gen.go index 75975955253..b8771d48753 100644 --- a/public/app/plugins/gen.go +++ b/public/app/plugins/gen.go @@ -49,8 +49,7 @@ func main() { pluginKindGen.Append( codegen.PluginTreeListJenny(), codegen.PluginGoTypesJenny("pkg/tsdb"), - codegen.PluginTSTypesJenny("public/app/plugins", adaptToPipeline(corecodegen.TSTypesJenny{})), - codegen.PluginTSEachMajor(rt), + codegen.PluginTSTypesJenny("public/app/plugins"), ) schifs := kindsys.SchemaInterfaces(rt.Context()) diff --git a/public/app/plugins/panel/alertGroups/panelcfg.gen.ts b/public/app/plugins/panel/alertGroups/panelcfg.gen.ts index dccaa7be815..04bd8098dae 100644 --- a/public/app/plugins/panel/alertGroups/panelcfg.gen.ts +++ b/public/app/plugins/panel/alertGroups/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/annolist/panelcfg.gen.ts b/public/app/plugins/panel/annolist/panelcfg.gen.ts index fd2a9274205..17343023728 100644 --- a/public/app/plugins/panel/annolist/panelcfg.gen.ts +++ b/public/app/plugins/panel/annolist/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/barchart/panelcfg.gen.ts b/public/app/plugins/panel/barchart/panelcfg.gen.ts index 841dee4a260..8a30ebf269f 100644 --- a/public/app/plugins/panel/barchart/panelcfg.gen.ts +++ b/public/app/plugins/panel/barchart/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/bargauge/panelcfg.gen.ts b/public/app/plugins/panel/bargauge/panelcfg.gen.ts index b9d330fac98..eb6f40ef6a5 100644 --- a/public/app/plugins/panel/bargauge/panelcfg.gen.ts +++ b/public/app/plugins/panel/bargauge/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/candlestick/panelcfg.gen.ts b/public/app/plugins/panel/candlestick/panelcfg.gen.ts index f6eafc6f39c..d527f54d7eb 100644 --- a/public/app/plugins/panel/candlestick/panelcfg.gen.ts +++ b/public/app/plugins/panel/candlestick/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/canvas/panelcfg.gen.ts b/public/app/plugins/panel/canvas/panelcfg.gen.ts index 880ef5d22db..16b6b3c83af 100644 --- a/public/app/plugins/panel/canvas/panelcfg.gen.ts +++ b/public/app/plugins/panel/canvas/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/dashlist/panelcfg.gen.ts b/public/app/plugins/panel/dashlist/panelcfg.gen.ts index 4c12168d0a5..7d85f926cfc 100644 --- a/public/app/plugins/panel/dashlist/panelcfg.gen.ts +++ b/public/app/plugins/panel/dashlist/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/datagrid/panelcfg.gen.ts b/public/app/plugins/panel/datagrid/panelcfg.gen.ts index 40269576d72..4816dbbc000 100644 --- a/public/app/plugins/panel/datagrid/panelcfg.gen.ts +++ b/public/app/plugins/panel/datagrid/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/debug/panelcfg.gen.ts b/public/app/plugins/panel/debug/panelcfg.gen.ts index 436fb0cd671..2163fc29ccd 100644 --- a/public/app/plugins/panel/debug/panelcfg.gen.ts +++ b/public/app/plugins/panel/debug/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/gauge/panelcfg.gen.ts b/public/app/plugins/panel/gauge/panelcfg.gen.ts index a0a73ef5863..f5d104afced 100644 --- a/public/app/plugins/panel/gauge/panelcfg.gen.ts +++ b/public/app/plugins/panel/gauge/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/geomap/panelcfg.gen.ts b/public/app/plugins/panel/geomap/panelcfg.gen.ts index 6c3f83f18b4..7e4288bf050 100644 --- a/public/app/plugins/panel/geomap/panelcfg.gen.ts +++ b/public/app/plugins/panel/geomap/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/heatmap/panelcfg.gen.ts b/public/app/plugins/panel/heatmap/panelcfg.gen.ts index 2816a19c90c..ce34f829840 100644 --- a/public/app/plugins/panel/heatmap/panelcfg.gen.ts +++ b/public/app/plugins/panel/heatmap/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/histogram/panelcfg.gen.ts b/public/app/plugins/panel/histogram/panelcfg.gen.ts index b49e6957790..68e5497753b 100644 --- a/public/app/plugins/panel/histogram/panelcfg.gen.ts +++ b/public/app/plugins/panel/histogram/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/logs/panelcfg.gen.ts b/public/app/plugins/panel/logs/panelcfg.gen.ts index e08ad83e62c..62e8fc956ed 100644 --- a/public/app/plugins/panel/logs/panelcfg.gen.ts +++ b/public/app/plugins/panel/logs/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/news/panelcfg.gen.ts b/public/app/plugins/panel/news/panelcfg.gen.ts index 8475aaa2f4e..d9e19537df4 100644 --- a/public/app/plugins/panel/news/panelcfg.gen.ts +++ b/public/app/plugins/panel/news/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/nodeGraph/panelcfg.gen.ts b/public/app/plugins/panel/nodeGraph/panelcfg.gen.ts index 672953359c3..d09f8d207cb 100644 --- a/public/app/plugins/panel/nodeGraph/panelcfg.gen.ts +++ b/public/app/plugins/panel/nodeGraph/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/piechart/panelcfg.gen.ts b/public/app/plugins/panel/piechart/panelcfg.gen.ts index 6d64ec8f2de..494d6678173 100644 --- a/public/app/plugins/panel/piechart/panelcfg.gen.ts +++ b/public/app/plugins/panel/piechart/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/stat/panelcfg.gen.ts b/public/app/plugins/panel/stat/panelcfg.gen.ts index 9d860c655d0..2f02876b845 100644 --- a/public/app/plugins/panel/stat/panelcfg.gen.ts +++ b/public/app/plugins/panel/stat/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/state-timeline/panelcfg.gen.ts b/public/app/plugins/panel/state-timeline/panelcfg.gen.ts index 12d089f6761..fb03ba0795f 100644 --- a/public/app/plugins/panel/state-timeline/panelcfg.gen.ts +++ b/public/app/plugins/panel/state-timeline/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/status-history/panelcfg.gen.ts b/public/app/plugins/panel/status-history/panelcfg.gen.ts index ef8b01455de..8bc46e363d0 100644 --- a/public/app/plugins/panel/status-history/panelcfg.gen.ts +++ b/public/app/plugins/panel/status-history/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/table/panelcfg.gen.ts b/public/app/plugins/panel/table/panelcfg.gen.ts index fa44e7f982e..5b771ff2640 100644 --- a/public/app/plugins/panel/table/panelcfg.gen.ts +++ b/public/app/plugins/panel/table/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/text/panelcfg.gen.ts b/public/app/plugins/panel/text/panelcfg.gen.ts index 8b35a85ed20..cf08ce24683 100644 --- a/public/app/plugins/panel/text/panelcfg.gen.ts +++ b/public/app/plugins/panel/text/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/timeseries/panelcfg.gen.ts b/public/app/plugins/panel/timeseries/panelcfg.gen.ts index 146ea812463..e5e4bce7e7b 100644 --- a/public/app/plugins/panel/timeseries/panelcfg.gen.ts +++ b/public/app/plugins/panel/timeseries/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/trend/panelcfg.gen.ts b/public/app/plugins/panel/trend/panelcfg.gen.ts index af1edc3126d..f72cfaceb72 100644 --- a/public/app/plugins/panel/trend/panelcfg.gen.ts +++ b/public/app/plugins/panel/trend/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate. diff --git a/public/app/plugins/panel/xychart/panelcfg.gen.ts b/public/app/plugins/panel/xychart/panelcfg.gen.ts index 52f8a1ae2ea..09f7869c536 100644 --- a/public/app/plugins/panel/xychart/panelcfg.gen.ts +++ b/public/app/plugins/panel/xychart/panelcfg.gen.ts @@ -4,7 +4,7 @@ // public/app/plugins/gen.go // Using jennies: // TSTypesJenny -// PluginTSTypesJenny +// PluginTsTypesJenny // // Run 'make gen-cue' from repository root to regenerate.