From c0f255f5a73e7ba75ec0d8c4037d3d50b296cedd Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Mon, 11 Jun 2018 14:28:35 -0400 Subject: [PATCH] Spark Admin: Reload page if websocket is disconnected --- src/web/CMakeLists.txt | 2 +- src/web/api/src/ServiceContext.ts | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/web/CMakeLists.txt b/src/web/CMakeLists.txt index 1d0bdf913..bab1b8ff2 100644 --- a/src/web/CMakeLists.txt +++ b/src/web/CMakeLists.txt @@ -20,7 +20,7 @@ set(PROTO_GLOBS file (GLOB_RECURSE Proto_Deps RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${PROTO_GLOBS}) file (GLOB_RECURSE Proto_Deps_For_Tool RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/api ${PROTO_GLOBS}) file (GLOB_RECURSE Api_Src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/src/*.fs) -file (GLOB_RECURSE Ui_Src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} api/src/*.fs) +file (GLOB_RECURSE Ui_Src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} api/src/*.ts) file (GLOB_RECURSE build_scripts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} api/*.sh) set (All_Deps ${Proto_Deps} ${Api_Src} ${Ui_Src} ${build_scripts}) diff --git a/src/web/api/src/ServiceContext.ts b/src/web/api/src/ServiceContext.ts index e7edc0225..6e17094ab 100644 --- a/src/web/api/src/ServiceContext.ts +++ b/src/web/api/src/ServiceContext.ts @@ -88,15 +88,17 @@ class PrivateContext { onclose(_){ - console.log("Reconnecting in 3 seconds...") - let i = setInterval(() => { - if (!this.connected()) { - this.connect() - } - else { - clearInterval(i) - } - },3000); + alert("Server disconnected. You will need to log in again."); + window.location = window.location; + // console.log("Reconnecting in 3 seconds...") + // let i = setInterval(() => { + // if (!this.connected()) { + // this.connect() + // } + // else { + // clearInterval(i) + // } + // },3000); } onmessage(e){ const raw_buffer = new Uint8Array(e.data)