2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 import {combineReducers} from 'redux';
24 import ForceDirectedGraph from 'generic-components/graph/ForceDirectedGraph.jsx';
25 import {aaiActionTypes} from 'app/MainScreenWrapperConstants.js';
27 tierSupportActionTypes, TSUI_GRAPH_MENU_NODE_DETAILS
28 } from 'app/tierSupport/TierSupportConstants.js';
29 import SelectedNodeDetailsReducer from 'app/tierSupport/selectedNodeDetails/SelectedNodeDetailsReducer.js';
30 import GlobalAutoCompleteSearchBarReducer from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.js';
32 MESSAGE_LEVEL_DANGER, MESSAGE_LEVEL_WARNING
33 } from 'utils/GlobalConstants.js';
35 globalAutoCompleteSearchBarActionTypes
36 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
38 export default combineReducers({
39 selectedNodeDetails: SelectedNodeDetailsReducer,
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 globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
85 let emptyNodesAndLinksWarningEvent = ForceDirectedGraph.generateNewProps([], [], {});
88 forceDirectedGraphRawData: emptyNodesAndLinksWarningEvent,
89 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS
91 case aaiActionTypes.AAI_WINDOW_RESIZE:
92 case tierSupportActionTypes.SPLIT_PANE_RESIZE:
93 let splitPaneLeftSideElement = document.getElementsByClassName('Pane1');
94 if (splitPaneLeftSideElement.length > 0) {
95 let width = splitPaneLeftSideElement[0].offsetWidth;
98 ...state, windowWidth: width, windowHeight: splitPaneLeftSideElement[0].offsetHeight