2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 import React, {Component} from 'react';
27 import {connect} from 'react-redux';
29 import DateRangeSelector from 'generic-components/dateRangeSelector/DateRangeSelector.jsx';
30 import ComponentManager from 'generic-components/componentManager/ComponentManager.jsx';
31 import {DYNAMIC_VIEW_LOADER_TITLE} from 'generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js';
32 import {processLayoutSourceChange} from 'generic-components/dynamicViewLoader/DynamicViewLoaderActions.js';
33 import {visualizationProviderProperties} from 'generic-components/dynamicViewLoader/VisualizationProvider.js';
34 import {LAYOUT_STATIC} from 'generic-components/componentManager/ComponentManagerConstants.js';
36 import i18n from 'utils/i18n/i18n';
37 import customViews from 'resources/views/customViews.json';
39 const mapStateToProps =
40 ({dynamicViewReducer: {dynamicViewLoadData}}) => {
42 viewTitle = i18n(DYNAMIC_VIEW_LOADER_TITLE),
44 } = dynamicViewLoadData;
52 let mapActionToProps = (dispatch) => {
54 onLayoutSourceChange: (layoutSource) => {
55 dispatch(processLayoutSourceChange(layoutSource));
60 class DynamicViewLoader extends Component {
62 viewTitle: React.PropTypes.string,
63 layoutSource: React.PropTypes.object
66 componentWillMount() {
67 let viewName = this.props.location.pathname.split('/');
69 for (let view in customViews) {
70 if (customViews[view]['viewName'] === viewName[1]) {
71 this.props.onLayoutSourceChange(customViews[view]['layoutProperties']);
77 let {viewTitle, layoutSource} = this.props;
81 <div className='secondary-header'>
82 <span className='secondary-title'>
88 componentPropertiesProvider={visualizationProviderProperties}
89 layoutType={LAYOUT_STATIC}
90 layoutFormat={layoutSource}
98 export default connect(mapStateToProps, mapActionToProps)(DynamicViewLoader);