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

* Table: Fixes migration for hidden columns in angular table

* update
pull/84462/head
Torkel Ödegaard 1 year ago committed by GitHub
parent 4dcbf4e5bb
commit d4b3877eb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 33
      public/app/plugins/panel/table/migrations.test.ts
  2. 7
      public/app/plugins/panel/table/migrations.ts

@ -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',

Loading…
Cancel
Save