mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TimeSeries: Old graph migration fix for series override lines: true (#74970)
This commit is contained in:
parent
a2e1a7e2f7
commit
ab75fbd009
@ -623,6 +623,51 @@ describe('Graph Migrations', () => {
|
||||
expect(panel.fieldConfig.defaults.custom.spanNulls).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('seriesOverride lines: true', () => {
|
||||
test('Should set displayMode', () => {
|
||||
const old = {
|
||||
angular: {
|
||||
bars: true,
|
||||
lines: false,
|
||||
seriesOverrides: [
|
||||
{
|
||||
alias: 'A-series',
|
||||
lines: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const panel = {} as PanelModel;
|
||||
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
|
||||
expect(panel.fieldConfig.overrides[0]).toEqual({
|
||||
matcher: { id: 'byName', options: 'A-series' },
|
||||
properties: [{ id: 'custom.drawStyle', value: 'line' }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('seriesOverride lines: false', () => {
|
||||
test('Should set lineWidth 0', () => {
|
||||
const old = {
|
||||
angular: {
|
||||
lines: true,
|
||||
seriesOverrides: [
|
||||
{
|
||||
alias: 'A-series',
|
||||
lines: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const panel = {} as PanelModel;
|
||||
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
|
||||
expect(panel.fieldConfig.overrides[0]).toEqual({
|
||||
matcher: { id: 'byName', options: 'A-series' },
|
||||
properties: [{ id: 'custom.lineWidth', value: 0 }],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const customColor = {
|
||||
|
@ -222,10 +222,17 @@ export function graphToTimeseriesOptions(angular: any): {
|
||||
}
|
||||
break;
|
||||
case 'lines':
|
||||
if (v) {
|
||||
rule.properties.push({
|
||||
id: 'custom.drawStyle',
|
||||
value: 'line',
|
||||
});
|
||||
} else {
|
||||
rule.properties.push({
|
||||
id: 'custom.lineWidth',
|
||||
value: 0, // don't show lines
|
||||
value: 0,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'linewidth':
|
||||
rule.properties.push({
|
||||
|
Loading…
Reference in New Issue
Block a user