Skip to content

Commit a1d4f6a

Browse files
committed
Address review comment
1 parent a3dc182 commit a1d4f6a

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

packages/dashboard-core-plugins/src/panels/NotebookPanel.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Wrapper for the Notebook for use in a golden layout container
2-
import React, { Component, MouseEvent, ReactElement } from 'react';
2+
import React, { Component, ReactElement } from 'react';
33
import ReactDOM from 'react-dom';
44
import memoize from 'memoize-one';
55
import { connect } from 'react-redux';
@@ -178,7 +178,7 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
178178
this.handleLinkClick = this.handleLinkClick.bind(this);
179179
this.handleLoadSuccess = this.handleLoadSuccess.bind(this);
180180
this.handleLoadError = this.handleLoadError.bind(this);
181-
this.handlePanelTabClick = this.handlePanelTabClick.bind(this);
181+
this.handleTabClick = this.handleTabClick.bind(this);
182182
this.handleRenameFile = this.handleRenameFile.bind(this);
183183
this.handleResize = this.handleResize.bind(this);
184184
this.handleRunCommand = this.handleRunCommand.bind(this);
@@ -287,7 +287,6 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
287287
if (tab != null) this.initTab(tab);
288288
this.initNotebookContent();
289289
glEventHub.on(NotebookEvent.RENAME_FILE, this.handleRenameFile);
290-
glContainer.on('tabClicked', this.handlePanelTabClick);
291290
}
292291

293292
componentDidUpdate(
@@ -316,11 +315,10 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
316315
this.debouncedSavePanelState.flush();
317316
this.pending.cancel();
318317

319-
const { glContainer, glEventHub } = this.props;
318+
const { glEventHub } = this.props;
320319

321320
const { fileMetadata, isPreview } = this.state;
322321
glEventHub.off(NotebookEvent.RENAME_FILE, this.handleRenameFile);
323-
glContainer.off('tabClicked', this.handlePanelTabClick);
324322
glEventHub.emit(NotebookEvent.UNREGISTER_FILE, fileMetadata, isPreview);
325323
}
326324

@@ -733,7 +731,7 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
733731
/**
734732
* @param event The click event from clicking on the link
735733
*/
736-
handleLinkClick(event: MouseEvent<HTMLAnchorElement>) {
734+
handleLinkClick(event: React.MouseEvent<HTMLAnchorElement>) {
737735
const { notebooksUrl, session, sessionLanguage } = this.props;
738736
const { href } = event.currentTarget;
739737
if (!href || !href.startsWith(notebooksUrl)) {
@@ -957,8 +955,8 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
957955
});
958956
}
959957

960-
handlePanelTabClick(e: MouseEvent): void {
961-
log.debug('handlePanelTabClick');
958+
handleTabClick(e: MouseEvent): void {
959+
log.debug('handle NotebookPanel tab click');
962960
this.focus();
963961
if (e.detail === 2) {
964962
this.removePreviewStatus();
@@ -1173,6 +1171,7 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
11731171
onTab={this.handleTab}
11741172
onResize={this.handleResize}
11751173
onShow={this.handleShow}
1174+
onTabClicked={this.handleTabClick}
11761175
onTabFocus={this.handleTabFocus}
11771176
onTabBlur={this.handleTabBlur}
11781177
onSessionOpen={this.handleSessionOpened}

packages/dashboard-core-plugins/src/panels/Panel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interface PanelProps {
4040
onFocus: FocusEventHandler<HTMLDivElement>;
4141
onBlur: FocusEventHandler<HTMLDivElement>;
4242
onTab: (tab: Tab) => void;
43-
onTabClicked: (...args: unknown[]) => void;
43+
onTabClicked: (e: MouseEvent) => void;
4444
onClearAllFilters: (...args: unknown[]) => void;
4545
onHide: (...args: unknown[]) => void;
4646
onResize: (...args: unknown[]) => void;
@@ -180,9 +180,9 @@ class Panel extends PureComponent<PanelProps, PanelState> {
180180
onTab(tab);
181181
}
182182

183-
handleTabClicked(...args: unknown[]): void {
183+
handleTabClicked(e: MouseEvent): void {
184184
const { onTabClicked } = this.props;
185-
onTabClicked(...args);
185+
onTabClicked(e);
186186
}
187187

188188
handleClearAllFilters(...args: unknown[]): void {

0 commit comments

Comments
 (0)