1 import React from 'react';
2 import classnames from 'classnames';
4 import VersionController from 'nfvo-components/panel/versionController/VersionController.jsx';
5 import NavigationSideBar from 'nfvo-components/panel/NavigationSideBar.jsx';
7 export default class TabulatedEditor extends React.Component {
10 const {versionControllerProps, navigationBarProps, onToggle, onVersionSwitching, onCreate, onSave, onClose, onVersionControllerAction, onNavigate, children} = this.props;
11 const {className = ''} = React.Children.only(children).props;
12 const child = this.prepareChild();
15 <div className='software-product-view'>
16 <div className='software-product-navigation-side-bar'>
17 <NavigationSideBar {...navigationBarProps} onSelect={onNavigate} onToggle={onToggle}/>
19 <div className='software-product-landing-view-right-side flex-column'>
21 {...versionControllerProps}
22 onVersionSwitching={version => onVersionSwitching(version)}
23 callVCAction={onVersionControllerAction}
24 onCreate={onCreate && this.handleCreate}
25 onSave={onSave && this.handleSave}
26 onClose={() => onClose(versionControllerProps)}/>
27 <div className={classnames('content-area', `${className}`)}>
38 const {onSave, onCreate, children} = this.props;
40 const additionalChildProps = {ref: 'editor'};
42 additionalChildProps.onSave = onSave;
45 additionalChildProps.onCreate = onCreate;
48 const child = React.cloneElement(React.Children.only(children), additionalChildProps);
55 const childInstance = this.refs.editor.getWrappedInstance();
56 if (childInstance.save) {
57 return childInstance.save();
59 return this.props.onSave();
63 handleCreate = () => {
64 const childInstance = this.refs.editor.getWrappedInstance();
65 if (childInstance.create) {
66 childInstance.create();
68 this.props.onCreate();