From 3d202a04b99f0e61b6ccf8b7a5610e1a15ca58e7 Mon Sep 17 00:00:00 2001 From: Herbert Eiselt Date: Mon, 11 Feb 2019 14:54:12 +0100 Subject: Add sdnr wt odlux Add complete sdnr wireless transport app odlux core and apps Change-Id: I5dcbfb8f3b790e3bda7c8df67bd69d81958f65e5 Issue-ID: SDNC-576 Signed-off-by: Herbert Eiselt --- .../apps/faultApp/src/views/faultApplication.tsx | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx (limited to 'sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx') diff --git a/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx b/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx new file mode 100644 index 000000000..9eb3a00ff --- /dev/null +++ b/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx @@ -0,0 +1,114 @@ +import * as React from 'react'; + +import { withRouter, RouteComponentProps } from 'react-router-dom'; + +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; + +import { MaterialTable, ColumnType, MaterialTableCtorType } from '../../../../framework/src/components/material-table'; +import { Panel } from '../../../../framework/src/components/material-ui'; + +import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; +import connect, { Connect, IDispatcher } from '../../../../framework/src/flux/connect'; + +import { Fault } from '../models/fault'; +import { PanelId } from '../models/panelId'; + +import { createCurrentProblemsProperties, createCurrentProblemsActions, currentProblemsReloadAction } from '../handlers/currentProblemsHandler'; +import { createAlarmLogEntriesProperties, createAlarmLogEntriesActions, alarmLogEntriesReloadAction } from '../handlers/alarmLogEntriesHandler'; +import { SetPanelAction } from '../actions/panelChangeActions'; + +const mapProps = (state: IApplicationStoreState) => ({ + activePanel: state.faultApp.currentOpenPanel, + currentProblemsProperties: createCurrentProblemsProperties(state), + faultNotifications: state.faultApp.faultNotifications, + alarmLogEntriesProperties: createAlarmLogEntriesProperties(state) +}); + +const mapDisp = (dispatcher: IDispatcher) => ({ + currentProblemsActions: createCurrentProblemsActions(dispatcher.dispatch), + alarmLogEntriesActions: createAlarmLogEntriesActions(dispatcher.dispatch), + reloadCurrentProblems: () => dispatcher.dispatch(currentProblemsReloadAction), + reloadAlarmLogEntries: () => dispatcher.dispatch(alarmLogEntriesReloadAction), + setCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new SetPanelAction(panelId)) +}); + +type FaultApplicationComponentProps = RouteComponentProps & Connect; + + +const FaultTable = MaterialTable as MaterialTableCtorType; + +class FaultApplicationComponent extends React.Component{ + + render(): JSX.Element { + + const { activePanel } = this.props; + + const onTogglePanel = (panelId: PanelId) => { + const nextActivePanel = panelId === this.props.activePanel ? null : panelId; + this.props.setCurrentPanel(nextActivePanel); + + switch (nextActivePanel) { + case 'CurrentProblem': + this.props.reloadCurrentProblems(); + break; + case 'AlarmLog': + this.props.reloadAlarmLogEntries(); + break; + case 'AlarmNotifications': + case null: + default: + // nothing to do + break; + } + }; + + return ( + <> + + + + + + + + + + + ); + }; + + private renderIcon = (props: { rowData: Fault }) => { + return ( + + ); + }; + +} + +export const FaultApplication = withRouter(connect(mapProps, mapDisp)(FaultApplicationComponent)); +export default FaultApplication; -- cgit 1.2.3-korg