mirror of
				https://github.com/grafana/grafana.git
				synced 2025-02-25 18:55:37 -06:00 
			
		
		
		
	Kindsys: Unique names for composable kind TS types (#61928)
* Kindsys: Unique names for composable kind TS types * Update all TS imports
This commit is contained in:
		| @@ -3,6 +3,7 @@ package codegen | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"path/filepath" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/grafana/codejen" | ||||
| 	tsast "github.com/grafana/cuetsy/ts/ast" | ||||
| @@ -40,11 +41,10 @@ func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	slotname := decl.SchemaInterface.Name() | ||||
| 	v := decl.Lineage.Latest().Version() | ||||
|  | ||||
| 	tsf.Nodes = append(tsf.Nodes, tsast.Raw{ | ||||
| 		Data: fmt.Sprintf("export const %sModelVersion = Object.freeze([%v, %v]);", slotname, v[0], v[1]), | ||||
| 		Data: fmt.Sprintf("export const %sModelVersion = Object.freeze([%v, %v]);", decl.SchemaInterface.Name(), v[0], v[1]), | ||||
| 	}) | ||||
|  | ||||
| 	jf, err := j.inner.Generate(decl) | ||||
| @@ -56,7 +56,7 @@ func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) { | ||||
| 		Data: string(jf.Data), | ||||
| 	}) | ||||
|  | ||||
| 	path := filepath.Join(j.root, decl.PluginPath, "models.gen.ts") | ||||
| 	path := filepath.Join(j.root, decl.PluginPath, fmt.Sprintf("%s.gen.ts", strings.ToLower(decl.SchemaInterface.Name()))) | ||||
| 	data := []byte(tsf.String()) | ||||
| 	data = data[:len(data)-1] // remove the additional line break added by the inner jenny | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { VizPanel, VizPanelState } from '@grafana/scenes'; | ||||
| import { GraphFieldConfig, TableFieldOptions } from '@grafana/schema'; | ||||
| import { PanelOptions as BarGaugePanelOptions } from 'app/plugins/panel/bargauge/models.gen'; | ||||
| import { PanelOptions as BarGaugePanelOptions } from 'app/plugins/panel/bargauge/panelcfg.gen'; | ||||
| import { PanelOptions as TablePanelOptions } from 'app/plugins/panel/table/models.gen'; | ||||
| import { TimeSeriesOptions } from 'app/plugins/panel/timeseries/types'; | ||||
|  | ||||
|   | ||||
| @@ -10,7 +10,7 @@ import { backendSrv } from '../../../core/services/backend_srv'; | ||||
| import { setDashboardSrv } from '../../../features/dashboard/services/DashboardSrv'; | ||||
|  | ||||
| import { AnnoListPanel, Props } from './AnnoListPanel'; | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| jest.mock('@grafana/runtime', () => ({ | ||||
|   ...(jest.requireActual('@grafana/runtime') as unknown as object), | ||||
|   | ||||
| @@ -19,7 +19,7 @@ import appEvents from 'app/core/app_events'; | ||||
| import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv'; | ||||
|  | ||||
| import { AnnotationListItem } from './AnnotationListItem'; | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| interface UserInfo { | ||||
|   id?: number; | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import React, { MouseEvent } from 'react'; | ||||
| import { AnnotationEvent, DateTimeInput, GrafanaTheme2, PanelProps } from '@grafana/data'; | ||||
| import { Card, TagList, Tooltip, RenderUserContentAsHTML, useStyles2 } from '@grafana/ui'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| interface Props extends Pick<PanelProps<PanelOptions>, 'options'> { | ||||
|   annotation: AnnotationEvent; | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import { PanelModel, PanelPlugin } from '@grafana/data'; | ||||
| import { TagsInput } from '@grafana/ui'; | ||||
|  | ||||
| import { AnnoListPanel } from './AnnoListPanel'; | ||||
| import { defaultPanelOptions, PanelOptions } from './models.gen'; | ||||
| import { defaultPanelOptions, PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions>(AnnoListPanel) | ||||
|   .setPanelOptions((builder) => { | ||||
|   | ||||
| @@ -37,7 +37,7 @@ import { CloseButton } from 'app/core/components/CloseButton/CloseButton'; | ||||
| import { DataHoverView } from '../geomap/components/DataHoverView'; | ||||
| import { getFieldLegendItem } from '../state-timeline/utils'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
| import { prepareBarChartDisplayValues, preparePlotConfigBuilder } from './utils'; | ||||
|  | ||||
| const TOOLTIP_OFFSET = 10; | ||||
|   | ||||
| @@ -16,7 +16,7 @@ import { ThresholdsStyleEditor } from '../timeseries/ThresholdsStyleEditor'; | ||||
|  | ||||
| import { BarChartPanel } from './BarChartPanel'; | ||||
| import { TickSpacingEditor } from './TickSpacingEditor'; | ||||
| import { PanelFieldConfig, PanelOptions, defaultPanelFieldConfig, defaultPanelOptions } from './models.gen'; | ||||
| import { PanelFieldConfig, PanelOptions, defaultPanelFieldConfig, defaultPanelOptions } from './panelcfg.gen'; | ||||
| import { BarChartSuggestionsSupplier } from './suggestions'; | ||||
| import { prepareBarChartDisplayValues } from './utils'; | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { VisualizationSuggestionsBuilder, VizOrientation } from '@grafana/data'; | ||||
| import { LegendDisplayMode, StackingMode, VisibilityMode } from '@grafana/schema'; | ||||
| import { SuggestionName } from 'app/types/suggestions'; | ||||
|  | ||||
| import { PanelFieldConfig, PanelOptions } from './models.gen'; | ||||
| import { PanelFieldConfig, PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export class BarChartSuggestionsSupplier { | ||||
|   getListWithDefaults(builder: VisualizationSuggestionsBuilder) { | ||||
|   | ||||
| @@ -19,7 +19,7 @@ import { | ||||
|   SortOrder, | ||||
| } from '@grafana/schema'; | ||||
|  | ||||
| import { PanelFieldConfig, PanelOptions } from './models.gen'; | ||||
| import { PanelFieldConfig, PanelOptions } from './panelcfg.gen'; | ||||
| import { BarChartOptionsEX, prepareBarChartDisplayValues, preparePlotConfigBuilder } from './utils'; | ||||
|  | ||||
| function mockDataFrame() { | ||||
|   | ||||
| @@ -32,7 +32,7 @@ import { getStackingGroups } from '@grafana/ui/src/components/uPlot/utils'; | ||||
| import { findField } from 'app/features/dimensions'; | ||||
|  | ||||
| import { BarsOptions, getConfig } from './bars'; | ||||
| import { PanelFieldConfig, PanelOptions, defaultPanelFieldConfig } from './models.gen'; | ||||
| import { PanelFieldConfig, PanelOptions, defaultPanelFieldConfig } from './panelcfg.gen'; | ||||
| import { BarChartDisplayValues, BarChartDisplayWarning } from './types'; | ||||
|  | ||||
| function getBarCharScaleOrientation(orientation: VizOrientation) { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { PanelModel } from '@grafana/data'; | ||||
| import { sharedSingleStatMigrationHandler } from '@grafana/ui'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export const barGaugePanelMigrationHandler = (panel: PanelModel<PanelOptions>): Partial<PanelOptions> => { | ||||
|   return sharedSingleStatMigrationHandler(panel); | ||||
|   | ||||
| @@ -16,7 +16,7 @@ import { BarGauge, DataLinksContextMenu, VizRepeater, VizRepeaterRenderValueProp | ||||
| import { DataLinksContextMenuApi } from '@grafana/ui/src/components/DataLinks/DataLinksContextMenu'; | ||||
| import { config } from 'app/core/config'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export class BarGaugePanel extends PureComponent<BarGaugePanelProps> { | ||||
|   renderComponent = ( | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import { addOrientationOption, addStandardDataReduceOptions } from '../stat/comm | ||||
|  | ||||
| import { barGaugePanelMigrationHandler } from './BarGaugeMigrations'; | ||||
| import { BarGaugePanel } from './BarGaugePanel'; | ||||
| import { PanelOptions, defaultPanelOptions } from './models.gen'; | ||||
| import { PanelOptions, defaultPanelOptions } from './panelcfg.gen'; | ||||
| import { BarGaugeSuggestionsSupplier } from './suggestions'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions>(BarGaugePanel) | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { VisualizationSuggestionsBuilder, VizOrientation } from '@grafana/data'; | ||||
| import { BarGaugeDisplayMode } from '@grafana/ui'; | ||||
| import { SuggestionName } from 'app/types/suggestions'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export class BarGaugeSuggestionsSupplier { | ||||
|   getSuggestionsForData(builder: VisualizationSuggestionsBuilder) { | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import { SearchCard } from 'app/features/search/components/SearchCard'; | ||||
| import { DashboardSearchItem } from 'app/features/search/types'; | ||||
| import { useDispatch } from 'app/types'; | ||||
|  | ||||
| import { PanelLayout, PanelOptions } from './models.gen'; | ||||
| import { PanelLayout, PanelOptions } from './panelcfg.gen'; | ||||
| import { getStyles } from './styles'; | ||||
|  | ||||
| type Dashboard = DashboardSearchItem & { id?: number; isSearchResult?: boolean; isRecent?: boolean }; | ||||
|   | ||||
| @@ -11,7 +11,7 @@ import { | ||||
| } from '../../../core/components/Select/ReadonlyFolderPicker/ReadonlyFolderPicker'; | ||||
|  | ||||
| import { DashList } from './DashList'; | ||||
| import { defaultPanelOptions, PanelLayout, PanelOptions } from './models.gen'; | ||||
| import { defaultPanelOptions, PanelLayout, PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions>(DashList) | ||||
|   .setPanelOptions((builder) => { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { PanelModel } from '@grafana/data'; | ||||
| import { sharedSingleStatPanelChangedHandler, sharedSingleStatMigrationHandler } from '@grafana/ui'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| // This is called when the panel first loads | ||||
| export const gaugePanelMigrationHandler = (panel: PanelModel<PanelOptions>): Partial<PanelOptions> => { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import { config } from 'app/core/config'; | ||||
|  | ||||
| import { clearNameForSingleSeries } from '../bargauge/BarGaugePanel'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export class GaugePanel extends PureComponent<PanelProps<PanelOptions>> { | ||||
|   renderComponent = ( | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import { addOrientationOption, addStandardDataReduceOptions } from '../stat/comm | ||||
|  | ||||
| import { gaugePanelMigrationHandler, gaugePanelChangedHandler } from './GaugeMigrations'; | ||||
| import { GaugePanel } from './GaugePanel'; | ||||
| import { PanelOptions, defaultPanelOptions } from './models.gen'; | ||||
| import { PanelOptions, defaultPanelOptions } from './panelcfg.gen'; | ||||
| import { GaugeSuggestionsSupplier } from './suggestions'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions>(GaugePanel) | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { ThresholdsMode, VisualizationSuggestionsBuilder } from '@grafana/data'; | ||||
| import { SuggestionName } from 'app/types/suggestions'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export class GaugeSuggestionsSupplier { | ||||
|   getSuggestionsForData(builder: VisualizationSuggestionsBuilder) { | ||||
|   | ||||
| @@ -23,7 +23,7 @@ import { | ||||
|   UPLOT_AXIS_FONT_SIZE, | ||||
| } from '@grafana/ui'; | ||||
|  | ||||
| import { defaultPanelFieldConfig, PanelFieldConfig, PanelOptions } from './models.gen'; | ||||
| import { defaultPanelFieldConfig, PanelFieldConfig, PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| function incrRoundDn(num: number, incr: number) { | ||||
|   return Math.floor(num / incr) * incr; | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import { histogramFieldsToFrame } from '@grafana/data/src/transformations/transf | ||||
| import { useTheme2 } from '@grafana/ui'; | ||||
|  | ||||
| import { Histogram, getBucketSize } from './Histogram'; | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| type Props = PanelProps<PanelOptions>; | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,7 @@ import { histogramFieldInfo } from '@grafana/data/src/transformations/transforme | ||||
| import { commonOptionsBuilder, graphFieldOptions } from '@grafana/ui'; | ||||
|  | ||||
| import { HistogramPanel } from './HistogramPanel'; | ||||
| import { PanelFieldConfig, PanelOptions, defaultPanelFieldConfig, defaultPanelOptions } from './models.gen'; | ||||
| import { PanelFieldConfig, PanelOptions, defaultPanelFieldConfig, defaultPanelOptions } from './panelcfg.gen'; | ||||
| import { originalDataHasHistogram } from './utils'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions, PanelFieldConfig>(HistogramPanel) | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import { CustomScrollbar } from '@grafana/ui'; | ||||
|  | ||||
| import { News } from './component/News'; | ||||
| import { DEFAULT_FEED_URL } from './constants'; | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
| import { useNewsFeed } from './useNewsFeed'; | ||||
|  | ||||
| interface NewsPanelProps extends PanelProps<PanelOptions> {} | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { PanelPlugin } from '@grafana/data'; | ||||
|  | ||||
| import { NewsPanel } from './NewsPanel'; | ||||
| import { DEFAULT_FEED_URL } from './constants'; | ||||
| import { PanelOptions, defaultPanelOptions } from './models.gen'; | ||||
| import { PanelOptions, defaultPanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions>(NewsPanel).setPanelOptions((builder) => { | ||||
|   builder | ||||
|   | ||||
| @@ -29,7 +29,7 @@ import { | ||||
| import { getTooltipContainerStyles } from '@grafana/ui/src/themes/mixins'; | ||||
| import { useComponentInstanceId } from '@grafana/ui/src/utils/useComponetInstanceId'; | ||||
|  | ||||
| import { PieChartType, PieChartLabels } from './models.gen'; | ||||
| import { PieChartType, PieChartLabels } from './panelcfg.gen'; | ||||
| import { filterDisplayItems, sumDisplayItemsReducer } from './utils'; | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import { | ||||
| import { LegendDisplayMode, SortOrder, TooltipDisplayMode } from '@grafana/schema'; | ||||
|  | ||||
| import { PieChartPanel } from './PieChartPanel'; | ||||
| import { PanelOptions, PieChartType, PieChartLegendValues } from './models.gen'; | ||||
| import { PanelOptions, PieChartType, PieChartLegendValues } from './panelcfg.gen'; | ||||
|  | ||||
| type PieChartPanelProps = ComponentProps<typeof PieChartPanel>; | ||||
|  | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import { | ||||
| } from '@grafana/ui'; | ||||
|  | ||||
| import { PieChart } from './PieChart'; | ||||
| import { PieChartLegendOptions, PieChartLegendValues, PanelOptions } from './models.gen'; | ||||
| import { PieChartLegendOptions, PieChartLegendValues, PanelOptions } from './panelcfg.gen'; | ||||
| import { filterDisplayItems, sumDisplayItemsReducer } from './utils'; | ||||
|  | ||||
| const defaultLegendOptions: PieChartLegendOptions = { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { FieldColorModeId, FieldConfigProperty, FieldMatcherID, PanelModel } from '@grafana/data'; | ||||
|  | ||||
| import { PieChartPanelChangedHandler } from './migrations'; | ||||
| import { PieChartLabels } from './models.gen'; | ||||
| import { PieChartLabels } from './panelcfg.gen'; | ||||
|  | ||||
| describe('PieChart -> PieChartV2 migrations', () => { | ||||
|   it('only migrates old piechart', () => { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { FieldColorModeId, FieldConfigProperty, FieldMatcherID, PanelModel } from '@grafana/data'; | ||||
| import { LegendDisplayMode } from '@grafana/schema'; | ||||
|  | ||||
| import { PanelOptions, PieChartLabels, PieChartLegendValues, PieChartType } from './models.gen'; | ||||
| import { PanelOptions, PieChartLabels, PieChartLegendValues, PieChartType } from './panelcfg.gen'; | ||||
|  | ||||
| export const PieChartPanelChangedHandler = ( | ||||
|   panel: PanelModel<Partial<PanelOptions>> | any, | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import { addStandardDataReduceOptions } from '../stat/common'; | ||||
|  | ||||
| import { PieChartPanel } from './PieChartPanel'; | ||||
| import { PieChartPanelChangedHandler } from './migrations'; | ||||
| import { PanelOptions, PanelFieldConfig, PieChartType, PieChartLabels, PieChartLegendValues } from './models.gen'; | ||||
| import { PanelOptions, PanelFieldConfig, PieChartType, PieChartLabels, PieChartLegendValues } from './panelcfg.gen'; | ||||
| import { PieChartSuggestionsSupplier } from './suggestions'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions, PanelFieldConfig>(PieChartPanel) | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { VisualizationSuggestionsBuilder } from '@grafana/data'; | ||||
| import { SuggestionName } from 'app/types/suggestions'; | ||||
|  | ||||
| import { PieChartLabels, PanelOptions, PieChartType } from './models.gen'; | ||||
| import { PieChartLabels, PanelOptions, PieChartType } from './panelcfg.gen'; | ||||
|  | ||||
| export class PieChartSuggestionsSupplier { | ||||
|   getSuggestionsForData(builder: VisualizationSuggestionsBuilder) { | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { FieldColorModeId, FieldConfigSource, PanelModel } from '@grafana/data'; | ||||
| import { BigValueTextMode, BigValueGraphMode, BigValueColorMode } from '@grafana/schema'; | ||||
| import { sharedSingleStatPanelChangedHandler } from '@grafana/ui'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| // This is called when the panel changes from another panel | ||||
| export const statPanelChangedHandler = ( | ||||
|   | ||||
| @@ -16,7 +16,7 @@ import { BigValue, DataLinksContextMenu, VizRepeater, VizRepeaterRenderValueProp | ||||
| import { DataLinksContextMenuApi } from '@grafana/ui/src/components/DataLinks/DataLinksContextMenu'; | ||||
| import { config } from 'app/core/config'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export class StatPanel extends PureComponent<PanelProps<PanelOptions>> { | ||||
|   renderComponent = ( | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import { commonOptionsBuilder, sharedSingleStatMigrationHandler } from '@grafana | ||||
| import { statPanelChangedHandler } from './StatMigrations'; | ||||
| import { StatPanel } from './StatPanel'; | ||||
| import { addStandardDataReduceOptions, addOrientationOption } from './common'; | ||||
| import { defaultPanelOptions, PanelOptions } from './models.gen'; | ||||
| import { defaultPanelOptions, PanelOptions } from './panelcfg.gen'; | ||||
| import { StatSuggestionsSupplier } from './suggestions'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions>(StatPanel) | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { VisualizationSuggestionsBuilder } from '@grafana/data'; | ||||
| import { BigValueColorMode, BigValueGraphMode } from '@grafana/schema'; | ||||
| import { SuggestionName } from 'app/types/suggestions'; | ||||
|  | ||||
| import { PanelOptions } from './models.gen'; | ||||
| import { PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export class StatSuggestionsSupplier { | ||||
|   getSuggestionsForData(builder: VisualizationSuggestionsBuilder) { | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import React from 'react'; | ||||
| import { dateTime, LoadingState, EventBusSrv } from '@grafana/data'; | ||||
|  | ||||
| import { Props, TextPanel } from './TextPanel'; | ||||
| import { TextMode } from './models.gen'; | ||||
| import { TextMode } from './panelcfg.gen'; | ||||
|  | ||||
| const replaceVariablesMock = jest.fn(); | ||||
| const defaultProps: Props = { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import { GrafanaTheme2, PanelProps, renderTextPanelMarkdown, textUtil, Interpola | ||||
| import { CustomScrollbar, CodeEditor, useStyles2 } from '@grafana/ui'; | ||||
| import config from 'app/core/config'; | ||||
|  | ||||
| import { defaultCodeOptions, PanelOptions, TextMode } from './models.gen'; | ||||
| import { defaultCodeOptions, PanelOptions, TextMode } from './panelcfg.gen'; | ||||
|  | ||||
| export interface Props extends PanelProps<PanelOptions> {} | ||||
|  | ||||
|   | ||||
| @@ -10,7 +10,7 @@ import { | ||||
|   variableSuggestionToCodeEditorSuggestion, | ||||
| } from '@grafana/ui'; | ||||
|  | ||||
| import { PanelOptions, TextMode } from './models.gen'; | ||||
| import { PanelOptions, TextMode } from './panelcfg.gen'; | ||||
|  | ||||
| export const TextPanelEditor = ({ value, onChange, context }: StandardEditorProps<string, any, PanelOptions>) => { | ||||
|   const language = useMemo(() => context.options?.mode ?? TextMode.Markdown, [context]); | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { PanelPlugin } from '@grafana/data'; | ||||
|  | ||||
| import { TextPanel } from './TextPanel'; | ||||
| import { TextPanelEditor } from './TextPanelEditor'; | ||||
| import { CodeLanguage, defaultCodeOptions, defaultPanelOptions, PanelOptions, TextMode } from './models.gen'; | ||||
| import { CodeLanguage, defaultCodeOptions, defaultPanelOptions, PanelOptions, TextMode } from './panelcfg.gen'; | ||||
| import { textPanelMigrationHandler } from './textPanelMigrationHandler'; | ||||
|  | ||||
| export const plugin = new PanelPlugin<PanelOptions>(TextPanel) | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { FieldConfigSource, PanelModel } from '@grafana/data'; | ||||
|  | ||||
| import { TextMode, PanelOptions } from './models.gen'; | ||||
| import { TextMode, PanelOptions } from './panelcfg.gen'; | ||||
| import { textPanelMigrationHandler } from './textPanelMigrationHandler'; | ||||
|  | ||||
| describe('textPanelMigrationHandler', () => { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { PanelModel } from '@grafana/data'; | ||||
|  | ||||
| import { TextMode, PanelOptions } from './models.gen'; | ||||
| import { TextMode, PanelOptions } from './panelcfg.gen'; | ||||
|  | ||||
| export const textPanelMigrationHandler = (panel: PanelModel<PanelOptions>): Partial<PanelOptions> => { | ||||
|   const previousVersion = parseFloat(panel.pluginVersion || '6.1'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user