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.
24 import {combineReducers} from 'redux';
25 import ForceDirectedGraph from 'generic-components/graph/ForceDirectedGraph.jsx';
26 import {aaiActionTypes} from 'app/MainScreenWrapperConstants.js';
28 tierSupportActionTypes, TSUI_GRAPH_MENU_NODE_DETAILS
29 } from 'app/tierSupport/TierSupportConstants.js';
30 import SelectedNodeDetailsReducer from 'app/tierSupport/selectedNodeDetails/SelectedNodeDetailsReducer.js';
31 import GlobalAutoCompleteSearchBarReducer from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.js';
32 import LaunchInContextReducer from 'app/tierSupport/launchExternalResource/LaunchExternalResourceReducer.js';
34 MESSAGE_LEVEL_DANGER, MESSAGE_LEVEL_WARNING
35 } from 'utils/GlobalConstants.js';
37 globalAutoCompleteSearchBarActionTypes
38 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
40 export default combineReducers({
41 selectedNodeDetails: SelectedNodeDetailsReducer,
42 launchExternalResourceReducer: LaunchInContextReducer,
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 tierSupportActionTypes.TS_GRAPH_NODE_SELECTED:
92 case tierSupportActionTypes.TIER_SUPPORT_ACTIVATE_BUSY_FEEDBACK:
95 enableBusyFeedback: true
97 case tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK:
100 enableBusyFeedback: false
102 case globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
103 let emptyNodesAndLinksWarningEvent = ForceDirectedGraph.generateNewProps([], [], {});
106 forceDirectedGraphRawData: emptyNodesAndLinksWarningEvent,
107 graphNodeSelectedMenu: TSUI_GRAPH_MENU_NODE_DETAILS
109 case aaiActionTypes.AAI_WINDOW_RESIZE:
110 case tierSupportActionTypes.SPLIT_PANE_RESIZE:
111 let splitPaneLeftSideElement = document.getElementsByClassName('Pane1');
112 if (splitPaneLeftSideElement.length > 0) {
113 let width = splitPaneLeftSideElement[0].offsetWidth;
116 ...state, windowWidth: width, windowHeight: splitPaneLeftSideElement[0].offsetHeight