aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-03-28 19:00:35 +0100
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-03-28 19:01:01 +0100
commit62e834802dae0bd15504785503060d7875c7b4ad (patch)
tree0b3d3ae0c62b279773a2aea3daebcad5f8ad78a2 /sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts
parentf2bb490d9c82decbdb50c1e4db1be2f34b28d097 (diff)
Add SDN-R odlux performance
A UI displaying performance monitoring data Change-Id: I2a9c28549aee1bcac366354c343a63f884bf09e0 Issue-ID: SDNC-585 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts')
-rw-r--r--sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts
new file mode 100644
index 000000000..2fd0ac8f1
--- /dev/null
+++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts
@@ -0,0 +1,43 @@
+import { IActionHandler } from '../../../../framework/src/flux/action';
+
+import {
+ AllAvailableLtpsLoadedAction,
+ LoadAllAvailableLtpsAction,
+} from '../actions/ltpAction';
+
+import { Ltp } from '../models/availableLtps';
+
+export interface IAvailableLtpsState {
+ distinctLtps: Ltp[];
+ busy: boolean;
+}
+
+const connectedNetworkElementsStateInit: IAvailableLtpsState = {
+ distinctLtps: [],
+ busy: false
+};
+
+export const availableLtpsActionHandler: IActionHandler<IAvailableLtpsState> = (state = connectedNetworkElementsStateInit, action) => {
+ if (action instanceof LoadAllAvailableLtpsAction) {
+
+ state = {
+ ...state,
+ busy: true
+ };
+
+ } else if (action instanceof AllAvailableLtpsLoadedAction) {
+ if (!action.error && action.availableLtps) {
+ state = {
+ ...state,
+ distinctLtps: action.availableLtps,
+ busy: false
+ };
+ } else {
+ state = {
+ ...state,
+ busy: false
+ };
+ }
+ }
+ return state;
+}; \ No newline at end of file