Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DH-17537: Fix Advanced Filter dialog not showing the values list on tree tables #2232

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/iris-grid/src/IrisGridModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ it('updates the model correctly when adding and removing a rollup config', async
expect(table.rollup).not.toHaveBeenCalled();
});

it('isRollupAvailable checks if the rollup method is defined', async () => {
const table = irisGridTestUtils.makeTable();

const mock = jest.fn();
table.rollup = mock;
const model = irisGridTestUtils.makeModel(table);

expect(model.isRollupAvailable).toBe(true);
});

it('closes the table correctly when the model is closed', () => {
const table = irisGridTestUtils.makeTable();
table.close = jest.fn();
Expand Down
4 changes: 0 additions & 4 deletions packages/iris-grid/src/IrisGridTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ class IrisGridTableModel
return this.table.getColumnStatistics != null;
}

get isValuesTableAvailable(): boolean {
return this.table.selectDistinct != null && this.table.copy != null;
}

get isRollupAvailable(): boolean {
return this.table.rollup != null;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/iris-grid/src/IrisGridTableModelTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,10 @@ class IrisGridTableModelTemplate<
: 0;
}

get isValuesTableAvailable(): boolean {
return this.table.selectDistinct != null && this.table.copy != null;
}

get isChartBuilderAvailable(): boolean {
return true;
}
Expand Down
27 changes: 27 additions & 0 deletions packages/iris-grid/src/IrisGridTreeTableModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ describe('IrisGridTreeTableModel virtual columns', () => {
expect(model.columns).toEqual(expected);
}
);

test.each([
['filter', 'Filter'],
['sort', 'Sort'],
['formatColor', 'Color'],
['get', 'get'],
['getFormat', 'getFormat'],
['formatNumber', 'formatNumber'],
['formatDate', 'formatDate'],
])('virtual column method %s is not implemented', (method, displayName) => {
const groupedColumns = columns.slice(0, 2);
const table = irisGridTestUtils.makeTreeTable(columns, groupedColumns);
const model = new IrisGridTreeTableModel(dh, table);
expect(() => model.columns[0][method]()).toThrow(
new Error(`${displayName} not implemented for virtual column`)
);
});
});

describe('IrisGridTreeTableModel layoutHints', () => {
Expand Down Expand Up @@ -78,3 +95,13 @@ describe('IrisGridTreeTableModel layoutHints', () => {
expect(model.layoutHints).toEqual(undefined);
});
});

describe('IrisGridTreeTableModel values table', () => {
it('is available for tree tables', () => {
const columns = irisGridTestUtils.makeColumns();
const table = irisGridTestUtils.makeTreeTable(columns, columns, 100, []);
const model = new IrisGridTreeTableModel(dh, table);

expect(model.isValuesTableAvailable).toBe(true);
});
});
2 changes: 1 addition & 1 deletion packages/iris-grid/src/IrisGridTreeTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const VirtualGroupColumn = Object.freeze({
throw new Error('Filter not implemented for virtual column');
},
sort: () => {
throw new Error('Sort not implemented virtual column');
throw new Error('Sort not implemented for virtual column');
},
formatColor: () => {
throw new Error('Color not implemented for virtual column');
Expand Down
Loading