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 {aaiActionTypes} from './MainScreenWrapperConstants.js';
29 } from 'app/networking/NetworkConstants.js';
32 } from 'utils/GlobalConstants.js';
33 import {fetchRequestObj} from 'app/networking/NetworkCalls.js';
36 getSetGlobalMessageEvent,
37 getClearGlobalMessageEvent
38 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js';
40 function createWindowSizeChangeEvent() {
42 type: aaiActionTypes.AAI_WINDOW_RESIZE
46 function createShowMenuEvent(show) {
48 type: aaiActionTypes.AAI_SHOW_MENU,
55 export function windowResize() {
57 dispatch(createWindowSizeChangeEvent());
61 export function showMainMenu(show) {
63 dispatch(createShowMenuEvent(show));
67 function createViewDataFoundEvent(viewData, paramName, curViewData) {
70 obj['data']['paramName'] = paramName;
71 obj['data']['viewData'] = viewData;
72 obj['data']['curViewData'] = curViewData;
73 obj['type'] = aaiActionTypes.EXTENSIBLE_VIEW_NETWORK_CALLBACK_RESPONSE_RECEIVED;
78 function extensibleViewData(dataFetchRequest, paramName, curViewData) {
80 return dataFetchRequest().then(
82 return response.json();
86 dispatch(createViewDataFoundEvent(responseJson, paramName, curViewData));
89 dispatch(getSetGlobalMessageEvent(ERROR_RETRIEVING_DATA, MESSAGE_LEVEL_DANGER));
90 dispatch(createViewDataFoundEvent({}, paramName, curViewData));
91 //To-do: If need to send a flag later on to the view, add a function to have the flag
96 export function extensibleViewNetworkCallback(urlApi, postBody, paramName, curViewData) {
98 let dataFetchRequest =
99 () => fetchRequestObj(BASE_URL + urlApi, POST,
100 POST_HEADER, postBody);
104 dispatch(extensibleViewData(dataFetchRequest, paramName, curViewData));
108 export function extensibleViewMessageCallback(msgText, msgSeverity) {
109 if (msgText.length > 0) {
112 getSetGlobalMessageEvent(msgText, msgSeverity));
116 dispatch(getClearGlobalMessageEvent());
121 export function clearExtensibleViewData() {
123 type: aaiActionTypes.EXTENSIBLE_VIEW_NETWORK_CALLBACK_CLEAR_DATA,
128 export function setSecondaryTitle(title) {
130 type: aaiActionTypes.SET_SECONDARY_TITLE,