diff options
author | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2021-12-06 15:09:15 +0100 |
---|---|---|
committer | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2021-12-06 15:12:24 +0100 |
commit | 152cb381ea2c915c762416092337ce1d8589d1c6 (patch) | |
tree | 63b71c8343f9292281f5d7f5eac14342fec06402 /sdnr/wt/odlux/apps | |
parent | 8ea94e1210671b941f84abfe16e248cfa086fe49 (diff) |
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 <aijana.schumann@highstreet-technologies.com>
Change-Id: I21137756b204287e25766a9646bf2faf7bad9d35
Diffstat (limited to 'sdnr/wt/odlux/apps')
13 files changed, 113 insertions, 39 deletions
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<ConfigurationApp viewData: nextProps.viewData || null, [OldProps]: nextProps, choises: nextProps.displaySpecification.displayMode === DisplayModeType.doNotDisplay + || nextProps.displaySpecification.displayMode === DisplayModeType.displayAsMessage ? null : nextProps.displaySpecification.displayMode === DisplayModeType.displayAsRPC ? nextProps.displaySpecification.inputViewSpecification && ConfigurationApplicationComponent.getChoisesFromElements(nextProps.displaySpecification.inputViewSpecification.elements, nextProps.viewData) || [] @@ -843,12 +844,22 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp ? this.renderUIViewList(ds.viewSpecification, ds.dataPath!, ds.keyProperty!, ds.apidocPath!, viewData) : ds.displayMode === DisplayModeType.displayAsRPC ? this.renderUIViewRPC(ds.inputViewSpecification, ds.dataPath!, viewData!, outputData, undefined, true, false) - : this.renderUIViewSelector(ds.viewSpecification, ds.dataPath!, viewData!, ds.keyProperty, editMode, isNew) + : ds.displayMode === DisplayModeType.displayAsMessage + ? this.renderMessage(ds.renderMessage) + : this.renderUIViewSelector(ds.viewSpecification, ds.dataPath!, viewData!, ds.keyProperty, editMode, isNew) } </div > ); } + private renderMessage(renderMessage: string) { + return ( + <div className={this.props.classes.container}> + <h4>{renderMessage}</h4> + </div> + ); + } + private renderCollectingData() { return ( <div className={this.props.classes.outer}> 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<EditNetworkEleme {setting.enableUsernameEditor && <RadioGroup row aria-label="password-tls-key" name="password-tls-key" value={radioSelected} onChange={this.handleRadioChange} > - <FormControlLabel value='password' control={<Radio />} label="Password" onChange={this.onRadioSelect} /> - <FormControlLabel value='tlsKey' control={<Radio />} label="TlsKey" onChange={this.onRadioSelect} /> + <FormControlLabel aria-label="passwordSelection" value='password' control={<Radio />} label="Password" onChange={this.onRadioSelect} /> + <FormControlLabel aria-label="tlsKeySelection" value='tlsKey' control={<Radio />} label="TlsKey" onChange={this.onRadioSelect} /> </RadioGroup> || 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 @@ <> <Dialog open={this.props.mode !== InfoNetworkElementDialogMode.None} > <DialogTitle id="form-dialog-title">{setting.dialogTitle + ' - ' + this.state.nodeId}</DialogTitle> - <InfoElementTable stickyHeader tableId="info-element-table" asynchronus columns={[ + <InfoElementTable stickyHeader isPopup tableId="info-element-table" asynchronus columns={[ { property: "module", title: "Module", type: ColumnType.text, width:900 }, { property: "revision", title: "Revision", type: ColumnType.custom, customControl: ({ rowData }) => { 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<IConnectionStatusCount> = (state = connectionStatusCountInit, action) => { @@ -50,7 +52,8 @@ export const connectionStatusCountHandler: IActionHandler<IConnectionStatusCount UnableToConnect: action.UnableToConnectCount, Undefined: action.UndefinedCount, Unmounted: action.UnmountedCount, - total: action.totalCount + total: action.totalCount, + isLoadingConnectionStatusChart: action.isLoadingConnectionStatusChart } } diff --git a/sdnr/wt/odlux/apps/connectApp/src/index.html b/sdnr/wt/odlux/apps/connectApp/src/index.html index 35dbdf71d..1a16876c9 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/index.html +++ b/sdnr/wt/odlux/apps/connectApp/src/index.html @@ -19,7 +19,7 @@ connectApp.register(); faultApp.register(); inventoryApp.register(); - app("./app.tsx").configureApplication({ authentication:"oauth", enablePolicy: false, transportpceUrl:"http://test.de"}); + app("./app.tsx").configureApplication({ authentication:"basic", enablePolicy: false, transportpceUrl:"http://test.de"}); app("./app.tsx").runApplication(); }); </script> 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 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<IFaultStatus> = (state = faultStatusInit, action) => { @@ -38,7 +40,8 @@ export const faultStatusHandler: IActionHandler<IFaultStatus> = (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<typeof window.setInterval> | 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; + } } |