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 i18n from 'utils/i18n/i18n';
26 globalAutoCompleteSearchBarActionTypes,
28 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
30 MESSAGE_LEVEL_WARNING,
32 } from 'utils/GlobalConstants.js';
34 export default (state = {}, action) => {
35 switch (action.type) {
36 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_FOUND:
39 suggestions: action.data.suggestions,
40 cachedSuggestions: action.data.suggestions,
41 feedbackMsgText: action.data.errorMsg,
42 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
44 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_NOT_FOUND:
47 suggestions: [{ text: i18n(NO_MATCHES_FOUND)}],
49 entityType: i18n(NO_MATCHES_FOUND)
52 feedbackMsgSeverity: ''
54 case globalAutoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS_TEXT_FIELD:
58 cachedSuggestions: [],
61 feedbackMsgSeverity: '',
62 clearSearchText: false
64 case globalAutoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS:
69 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_CHANGED:
74 feedbackMsgSeverity: ''
76 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_CLICKED:
79 selectedSuggestion: action.data.selectedSuggestion,
80 performPrepareVisualization: true,
82 feedbackMsgSeverity: ''
84 case globalAutoCompleteSearchBarActionTypes.NETWORK_ERROR:
88 cachedSuggestions: [],
89 feedbackMsgText: action.data.errorMsg,
90 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
92 case globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
96 cachedSuggestions: [],
97 feedbackMsgText: action.data.errorMsg,
98 feedbackMsgSeverity: MESSAGE_LEVEL_WARNING