Table: Fixes migration for hidden columns in angular table (#84579)

* Table: Fixes migration for hidden columns in angular table

* update
This commit is contained in:
Torkel Ödegaard
2024-03-15 16:05:34 +01:00
committed by GitHub
parent 4dcbf4e5bb
commit d4b3877eb8
2 changed files with 40 additions and 0 deletions
@@ -126,6 +126,7 @@ describe('Table Migrations', () => {
],
},
};
const panel = {} as PanelModel;
tablePanelChangedHandler(panel, 'table-old', oldStyles);
expect(panel).toMatchInlineSnapshot(`
@@ -269,6 +270,38 @@ describe('Table Migrations', () => {
`);
});
it('migrates hidden fields to override', () => {
const oldStyles = {
angular: {
columns: [],
styles: [
{
dateFormat: 'YYYY-MM-DD HH:mm:ss',
pattern: 'time',
type: 'hidden',
},
],
},
};
const panel = {} as PanelModel;
tablePanelChangedHandler(panel, 'table-old', oldStyles);
expect(panel.fieldConfig.overrides).toEqual([
{
matcher: {
id: 'byName',
options: 'time',
},
properties: [
{
id: 'custom.hidden',
value: true,
},
],
},
]);
});
it('migrates DataFrame[] from format using meta.custom.parentRowIndex to format using FieldType.nestedFrames', () => {
const mainFrame = (refId: string) => {
return createDataFrame({
@@ -150,6 +150,13 @@ const migrateTableStyleToOverride = (style: Style) => {
});
}
if (style.type === 'hidden') {
override.properties.push({
id: 'custom.hidden',
value: true,
});
}
if (style.link) {
override.properties.push({
id: 'links',