2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 import {combineReducers} from 'redux';
22 import ForceDirectedGraph from 'generic-components/graph/ForceDirectedGraph.jsx';
23 import {aaiActionTypes} from 'app/MainScreenWrapperConstants.js';
25 tierSupportActionTypes, TSUI_GRAPH_MENU_NODE_DETAILS
26 } from 'app/tierSupport/TierSupportConstants.js';
27 import SelectedNodeDetailsReducer from 'app/tierSupport/selectedNodeDetails/SelectedNodeDetailsReducer.js';
28 import GlobalAutoCompleteSearchBarReducer from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.js';
29 import LaunchInContextReducer from 'app/tierSupport/launchExternalResource/LaunchExternalResourceReducer.js';
31 MESSAGE_LEVEL_DANGER, MESSAGE_LEVEL_WARNING
32 } from 'utils/GlobalConstants.js';
34 globalAutoCompleteSearchBarActionTypes
35 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
37 export default combineReducers({
38 selectedNodeDetails: SelectedNodeDetailsReducer,
39 launchExternalResourceReducer: LaunchInContextReducer,
40 globalAutoCompleteSearchBar: GlobalAutoCompleteSearchBarReducer,
41 tierSupportReducer: (state = {}, action) => {
42 switch (action.type) {
43 case tierSupportActionTypes.TS_NODE_SEARCH_RESULTS:
44 let graphData = ForceDirectedGraph.generateNewProps(action.data.nodes, action.data.links,
45 action.data.graphMeta);
49 forceDirectedGraphRawData: graphData,
51 feedbackMsgSeverity: ''
53 case tierSupportActionTypes.TS_GRAPH_NODE_MENU_SELECTED:
55 ...state, graphNodeSelectedMenu: action.data
57 case tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS:
58 let emptyNodesAndLinksNoResults = ForceDirectedGraph.generateNewProps([], [], {});
61 forceDirectedGraphRawData: emptyNodesAndLinksNoResults,
62 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS,
63 feedbackMsgText: action.data.errorMsg,
64 feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
66 case tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR:
67 let emptyNodesAndLinksNetworkError = ForceDirectedGraph.generateNewProps([], [], {});
70 forceDirectedGraphRawData: emptyNodesAndLinksNetworkError,
71 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS,
72 feedbackMsgText: action.data.errorMsg,
73 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
75 case tierSupportActionTypes.TIER_SUPPORT_CLEAR_DATA:
76 let emptyNodesAndLinksClearData = ForceDirectedGraph.generateNewProps([], [], {});
79 forceDirectedGraphRawData: emptyNodesAndLinksClearData,
80 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS,
82 feedbackMsgSeverity: ''
84 case tierSupportActionTypes.TS_GRAPH_NODE_SELECTED:
89 case tierSupportActionTypes.TIER_SUPPORT_ACTIVATE_BUSY_FEEDBACK:
92 enableBusyFeedback: true
94 case tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK:
97 enableBusyFeedback: false
99 case globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
100 let emptyNodesAndLinksWarningEvent = ForceDirectedGraph.generateNewProps([], [], {});
103 forceDirectedGraphRawData: emptyNodesAndLinksWarningEvent,
104 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS
106 case aaiActionTypes.AAI_WINDOW_RESIZE:
107 case tierSupportActionTypes.SPLIT_PANE_RESIZE:
108 let splitPaneLeftSideElement = document.getElementsByClassName('Pane1');
109 if (splitPaneLeftSideElement.length > 0) {
110 let width = splitPaneLeftSideElement[0].offsetWidth;
113 ...state, windowWidth: width, windowHeight: splitPaneLeftSideElement[0].offsetHeight
118 case tierSupportActionTypes.TS_OVERLAY_NETWORK_CALLBACK_RESPONSE_RECEIVED:
119 let newNodeData = JSON.parse(JSON.stringify(action.data.curData));
120 newNodeData[action.data.paramName] = action.data.overlayData;
123 nodeData: newNodeData