<commit_before>var React = require('react')
var addr = require('./typography.jsx').addr

module.exports = React.createClass({

  render: function() {
    // convert from base64 length to real length
    var size = Math.floor(this.props.object.Data.length * 4/3)
    var data = 'data:text/plain;base64,' + this.props.object.Data.substr(0, 10000)
    var handleLink = this.props.handleLink

    var back = null
    if(this.props.path.indexOf('/') !== -1) {
      back = (
        <div>
          <button className="btn btn-primary" onClick={this.props.handleBack}>
            <i className="fa fa-arrow-left"></i> Back to parent object
          </button>
        </div>
      )
    }

    return (
      <div className="webui-object">
        {back}
        <h4>Links</h4>
        <div className="panel panel-default">
          <div className="table-responsive">
            <table className="table table-hover filelist">
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Hash</th>
                  <th>Size</th>
                </tr>
              </thead>
              <tbody>
              {this.props.object.Links.map(function(link) {
                return <tr>
                  <td><a href="#" data-name={link.Name} data-hash={link.Hash} onClick={handleLink}>{link.Name}</a></td>
                  <td><a href="#" data-name={link.Name} data-hash={link.Hash} onClick={handleLink}>{addr(link.Hash)}</a></td>
                  <td>{link.Size}</td>
                </tr>
              })}
              </tbody>
            </table>
          </div>
        </div>
        <br/>
        <h4>Data <span className="small">({size} bytes)</span></h4>
        <div className="panel panel-default">
          <iframe src={data} className="panel-inner"></iframe>
        </div>
      </div>
    )
  }
})<commit_msg>Don't show Links table for objects with no links<commit_after>var React = require('react')
var addr = require('./typography.jsx').addr

module.exports = React.createClass({

  render: function() {
    // convert from base64 length to real length
    var size = Math.floor(this.props.object.Data.length * 4/3)
    var data = 'data:text/plain;base64,' + this.props.object.Data.substr(0, 10000)
    var handleLink = this.props.handleLink

    var back = null
    if(this.props.path.indexOf('/') !== -1) {
      back = (
        <div>
          <button className="btn btn-primary" onClick={this.props.handleBack}>
            <i className="fa fa-arrow-left"></i> Back to parent object
          </button>
        </div>
      )
    }

    var links = <div className="padded"><span>This object has no links</span></div>
    if(this.props.object.Links.length > 0) {
      links = (
        <div className="table-responsive">
          <table className="table table-hover filelist">
            <thead>
              <tr>
                <th>Name</th>
                <th>Hash</th>
                <th>Size</th>
              </tr>
            </thead>
            <tbody>
            {this.props.object.Links.map(function(link) {
              return <tr>
                <td><a href="#" data-name={link.Name} data-hash={link.Hash} onClick={handleLink}>{link.Name}</a></td>
                <td><a href="#" data-name={link.Name} data-hash={link.Hash} onClick={handleLink}>{addr(link.Hash)}</a></td>
                <td>{link.Size}</td>
              </tr>
            })}
            </tbody>
          </table>
        </div>
      )
    }

    return (
      <div className="webui-object">
        {back}
        <h4>Links</h4>
        <div className="panel panel-default">
          {links}
        </div>
        <br/>
        <h4>Data <span className="small">({size} bytes)</span></h4>
        <div className="panel panel-default">
          <iframe src={data} className="panel-inner"></iframe>
        </div>
      </div>
    )
  }
})
{'fraction_non_alphanumeric': 0.16722322116619573, 'fraction_numerical': 0.008990495761623427, 'mean_word_length': 1.7558386411889597, 'pattern_counts': {'":': 0, '<': 105, '<?xml version=': 0, '>': 106, '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': '7178136', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1156, 'n_words': 226}