diff --git a/packages/code-studio/src/main/AppInit.tsx b/packages/code-studio/src/main/AppInit.tsx index 83f51f1908..e4a580fe56 100644 --- a/packages/code-studio/src/main/AppInit.tsx +++ b/packages/code-studio/src/main/AppInit.tsx @@ -184,13 +184,6 @@ function AppInit(props: AppInitProps) { setError(`Server shutdown: ${detail ?? 'Unknown reason'}`); setDisconnectError(null); }); - connection.addEventListener( - dh.CoreClient.EVENT_RECONNECT_AUTH_FAILED, - event => { - log.warn('Reconnect authentication failed'); - setError('Reconnect authentication failed'); - } - ); const sessionWrapper = await loadSessionWrapper(connection); const name = 'user'; diff --git a/packages/code-studio/src/main/AppMainContainer.tsx b/packages/code-studio/src/main/AppMainContainer.tsx index 555da8a1e7..3893588ff9 100644 --- a/packages/code-studio/src/main/AppMainContainer.tsx +++ b/packages/code-studio/src/main/AppMainContainer.tsx @@ -21,6 +21,7 @@ import { Button, InfoModal, LoadingSpinner, + BasicModal, } from '@deephaven/components'; import { IrisGridModel, @@ -156,6 +157,7 @@ interface AppMainContainerProps { interface AppMainContainerState { contextActions: ContextAction[]; + isAuthFailed: boolean; isDisconnected: boolean; isPanelsMenuShown: boolean; isSettingsMenuShown: boolean; @@ -185,6 +187,11 @@ export class AppMainContainer extends Component< ); } + static handleRefresh() { + log.info('Refreshing application'); + window.location.reload(); + } + constructor(props: AppMainContainerProps & RouteComponentProps) { super(props); this.handleSettingsMenuHide = this.handleSettingsMenuHide.bind(this); @@ -213,6 +220,7 @@ export class AppMainContainer extends Component< this.openNotebookFromURL = this.openNotebookFromURL.bind(this); this.handleDisconnect = this.handleDisconnect.bind(this); this.handleReconnect = this.handleReconnect.bind(this); + this.handleReconnectAuthFailed = this.handleReconnectAuthFailed.bind(this); this.importElement = React.createRef(); @@ -242,6 +250,7 @@ export class AppMainContainer extends Component< isGlobal: true, }, ], + isAuthFailed: false, isDisconnected: false, isPanelsMenuShown: false, isSettingsMenuShown: false, @@ -555,6 +564,10 @@ export class AppMainContainer extends Component< this.setState({ isDisconnected: false }); } + handleReconnectAuthFailed() { + this.setState({ isAuthFailed: true }); + } + /** * Import the provided file and set it in the workspace data (which should then load it in the dashboard) * @param file JSON file to import @@ -661,6 +674,10 @@ export class AppMainContainer extends Component< dh.IdeConnection.EVENT_RECONNECT, this.handleReconnect ); + connection.addEventListener( + dh.CoreClient.EVENT_RECONNECT_AUTH_FAILED, + this.handleReconnectAuthFailed + ); } stopListeningForDisconnect() { @@ -673,6 +690,10 @@ export class AppMainContainer extends Component< dh.IdeConnection.EVENT_RECONNECT, this.handleReconnect ); + connection.removeEventListener( + dh.CoreClient.EVENT_RECONNECT_AUTH_FAILED, + this.handleReconnectAuthFailed + ); } hydrateDefault( @@ -788,6 +809,7 @@ export class AppMainContainer extends Component< const { canUsePanels } = permissions; const { contextActions, + isAuthFailed, isDisconnected, isPanelsMenuShown, isSettingsMenuShown, @@ -929,7 +951,7 @@ export class AppMainContainer extends Component< onChange={this.handleImportLayoutFiles} /> @@ -938,6 +960,13 @@ export class AppMainContainer extends Component< } subtitle="Please check your network connection." /> + ); }