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 i18n from 'utils/i18n/i18n';
29 globalAutoCompleteSearchBarActionTypes,
31 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
33 MESSAGE_LEVEL_WARNING,
35 } from 'utils/GlobalConstants.js';
37 export default (state = {}, action) => {
38 switch (action.type) {
39 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_FOUND:
42 suggestions: action.data.suggestions,
43 cachedSuggestions: action.data.suggestions,
44 feedbackMsgText: action.data.errorMsg,
45 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
47 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_NOT_FOUND:
50 suggestions: [{ text: i18n(NO_MATCHES_FOUND)}],
52 entityType: i18n(NO_MATCHES_FOUND)
55 feedbackMsgSeverity: ''
57 case globalAutoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS_TEXT_FIELD:
61 cachedSuggestions: [],
64 feedbackMsgSeverity: '',
65 clearSearchText: false
67 case globalAutoCompleteSearchBarActionTypes.CLEAR_SUGGESTIONS:
72 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_CHANGED:
77 feedbackMsgSeverity: ''
79 case globalAutoCompleteSearchBarActionTypes.SUGGESTION_CLICKED:
82 selectedSuggestion: action.data.selectedSuggestion,
83 performPrepareVisualization: true,
85 feedbackMsgSeverity: ''
87 case globalAutoCompleteSearchBarActionTypes.NETWORK_ERROR:
91 cachedSuggestions: [],
92 feedbackMsgText: action.data.errorMsg,
93 feedbackMsgSeverity: MESSAGE_LEVEL_DANGER
95 case globalAutoCompleteSearchBarActionTypes.SEARCH_WARNING_EVENT:
99 cachedSuggestions: [],
100 feedbackMsgText: action.data.errorMsg,
101 feedbackMsgSeverity: MESSAGE_LEVEL_WARNING