2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 import {combineReducers} from 'redux';
27 import ForceDirectedGraph from 'generic-components/graph/ForceDirectedGraph.jsx';
28 import {aaiActionTypes} from 'app/MainScreenWrapperConstants.js';
30 tierSupportActionTypes, TSUI_GRAPH_MENU_NODE_DETAILS
31 } from 'app/tierSupport/TierSupportConstants.js';
32 import SelectedNodeDetailsReducer from 'app/tierSupport/selectedNodeDetails/SelectedNodeDetailsReducer.js';
33 import GlobalAutoCompleteSearchBarReducer from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.js';
35 MESSAGE_LEVEL_DANGER, MESSAGE_LEVEL_WARNING
36 } from 'utils/GlobalConstants.js';
38 globalAutoCompleteSearchBarActionTypes
39 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
41 export default combineReducers({
42 selectedNodeDetails: SelectedNodeDetailsReducer,
43 globalAutoCompleteSearchBar: GlobalAutoCompleteSearchBarReducer,
44 tierSupportReducer: (state = {}, action) => {
45 switch (action.type) {
46 case tierSupportActionTypes.TS_NODE_SEARCH_RESULTS:
47 let graphData = ForceDirectedGraph.generateNewProps(action.data.nodes, action.data.links,
48 action.data.graphMeta);
52 forceDirectedGraphRawData: graphData,
54 feedbackMsgSeverity: ''
56 case tierSupportActionTypes.TS_GRAPH_NODE_MENU_SELECTED:
58 ...state, graphNodeSelectedMenu: action.data
60 case tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS:
61 let emptyNodesAndLinksNoResults = ForceDirectedGraph.generateNewProps([], [], {});
64 forceDirectedGraphRawData: emptyNodesAndLinksNoResults,
65 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS,
66 feedbackMsgText: action.data.errorMsg,
67 feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
69 case tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR:
70 let emptyNodesAndLinksNetworkError = ForceDirectedGraph.generateNewProps([], [], {});
73 forceDirectedGraphRawData: emptyNodesAndLinksNetworkError,
74 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS,
75 feedbackMsgText: action.data.errorMsg,
76 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
78 case tierSupportActionTypes.TIER_SUPPORT_CLEAR_DATA:
79 let emptyNodesAndLinksClearData = ForceDirectedGraph.generateNewProps([], [], {});
82 forceDirectedGraphRawData: emptyNodesAndLinksClearData,
83 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS,
85 feedbackMsgSeverity: ''
87 case globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
88 let emptyNodesAndLinksWarningEvent = ForceDirectedGraph.generateNewProps([], [], {});
91 forceDirectedGraphRawData: emptyNodesAndLinksWarningEvent,
92 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS
94 case aaiActionTypes.AAI_WINDOW_RESIZE:
95 case tierSupportActionTypes.SPLIT_PANE_RESIZE:
96 let splitPaneLeftSideElement = document.getElementsByClassName('Pane1');
97 if (splitPaneLeftSideElement.length > 0) {
98 let width = splitPaneLeftSideElement[0].offsetWidth;
101 ...state, windowWidth: width, windowHeight: splitPaneLeftSideElement[0].offsetHeight