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';
42 import { ReloadAction } from '../actions/reloadAction';
44 export interface IPerformanceHistoryStoreState {
46 networkElements: IDeviceListState;
47 ltps: IAvailableLtpsState;
48 performanceData: IPerformanceDataState;
49 receiveLevel: IReceiveLevelState;
50 transmissionPower: ITransmissionPowerState;
51 adaptiveModulation: IAdaptiveModulationState;
52 temperature: ITemperatureState;
53 signalToInterference: ISignalToInterferenceState;
54 crossPolarDiscrimination: ICrossPolarDiscriminationState;
55 currentOpenPanel: string | null;
56 pmDataIntervalType: PmDataInterval;
57 subViews: toggleViewDataType;
58 isReloadSchedueled: boolean;
61 const mountIdHandler: IActionHandler<string> = (state = "", action) => {
62 if (action instanceof UpdateMountId) {
65 state = action.nodeId;
71 const reloadHandler: IActionHandler<boolean> = (state = false, action) => {
73 if (action instanceof ReloadAction) {
80 const currentOpenPanelHandler: IActionHandler<string | null> = (state = null, action) => {
81 if (action instanceof SetPanelAction) {
82 state = action.panelId;
87 const currentPMDataIntervalHandler: IActionHandler<PmDataInterval> = (state = PmDataInterval.pmInterval15Min, action) => {
88 if (action instanceof TimeChangeAction) {
94 type filterableSubview = { subView: SubTabType, isFilterVisible: boolean };
95 type toggleViewDataType = { currentSubView: currentViewType, performanceData: filterableSubview, receiveLevel: filterableSubview, transmissionPower: filterableSubview, adaptiveModulation: filterableSubview, temperatur: filterableSubview, SINR: filterableSubview, CPD: filterableSubview };
98 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) => {
100 if (action instanceof SetSubViewAction) {
101 switch (action.currentView) {
102 case "performanceData": state = { ...state, performanceData: { ...state.performanceData, subView: action.selectedTab } }; break;
103 case "adaptiveModulation": state = { ...state, adaptiveModulation: { ...state.adaptiveModulation, subView: action.selectedTab } }; break;
104 case "receiveLevel": state = { ...state, receiveLevel: { ...state.receiveLevel, subView: action.selectedTab } }; break;
105 case "transmissionPower": state = { ...state, transmissionPower: { ...state.transmissionPower, subView: action.selectedTab } }; break;
106 case "Temp": state = { ...state, temperatur: { ...state.temperatur, subView: action.selectedTab } }; break;
107 case "SINR": state = { ...state, SINR: { ...state.SINR, subView: action.selectedTab } }; break;
108 case "CPD": state = { ...state, CPD: { ...state.CPD, subView: action.selectedTab } }; break;
111 else if (action instanceof SetFilterVisibility) {
112 switch (action.currentView) {
113 case "performanceData": state = {
114 ...state, performanceData: { ...state.performanceData, isFilterVisible: action.isVisible }
116 case "adaptiveModulation": state = { ...state, adaptiveModulation: { ...state.performanceData, isFilterVisible: action.isVisible } }; break;
117 case "receiveLevel": state = { ...state, receiveLevel: { ...state.receiveLevel, isFilterVisible: action.isVisible } }; break;
118 case "transmissionPower": state = { ...state, transmissionPower: { ...state.transmissionPower, isFilterVisible: action.isVisible } }; break;
119 case "Temp": state = { ...state, temperatur: { ...state.temperatur, isFilterVisible: action.isVisible } }; break;
120 case "SINR": state = { ...state, SINR: { ...state.SINR, isFilterVisible: action.isVisible } }; break;
121 case "CPD": state = { ...state, CPD: { ...state.CPD, isFilterVisible: action.isVisible } }; break;
124 } else if (action instanceof ResetAllSubViewsAction) {
126 ...state, performanceData: { ...state.performanceData, subView: "chart" },
127 adaptiveModulation: { ...state.adaptiveModulation, subView: "chart" },
128 receiveLevel: { ...state.receiveLevel, subView: "chart" },
129 transmissionPower: { ...state.transmissionPower, subView: "chart" },
130 temperatur: { ...state.temperatur, subView: "chart" },
131 SINR: { ...state.SINR, subView: "chart" },
132 CPD: { ...state.CPD, subView: "chart" }
139 declare module '../../../../framework/src/store/applicationStore' {
140 interface IApplicationStoreState {
141 performanceHistory: IPerformanceHistoryStoreState;
142 connect: IConnectAppStoreState;
146 const actionHandlers = {
147 nodeId: mountIdHandler,
148 networkElements: deviceListActionHandler,
149 ltps: availableLtpsActionHandler,
150 performanceData: performanceDataActionHandler,
151 receiveLevel: receiveLevelActionHandler,
152 transmissionPower: transmissionPowerActionHandler,
153 adaptiveModulation: adaptiveModulationActionHandler,
154 temperature: temperatureActionHandler,
155 signalToInterference: signalToInterferenceActionHandler,
156 crossPolarDiscrimination: crossPolarDiscriminationActionHandler,
157 currentOpenPanel: currentOpenPanelHandler,
158 pmDataIntervalType: currentPMDataIntervalHandler,
159 subViews: toogleViewDataHandler,
160 isReloadSchedueled: reloadHandler
163 const performanceHistoryRootHandler = combineActionHandler<IPerformanceHistoryStoreState>(actionHandlers);
164 export default performanceHistoryRootHandler;