<commit_before>import React, { PropTypes } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import Elements from '../../../api/elements/elements.js';
import Element from './element.jsx';
import { Button, Panel } from 'react-bootstrap';
import header from './header.jsx';

class ElementTree extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      addDimensionButtonVisible: false,
    };
  }

  render() {
    return (
      <Panel
        className="element-tree"
        onMouseEnter={() => this.setState({ addDimensionButtonVisible: true })}
        onMouseLeave={() => this.setState({ addDimensionButtonVisible: false })}
        header={header(this.props.businessObject, this.props.readOnly)}
      >
        <div id="elements">
          {this.props.elements.map((element) => {
            return (
              <Element
                setSelectedElementId={this.props.setSelectedElementId}
                selectedElementId={this.props.selectedElementId}
                key={element._id}
                element={element}
                readOnly={this.props.readOnly}
                draggable={this.props.draggable}
              />
              );
          })}
          {this.state.addDimensionButtonVisible &&
            <div className="text-center" style={{ marginTop: '10px' }} >
              <Button onClick={() => Elements.add(this.props.businessObject._id, 'dimension')}>
                <i className="fa fa-plus"> Add new Dimension</i>
              </Button>
            </div>
          }
        </div>
      </Panel>
    );
  }
}

ElementTree.propTypes = {
  elements: PropTypes.array.isRequired,
  setSelectedElementId: PropTypes.func.isRequired,
  selectedElementId: PropTypes.string,
  readOnly: PropTypes.bool,
  draggable: PropTypes.bool,
  businessObject: PropTypes.object.isRequired,
};

export default createContainer((props) => {
  return {
    elements: Elements.collection.find(
      { parentId: props.businessObject._id, typeName: 'dimension' }
    ).fetch(),
  };<commit_msg>Do not show add dimension button in report view<commit_after>import React, { PropTypes } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import Elements from '../../../api/elements/elements.js';
import Element from './element.jsx';
import { Button, Panel } from 'react-bootstrap';
import header from './header.jsx';

class ElementTree extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      addDimensionButtonVisible: false,
    };
  }

  render() {
    return (
      <Panel
        className="element-tree"
        onMouseEnter={() => this.setState({ addDimensionButtonVisible: true })}
        onMouseLeave={() => this.setState({ addDimensionButtonVisible: false })}
        header={header(this.props.businessObject, this.props.readOnly)}
      >
        <div id="elements">
          {this.props.elements.map((element) => {
            return (
              <Element
                setSelectedElementId={this.props.setSelectedElementId}
                selectedElementId={this.props.selectedElementId}
                key={element._id}
                element={element}
                readOnly={this.props.readOnly}
                draggable={this.props.draggable}
              />
              );
          })}
          {this.state.addDimensionButtonVisible && !this.props.readOnly &&
            <div className="text-center" style={{ marginTop: '10px' }} >
              <Button onClick={() => Elements.add(this.props.businessObject._id, 'dimension')}>
                <i className="fa fa-plus"> Add new Dimension</i>
              </Button>
            </div>
          }
        </div>
      </Panel>
    );
  }
}

ElementTree.propTypes = {
  elements: PropTypes.array.isRequired,
  setSelectedElementId: PropTypes.func.isRequired,
  selectedElementId: PropTypes.string,
  readOnly: PropTypes.bool,
  draggable: PropTypes.bool,
  businessObject: PropTypes.object.isRequired,
};

export default createContainer((props) => {
  return {
    elements: Elements.collection.find(
      { parentId: props.businessObject._id, typeName: 'dimension' }
    ).fetch(),
  };
{'fraction_non_alphanumeric': 0.1340768865685809, 'fraction_numerical': 0.0009492168960607499, 'mean_word_length': 2.4240454914703493, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6610430', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1166, 'n_words': 217}