2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt odlux
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
20 import { combineActionHandler } from '../../../../framework/src/flux/middleware';
22 // ** do not remove **
23 import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
24 import { IActionHandler } from '../../../../framework/src/flux/action';
26 import { IConnectAppStoreState } from '../../../connectApp/src/handlers/connectAppRootHandler';
27 import { IPerformanceDataState, performanceDataActionHandler } from './performanceDataHandler';
28 import { IReceiveLevelState, receiveLevelActionHandler } from './receiveLevelHandler';
29 import { ITransmissionPowerState, transmissionPowerActionHandler } from './transmissionPowerHandler';
30 import { IAdaptiveModulationState, adaptiveModulationActionHandler } from './adaptiveModulationHandler';
31 import { ITemperatureState, temperatureActionHandler } from './temperatureHandler';
32 import { ISignalToInterferenceState, signalToInterferenceActionHandler } from './signalToInterferenceHandler';
33 import { ICrossPolarDiscriminationState, crossPolarDiscriminationActionHandler } from './crossPolarDiscriminationHandler';
34 import { SetPanelAction } from '../actions/panelChangeActions';
35 import { IDeviceListState, deviceListActionHandler } from './deviceListActionHandler';
36 import { IAvailableLtpsState, availableLtpsActionHandler } from './availableLtpsActionHandler';
37 import { PmDataInterval } from '../models/performanceDataType';
38 import { TimeChangeAction } from '../actions/timeChangeAction';
39 import { UpdateMountId } from '../actions/deviceListActions';
40 import { SetSubViewAction, ResetAllSubViewsAction, SetFilterVisibility } from '../actions/toggleActions';
41 import { SubTabType, currentViewType } from '../models/toggleDataType';
43 export interface IPerformanceHistoryStoreState {
45 networkElements: IDeviceListState;
46 ltps: IAvailableLtpsState;
47 performanceData: IPerformanceDataState;
48 receiveLevel: IReceiveLevelState;
49 transmissionPower: ITransmissionPowerState;
50 adaptiveModulation: IAdaptiveModulationState;
51 temperature: ITemperatureState;
52 signalToInterference: ISignalToInterferenceState;
53 crossPolarDiscrimination: ICrossPolarDiscriminationState;
54 currentOpenPanel: string | null;
55 pmDataIntervalType: PmDataInterval;
56 subViews: toggleViewDataType;
59 const mountIdHandler: IActionHandler<string> = (state = "", action) => {
60 if (action instanceof UpdateMountId) {
63 state = action.nodeId;
70 const currentOpenPanelHandler: IActionHandler<string | null> = (state = null, action) => {
71 if (action instanceof SetPanelAction) {
72 state = action.panelId;
77 const currentPMDataIntervalHandler: IActionHandler<PmDataInterval> = (state = PmDataInterval.pmInterval15Min, action) => {
78 if (action instanceof TimeChangeAction) {
84 type filterableSubview = { subView: SubTabType, isFilterVisible: boolean };
85 type toggleViewDataType = { currentSubView: currentViewType, performanceData: filterableSubview, receiveLevel: filterableSubview, transmissionPower: filterableSubview, adaptiveModulation: filterableSubview, temperatur: filterableSubview, SINR: filterableSubview, CPD: filterableSubview };
88 const toogleViewDataHandler: IActionHandler<toggleViewDataType> = (state = { currentSubView: "performanceData", performanceData: { subView: "chart", isFilterVisible: true }, receiveLevel: { subView: "chart", isFilterVisible: true }, adaptiveModulation: { subView: "chart", isFilterVisible: true }, transmissionPower: { subView: "chart", isFilterVisible: true }, temperatur: { subView: "chart", isFilterVisible: true }, SINR: { subView: "chart", isFilterVisible: true }, CPD: { subView: "chart", isFilterVisible: true } }, action) => {
90 if (action instanceof SetSubViewAction) {
91 switch (action.currentView) {
92 case "performanceData": state = { ...state, performanceData: { ...state.performanceData, subView: action.selectedTab } }; break;
93 case "adaptiveModulation": state = { ...state, adaptiveModulation: { ...state.adaptiveModulation, subView: action.selectedTab } }; break;
94 case "receiveLevel": state = { ...state, receiveLevel: { ...state.receiveLevel, subView: action.selectedTab } }; break;
95 case "transmissionPower": state = { ...state, transmissionPower: { ...state.transmissionPower, subView: action.selectedTab } }; break;
96 case "Temp": state = { ...state, temperatur: { ...state.temperatur, subView: action.selectedTab } }; break;
97 case "SINR": state = { ...state, SINR: { ...state.SINR, subView: action.selectedTab } }; break;
98 case "CPD": state = { ...state, CPD: { ...state.CPD, subView: action.selectedTab } }; break;
101 else if (action instanceof SetFilterVisibility) {
102 switch (action.currentView) {
103 case "performanceData": state = {
104 ...state, performanceData: { ...state.performanceData, isFilterVisible: action.isVisible }
106 case "adaptiveModulation": state = { ...state, adaptiveModulation: { ...state.performanceData, isFilterVisible: action.isVisible } }; break;
107 case "receiveLevel": state = { ...state, receiveLevel: { ...state.receiveLevel, isFilterVisible: action.isVisible } }; break;
108 case "transmissionPower": state = { ...state, transmissionPower: { ...state.transmissionPower, isFilterVisible: action.isVisible } }; break;
109 case "Temp": state = { ...state, temperatur: { ...state.temperatur, isFilterVisible: action.isVisible } }; break;
110 case "SINR": state = { ...state, SINR: { ...state.SINR, isFilterVisible: action.isVisible } }; break;
111 case "CPD": state = { ...state, CPD: { ...state.CPD, isFilterVisible: action.isVisible } }; break;
114 } else if (action instanceof ResetAllSubViewsAction) {
116 ...state, performanceData: { ...state.performanceData, subView: "chart" },
117 adaptiveModulation: { ...state.adaptiveModulation, subView: "chart" },
118 receiveLevel: { ...state.receiveLevel, subView: "chart" },
119 transmissionPower: { ...state.transmissionPower, subView: "chart" },
120 temperatur: { ...state.temperatur, subView: "chart" },
121 SINR: { ...state.SINR, subView: "chart" },
122 CPD: { ...state.CPD, subView: "chart" }
129 declare module '../../../../framework/src/store/applicationStore' {
130 interface IApplicationStoreState {
131 performanceHistory: IPerformanceHistoryStoreState;
132 connect: IConnectAppStoreState;
136 const actionHandlers = {
137 nodeId: mountIdHandler,
138 networkElements: deviceListActionHandler,
139 ltps: availableLtpsActionHandler,
140 performanceData: performanceDataActionHandler,
141 receiveLevel: receiveLevelActionHandler,
142 transmissionPower: transmissionPowerActionHandler,
143 adaptiveModulation: adaptiveModulationActionHandler,
144 temperature: temperatureActionHandler,
145 signalToInterference: signalToInterferenceActionHandler,
146 crossPolarDiscrimination: crossPolarDiscriminationActionHandler,
147 currentOpenPanel: currentOpenPanelHandler,
148 pmDataIntervalType: currentPMDataIntervalHandler,
149 subViews: toogleViewDataHandler
152 const performanceHistoryRootHandler = combineActionHandler<IPerformanceHistoryStoreState>(actionHandlers);
153 export default performanceHistoryRootHandler;