summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--resources/views/extensibleViews.json2
-rw-r--r--src/app/MainScreenHeader.jsx19
-rw-r--r--src/app/MainScreenWrapper.jsx31
-rw-r--r--src/app/extensibility/index.js1
-rw-r--r--src/app/networking/NetworkCalls.js28
5 files changed, 62 insertions, 19 deletions
diff --git a/resources/views/extensibleViews.json b/resources/views/extensibleViews.json
index 32960f8..0d4f101 100644
--- a/resources/views/extensibleViews.json
+++ b/resources/views/extensibleViews.json
@@ -1,2 +1,2 @@
[
-] \ No newline at end of file
+]
diff --git a/src/app/MainScreenHeader.jsx b/src/app/MainScreenHeader.jsx
index ec1efda..a3225e7 100644
--- a/src/app/MainScreenHeader.jsx
+++ b/src/app/MainScreenHeader.jsx
@@ -29,7 +29,6 @@ import {postAnalyticsData} from 'app/analytics/AnalyticsActions.js';
import GlobalInlineMessageBar from 'app/globalInlineMessageBar/GlobalInlineMessageBar.jsx';
import {getClearGlobalMessageEvent} from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js';
import {externalUrlRequest, externalMessageRequest, getSubscriptionPayload} from 'app/contextHandler/ContextHandlerActions.js';
-
import {
filterBarActionTypes
} from 'utils/GlobalConstants.js';
@@ -265,11 +264,19 @@ class MainScreenHeader extends Component {
// add all custom view menu options
for (let view in extensibleViews) {
- menuOptions.push(
- <MenuItem key={extensibleViews[view]['viewName'] + 'Menu'} to={'/' + extensibleViews[view]['viewName']}
- label={extensibleViews[view]['displayName']}
- iconClass={'button-icon ' + extensibleViews[view]['iconClass']}/>
- );
+ let shouldDisplayIcon = false;
+ if(extensibleViews[view]['onlyRoute'] === undefined){
+ shouldDisplayIcon = true;
+ } else if(extensibleViews[view]['onlyRoute'] === false){
+ shouldDisplayIcon = true;
+ }
+ if(shouldDisplayIcon === true){
+ menuOptions.push(
+ <MenuItem key={extensibleViews[view]['viewName'] + 'Menu'} to={'/' + extensibleViews[view]['viewName']}
+ label={extensibleViews[view]['displayName']}
+ iconClass={'button-icon ' + extensibleViews[view]['iconClass']}/>
+ );
+ }
}
let secondaryTitleClass = 'secondary-header';
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 (
diff --git a/src/app/extensibility/index.js b/src/app/extensibility/index.js
index 28e61d3..3ca3ef6 100644
--- a/src/app/extensibility/index.js
+++ b/src/app/extensibility/index.js
@@ -21,7 +21,6 @@
// Import section (used as anchor to add extension imports)
let components = {};
-
// Components section (used as an anchor to add extension components)
export default components;
diff --git a/src/app/networking/NetworkCalls.js b/src/app/networking/NetworkCalls.js
index af343e1..63c08ed 100644
--- a/src/app/networking/NetworkCalls.js
+++ b/src/app/networking/NetworkCalls.js
@@ -18,6 +18,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
+import {BASE_URL} from 'app/networking/NetworkConstants.js';
+
function fetchRequest(URL, POST, POST_HEADER, BODY) {
return fetch(URL, {
credentials: 'same-origin',
@@ -42,13 +45,34 @@ function getRequest(URL, GET) {
return fetch(URL, {
credentials: 'same-origin',
method: GET
- });
+ }).then(
+ (response) => response.json()
+ );
}
+const genericRequest = (url, relativeURL, httpMethodType) => {
+ let URL;
+ if(relativeURL){
+ URL = BASE_URL.concat(url);
+ } else {
+ URL = url;
+ }
+ switch(httpMethodType){
+ case 'GET':
+ return fetch(URL, {
+ credentials: 'same-origin',
+ method: 'GET'
+ }).then(
+ (response) => response.json()
+ );
+ }
+};
+
module.exports = {
fetchRequest: fetchRequest,
fetchRequestObj: fetchRequestObj,
- getRequest: getRequest
+ getRequest: getRequest,
+ genericRequest: genericRequest
};