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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user