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 {tierSupportActionTypes} from 'app/tierSupport/TierSupportConstants.js';
28 globalAutoCompleteSearchBarActionTypes
29 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
30 import {isEmpty} from 'lodash';
32 export default (state = {}, action) => {
33 switch (action.type) {
34 case tierSupportActionTypes.TS_NODE_SEARCH_RESULTS:
35 if(!isEmpty(action.data.nodes)){
36 for (const node of action.data.nodes) {
37 if (node.nodeMeta.searchTarget === true) {
38 let externalResourcePayload = {};
39 if(!isEmpty(node.externalResourcePayload)){
40 externalResourcePayload = node.externalResourcePayload;
44 externalResourcePayload: externalResourcePayload
51 externalResourcePayload: {}
54 case tierSupportActionTypes.TS_GRAPH_NODE_SELECTED:
55 let externalResourcePayload;
56 if(action.data.externalResourcePayload){
57 externalResourcePayload = action.data.externalResourcePayload;
59 externalResourcePayload = {};
63 externalResourcePayload: externalResourcePayload
66 case globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
67 case tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR:
68 case tierSupportActionTypes.TIER_SUPPORT_CLEAR_DATA:
69 case tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS:
72 externalResourcePayload: {}