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 { PropTypes } from 'prop-types';
23 import {connect} from 'react-redux';
25 import DateRangeSelector from 'generic-components/dateRangeSelector/DateRangeSelector.jsx';
26 import ComponentManager from 'generic-components/componentManager/ComponentManager.jsx';
27 import {DYNAMIC_VIEW_LOADER_TITLE} from 'generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js';
28 import {processLayoutSourceChange} from 'generic-components/dynamicViewLoader/DynamicViewLoaderActions.js';
29 import {visualizationProviderProperties} from 'generic-components/dynamicViewLoader/VisualizationProvider.js';
30 import {LAYOUT_STATIC} from 'generic-components/componentManager/ComponentManagerConstants.js';
32 import i18n from 'utils/i18n/i18n';
33 import customViews from 'resources/views/customViews.json';
35 const mapStateToProps =
36 ({dynamicViewReducer: {dynamicViewLoadData}}) => {
38 viewTitle = i18n(DYNAMIC_VIEW_LOADER_TITLE),
40 } = dynamicViewLoadData;
48 let mapActionToProps = (dispatch) => {
50 onLayoutSourceChange: (layoutSource) => {
51 dispatch(processLayoutSourceChange(layoutSource));
56 class DynamicViewLoader extends Component {
58 viewTitle: PropTypes.string,
59 layoutSource: PropTypes.object
62 componentWillMount() {
63 let viewName = this.props.location.pathname.split('/');
65 for (let view in customViews) {
66 if (customViews[view]['viewName'] === viewName[1]) {
67 this.props.onLayoutSourceChange(customViews[view]['layoutProperties']);
73 let {viewTitle, layoutSource} = this.props;
77 <div className='secondary-header'>
78 <span className='secondary-title'>
84 componentPropertiesProvider={visualizationProviderProperties}
85 layoutType={LAYOUT_STATIC}
86 layoutFormat={layoutSource}
94 export default connect(mapStateToProps, mapActionToProps)(DynamicViewLoader);