Code Review
/
aai
/
sparky-fe.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Adding option for configurable header
[aai/sparky-fe.git]
/
src
/
app
/
contextHandler
/
ContextHandlerActions.js
diff --git
a/src/app/contextHandler/ContextHandlerActions.js
b/src/app/contextHandler/ContextHandlerActions.js
index
889020a
..
f3ede6d
100644
(file)
--- a/
src/app/contextHandler/ContextHandlerActions.js
+++ b/
src/app/contextHandler/ContextHandlerActions.js
@@
-2,8
+2,8
@@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017
-2018
AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017
-2018
Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-17,10
+17,7
@@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
*/
-
import {
POST,
POST_HEADER,
import {
POST,
POST_HEADER,
@@
-65,17
+62,22
@@
function getExternalParamValues(urlParams) {
}
function createSubscriptionPayloadEvent(payload) {
}
function createSubscriptionPayloadEvent(payload) {
- return {
- type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_FOUND,
- data: payload
- };
-}
-function createSubscriptionIsEmptyEvent() {
- return {
- type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_EMPTY,
- data: {}
- };
+ let event = undefined;
+
+ if (payload.subscriptionEnabled) {
+ event = {
+ type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_FOUND,
+ data: payload
+ };
+ } else {
+ event = {
+ type: contextHandlerActionTypes.SUBSCRIPTION_PAYLOAD_EMPTY,
+ data: {}
+ };
+ }
+
+ return event;
}
function fetchSubscriptionPayload(fetchRequestCallback) {
}
function fetchSubscriptionPayload(fetchRequestCallback) {
@@
-86,33
+88,30
@@
function fetchSubscriptionPayload(fetchRequestCallback) {
return Promise.reject(new Error(response.status));
} else {
// assume 200 status
return Promise.reject(new Error(response.status));
} else {
// assume 200 status
- return response;
+ return response
.json()
;
}
}
).then(
(results)=> {
dispatch(createSubscriptionPayloadEvent(results));
}
}
).then(
(results)=> {
dispatch(createSubscriptionPayloadEvent(results));
-
}
).catch(
}
).catch(
- (e) => {
- if(e.name === 'EmptyResponseException'){
- dispatch(getClearGlobalMessageEvent());
- dispatch(createSubscriptionIsEmptyEvent());
- } else{
- dispatch(getSetGlobalMessageEvent(SUBSCRIPTION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
- }
+ () => {
+ dispatch(getSetGlobalMessageEvent(SUBSCRIPTION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
}
);
};
}
}
);
};
}
+
export function getSubscriptionPayload() {
let externalfetchRequest =
export function getSubscriptionPayload() {
let externalfetchRequest =
- () => networkCall.getRequest(SUBSCRIPTION_PAYLOAD_URL, GET);
+ () => networkCall.getRequest(SUBSCRIPTION_PAYLOAD_URL, GET);
+
return dispatch => {
dispatch(fetchSubscriptionPayload(externalfetchRequest));
};
}
return dispatch => {
dispatch(fetchSubscriptionPayload(externalfetchRequest));
};
}
+
function validateExternalParams(externalURLParams) {
if(externalURLParams.view && externalURLParams.entityId && externalURLParams.entityType) {
return true;
function validateExternalParams(externalURLParams) {
if(externalURLParams.view && externalURLParams.entityId && externalURLParams.entityType) {
return true;
@@
-121,7
+120,6
@@
function validateExternalParams(externalURLParams) {
}
}
-
function createSuggestionFoundEvent(suggestion) {
return {
type: contextHandlerActionTypes.SINGLE_SUGGESTION_FOUND,
function createSuggestionFoundEvent(suggestion) {
return {
type: contextHandlerActionTypes.SINGLE_SUGGESTION_FOUND,