aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/faultApp/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/apps/faultApp/src/handlers')
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts5
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts29
2 files changed, 33 insertions, 1 deletions
diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts
index a887a3327..e97383e10 100644
--- a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts
+++ b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts
@@ -10,12 +10,14 @@ import { IFaultNotifications, faultNotificationsHandler } from './notificationsH
import { ICurrentProblemsState, currentProblemsActionHandler } from './currentProblemsHandler';
import { IAlarmLogEntriesState, alarmLogEntriesActionHandler } from './alarmLogEntriesHandler';
import { SetPanelAction } from '../actions/panelChangeActions';
+import { IFaultStatus, faultStatusHandler } from './faultStatusHandler';
export interface IFaultAppStoreState {
currentProblems: ICurrentProblemsState;
faultNotifications: IFaultNotifications;
alarmLogEntries: IAlarmLogEntriesState;
currentOpenPanel: string|null;
+ faultStatus: IFaultStatus;
}
const currentOpenPanelHandler: IActionHandler<string | null> = (state = null, action) => {
@@ -35,7 +37,8 @@ const actionHandlers = {
currentProblems: currentProblemsActionHandler,
faultNotifications: faultNotificationsHandler,
alarmLogEntries: alarmLogEntriesActionHandler,
- currentOpenPanel: currentOpenPanelHandler
+ currentOpenPanel: currentOpenPanelHandler,
+ faultStatus: faultStatusHandler
};
export const faultAppRootHandler = combineActionHandler<IFaultAppStoreState>(actionHandlers);
diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts
new file mode 100644
index 000000000..0a084df6b
--- /dev/null
+++ b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultStatusHandler.ts
@@ -0,0 +1,29 @@
+import { IActionHandler } from "../../../../framework/src/flux/action";
+import { SetFaultStatusAction } from "../actions/statusActions";
+
+export interface IFaultStatus {
+ critical: number,
+ major: number,
+ minor: number,
+ warning: number
+}
+
+const faultStatusInit: IFaultStatus = {
+ critical: 0,
+ major: 0,
+ minor: 0,
+ warning: 0
+};
+
+export const faultStatusHandler: IActionHandler<IFaultStatus> = (state = faultStatusInit, action) => {
+ if (action instanceof SetFaultStatusAction) {
+ state = {
+ critical: action.criticalFaults,
+ major: action.majorFaults,
+ minor: action.minorFaults,
+ warning: action.warnings
+ }
+ }
+
+ return state;
+} \ No newline at end of file