summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/faultApp/src/actions
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-06-07 17:40:50 +0200
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-06-07 17:41:24 +0200
commitd93e6a996e60fb6abce9a870cef6b2d57bfa70fd (patch)
tree97595acb7fa809e742beb6cd5eeaaeab5f956ba9 /sdnr/wt/odlux/apps/faultApp/src/actions
parent1445dabe9bc28629077033e2f189ad05dc61b884 (diff)
SDNR Add missing status bar to ODLUX Framework
Modify framework and adapt all apps Issue-ID: SDNC-789 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com> Change-Id: I1ea0a3df6c3f6db08f2bd7a21eb3b4cbf230a08a Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/faultApp/src/actions')
-rw-r--r--sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts b/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts
new file mode 100644
index 000000000..48f501ba8
--- /dev/null
+++ b/sdnr/wt/odlux/apps/faultApp/src/actions/statusActions.ts
@@ -0,0 +1,26 @@
+import { FaultApplicationBaseAction } from './notificationActions';
+import { getFaultStateFromDatabase } from '../services/faultStatusService';
+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) {
+ super();
+ }
+}
+
+
+export const refreshFaultStatusAsyncAction = async (dispatch: Dispatch ) => {
+ const result = await getFaultStateFromDatabase().catch(_=>null);
+ if (result) {
+ const statusAction = new SetFaultStatusAction(
+ result["Critical"] || 0,
+ result["Major"] || 0,
+ result["Minor"] || 0,
+ result["Warning"] || 0
+ );
+ dispatch(statusAction);
+ return;
+ }
+ dispatch(new SetFaultStatusAction(0, 0, 0, 0));
+}