X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FDetailsPanel.js;fp=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FDetailsPanel.js;h=a20679fd18d38a57ab218b33cb2c67f15e5a250a;hb=e29efc315df33d546237e270470916e26df391d6;hp=0000000000000000000000000000000000000000;hpb=9c5e457509ba5a1822c316635c6308874e61b4b9;p=osm%2FUI.git diff --git a/skyquake/plugins/composer/src/src/components/DetailsPanel.js b/skyquake/plugins/composer/src/src/components/DetailsPanel.js new file mode 100644 index 000000000..a20679fd1 --- /dev/null +++ b/skyquake/plugins/composer/src/src/components/DetailsPanel.js @@ -0,0 +1,76 @@ + +/* + * + * Copyright 2016 RIFT.IO Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +'use strict'; + +import _ from 'lodash' +import React from 'react'; +import PureRenderMixin from 'react-addons-pure-render-mixin' +import messages from './messages' +import serializers from '../libraries/model/DescriptorModelSerializer' +import JSONViewer from 'widgets/JSONViewer/JSONViewer'; +import PopupWindow from './PopupWindow' +import CatalogItemDetailsEditor from './CatalogItemDetailsEditor' +import SelectionManager from '../libraries/SelectionManager' + +import '../styles/DetailsPanel.scss' + +const DetailsPanel = React.createClass({ + mixins: [PureRenderMixin, SelectionManager.reactPauseResumeMixin], + getInitialState() { + return {}; + }, + getDefaultProps() { + return { + containers: [], + showJSONViewer: false + }; + }, + componentWillMount() { + }, + componentDidMount() { + }, + componentDidUpdate() { + SelectionManager.refreshOutline(); + }, + componentWillUnmount() { + }, + render() { + let json = '{}'; + let bodyComponent = messages.detailsWelcome(); + const selected = this.props.containers.filter(d => SelectionManager.isSelected(d)); + const selectedContainer = selected[0]; + if (selectedContainer) { + bodyComponent = ; + const edit = _.cloneDeep(selectedContainer.model); + json = serializers.serialize(edit) || edit; + } + const jsonViewerTitle = selectedContainer ? selectedContainer.model.name : 'nothing selected'; + const hasNoCatalogs = this.props.hasNoCatalogs; + return ( +
event.preventDefault()}> +
+ {hasNoCatalogs ? null : bodyComponent} +
+ +
+ ); + } +}); + +export default DetailsPanel;