diff options
Diffstat (limited to 'sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx')
-rw-r--r-- | sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx b/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx index 1990cc03d..afca74664 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx +++ b/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx @@ -35,6 +35,8 @@ import { PanelId } from "./models/panelId"; import { NetworkElementsList } from './components/networkElements' let currentStatus: string | undefined = undefined; +let refreshInterval: ReturnType<typeof window.setInterval> | null = null; + const mapProps = (state: IApplicationStoreState) => ({ currentProblemsProperties: createNetworkElementsProperties(state), @@ -108,9 +110,26 @@ export function register() { applicationApi.applicationStoreInitialized.then(store => { store.dispatch(refreshConnectionStatusCountAsyncAction); }); - window.setInterval(() => { + + + applicationApi.loginEvent.addHandler(e=>{ + refreshInterval = startRefreshInterval() as any; + }) + + applicationApi.logoutEvent.addHandler(e=>{ + applicationApi.applicationStoreInitialized.then(store => { - store.dispatch(refreshConnectionStatusCountAsyncAction); + clearInterval(refreshInterval!); }); - }, 15000); + }) + + const startRefreshInterval =() =>{ + const refresh = window.setInterval(() => { + applicationApi.applicationStoreInitialized.then(store => { + store.dispatch(refreshConnectionStatusCountAsyncAction); + }); + }, 15000); + + return refresh; + } }
\ No newline at end of file |