From 62e834802dae0bd15504785503060d7875c7b4ad Mon Sep 17 00:00:00 2001 From: Herbert Eiselt Date: Thu, 28 Mar 2019 19:00:35 +0100 Subject: Add SDN-R odlux performance A UI displaying performance monitoring data Change-Id: I2a9c28549aee1bcac366354c343a63f884bf09e0 Issue-ID: SDNC-585 Signed-off-by: Herbert Eiselt --- .../src/handlers/availableLtpsActionHandler.ts | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts (limited to 'sdnr/wt/odlux/apps/performanceHistoryApp/src/handlers/availableLtpsActionHandler.ts') 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 = (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 -- cgit 1.2.3-korg