<commit_before>import _ from 'messages'
import Icon from 'icon'
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
import forEach from 'lodash/forEach'
import React from 'react'
import xo from 'xo'
import { FormattedRelative, FormattedTime } from 'react-intl'
import { Row, Col } from 'grid'

export default ({
  logs,
  snapshots,
  vm
}) => <div>
  {isEmpty(logs)
    ? <Row>
      <Col smallSize={6} className='text-xs-center'>
        <br/>
        <h4>{_('noLogs')}</h4>
      </Col>
    </Row>
    : [<Row>
      <Col smallSize={12} className='text-xs-right'>
        <button className='btn btn-lg btn-danger btn-tab' onClick={() => {
          forEach(logs, (log) =>
            xo.call('message.delete', {id: log.id})
          )
        }}>
          <Icon icon='delete' size={1} /> {_('logRemoveAll')}
        </button>
        <br/>
        <table className='table'>
          <thead className='thead-default'>
            <tr>
              <th>{_('logDate')}</th>
              <th>{_('logName')}</th>
              <th>{_('logContent')}</th>
              <th>{_('logAction')}</th>
            </tr>
          </thead>
          <tbody>
            {map(logs, (log) =>
              <tr key={log.id}>
                <td><FormattedTime value={log.time * 1000} minute='numeric' hour='numeric' day='numeric' month='long' year='numeric'/> (<FormattedRelative value={log.time * 1000}/>)</td>
                <td>{log.name}</td>
                <td>{log.body}</td>
                <td>
                  <button className='btn btn-link' onClick={() => {
                    xo.call('message.delete', { id: log.id })
                  }}>
                    <i className='xo-icon-delete xo-icon-action-row'></i>
                  </button>
                </td>
              </tr>
            )}
          </tbody>
        </table>
      </Col>
    </Row>]
  }
</div><commit_msg>remove more xo direct call<commit_after>import _ from 'messages'
import Icon from 'icon'
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
import forEach from 'lodash/forEach'
import React from 'react'
import { deleteMessage } from 'xo'
import { FormattedRelative, FormattedTime } from 'react-intl'
import { Row, Col } from 'grid'

export default ({
  logs,
  snapshots,
  vm
}) => <div>
  {isEmpty(logs)
    ? <Row>
      <Col smallSize={6} className='text-xs-center'>
        <br/>
        <h4>{_('noLogs')}</h4>
      </Col>
    </Row>
    : [<Row>
      <Col smallSize={12} className='text-xs-right'>
        <button className='btn btn-lg btn-danger btn-tab' onClick={() => {
          forEach(logs, (log) =>
            deleteMessage(log)
          )
        }}>
          <Icon icon='delete' size={1} /> {_('logRemoveAll')}
        </button>
        <br/>
        <table className='table'>
          <thead className='thead-default'>
            <tr>
              <th>{_('logDate')}</th>
              <th>{_('logName')}</th>
              <th>{_('logContent')}</th>
              <th>{_('logAction')}</th>
            </tr>
          </thead>
          <tbody>
            {map(logs, (log) =>
              <tr key={log.id}>
                <td><FormattedTime value={log.time * 1000} minute='numeric' hour='numeric' day='numeric' month='long' year='numeric'/> (<FormattedRelative value={log.time * 1000}/>)</td>
                <td>{log.name}</td>
                <td>{log.body}</td>
                <td>
                  <button className='btn btn-link' onClick={() => {
                    deleteMessage(log)
                  }}>
                    <i className='xo-icon-delete xo-icon-action-row'></i>
                  </button>
                </td>
              </tr>
            )}
          </tbody>
        </table>
      </Col>
    </Row>]
  }
</div>
{'fraction_non_alphanumeric': 0.17932489451476794, 'fraction_numerical': 0.007383966244725738, 'mean_word_length': 1.699644128113879, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 111, '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': '6312660', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1176, 'n_words': 241}