2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 import React, {Component} from 'react';
24 import {connect} from 'react-redux';
26 import DateRangeSelector from 'generic-components/dateRangeSelector/DateRangeSelector.jsx';
27 import ComponentManager from 'generic-components/componentManager/ComponentManager.jsx';
28 import {DYNAMIC_VIEW_LOADER_TITLE} from 'generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js';
29 import {processLayoutSourceChange} from 'generic-components/dynamicViewLoader/DynamicViewLoaderActions.js';
30 import {visualizationProviderProperties} from 'generic-components/dynamicViewLoader/VisualizationProvider.js';
31 import {LAYOUT_STATIC} from 'generic-components/componentManager/ComponentManagerConstants.js';
33 import i18n from 'utils/i18n/i18n';
34 import customViews from 'resources/views/customViews.json';
36 const mapStateToProps =
37 ({dynamicViewReducer: {dynamicViewLoadData}}) => {
39 viewTitle = i18n(DYNAMIC_VIEW_LOADER_TITLE),
41 } = dynamicViewLoadData;
49 let mapActionToProps = (dispatch) => {
51 onLayoutSourceChange: (layoutSource) => {
52 dispatch(processLayoutSourceChange(layoutSource));
57 class DynamicViewLoader extends Component {
59 viewTitle: React.PropTypes.string,
60 layoutSource: React.PropTypes.object
63 componentWillMount() {
64 let viewName = this.props.location.pathname.split('/');
66 for (let view in customViews) {
67 if (customViews[view]['viewName'] === viewName[1]) {
68 this.props.onLayoutSourceChange(customViews[view]['layoutProperties']);
74 let {viewTitle, layoutSource} = this.props;
78 <div className='secondary-header'>
79 <span className='secondary-title'>
85 componentPropertiesProvider={visualizationProviderProperties}
86 layoutType={LAYOUT_STATIC}
87 layoutFormat={layoutSource}
95 export default connect(mapStateToProps, mapActionToProps)(DynamicViewLoader);