summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/MainScreenHeader.jsx39
-rw-r--r--src/app/MainScreenWrapperConstants.js3
-rw-r--r--src/app/MainScreenWrapperReducer.js9
-rw-r--r--src/app/analytics/AnalyticsActions.js6
-rw-r--r--src/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.jsx4
-rw-r--r--src/app/personlaization/PersonalizationActions.js80
-rw-r--r--src/app/personlaization/PersonalizationConstans.js30
7 files changed, 158 insertions, 13 deletions
diff --git a/src/app/MainScreenHeader.jsx b/src/app/MainScreenHeader.jsx
index 1a39bc4..7808d19 100644
--- a/src/app/MainScreenHeader.jsx
+++ b/src/app/MainScreenHeader.jsx
@@ -26,7 +26,7 @@ import {clearFilters} from 'filter-bar-utils';
import Button from 'react-bootstrap/lib/Button.js';
import Modal from 'react-bootstrap/lib/Modal.js';
import GlobalAutoCompleteSearchBar from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.jsx';
-import {postAnalyticsData} from 'app/analytics/AnalyticsActions.js';
+import {postAnalyticsData, getStoreAnalyticsPayload} 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';
@@ -41,7 +41,8 @@ import {
} from 'react-router-dom';
import {
- AAI_TITLE,
+ AAI_TOP_LEFT_HEADER,
+ AAI_HTML_TITLE,
MENU_ITEM_TIER_SUPPORT,
MENU_ITEM_VNF_SEARCH
} from './MainScreenWrapperConstants.js';
@@ -55,7 +56,8 @@ import {
import {clearSuggestionsTextField} from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarActions.js';
import {changeUrlAddress} from 'utils/Routes.js';
import extensibleViews from 'resources/views/extensibleViews.json';
-
+import {getPersonalizationDetails} from 'app/personlaization/PersonalizationActions.js';
+import {isEmpty} from 'lodash';
const mapStateToProps = ({mainWrapper, configurableViews}) => {
let {
@@ -64,7 +66,9 @@ const mapStateToProps = ({mainWrapper, configurableViews}) => {
externalRequestFound = {},
secondaryTitle = '',
subscriptionPayload = {},
- subscriptionEnabled = false
+ subscriptionEnabled = false,
+ aaiTopLeftPersonalizedHeader = AAI_TOP_LEFT_HEADER,
+ aaiPersonalizedHtmlDocumentTitle = AAI_HTML_TITLE
} = mainWrapper;
let {
@@ -78,7 +82,9 @@ const mapStateToProps = ({mainWrapper, configurableViews}) => {
secondaryTitle,
subscriptionPayload,
subscriptionEnabled,
- configurableViewsConfig
+ configurableViewsConfig,
+ aaiTopLeftPersonalizedHeader,
+ aaiPersonalizedHtmlDocumentTitle
};
};
@@ -90,7 +96,7 @@ const mapActionsToProps = (dispatch) => {
dispatch(showMainMenu(false));
},
dispatchAnalyticsData: () => dispatch(
- postAnalyticsData(document.documentElement.outerHTML.replace('\s+', ''))),
+ postAnalyticsData(getStoreAnalyticsPayload())),
onRouteChange: () => {
dispatch(getClearGlobalMessageEvent());
dispatch(clearSuggestionsTextField());
@@ -109,6 +115,9 @@ const mapActionsToProps = (dispatch) => {
},
onFetchCustomViews: () => {
dispatch(getConfigurableViewConfigs());
+ },
+ onGetPersonalizationValues: () => {
+ dispatch(getPersonalizationDetails());
}
};
};
@@ -119,7 +128,9 @@ class MainScreenHeader extends Component {
toggleButtonActive: PropTypes.bool,
externalRequestFound: PropTypes.object,
secondaryTitle: PropTypes.string,
- subscriptionPayload: PropTypes.object
+ subscriptionPayload: PropTypes.object,
+ aaiTopLeftPersonalizedHeader: PropTypes.string,
+ aaiPersonalizedHtmlDocumentTitle: PropTypes.string
};
navigationLinkAndCurrentPathMatch(location, to) {
@@ -151,6 +162,7 @@ class MainScreenHeader extends Component {
}
componentWillMount() {
+ this.props.onGetPersonalizationValues();
this.props.onGetSubscriptionPayload();
if(this.props.match.params.externalUrl !== undefined &&
this.isValidExternalURL(this.props.match.params.externalUrl)) {
@@ -159,6 +171,14 @@ class MainScreenHeader extends Component {
}
componentWillReceiveProps(nextProps) {
+ if(!isEmpty(nextProps.aaiPersonalizedHtmlDocumentTitle)) {
+ if(!sessionStorage.getItem('PAGE_TITLE') || sessionStorage.getItem('PAGE_TITLE') !== nextProps.aaiPersonalizedHtmlDocumentTitle) {
+ sessionStorage.setItem('PAGE_TITLE', nextProps.aaiPersonalizedHtmlDocumentTitle);
+ }
+ document.title = nextProps.aaiPersonalizedHtmlDocumentTitle;
+ } else {
+ document.title = AAI_HTML_TITLE;
+ }
if (this.props.location &&
this.props.location.pathname !==
nextProps.location.pathname) {
@@ -246,7 +266,8 @@ class MainScreenHeader extends Component {
onHideMenu,
toggleButtonActive,
secondaryTitle,
- configurableViewsConfig
+ configurableViewsConfig,
+ aaiTopLeftPersonalizedHeader
} = this.props;
let menuOptions = [];
@@ -335,7 +356,7 @@ class MainScreenHeader extends Component {
{menuOptions}
</Modal.Body>
</Modal>
- <span className='application-title'>{AAI_TITLE}</span>
+ <span className='application-title'>{aaiTopLeftPersonalizedHeader}</span>
<GlobalAutoCompleteSearchBar history={this.props.history}/>
</div>
<GlobalInlineMessageBar />
diff --git a/src/app/MainScreenWrapperConstants.js b/src/app/MainScreenWrapperConstants.js
index 6510703..a3748d0 100644
--- a/src/app/MainScreenWrapperConstants.js
+++ b/src/app/MainScreenWrapperConstants.js
@@ -35,6 +35,7 @@ export const screens = keyMirror({
VNF_SEARCH: null
});
-export const AAI_TITLE = 'A&AI';
+export const AAI_TOP_LEFT_HEADER = 'A&AI';
+export const AAI_HTML_TITLE = 'A&AI';
export const MENU_ITEM_TIER_SUPPORT = 'View & Inspect';
export const MENU_ITEM_VNF_SEARCH = 'VNFs';
diff --git a/src/app/MainScreenWrapperReducer.js b/src/app/MainScreenWrapperReducer.js
index 6f92962..1875163 100644
--- a/src/app/MainScreenWrapperReducer.js
+++ b/src/app/MainScreenWrapperReducer.js
@@ -25,6 +25,9 @@ import {
import {
contextHandlerActionTypes
} from 'app/contextHandler/ContextHandlerConstants.js';
+import {
+ personalizationActionTypes
+} from 'app/personlaization/PersonalizationConstans.js';
export default (state = {}, action) => {
switch (action.type) {
@@ -76,6 +79,12 @@ export default (state = {}, action) => {
...state,
subscriptionEnabled: false
};
+ case personalizationActionTypes.PERSONALIZATION_PAYLOAD_FOUND:
+ return {
+ ...state,
+ aaiTopLeftPersonalizedHeader: action.data.topLeftHeader,
+ aaiPersonalizedHtmlDocumentTitle: action.data.htmlDocumentTitle
+ };
}
return state;
};
diff --git a/src/app/analytics/AnalyticsActions.js b/src/app/analytics/AnalyticsActions.js
index 43bb847..fea01f0 100644
--- a/src/app/analytics/AnalyticsActions.js
+++ b/src/app/analytics/AnalyticsActions.js
@@ -26,6 +26,10 @@ import {
import {ANALYTICS_URL} from 'app/analytics/AnalyticsConstants.js';
let fetch = require('node-fetch');
+export function getStoreAnalyticsPayload() {
+ var documentBody = document.body.getElementsByTagName('*');
+ return documentBody[0].innerHTML.replace('\s+', '');
+}
function getAnalyticsPostBody(payload){
return {
@@ -36,7 +40,7 @@ function getAnalyticsPostBody(payload){
}
export function postAnalyticsData(payload){
-
+
return () => {
fetch(ANALYTICS_URL, {
method: POST,
diff --git a/src/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.jsx b/src/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.jsx
index 9c3e49a..e06fead 100644
--- a/src/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.jsx
+++ b/src/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.jsx
@@ -21,7 +21,7 @@
import {connect} from 'react-redux';
import React, {Component} from 'react';
import AutoCompleteSearchBar from 'generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx';
-import {postAnalyticsData} from 'app/analytics/AnalyticsActions.js';
+import {postAnalyticsData, getStoreAnalyticsPayload} from 'app/analytics/AnalyticsActions.js';
import {getClearGlobalMessageEvent} from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js';
import {
queryRequestedValues,
@@ -46,7 +46,7 @@ let mapActionToProps = (dispatch) => {
},
onSuggestionsClearRequested: () => dispatch(onSuggestionsClearRequested()),
dispatchAnalytics: () => dispatch(
- postAnalyticsData(document.documentElement.outerHTML.replace('\s+', ''))),
+ postAnalyticsData(getStoreAnalyticsPayload())),
onInvalidSearch: (searchText) => {
dispatch(getInvalidSearchInputEvent(searchText));
},
diff --git a/src/app/personlaization/PersonalizationActions.js b/src/app/personlaization/PersonalizationActions.js
new file mode 100644
index 0000000..0d188fd
--- /dev/null
+++ b/src/app/personlaization/PersonalizationActions.js
@@ -0,0 +1,80 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+ import {
+ GET
+ } from 'app/networking/NetworkConstants.js';
+import networkCall from 'app/networking/NetworkCalls.js';
+import {
+ GET_PERSONALIZED_VALUES_URL,
+ PERSONALIZATION_FAILED_MESSAGE,
+ personalizationActionTypes
+} from 'app/personlaization/PersonalizationConstans.js';
+import {
+ getSetGlobalMessageEvent
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js';
+
+import {
+ STATUS_CODE_5XX_SERVER_ERROR,
+ MESSAGE_LEVEL_WARNING
+} from 'utils/GlobalConstants.js';
+
+
+function createPersonalizedValuesEvent(payload) {
+
+ let event = {
+ type: personalizationActionTypes.PERSONALIZATION_PAYLOAD_FOUND,
+ data: payload
+ };
+ return event;
+}
+
+function fetchPersonalizedValues(fetchRequestCallback) {
+ return dispatch => {
+ return fetchRequestCallback().then(
+ (response) => {
+ if (response.status >= STATUS_CODE_5XX_SERVER_ERROR) {
+ dispatch(getSetGlobalMessageEvent(PERSONALIZATION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
+ } else {
+ // assume 200 status
+ return response.json();
+ }
+ }
+ ).then(
+ (results)=> {
+ dispatch(createPersonalizedValuesEvent(results));
+ }
+ ).catch(
+ () => {
+ dispatch(getSetGlobalMessageEvent(PERSONALIZATION_FAILED_MESSAGE , MESSAGE_LEVEL_WARNING));
+ }
+ );
+ };
+}
+
+export function getPersonalizationDetails(){
+ let personalizationFetchRequest =
+ () => networkCall.getRequest(GET_PERSONALIZED_VALUES_URL, GET);
+
+ return dispatch => {
+ dispatch(fetchPersonalizedValues(personalizationFetchRequest));
+ };
+} \ No newline at end of file
diff --git a/src/app/personlaization/PersonalizationConstans.js b/src/app/personlaization/PersonalizationConstans.js
new file mode 100644
index 0000000..bbe0174
--- /dev/null
+++ b/src/app/personlaization/PersonalizationConstans.js
@@ -0,0 +1,30 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+import keyMirror from 'utils/KeyMirror.js';
+import {BASE_URL} from 'app/networking/NetworkConstants.js';
+
+export const personalizationActionTypes = keyMirror({
+ PERSONALIZATION_PAYLOAD_FOUND: null
+});
+
+export const GET_PERSONALIZED_VALUES_URL = BASE_URL + '/rest/getPersonalizedValues';
+export const PERSONALIZATION_FAILED_MESSAGE = 'Failed to fetch personalization values';