summaryrefslogtreecommitdiffstats
path: root/src/app/MainScreenWrapper.jsx
diff options
context:
space:
mode:
authorArul.Nambi <arul.nambi@amdocs.com>2018-09-04 16:18:34 -0400
committerArul.Nambi <arul.nambi@amdocs.com>2018-09-05 08:55:56 -0400
commitb68cd9cee606372747f6fee4a864de994b0518a7 (patch)
tree5da47b9f152f7d8449639141f93fd23b43981cb5 /src/app/MainScreenWrapper.jsx
parent3d6886c9c4ab551d3aefa00c5f1751459ee1140b (diff)
Add network call as promise for ext views
Adding support for network calls that can be used in the extended views without relying on the reducers of main app. Also adding functinality to remove the view from the hanburger menu which will be useful for apps that want to have a route but not an entry in main menu. Issue-ID: AAI-1564 Change-Id: Ie4776d030d8458d3ce8d77782d5dfda11e01b878 Signed-off-by: Arul.Nambi <arul.nambi@amdocs.com>
Diffstat (limited to 'src/app/MainScreenWrapper.jsx')
-rw-r--r--src/app/MainScreenWrapper.jsx31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/app/MainScreenWrapper.jsx b/src/app/MainScreenWrapper.jsx
index 192c11d..4bffc88 100644
--- a/src/app/MainScreenWrapper.jsx
+++ b/src/app/MainScreenWrapper.jsx
@@ -26,7 +26,7 @@ import VnfSearch from './vnfSearch/VnfSearch.jsx';
import MainScreenHeader from './MainScreenHeader.jsx';
import {decryptParamsForView, changeUrlAddress} from 'utils/Routes.js';
import {isEmpty} from 'lodash';
-
+import {genericRequest} from 'app/networking/NetworkCalls.js';
import {
Route,
HashRouter as Router,
@@ -95,15 +95,20 @@ class MainScreenWrapper extends Component {
let customViewList = [];
extensibleViews.forEach(function(view,key) {
- let path;
- if(isEmpty(extensibleViews[key]['routePath'])){
+ let path = ''
+ , extKey = ''
+ ;
+ if(isEmpty(extensibleViews[key]['viewParams'])){
path = '/' + view.viewName + '/:extensibleViewParams?';
+ extKey = view.viewName + 'Route';
} else {
- path = '/' + view.viewName + view.routePath + '/:extensibleViewParams?';
+ path = '/' + view.viewName + view.viewParams;
+ extKey = view.viewName + view.viewParams + 'Route'
}
+
var renderComponent = (props) => {
let viewParams = {};
- if(props.match.params.extensibleViewParams !== undefined) {
+ if(isEmpty(extensibleViews[key]['viewParams']) && props.match.params.extensibleViewParams !== undefined) {
viewParams = decryptParamsForView(props.match.params.extensibleViewParams);
}
@@ -124,17 +129,25 @@ class MainScreenWrapper extends Component {
changeRouteCallback = {(routeParam, historyObj) => {
changeUrlAddress(routeParam, historyObj);
}}
+ networkingCallbackPromise = {(url, relativeURL, httpMethodType) => {
+ return genericRequest(url, relativeURL, httpMethodType);
+ }}
viewName={view.displayName}
viewData={extensibleViewNetworkCallbackData}
viewParams={viewParams}/>
);
}
};
-
- customViewList.push(
- <Route key={extensibleViews[key]['viewName'] + 'Route'} path={path}
- render={renderComponent}/>
+ if(isEmpty(extensibleViews[key]['isExact']) && !extensibleViews[key]['isExact']){
+ customViewList.push(
+ <Route key={extKey} path={path} render={renderComponent}/>
);
+ } else {
+ customViewList.push(
+ <Route key={extKey} exact path={path} render={renderComponent}/>
+ );
+ }
+
});
return (