2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 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 import i18n from 'utils/i18n/i18n';
24 globalAutoCompleteSearchBarActionTypes,
26 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
28 MESSAGE_LEVEL_WARNING,
30 } from 'utils/GlobalConstants.js';
32 export default (state = {}, action) => {
33 switch (action.type) {
34 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_FOUND:
37 suggestions: action.data.suggestions,
38 cachedSuggestions: action.data.suggestions,
39 feedbackMsgText: action.data.errorMsg,
40 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
42 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_NOT_FOUND:
45 suggestions: [{ text: i18n(NO_MATCHES_FOUND)}],
47 entityType: i18n(NO_MATCHES_FOUND)
50 feedbackMsgSeverity: ''
52 case globalAutoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS_TEXT_FIELD:
56 cachedSuggestions: [],
59 feedbackMsgSeverity: '',
60 clearSearchText: false
62 case globalAutoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS:
67 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_CHANGED:
72 feedbackMsgSeverity: ''
74 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_CLICKED:
77 selectedSuggestion: action.data.selectedSuggestion,
78 performPrepareVisualization: true,
80 feedbackMsgSeverity: ''
82 case globalAutoCompleteSearchBarActionTypes.NETWORK_ERROR:
86 cachedSuggestions: [],
87 feedbackMsgText: action.data.errorMsg,
88 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
90 case globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
94 cachedSuggestions: [],
95 feedbackMsgText: action.data.errorMsg,
96 feedbackMsgSeverity: MESSAGE_LEVEL_WARNING