2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 import React, {Component} from 'react';
22 import {connect} from 'react-redux';
24 import DateRangeSelector from 'generic-components/dateRangeSelector/DateRangeSelector.jsx';
25 import ComponentManager from 'generic-components/componentManager/ComponentManager.jsx';
26 import {DYNAMIC_VIEW_LOADER_TITLE} from 'generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js';
27 import {processLayoutSourceChange} from 'generic-components/dynamicViewLoader/DynamicViewLoaderActions.js';
28 import {visualizationProviderProperties} from 'generic-components/dynamicViewLoader/VisualizationProvider.js';
29 import {LAYOUT_STATIC} from 'generic-components/componentManager/ComponentManagerConstants.js';
31 import i18n from 'utils/i18n/i18n';
32 import customViews from 'resources/views/customViews.json';
34 const mapStateToProps =
35 ({dynamicViewReducer: {dynamicViewLoadData}}) => {
37 viewTitle = i18n(DYNAMIC_VIEW_LOADER_TITLE),
39 } = dynamicViewLoadData;
47 let mapActionToProps = (dispatch) => {
49 onLayoutSourceChange: (layoutSource) => {
50 dispatch(processLayoutSourceChange(layoutSource));
55 class DynamicViewLoader extends Component {
57 viewTitle: React.PropTypes.string,
58 layoutSource: React.PropTypes.object
61 componentWillMount() {
62 let viewName = this.props.location.pathname.split('/');
64 for (let view in customViews) {
65 if (customViews[view]['viewName'] === viewName[1]) {
66 this.props.onLayoutSourceChange(customViews[view]['layoutProperties']);
72 let {viewTitle, layoutSource} = this.props;
76 <div className='secondary-header'>
77 <span className='secondary-title'>
83 componentPropertiesProvider={visualizationProviderProperties}
84 layoutType={LAYOUT_STATIC}
85 layoutFormat={layoutSource}
93 export default connect(mapStateToProps, mapActionToProps)(DynamicViewLoader);