From 152cb381ea2c915c762416092337ce1d8589d1c6 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Mon, 6 Dec 2021 15:09:15 +0100 Subject: Update ODLUX Update login view, add logout after user session ends, add user settings, several bugfixes Issue-ID: CCSDK-3540 Signed-off-by: Aijana Schumann Change-Id: I21137756b204287e25766a9646bf2faf7bad9d35 --- .../src/actions/connectionStatusCountActions.ts | 9 +++++--- .../src/components/editNetworkElementDialog.tsx | 4 ++-- .../src/components/infoNetworkElementDialog.tsx | 2 +- .../src/handlers/connectionStatusCountHandler.ts | 9 +++++--- sdnr/wt/odlux/apps/connectApp/src/index.html | 2 +- .../wt/odlux/apps/connectApp/src/pluginConnect.tsx | 25 +++++++++++++++++++--- sdnr/wt/odlux/apps/connectApp/webpack.config.js | 22 +++++++++---------- 7 files changed, 49 insertions(+), 24 deletions(-) (limited to 'sdnr/wt/odlux/apps/connectApp') diff --git a/sdnr/wt/odlux/apps/connectApp/src/actions/connectionStatusCountActions.ts b/sdnr/wt/odlux/apps/connectApp/src/actions/connectionStatusCountActions.ts index e1e16b704..43bae720c 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/actions/connectionStatusCountActions.ts +++ b/sdnr/wt/odlux/apps/connectApp/src/actions/connectionStatusCountActions.ts @@ -26,13 +26,14 @@ export class ConnectionStatusCountBaseAction extends Action { } export class SetConnectionStatusCountAction extends ConnectionStatusCountBaseAction { constructor(public ConnectedCount: number, public ConnectingCount: number, public DisconnectedCount: number, - public MountedCount: number, public UnableToConnectCount: number, public UndefinedCount: number, public UnmountedCount: number, public totalCount: number) { + public MountedCount: number, public UnableToConnectCount: number, public UndefinedCount: number, public UnmountedCount: number, public totalCount: number, public isLoadingConnectionStatusChart: boolean) { super(); } } export const refreshConnectionStatusCountAsyncAction = async (dispatch: Dispatch) => { + dispatch(new SetConnectionStatusCountAction(0, 0, 0, 0, 0, 0, 0, 0, true)); const result = await getConnectionStatusCountStateFromDatabase().catch(_ => null); if (result) { const statusAction = new SetConnectionStatusCountAction( @@ -43,10 +44,12 @@ export const refreshConnectionStatusCountAsyncAction = async (dispatch: Dispatch result["UnableToConnect"] || 0, result["Undefined"] || 0, result["Unmounted"] || 0, - result["total"] || 0 + result["total"] || 0, + false ); dispatch(statusAction); return; + } else { + dispatch(new SetConnectionStatusCountAction(0, 0, 0, 0, 0, 0, 0, 0, false)); } - dispatch(new SetConnectionStatusCountAction(0, 0, 0, 0, 0, 0, 0, 0)); } diff --git a/sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx b/sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx index df265c23d..061303976 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx +++ b/sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx @@ -233,8 +233,8 @@ class EditNetworkElementDialogComponent extends React.Component - } label="Password" onChange={this.onRadioSelect} /> - } label="TlsKey" onChange={this.onRadioSelect} /> + } label="Password" onChange={this.onRadioSelect} /> + } label="TlsKey" onChange={this.onRadioSelect} /> || null} {setting.enableUsernameEditor && showPasswordTextField && diff --git a/sdnr/wt/odlux/apps/connectApp/src/components/infoNetworkElementDialog.tsx b/sdnr/wt/odlux/apps/connectApp/src/components/infoNetworkElementDialog.tsx index 9b71eb354..aeaaa91e7 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/components/infoNetworkElementDialog.tsx +++ b/sdnr/wt/odlux/apps/connectApp/src/components/infoNetworkElementDialog.tsx @@ -113,7 +113,7 @@ <> {setting.dialogTitle + ' - ' + this.state.nodeId} - { diff --git a/sdnr/wt/odlux/apps/connectApp/src/handlers/connectionStatusCountHandler.ts b/sdnr/wt/odlux/apps/connectApp/src/handlers/connectionStatusCountHandler.ts index 611786520..219a09617 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/handlers/connectionStatusCountHandler.ts +++ b/sdnr/wt/odlux/apps/connectApp/src/handlers/connectionStatusCountHandler.ts @@ -26,7 +26,8 @@ export interface IConnectionStatusCount { UnableToConnect: number, Undefined: number, Unmounted: number, - total: number + total: number, + isLoadingConnectionStatusChart: boolean } const connectionStatusCountInit: IConnectionStatusCount = { @@ -37,7 +38,8 @@ const connectionStatusCountInit: IConnectionStatusCount = { UnableToConnect: 0, Undefined: 0, Unmounted: 0, - total: 0 + total: 0, + isLoadingConnectionStatusChart: false }; export const connectionStatusCountHandler: IActionHandler = (state = connectionStatusCountInit, action) => { @@ -50,7 +52,8 @@ export const connectionStatusCountHandler: IActionHandler 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 | 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 diff --git a/sdnr/wt/odlux/apps/connectApp/webpack.config.js b/sdnr/wt/odlux/apps/connectApp/webpack.config.js index df88a80a9..70ddd4932 100644 --- a/sdnr/wt/odlux/apps/connectApp/webpack.config.js +++ b/sdnr/wt/odlux/apps/connectApp/webpack.config.js @@ -131,49 +131,49 @@ module.exports = (env) => { }, proxy: { "/about": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/yang-schema/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/oauth/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/database/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/restconf/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/rests/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/help/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/about/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/tree/": { - target: "http://localhost:18181", + target: "http://sdnr:8181", secure: false }, "/websocket": { - target: "http://localhost:18181", + target: "http://sdnr:8181", ws: true, changeOrigin: true, secure: false }, "/apidoc": { - target: "http://localhost:18181", + target: "http://sdnr:8181", ws: true, changeOrigin: true, secure: false -- cgit 1.2.3-korg