diff options
author | steventh <steve.thomas@amdocs.com> | 2018-02-27 11:40:28 -0500 |
---|---|---|
committer | steventh <steve.thomas@amdocs.com> | 2018-02-27 14:50:13 -0500 |
commit | e97e160e9d9d93b7e45c30166f4a0fec6b2e613d (patch) | |
tree | c69e7067624b3057eae27dca7bf0d4be179a2e82 /src/app/MainScreenWrapperActionHelper.js | |
parent | 9fcc0c271c53041e7e196182af51368fbce7dd3f (diff) |
Adding Violation History to DIO
Issue-ID: AAI-817
Change-Id: I2fbdbea3eedc568ef7046d83496890969a0c85ec
Signed-off-by: steventh <steve.thomas@amdocs.com>
Diffstat (limited to 'src/app/MainScreenWrapperActionHelper.js')
-rw-r--r-- | src/app/MainScreenWrapperActionHelper.js | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/app/MainScreenWrapperActionHelper.js b/src/app/MainScreenWrapperActionHelper.js index 6278f29..3e22206 100644 --- a/src/app/MainScreenWrapperActionHelper.js +++ b/src/app/MainScreenWrapperActionHelper.js @@ -20,7 +20,6 @@ * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -import {aaiActionTypes} from './MainScreenWrapperConstants.js'; import { POST, POST_HEADER, @@ -36,6 +35,7 @@ import { getSetGlobalMessageEvent, getClearGlobalMessageEvent } from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js'; +import {aaiActionTypes} from 'app/MainScreenWrapperConstants.js'; function createWindowSizeChangeEvent() { return { @@ -64,6 +64,45 @@ export function showMainMenu(show) { }; } +function createOverlayDataFoundEvent(overlayData, paramName, curData, responseEventKey) { + return { + type: responseEventKey, + data: { + paramName: paramName, + overlayData: overlayData, + curData: curData + } + }; +} + +function overlayViewData(dataFetchRequest, paramName, curData, responseEventKey) { + return dispatch => { + dataFetchRequest().then( + (response) => { + return response.json(); + } + ).then( + (responseJson) => { + dispatch(createOverlayDataFoundEvent(responseJson, paramName, curData, responseEventKey)); + }).catch( + () => { + dispatch(getSetGlobalMessageEvent(ERROR_RETRIEVING_DATA, MESSAGE_LEVEL_DANGER)); + dispatch(createOverlayDataFoundEvent({}, paramName, curData, responseEventKey)); + }); + }; +} + +export function overlayNetworkCallback(urlApi, postBody, paramName, curData, responseEventKey) { + let dataFetchRequest = + () => fetchRequestObj(BASE_URL + urlApi, POST, + POST_HEADER, JSON.stringify(postBody)); + + + return dispatch => { + dispatch(overlayViewData(dataFetchRequest, paramName, curData, responseEventKey)); + }; +} + function createViewDataFoundEvent(viewData, paramName, curViewData) { var obj = {}; obj['data'] = {}; |