<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import MaterialSlider from '../../../../../components/MaterialSlider';
import SensorBar from '../../../../../components/SensorBar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import SvgIcon from '@material-ui/core/SvgIcon';
import svgIcons from '../../../../../images/svgIcons';
import { HorizontalDividerLine } from '../../../../../components/HorizontalDividerLine';
import CategoryMapping from './numberResource/CategoryMapping';

class NumberResource extends React.Component {
  render () {
    if (this.props.smallForm === false) {
      //Single Resource
      const max = this.props.resource.schema.maximum;
      const min = this.props.resource.schema.minimum;

      const graphIcon = (
        <SvgIcon>
          <path d={svgIcons.chart} />
        </SvgIcon>
      );

      const chartModalProps = {
        open: true,
        objectID: this.props.objectID,
        instanceID: this.props.instanceID,
        resourceID: this.props.resource.resourceID
      };

      const NumberResourceComponent = (
        <div>
            <Typography variant='headline' align='center'>{this.props.resource.name}</Typography>
            <br/>
            <br/>
            <div>
              <SensorBar
                currentValue={this.props.currentValue}
                max={max}
                min={min}/>
              <div style={{display: 'block', float: 'left'}}>
                <Typography variant='body2'>{min}</Typography>
              </div>
              <div style={{display: 'block', float: 'right'}}>
                <Typography variant='body2'>{max}</Typography>
              </div>
            </div>

            <br/>
            <Typography variant='title' align='center'>{this.props.currentValue
              + ' ' + this.props.resource.schema.unit}</Typography>
            <div style={{float: 'right', marginBottom: 10}}>
              <Button variant='fab' mini aria-label="Show Graph" color='secondary' onClick={() => this.props.showModal('CHART', chartModalProps)}>
                {graphIcon}
              </Button>
            </div>
            {Object.entries(this.props.mappings).map((mappingsKeyValue) => {
              const currentMapping = mappingsKeyValue[1];
              return (
                <div key={currentMapping.mappingID + '_div'}>
                  <HorizontalDividerLine isMappingDivider={true}/>
                  <CategoryMapping
                    mapping={currentMapping}
                    currentValue={this.props.currentValue}
                    max={max}
                    min={min}/>
                </div>
              );
            })}
        </div>
      );

      return NumberResourceComponent;
    } else {
      //Multi Resource
      const max = this.props.resource.maximum;
      const min = this.props.resource.minimum;
<commit_msg>Change location for units and types to appropriate API changes<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import MaterialSlider from '../../../../../components/MaterialSlider';
import SensorBar from '../../../../../components/SensorBar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import SvgIcon from '@material-ui/core/SvgIcon';
import svgIcons from '../../../../../images/svgIcons';
import { HorizontalDividerLine } from '../../../../../components/HorizontalDividerLine';
import CategoryMapping from './numberResource/CategoryMapping';

class NumberResource extends React.Component {
  render () {
    if (this.props.smallForm === false) {
      //Single Resource
      const max = this.props.resource.schema.maximum;
      const min = this.props.resource.schema.minimum;

      const graphIcon = (
        <SvgIcon>
          <path d={svgIcons.chart} />
        </SvgIcon>
      );

      const chartModalProps = {
        open: true,
        objectID: this.props.objectID,
        instanceID: this.props.instanceID,
        resourceID: this.props.resource.resourceID
      };

      const NumberResourceComponent = (
        <div>
            <Typography variant='headline' align='center'>{this.props.resource.name}</Typography>
            <br/>
            <br/>
            <div>
              <SensorBar
                currentValue={this.props.currentValue}
                max={max}
                min={min}/>
              <div style={{display: 'block', float: 'left'}}>
                <Typography variant='body2'>{min}</Typography>
              </div>
              <div style={{display: 'block', float: 'right'}}>
                <Typography variant='body2'>{max}</Typography>
              </div>
            </div>

            <br/>
            <Typography variant='title' align='center'>{this.props.currentValue
              + ' ' + this.props.resource.unit}</Typography>
            <div style={{float: 'right', marginBottom: 10}}>
              <Button variant='fab' mini aria-label="Show Graph" color='secondary' onClick={() => this.props.showModal('CHART', chartModalProps)}>
                {graphIcon}
              </Button>
            </div>
            {Object.entries(this.props.mappings).map((mappingsKeyValue) => {
              const currentMapping = mappingsKeyValue[1];
              return (
                <div key={currentMapping.mappingID + '_div'}>
                  <HorizontalDividerLine isMappingDivider={true}/>
                  <CategoryMapping
                    mapping={currentMapping}
                    currentValue={this.props.currentValue}
                    max={max}
                    min={min}/>
                </div>
              );
            })}
        </div>
      );

      return NumberResourceComponent;
    } else {
      //Multi Resource
      const max = this.props.resource.maximum;
      const min = this.props.resource.minimum;

{'fraction_non_alphanumeric': 0.1424496644295302, 'fraction_numerical': 0.0016778523489932886, 'mean_word_length': 1.878319652341864, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 69, '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': '376571', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1531, 'n_words': 313}