DashboardSchema: Remove some old panel types (#78590)

This commit is contained in:
Torkel Ödegaard
2023-11-24 14:53:28 +01:00
committed by GitHub
parent 02a079e64a
commit 54bca5e590
13 changed files with 91 additions and 218 deletions

View File

@@ -192,9 +192,9 @@ Sensitive information stripped: queries (metric, template,annotation) and panel
### Panels
| Property | Type | Required | Default | Description |
|----------|-------------------------------------------------------------------------------------------------------------|----------|---------|-------------|
| `object` | Possible types are: [](#), [RowPanel](#rowpanel), [GraphPanel](#graphpanel), [HeatmapPanel](#heatmappanel). | | |
| Property | Type | Required | Default | Description |
|----------|---------------------------------------------------|----------|---------|-------------|
| `object` | Possible types are: [](#), [RowPanel](#rowpanel). | | |
### DataTransformerConfig
@@ -392,26 +392,6 @@ in panel plugin schemas.
| `id` | string | **Yes** | `` | |
| `value` | | No | | |
### GraphPanel
Support for legacy graph panel.
@deprecated this a deprecated panel type
| Property | Type | Required | Default | Description |
|----------|-------------------|----------|---------|----------------------------------------------------|
| `type` | string | **Yes** | | Possible values are: `graph`. |
| `legend` | [object](#legend) | No | | @deprecated this is part of deprecated graph panel |
### Legend
@deprecated this is part of deprecated graph panel
| Property | Type | Required | Default | Description |
|------------|---------|----------|---------|-------------|
| `show` | boolean | **Yes** | `true` | |
| `sortDesc` | boolean | No | | |
| `sort` | string | No | | |
### GridPos
Position and dimensions of a panel in the grid
@@ -424,15 +404,6 @@ Position and dimensions of a panel in the grid
| `y` | uint32 | **Yes** | `0` | Panel y. The y coordinate is the number of rows from the top edge of the grid |
| `static` | boolean | No | | Whether the panel is fixed within the grid. If true, the panel will not be affected by other panels' interactions |
### HeatmapPanel
Support for legacy heatmap panel.
@deprecated this a deprecated panel type
| Property | Type | Required | Default | Description |
|----------|--------|----------|---------|---------------------------------|
| `type` | string | **Yes** | | Possible values are: `heatmap`. |
### LibraryPanelRef
A library panel is a reusable panel that you can use in any dashboard.
@@ -444,27 +415,6 @@ Library panels streamline reuse of panels across multiple dashboards.
| `name` | string | **Yes** | | Library panel name |
| `uid` | string | **Yes** | | Library panel uid |
### RowPanel
Row panel
| Property | Type | Required | Default | Description |
|--------------|---------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `collapsed` | boolean | **Yes** | `false` | Whether this row should be collapsed or not. |
| `id` | uint32 | **Yes** | | Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally. |
| `panels` | [panels](#panels)[] | **Yes** | | List of panels in the row |
| `type` | string | **Yes** | | The panel type<br/>Possible values are: `row`. |
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
| `gridPos` | [GridPos](#gridpos) | No | | Position and dimensions of a panel in the grid |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `title` | string | No | | Row title |
### Panels
| Property | Type | Required | Default | Description |
|----------|------------------------------------------------------------------------------------------------|----------|---------|-------------|
| `object` | Possible types are: [Panel](#panel), [GraphPanel](#graphpanel), [HeatmapPanel](#heatmappanel). | | |
### Panel
Dashboard panels are the basic visualization building blocks.
@@ -495,6 +445,71 @@ Dashboard panels are the basic visualization building blocks.
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | No | | List of transformations that are applied to the panel data before rendering.<br/>When there are multiple transformations, Grafana applies them in the order they are listed.<br/>Each transformation creates a result set that then passes on to the next transformation in the processing pipeline. |
| `transparent` | boolean | No | `false` | Whether to display the panel without a background. |
### Target
Schema for panel targets is specified by datasource
plugins. We use a placeholder definition, which the Go
schema loader either left open/as-is with the Base
variant of the Dashboard and Panel families, or filled
with types derived from plugins in the Instance variant.
When working directly from CUE, importers can extend this
type directly to achieve the same effect.
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
### Options
It depends on the panel plugin. They are specified by the Options field in panel plugin schemas.
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
### RowPanel
Row panel
| Property | Type | Required | Default | Description |
|--------------|---------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `collapsed` | boolean | **Yes** | `false` | Whether this row should be collapsed or not. |
| `id` | uint32 | **Yes** | | Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally. |
| `panels` | [Panel](#panel)[] | **Yes** | | List of panels in the row |
| `type` | string | **Yes** | | The panel type<br/>Possible values are: `row`. |
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
| `gridPos` | [GridPos](#gridpos) | No | | Position and dimensions of a panel in the grid |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `title` | string | No | | Row title |
### Panel
Dashboard panels are the basic visualization building blocks.
| Property | Type | Required | Default | Description |
|--------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | The panel plugin type id. This is used to find the plugin to display the panel.<br/>Constraint: `length >=1`. |
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
| `description` | string | No | | Panel description. |
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | No | | The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.<br/>Each column within this structure is called a field. A field can represent a single time series or table column.<br/>Field options allow you to change how the data is displayed in your visualizations. |
| `gridPos` | [GridPos](#gridpos) | No | | Position and dimensions of a panel in the grid |
| `hideTimeOverride` | boolean | No | | Controls if the timeFrom or timeShift overrides are shown in the panel header |
| `id` | uint32 | No | | Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally. |
| `interval` | string | No | | The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.<br/>This value must be formatted as a number followed by a valid time<br/>identifier like: "40s", "3d", etc.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | A library panel is a reusable panel that you can use in any dashboard.<br/>When you make a change to a library panel, that change propagates to all instances of where the panel is used.<br/>Library panels streamline reuse of panels across multiple dashboards. |
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links. |
| `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. |
| `maxPerRow` | number | No | | Option for repeated panels that controls max items per row<br/>Only relevant for horizontally repeated panels |
| `options` | [options](#options) | No | | It depends on the panel plugin. They are specified by the Options field in panel plugin schemas. |
| `pluginVersion` | string | No | | The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs. |
| `repeatDirection` | string | No | `h` | Direction to repeat in if 'repeat' is set.<br/>`h` for horizontal, `v` for vertical.<br/>Possible values are: `h`, `v`. |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `tags` | string[] | No | | Tags for the panel. |
| `targets` | [Target](#target)[] | No | | Depends on the panel plugin. See the plugin documentation for details. |
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,<br/>which causes them to be different than what is selected in<br/>the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different<br/>time periods or days on the same dashboard.<br/>The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),<br/>`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.<br/>For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `title` | string | No | | Panel title. |
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | No | | List of transformations that are applied to the panel data before rendering.<br/>When there are multiple transformations, Grafana applies them in the order they are listed.<br/>Each transformation creates a result set that then passes on to the next transformation in the processing pipeline. |
| `transparent` | boolean | No | `false` | Whether to display the panel without a background. |
### FieldConfigSource
The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
@@ -562,66 +577,6 @@ For example, you can configure a special value mapping so that null values appea
| `options` | [options](#options) | **Yes** | | |
| `type` | string | **Yes** | | |
### Target
Schema for panel targets is specified by datasource
plugins. We use a placeholder definition, which the Go
schema loader either left open/as-is with the Base
variant of the Dashboard and Panel families, or filled
with types derived from plugins in the Instance variant.
When working directly from CUE, importers can extend this
type directly to achieve the same effect.
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
### Options
It depends on the panel plugin. They are specified by the Options field in panel plugin schemas.
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
### GraphPanel
Support for legacy graph panel.
@deprecated this a deprecated panel type
| Property | Type | Required | Default | Description |
|----------|-------------------|----------|---------|----------------------------------------------------|
| `type` | string | **Yes** | | Possible values are: `graph`. |
| `legend` | [legend](#legend) | No | | @deprecated this is part of deprecated graph panel |
### Panel
Dashboard panels are the basic visualization building blocks.
| Property | Type | Required | Default | Description |
|--------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | The panel plugin type id. This is used to find the plugin to display the panel.<br/>Constraint: `length >=1`. |
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
| `description` | string | No | | Panel description. |
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | No | | The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.<br/>Each column within this structure is called a field. A field can represent a single time series or table column.<br/>Field options allow you to change how the data is displayed in your visualizations. |
| `gridPos` | [GridPos](#gridpos) | No | | Position and dimensions of a panel in the grid |
| `hideTimeOverride` | boolean | No | | Controls if the timeFrom or timeShift overrides are shown in the panel header |
| `id` | uint32 | No | | Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally. |
| `interval` | string | No | | The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.<br/>This value must be formatted as a number followed by a valid time<br/>identifier like: "40s", "3d", etc.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | A library panel is a reusable panel that you can use in any dashboard.<br/>When you make a change to a library panel, that change propagates to all instances of where the panel is used.<br/>Library panels streamline reuse of panels across multiple dashboards. |
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links. |
| `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. |
| `maxPerRow` | number | No | | Option for repeated panels that controls max items per row<br/>Only relevant for horizontally repeated panels |
| `options` | [options](#options) | No | | It depends on the panel plugin. They are specified by the Options field in panel plugin schemas. |
| `pluginVersion` | string | No | | The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs. |
| `repeatDirection` | string | No | `h` | Direction to repeat in if 'repeat' is set.<br/>`h` for horizontal, `v` for vertical.<br/>Possible values are: `h`, `v`. |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `tags` | string[] | No | | Tags for the panel. |
| `targets` | [Target](#target)[] | No | | Depends on the panel plugin. See the plugin documentation for details. |
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,<br/>which causes them to be different than what is selected in<br/>the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different<br/>time periods or days on the same dashboard.<br/>The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),<br/>`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.<br/>For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `title` | string | No | | Panel title. |
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | No | | List of transformations that are applied to the panel data before rendering.<br/>When there are multiple transformations, Grafana applies them in the order they are listed.<br/>Each transformation creates a result set that then passes on to the next transformation in the processing pipeline. |
| `transparent` | boolean | No | `false` | Whether to display the panel without a background. |
### Templating
Configured template variables

View File

@@ -89,7 +89,7 @@ lineage: schemas: [{
version?: uint32
// List of dashboard panels
panels?: [...(#Panel | #RowPanel | #GraphPanel | #HeatmapPanel)]
panels?: [...(#Panel | #RowPanel)]
// Configured template variables
templating?: {
@@ -713,31 +713,11 @@ lineage: schemas: [{
id: uint32
// List of panels in the row
panels: [...(#Panel | #GraphPanel | #HeatmapPanel)]
panels: [...#Panel]
// Name of template variable to repeat for.
repeat?: string
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
// Support for legacy graph panel.
// @deprecated this a deprecated panel type
#GraphPanel: {
type: "graph"
// @deprecated this is part of deprecated graph panel
legend?: {
show: bool | *true
sort?: string
sortDesc?: bool
}
...
} @cuetsy(kind="interface")
// Support for legacy heatmap panel.
// @deprecated this a deprecated panel type
#HeatmapPanel: {
type: "heatmap"
...
} @cuetsy(kind="interface")
}
},
]

View File

@@ -37,9 +37,7 @@ export type {
RegexMap,
SpecialValueMap,
ValueMappingResult,
LibraryPanelRef,
GraphPanel,
HeatmapPanel
LibraryPanelRef
} from './raw/dashboard/x/dashboard_types.gen';
// Raw generated enums and default consts from dashboard kind.

View File

@@ -941,7 +941,7 @@ export interface RowPanel {
/**
* List of panels in the row
*/
panels: Array<(Panel | GraphPanel | HeatmapPanel)>;
panels: Array<Panel>;
/**
* Name of template variable to repeat for.
*/
@@ -961,30 +961,6 @@ export const defaultRowPanel: Partial<RowPanel> = {
panels: [],
};
/**
* Support for legacy graph panel.
* @deprecated this a deprecated panel type
*/
export interface GraphPanel {
/**
* @deprecated this is part of deprecated graph panel
*/
legend?: {
show: boolean;
sort?: string;
sortDesc?: boolean;
};
type: 'graph';
}
/**
* Support for legacy heatmap panel.
* @deprecated this a deprecated panel type
*/
export interface HeatmapPanel {
type: 'heatmap';
}
export interface Dashboard {
/**
* Contains the list of annotations that are associated with the dashboard.
@@ -1032,7 +1008,7 @@ export interface Dashboard {
/**
* List of dashboard panels
*/
panels?: Array<(Panel | RowPanel | GraphPanel | HeatmapPanel)>;
panels?: Array<(Panel | RowPanel)>;
/**
* Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
*/

View File

@@ -11,7 +11,7 @@ export interface Panel<TOptions = Record<string, unknown>, TCustomFieldConfig =
}
export interface RowPanel extends Omit<raw.RowPanel, 'panels'> {
panels: Array<Panel | raw.GraphPanel | raw.HeatmapPanel>;
panels: Panel[];
}
export enum VariableHide {
@@ -25,7 +25,7 @@ export interface VariableModel extends Omit<raw.VariableModel, 'datasource'> {
}
export interface Dashboard extends Omit<raw.Dashboard, 'templating' | 'annotations' | 'panels'> {
panels?: Array<Panel | RowPanel | raw.GraphPanel | raw.HeatmapPanel>;
panels?: Array<Panel | RowPanel>;
annotations?: AnnotationContainer;
templating?: {
list?: VariableModel[];

View File

@@ -52,16 +52,6 @@ const (
FieldColorSeriesByModeMin FieldColorSeriesByMode = "min"
)
// Defines values for GraphPanelType.
const (
GraphPanelTypeGraph GraphPanelType = "graph"
)
// Defines values for HeatmapPanelType.
const (
HeatmapPanelTypeHeatmap HeatmapPanelType = "heatmap"
)
// Defines values for MappingType.
const (
MappingTypeRange MappingType = "range"
@@ -453,21 +443,6 @@ type FieldConfigSource struct {
} `json:"overrides"`
}
// Support for legacy graph panel.
// @deprecated this a deprecated panel type
type GraphPanel struct {
// @deprecated this is part of deprecated graph panel
Legend *struct {
Show bool `json:"show"`
Sort *string `json:"sort,omitempty"`
SortDesc *bool `json:"sortDesc,omitempty"`
} `json:"legend,omitempty"`
Type GraphPanelType `json:"type"`
}
// GraphPanelType defines model for GraphPanel.Type.
type GraphPanelType string
// Position and dimensions of a panel in the grid
type GridPos struct {
// Panel height. The height is the number of rows from the top edge of the panel.
@@ -486,15 +461,6 @@ type GridPos struct {
Y int `json:"y"`
}
// Support for legacy heatmap panel.
// @deprecated this a deprecated panel type
type HeatmapPanel struct {
Type HeatmapPanelType `json:"type"`
}
// HeatmapPanelType defines model for HeatmapPanel.Type.
type HeatmapPanelType string
// A library panel is a reusable panel that you can use in any dashboard.
// When you make a change to a library panel, that change propagates to all instances of where the panel is used.
// Library panels streamline reuse of panels across multiple dashboards.
@@ -672,7 +638,7 @@ type RowPanel struct {
Id int `json:"id"`
// List of panels in the row
Panels []any `json:"panels"`
Panels []Panel `json:"panels"`
// Name of template variable to repeat for.
Repeat *string `json:"repeat,omitempty"`

View File

@@ -517,7 +517,6 @@ describe('transformSceneToSaveModel', () => {
expect(snapshot.panels?.length).toBe(3);
// Regular panel with SceneQueryRunner
// @ts-expect-error
expect(snapshot.panels?.[0].datasource).toEqual(GRAFANA_DATASOURCE_REF);
// @ts-expect-error
expect(snapshot.panels?.[0].targets?.[0].datasource).toEqual(GRAFANA_DATASOURCE_REF);
@@ -530,7 +529,6 @@ describe('transformSceneToSaveModel', () => {
});
// Panel with transformations
// @ts-expect-error
expect(snapshot.panels?.[1].datasource).toEqual(GRAFANA_DATASOURCE_REF);
// @ts-expect-error
expect(snapshot.panels?.[1].targets?.[0].datasource).toEqual(GRAFANA_DATASOURCE_REF);
@@ -550,7 +548,6 @@ describe('transformSceneToSaveModel', () => {
]);
// Panel with a shared query (dahsboard query)
// @ts-expect-error
expect(snapshot.panels?.[2].datasource).toEqual(GRAFANA_DATASOURCE_REF);
// @ts-expect-error
expect(snapshot.panels?.[2].targets?.[0].datasource).toEqual(GRAFANA_DATASOURCE_REF);
@@ -783,7 +780,6 @@ describe('transformSceneToSaveModel', () => {
expect(snapshot.panels?.length).toBe(3);
expect(result.panels?.length).toBe(1);
// @ts-expect-error
expect(result.panels?.[0].gridPos).toEqual({ w: 24, x: 0, y: 0, h: 20 });
});

View File

@@ -409,10 +409,8 @@ export function trimDashboardForSnapshot(title: string, time: TimeRange, dash: D
// When VizPanel is present, we are snapshoting a single panel. The rest of the panels is removed from the dashboard,
// and the panel is resized to 24x20 grid and placed at the top of the dashboard.
if (panel) {
// @ts-expect-error Due to legacy panels types. Id is present on such panels too.
const singlePanel = dash.panels?.find((p) => p.id === getPanelIdForVizPanel(panel));
if (singlePanel) {
// @ts-expect-error Due to legacy panels types. Id is present on such panels too.
singlePanel.gridPos = { w: 24, x: 0, y: 0, h: 20 };
result = {
...result,

View File

@@ -11,9 +11,11 @@ function getDefaultDashboardModel() {
panels: [
createPanelSaveModel({
id: 1,
type: 'graph',
type: 'timeseries',
gridPos: { x: 0, y: 0, w: 24, h: 6 },
legend: { show: true, sortDesc: false }, // TODO legend is marked as a non-persisted field
options: {
legend: { showLegend: true },
},
}),
{
@@ -22,8 +24,8 @@ function getDefaultDashboardModel() {
gridPos: { x: 0, y: 6, w: 24, h: 2 },
collapsed: true,
panels: [
{ id: 3, type: 'graph', gridPos: { x: 0, y: 6, w: 12, h: 2 } },
{ id: 4, type: 'graph', gridPos: { x: 12, y: 6, w: 12, h: 2 } },
{ id: 3, type: 'timeseries', gridPos: { x: 0, y: 6, w: 12, h: 2 }, options: {} },
{ id: 4, type: 'timeseries', gridPos: { x: 12, y: 6, w: 12, h: 2 }, options: {} },
],
},
{ id: 5, type: 'row', gridPos: { x: 0, y: 6, w: 1, h: 1 }, collapsed: false, panels: [] },
@@ -66,10 +68,9 @@ describe('DashboardPrompt', () => {
expect(hasChanges(dash, original)).toBe(false);
});
it('Should ignore panel legend changes', () => {
it('Should ignore panel changes as those are handled via dirty flag', () => {
const { original, dash } = getTestContext();
dash.panels[0]!.legend!.sortDesc = true;
dash.panels[0]!.legend!.sort = 'avg';
dash.panels[0]!.options = { legend: { showLegend: false } };
expect(hasChanges(dash, original)).toBe(false);
});

View File

@@ -207,6 +207,7 @@ export function hasChanges(current: DashboardModel, original: unknown) {
if (current.hasUnsavedChanges()) {
return true;
}
// TODO: Make getSaveModelClone return Dashboard type instead
const currentClean = cleanDashboardFromIgnoredChanges(current.getSaveModelCloneOld() as unknown as Dashboard);
const originalClean = cleanDashboardFromIgnoredChanges(original as Dashboard);

View File

@@ -71,8 +71,8 @@ describe('DashboardModel', () => {
panels: [
{
type: 'graph',
legend: { show: true },
// @ts-expect-error
legend: { show: true },
aliasYAxis: { test: 2 },
y_formats: ['kbyte', 'ms'],
grid: {
@@ -1906,13 +1906,13 @@ describe('DashboardModel', () => {
},
],
},
// @ts-expect-error
{
type: 'row',
id: 5,
panels: [
{
id: 6,
// @ts-expect-error
datasource: 'prom',
},
],

View File

@@ -900,8 +900,11 @@ describe('DashboardModel', () => {
beforeEach(() => {
model = createDashboardModelFixture({
panels: [
// @ts-expect-error
{ id: 1, type: 'graph', gridPos: { x: 0, y: 0, w: 24, h: 2 }, legend: { show: true } },
// @ts-expect-error
{ id: 3, type: 'graph', gridPos: { x: 0, y: 4, w: 12, h: 2 }, legend: { show: false } },
// @ts-expect-error
{ id: 4, type: 'graph', gridPos: { x: 12, y: 4, w: 12, h: 2 }, legend: { show: false } },
],
});

View File

@@ -3,7 +3,6 @@ import {
Dashboard,
defaultDashboardCursorSync,
defaultVariableModel,
GraphPanel,
Panel,
RowPanel,
VariableModel,
@@ -30,7 +29,7 @@ export function createDashboardModelFixture(
return new DashboardModel(dashboardJson, meta, { getVariablesFromState });
}
export function createPanelSaveModel(panelInput: Partial<Panel | GraphPanel | RowPanel> = {}): Panel {
export function createPanelSaveModel(panelInput: Partial<Panel | RowPanel> = {}): Panel {
return {
type: 'timeseries',
...panelInput,