diff options
author | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2020-02-28 15:15:26 +0100 |
---|---|---|
committer | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2020-02-28 15:15:26 +0100 |
commit | 889c7fbc0f78eadc302e8849ea7e6cad795e0d6e (patch) | |
tree | da4cb3a08d06520497f1ed584fbdf70afcc22edb /sdnr/wt/odlux/apps/faultApp | |
parent | 4eed58ba1a434261510c996316d2d201a40eb760 (diff) |
update odlux stage 3
PerformanceApp: Add filter to chart view
add scrolling header to tables, add basic validation to editNetworkElementDialog
bugfixes
Issue-ID: SDNC-1087
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: I585bd6cfeb11b867cd630e96e6479170d2f92fe8
Diffstat (limited to 'sdnr/wt/odlux/apps/faultApp')
4 files changed, 46 insertions, 14 deletions
diff --git a/sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts b/sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts index 58da19d46..7cf02ac4f 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts +++ b/sdnr/wt/odlux/apps/faultApp/src/actions/panelChangeActions.ts @@ -24,6 +24,12 @@ export class SetPanelAction extends Action { } } +export class RememberCurrentPanelAction extends Action { + constructor(public panelId: PanelId) { + super(); + } +} + export const setPanelAction = (panelId: PanelId) => { return new SetPanelAction(panelId); } diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts index dddb4a247..a5cf928fc 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts +++ b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts @@ -26,21 +26,26 @@ import { IActionHandler } from '../../../../framework/src/flux/action'; import { IFaultNotifications, faultNotificationsHandler } from './notificationsHandler'; import { ICurrentProblemsState, currentProblemsActionHandler } from './currentProblemsHandler'; import { IAlarmLogEntriesState, alarmLogEntriesActionHandler } from './alarmLogEntriesHandler'; -import { SetPanelAction } from '../actions/panelChangeActions'; +import { SetPanelAction, RememberCurrentPanelAction } from '../actions/panelChangeActions'; import { IFaultStatus, faultStatusHandler } from './faultStatusHandler'; import { stuckAlarmHandler } from './clearStuckAlarmsHandler'; +import { PanelId } from 'models/panelId'; export interface IFaultAppStoreState { currentProblems: ICurrentProblemsState; faultNotifications: IFaultNotifications; alarmLogEntries: IAlarmLogEntriesState; - currentOpenPanel: string | null; + currentOpenPanel: ICurrentOpenPanelState; faultStatus: IFaultStatus; } -const currentOpenPanelHandler: IActionHandler<string | null> = (state = null, action) => { +type ICurrentOpenPanelState = { openPanel: string | null, savedPanel: PanelId | null }; +const panelInitState = { openPanel: null, savedPanel: null }; +const currentOpenPanelHandler: IActionHandler<ICurrentOpenPanelState> = (state = panelInitState, action) => { if (action instanceof SetPanelAction) { - state = action.panelId; + state = { ...state, openPanel: action.panelId }; + } else if (action instanceof RememberCurrentPanelAction) { + state = { ...state, savedPanel: action.panelId }; } return state; } diff --git a/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx b/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx index 02dde90f7..666667e40 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx +++ b/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx @@ -40,6 +40,7 @@ import { AddFaultNotificationAction } from "./actions/notificationActions"; import { createCurrentProblemsProperties, createCurrentProblemsActions, currentProblemsReloadAction } from "./handlers/currentProblemsHandler"; import { FaultStatus } from "./components/faultStatus"; import { refreshFaultStatusAsyncAction } from "./actions/statusActions"; +import { alarmLogEntriesReloadAction } from "./handlers/alarmLogEntriesHandler"; let currentMountId: string | undefined = undefined; @@ -49,7 +50,7 @@ const mapProps = (state: IApplicationStoreState) => ({ const mapDisp = (dispatcher: IDispatcher) => ({ currentProblemsActions: createCurrentProblemsActions(dispatcher.dispatch, true), - setCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new SetPanelAction(panelId)) + setCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new SetPanelAction(panelId)), }); const FaultApplicationRouteAdapter = connect(mapProps, mapDisp)((props: RouteComponentProps<{ mountId?: string }> & Connect<typeof mapProps, typeof mapDisp>) => { @@ -73,9 +74,9 @@ const FaultApplicationRouteAdapter = connect(mapProps, mapDisp)((props: RouteCom const App = withRouter((props: RouteComponentProps) => ( <Switch> - <Route path={ `${ props.match.path }/:mountId?` } component={ FaultApplicationRouteAdapter } /> - <Redirect to={ `${ props.match.path }` } /> - </Switch> + <Route path={`${props.match.path}/:mountId?`} component={FaultApplicationRouteAdapter} /> + <Redirect to={`${props.match.path}`} /> + </Switch> )); export function register() { @@ -93,6 +94,13 @@ export function register() { const store = applicationApi && applicationApi.applicationStore; if (fault && store) { store.dispatch(new AddFaultNotificationAction(fault)); + + //reload fault data if tab is open + if (store.state.fault.currentOpenPanel.openPanel === "AlarmLog") { + store.dispatch(alarmLogEntriesReloadAction); + } else if (store.state.fault.currentOpenPanel.openPanel === "CurrentProblem") { + store.dispatch(currentProblemsReloadAction); + } } })); diff --git a/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx b/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx index cbcfd84d6..ed395d2e4 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx +++ b/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx @@ -33,13 +33,14 @@ import { PanelId } from '../models/panelId'; import { createCurrentProblemsProperties, createCurrentProblemsActions, currentProblemsReloadAction } from '../handlers/currentProblemsHandler'; import { createAlarmLogEntriesProperties, createAlarmLogEntriesActions, alarmLogEntriesReloadAction } from '../handlers/alarmLogEntriesHandler'; -import { setPanelAction } from '../actions/panelChangeActions'; +import { setPanelAction, RememberCurrentPanelAction } from '../actions/panelChangeActions'; import { Tooltip, IconButton, AppBar, Tabs, Tab } from '@material-ui/core'; import RefreshIcon from '@material-ui/icons/Refresh'; import ClearStuckAlarmsDialog, { ClearStuckAlarmsDialogMode } from '../components/clearStuckAlarmsDialog'; const mapProps = (state: IApplicationStoreState) => ({ - panelId: state.fault.currentOpenPanel, + panelId: state.fault.currentOpenPanel.openPanel, + savedPanel: state.fault.currentOpenPanel.savedPanel, currentProblemsProperties: createCurrentProblemsProperties(state), faultNotifications: state.fault.faultNotifications, alarmLogEntriesProperties: createAlarmLogEntriesProperties(state) @@ -52,7 +53,8 @@ const mapDisp = (dispatcher: IDispatcher) => ({ reloadAlarmLogEntries: () => dispatcher.dispatch(alarmLogEntriesReloadAction), switchActivePanel: (panelId: PanelId) => { dispatcher.dispatch(setPanelAction(panelId)); - } + }, + rememberCurrentPanel: (panelId: PanelId) => dispatcher.dispatch(new RememberCurrentPanelAction(panelId)) }); type FaultApplicationComponentProps = RouteComponentProps & Connect<typeof mapProps, typeof mapDisp>; @@ -146,7 +148,7 @@ class FaultApplicationComponent extends React.Component<FaultApplicationComponen { property: "icon", title: "", type: ColumnType.custom, customControl: this.renderIcon }, { property: "timeStamp", title: "Time Stamp" }, { property: "nodeName", title: "Node Name" }, - { property: "counter", title: "Count", width: "100px" }, + { property: "counter", title: "Count", width: "100px", type: ColumnType.numeric }, { property: "objectId", title: "Object Id" }, { property: "problem", title: "Alarm Type" }, { property: "severity", title: "Severity", width: "140px" }, @@ -174,11 +176,22 @@ class FaultApplicationComponent extends React.Component<FaultApplicationComponen }; + componentWillUnmount() { + if (this.props.panelId) { + this.props.rememberCurrentPanel(this.props.panelId as PanelId); + this.props.switchActivePanel(null); + } + } + public componentDidMount() { - if (this.props.panelId === null) { //don't change tabs, if one is selected already + if (this.props.panelId === null && this.props.savedPanel === null) { //set default tab if none is set this.onToggleTabs("CurrentProblem"); - } + } else // load saved tab if possible + if (this.props.panelId === null && this.props.savedPanel !== null) { + this.onToggleTabs(this.props.savedPanel); + this.props.rememberCurrentPanel(null); + } this.props.alarmLogEntriesActions.onToggleFilter(); this.props.currentProblemsActions.onToggleFilter(); |