Skip to content

Commit 412dc5c

Browse files
committed
Refactor PanelManager to use new listeners
1 parent 7e6756b commit 412dc5c

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

packages/dashboard/src/NavigationEvent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { makeEventFunctions } from '@deephaven/golden-layout';
22

3-
export const NavigationEvent = Object.freeze({
3+
const NavigationEvent = Object.freeze({
44
CYCLE_TO_NEXT_STACK: 'NavigationEvent.CYCLE_TO_NEXT_STACK',
55
CYCLE_TO_PREVIOUS_STACK: 'NavigationEvent.CYCLE_TO_PREVIOUS_STACK',
66
CYCLE_TO_NEXT_TAB: 'NavigationEvent.CYCLE_TO_NEXT_TAB',

packages/dashboard/src/PanelManager.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ class PanelManager {
123123
eventHub.on(PanelEvent.MOUNT, this.handleMount);
124124
eventHub.on(PanelEvent.UNMOUNT, this.handleUnmount);
125125
eventHub.on(PanelEvent.REOPEN, this.handleReopen);
126+
eventHub.on(PanelEvent.REOPEN_LAST, this.handleReopenLast);
127+
eventHub.on(PanelEvent.DELETE, this.handleDeleted);
128+
eventHub.on(PanelEvent.CLOSED, this.handleClosed);
129+
eventHub.on(PanelEvent.CLOSE, this.handleControlClose);
126130
eventHub.on(
127131
NavigationEvent.CYCLE_TO_NEXT_STACK,
128132
this.handleCycleToNextStack
@@ -136,10 +140,6 @@ class PanelManager {
136140
NavigationEvent.CYCLE_TO_PREVIOUS_TAB,
137141
this.handleCycleToPreviousTab
138142
);
139-
eventHub.on(PanelEvent.REOPEN_LAST, this.handleReopenLast);
140-
eventHub.on(PanelEvent.DELETE, this.handleDeleted);
141-
eventHub.on(PanelEvent.CLOSED, this.handleClosed);
142-
eventHub.on(PanelEvent.CLOSE, this.handleControlClose);
143143
// PanelEvent.OPEN should be listened to by plugins to open a panel
144144
}
145145

@@ -149,6 +149,10 @@ class PanelManager {
149149
eventHub.off(PanelEvent.MOUNT, this.handleMount);
150150
eventHub.off(PanelEvent.UNMOUNT, this.handleUnmount);
151151
eventHub.off(PanelEvent.REOPEN, this.handleReopen);
152+
eventHub.off(PanelEvent.REOPEN_LAST, this.handleReopenLast);
153+
eventHub.off(PanelEvent.DELETE, this.handleDeleted);
154+
eventHub.off(PanelEvent.CLOSED, this.handleClosed);
155+
eventHub.off(PanelEvent.CLOSE, this.handleControlClose);
152156
eventHub.off(
153157
NavigationEvent.CYCLE_TO_NEXT_STACK,
154158
this.handleCycleToNextStack
@@ -162,10 +166,6 @@ class PanelManager {
162166
NavigationEvent.CYCLE_TO_PREVIOUS_TAB,
163167
this.handleCycleToPreviousTab
164168
);
165-
eventHub.off(PanelEvent.REOPEN_LAST, this.handleReopenLast);
166-
eventHub.off(PanelEvent.DELETE, this.handleDeleted);
167-
eventHub.off(PanelEvent.CLOSED, this.handleClosed);
168-
eventHub.off(PanelEvent.CLOSE, this.handleControlClose);
169169
}
170170

171171
getClosedPanelConfigsOfType(typeString: string): ClosedPanels {

0 commit comments

Comments
 (0)