TimeSeries: Add missing legend width migration (#50551)

This commit is contained in:
Zoltán Bedi 2022-06-10 09:55:46 +02:00 committed by GitHub
parent fd239f94e8
commit ce6a73a623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -127,6 +127,23 @@ describe('Graph Migrations', () => {
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
expect(panel).toMatchSnapshot();
});
test('with sideWidth', () => {
const old: any = {
angular: {
legend: {
alignAsTable: true,
rightSide: true,
show: true,
sideWidth: 200,
total: true,
values: true,
},
},
};
const panel = {} as PanelModel;
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
expect(panel.options.legend.width).toBe(200);
});
});
describe('stacking', () => {

View File

@ -345,6 +345,10 @@ export function flotToGraphOptions(angular: any): { fieldConfig: FieldConfigSour
const enabledLegendValues = pickBy(angular.legend);
options.legend.calcs = getReducersFromLegend(enabledLegendValues);
}
if (angular.legend.sideWidth) {
options.legend.width = angular.legend.sideWidth;
}
}
const tooltipConfig = angular.tooltip;