Skip to content
Draft
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
6 changes: 4 additions & 2 deletions plugins/pivot/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ package_dir=
=src
packages=find_namespace:
install_requires =
deephaven-core>=0.35.1
deephaven-core>=0.37.0
deephaven-plugin>=0.6.0
deephaven-plugin-utilities
deephaven-plugin-utilities>=0.0.2
typing_extensions;python_version<'3.11'
pytz
include_package_data = True

[options.packages.find]
Expand Down
2 changes: 1 addition & 1 deletion plugins/pivot/src/js/src/IrisGridPivotModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ describe('IrisGridPivotModel', () => {

model.setViewport(0, 10);

expect(pivotTable.addEventListener).toHaveBeenCalledTimes(1);
expect(pivotTable.addEventListener).toHaveBeenCalledTimes(3);

// Simulate the update event with the data
asMock(pivotTable.addEventListener).mock.calls[0][1](updateEvent);
Expand Down
32 changes: 32 additions & 0 deletions plugins/pivot/src/js/src/IrisGridPivotModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ class IrisGridPivotModel<R extends UIPivotRow = UIPivotRow>

this.handleModelEvent = this.handleModelEvent.bind(this);
this.handlePivotUpdated = this.handlePivotUpdated.bind(this);
this.handleTableDisconnect = this.handleTableDisconnect.bind(this);
this.handleTableReconnect = this.handleTableReconnect.bind(this);

this.pivotTable = pivotTable;
this.irisFormatter = formatter;
Expand Down Expand Up @@ -720,6 +722,18 @@ class IrisGridPivotModel<R extends UIPivotRow = UIPivotRow>
this.dispatchEvent(new EventShimCustomEvent(type, { detail }));
}

handleTableDisconnect(): void {
log.info('Pivot table disconnected');
this.dispatchEvent(
new EventShimCustomEvent(IrisGridModel.EVENT.DISCONNECT)
);
}

handleTableReconnect(): void {
log.info('Pivot table reconnected');
this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.RECONNECT));
}

handlePivotUpdated(
event: CorePlusDhType.Event<CorePlusDhType.coreplus.pivot.PivotSnapshot>
): void {
Expand Down Expand Up @@ -920,6 +934,15 @@ class IrisGridPivotModel<R extends UIPivotRow = UIPivotRow>
this.dh.coreplus.pivot.PivotTable.EVENT_UPDATED,
this.handlePivotUpdated
);

this.pivotTable.addEventListener(
this.dh.coreplus.pivot.PivotTable.EVENT_DISCONNECT,
this.handleTableDisconnect
);
this.pivotTable.addEventListener(
this.dh.coreplus.pivot.PivotTable.EVENT_RECONNECT,
this.handleTableReconnect
);
}

stopListening(): void {
Expand All @@ -929,6 +952,15 @@ class IrisGridPivotModel<R extends UIPivotRow = UIPivotRow>
this.dh.coreplus.pivot.PivotTable.EVENT_UPDATED,
this.handlePivotUpdated
);

this.pivotTable.removeEventListener(
this.dh.coreplus.pivot.PivotTable.EVENT_DISCONNECT,
this.handleTableDisconnect
);
this.pivotTable.removeEventListener(
this.dh.coreplus.pivot.PivotTable.EVENT_RECONNECT,
this.handleTableReconnect
);
}

addListeners(model: IrisGridModel): void {
Expand Down
Loading