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 --- .../configurationApp/src/actions/deviceActions.ts | 6 +++++ .../src/handlers/viewDescriptionHandler.ts | 6 ++++- .../src/views/configurationApplication.tsx | 13 +++++++++- .../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 ++++++++-------- .../apps/faultApp/src/actions/statusActions.ts | 15 +++++++---- .../faultApp/src/handlers/faultStatusHandler.ts | 9 ++++--- sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx | 30 ++++++++++++++++++---- 13 files changed, 113 insertions(+), 39 deletions(-) (limited to 'sdnr/wt/odlux/apps') diff --git a/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts b/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts index b5dd310bc..ac8aa0ac2 100644 --- a/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts +++ b/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts @@ -55,6 +55,12 @@ export const updateNodeIdAsyncActionCreator = (nodeId: string) => async (dispatc const { availableCapabilities, unavailableCapabilities, importOnlyModules } = await restService.getCapabilitiesByMountId(nodeId); if (!availableCapabilities || availableCapabilities.length <= 0) { + dispatch(new SetCollectingSelectionData(false)); + dispatch(new UpdateDeviceDescription(nodeId, {}, [])); + dispatch(new UpdatViewDescription("", [], { + displayMode: DisplayModeType.displayAsMessage, + renderMessage: `NetworkElement : "${nodeId}" has no capabilities.` + })); throw new Error(`NetworkElement : [${nodeId}] has no capabilities.`); } diff --git a/sdnr/wt/odlux/apps/configurationApp/src/handlers/viewDescriptionHandler.ts b/sdnr/wt/odlux/apps/configurationApp/src/handlers/viewDescriptionHandler.ts index 7a9812bfd..ff85a97ea 100644 --- a/sdnr/wt/odlux/apps/configurationApp/src/handlers/viewDescriptionHandler.ts +++ b/sdnr/wt/odlux/apps/configurationApp/src/handlers/viewDescriptionHandler.ts @@ -25,7 +25,8 @@ export enum DisplayModeType { doNotDisplay = 0, displayAsObject = 1, displayAsList = 2, - displayAsRPC = 3 + displayAsRPC = 3, + displayAsMessage = 4 }; export type DisplaySpecification = { @@ -41,6 +42,9 @@ export type DisplaySpecification = { inputViewSpecification?: ViewSpecification; outputViewSpecification?: ViewSpecification; dataPath?: string; +} | { + displayMode: DisplayModeType.displayAsMessage; + renderMessage: string; } export interface IViewDescriptionState { diff --git a/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx b/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx index 8d0e19246..b777cdbe5 100644 --- a/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx +++ b/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx @@ -265,6 +265,7 @@ class ConfigurationApplicationComponent extends React.Component ); } + private renderMessage(renderMessage: string) { + return ( +
+

{renderMessage}

+
+ ); + } + private renderCollectingData() { return (
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 diff --git a/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts b/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts index 8a3633243..c50c08ef2 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts +++ b/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts @@ -21,23 +21,28 @@ import { Dispatch } from '../../../../framework/src/flux/store'; export class SetFaultStatusAction extends FaultApplicationBaseAction { - constructor (public criticalFaults: number, public majorFaults: number, public minorFaults: number, public warnings: number) { + constructor (public criticalFaults: number, public majorFaults: number, public minorFaults: number, public warnings: number, public isLoadingAlarmStatusChart: boolean) { super(); } } -export const refreshFaultStatusAsyncAction = async (dispatch: Dispatch ) => { - const result = await getFaultStateFromDatabase().catch(_=>null); +export const refreshFaultStatusAsyncAction = async (dispatch: Dispatch) => { + + dispatch(new SetFaultStatusAction(0, 0, 0, 0, true)); + const result = await getFaultStateFromDatabase().catch(_ => null); if (result) { const statusAction = new SetFaultStatusAction( result["Critical"] || 0, result["Major"] || 0, result["Minor"] || 0, - result["Warning"] || 0 + result["Warning"] || 0, + false ); dispatch(statusAction); return; } - dispatch(new SetFaultStatusAction(0, 0, 0, 0)); + else { + dispatch(new SetFaultStatusAction(0, 0, 0, 0, false)); + } } diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts index 1c76a4b1a..e1fceb4be 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts +++ b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts @@ -22,14 +22,16 @@ export interface IFaultStatus { critical: number, major: number, minor: number, - warning: number + warning: number, + isLoadingAlarmStatusChart: boolean } const faultStatusInit: IFaultStatus = { critical: 0, major: 0, minor: 0, - warning: 0 + warning: 0, + isLoadingAlarmStatusChart: false }; export const faultStatusHandler: IActionHandler = (state = faultStatusInit, action) => { @@ -38,7 +40,8 @@ export const faultStatusHandler: IActionHandler = (state = faultSt critical: action.criticalFaults, major: action.majorFaults, minor: action.minorFaults, - warning: action.warnings + warning: action.warnings, + isLoadingAlarmStatusChart: action.isLoadingAlarmStatusChart } } diff --git a/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx b/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx index 3715c623e..0c5fdde27 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx +++ b/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx @@ -39,10 +39,11 @@ import { AddFaultNotificationAction } from "./actions/notificationActions"; import { createCurrentProblemsProperties, createCurrentProblemsActions, currentProblemsReloadAction } from "./handlers/currentProblemsHandler"; import { FaultStatus } from "./components/faultStatus"; -import { refreshFaultStatusAsyncAction } from "./actions/statusActions"; +import { refreshFaultStatusAsyncAction, SetFaultStatusAction } from "./actions/statusActions"; let currentMountId: string | undefined = undefined; let currentSeverity: string | undefined = undefined; +let refreshInterval: ReturnType | null = null; const mapProps = (state: IApplicationStoreState) => ({ currentProblemsProperties: createCurrentProblemsProperties(state), @@ -140,11 +141,30 @@ export function register() { applicationApi.applicationStoreInitialized.then(store => { store.dispatch(refreshFaultStatusAsyncAction); }); - - window.setInterval(() => { + + applicationApi.loginEvent.addHandler(e=>{ + refreshInterval = startRefreshInterval() as any; + }) + + applicationApi.logoutEvent.addHandler(e=>{ + applicationApi.applicationStoreInitialized.then(store => { - store.dispatch(refreshFaultStatusAsyncAction); + store.dispatch(new SetFaultStatusAction(0, 0, 0, 0, false)); + clearInterval(refreshInterval!); }); - }, 15000); + }) + + + + function startRefreshInterval(){ + const refreshFaultStatus = window.setInterval(() => { + applicationApi.applicationStoreInitialized.then(store => { + + store.dispatch(refreshFaultStatusAsyncAction); + }); + }, 15000); + + return refreshFaultStatus; + } } -- cgit 1.2.3-korg