Skip to content

Commit 86e16ee

Browse files
authored
fix: DH-17537: Fix Advanced Filter dialog not showing the values list on tree tables (#2232)
Move `isValuesTableAvailable` getter from `IrisGridTableModel` to `IrisGridTableModelTemplate` to make it availalbe in tree table model. Fixes DH-17537 in enterprise. Note, this doesn't fix the issue with Advanced Filter on tree tables in Community. JSAPI throws an exception on a `treeTable.copy` call. ``` [AdvancedFilterCreator] Unable to open values table Error: java.lang.UnsupportedOperationException: reexport at UnsupportedOperationException_0.createError (dh-core.js:1383:10) at UnsupportedOperationException_0.initializeBackingError (dh-core.js:1409:46) at UnsupportedOperationException_0.Throwable_0 (dh-core.js:1348:8) at UnsupportedOperationException_0.Exception_1 (dh-core.js:1433:18) at UnsupportedOperationException_0.RuntimeException_1 (dh-core.js:1446:18) at new UnsupportedOperationException_0 (dh-core.js:35418:25) at Object.lambda$56 (dh-core.js:24457:14) at JsTreeTable$lambda$56$Type.fetch_25 [as fetch_1] (dh-core.js:25453:10) at Object.$lambda$32_0 (dh-core.js:31972:23) at ClientTableState$lambda$32$Type.accept_90 [as accept] (dh-core.js:32707:9) at Function.onInvoke_2 (dh-core.js:5068:12) at lambda (dh-core.js:174:22) at new Promise (<anonymous>) at Object.$refetch_2 (dh-core.js:32098:13) at JsTreeTable.copy_1 [as copy] (dh-core.js:24514:16) at Proxy.valuesTable (IrisGridTableModelTemplate.ts:1519:32) at AdvancedFilterCreator.initValuesTable (AdvancedFilterCreator.tsx:212:13) ``` Filed an issue in Core: deephaven/deephaven-core#6097
1 parent ec9b41e commit 86e16ee

5 files changed

Lines changed: 42 additions & 5 deletions

File tree

packages/iris-grid/src/IrisGridModel.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ it('updates the model correctly when adding and removing a rollup config', async
150150
expect(table.rollup).not.toHaveBeenCalled();
151151
});
152152

153+
it('isRollupAvailable checks if the rollup method is defined', async () => {
154+
const table = irisGridTestUtils.makeTable();
155+
156+
const mock = jest.fn();
157+
table.rollup = mock;
158+
const model = irisGridTestUtils.makeModel(table);
159+
160+
expect(model.isRollupAvailable).toBe(true);
161+
});
162+
153163
it('closes the table correctly when the model is closed', () => {
154164
const table = irisGridTestUtils.makeTable();
155165
table.close = jest.fn();

packages/iris-grid/src/IrisGridTableModel.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ class IrisGridTableModel
6363
return this.table.getColumnStatistics != null;
6464
}
6565

66-
get isValuesTableAvailable(): boolean {
67-
return this.table.selectDistinct != null && this.table.copy != null;
68-
}
69-
7066
get isRollupAvailable(): boolean {
7167
return this.table.rollup != null;
7268
}

packages/iris-grid/src/IrisGridTableModelTemplate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ class IrisGridTableModelTemplate<
446446
: 0;
447447
}
448448

449+
get isValuesTableAvailable(): boolean {
450+
return this.table.selectDistinct != null && this.table.copy != null;
451+
}
452+
449453
get isChartBuilderAvailable(): boolean {
450454
return true;
451455
}

packages/iris-grid/src/IrisGridTreeTableModel.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ describe('IrisGridTreeTableModel virtual columns', () => {
3232
expect(model.columns).toEqual(expected);
3333
}
3434
);
35+
36+
test.each([
37+
['filter', 'Filter'],
38+
['sort', 'Sort'],
39+
['formatColor', 'Color'],
40+
['get', 'get'],
41+
['getFormat', 'getFormat'],
42+
['formatNumber', 'formatNumber'],
43+
['formatDate', 'formatDate'],
44+
])('virtual column method %s is not implemented', (method, displayName) => {
45+
const groupedColumns = columns.slice(0, 2);
46+
const table = irisGridTestUtils.makeTreeTable(columns, groupedColumns);
47+
const model = new IrisGridTreeTableModel(dh, table);
48+
expect(() => model.columns[0][method]()).toThrow(
49+
new Error(`${displayName} not implemented for virtual column`)
50+
);
51+
});
3552
});
3653

3754
describe('IrisGridTreeTableModel layoutHints', () => {
@@ -78,3 +95,13 @@ describe('IrisGridTreeTableModel layoutHints', () => {
7895
expect(model.layoutHints).toEqual(undefined);
7996
});
8097
});
98+
99+
describe('IrisGridTreeTableModel values table', () => {
100+
it('is available for tree tables', () => {
101+
const columns = irisGridTestUtils.makeColumns();
102+
const table = irisGridTestUtils.makeTreeTable(columns, columns, 100, []);
103+
const model = new IrisGridTreeTableModel(dh, table);
104+
105+
expect(model.isValuesTableAvailable).toBe(true);
106+
});
107+
});

packages/iris-grid/src/IrisGridTreeTableModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const VirtualGroupColumn = Object.freeze({
3030
throw new Error('Filter not implemented for virtual column');
3131
},
3232
sort: () => {
33-
throw new Error('Sort not implemented virtual column');
33+
throw new Error('Sort not implemented for virtual column');
3434
},
3535
formatColor: () => {
3636
throw new Error('Color not implemented for virtual column');

0 commit comments

Comments
 (0)