<commit_before>import React from 'react';
import fetch from 'isomorphic-fetch';
import { fromNow, abbreviateNumber } from 'utility';
import Helmet from 'react-helmet';
import Table from 'components/Table';
import strings from 'lang';

function jsonResponse(response) {
  return response.json();
}

const columns = [
  { displayName: 'key', field: 'key' },
  { displayName: 'value', field: 'value' },
];

const tableStyle = {
  flexGrow: 1, overflowX: 'auto', boxSizing: 'border-box', padding: '15px',
};

class Status extends React.Component {
  componentWillMount() {
    this.setState({
      result: {},
    });
    fetch(`${process.env.REACT_APP_API_HOST}/api/status`).then(jsonResponse).then(json => this.setState({ result: json }));
  }
  render() {
    return (
      <div style={{ display: 'flex', flexDirection: 'row', flexWrap: 'wrap' }}>
        <Helmet title={strings.title_status} />
        <Table
          style={tableStyle}
          data={Object.keys(this.state.result)
          .filter(key => typeof (this.state.result[key]) !== 'object')
          .map(key => ({ key, value: this.state.result[key] }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={Object.keys(this.state.result.health || {})
          .map(key => ({
            key,
            value: `${abbreviateNumber(this.state.result.health[key].metric)}/${abbreviateNumber(this.state.result.health[key].threshold)}`,
          }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={(this.state.result.last_added || [])
          .map(match => ({ key: match.match_id, value: fromNow(match.start_time + match.duration) }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={(this.state.result.last_parsed || [])
          .map(match => ({ key: match.match_id, value: fromNow(match.start_time + match.duration) }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={(this.state.result.retriever || [])
          .map(row => ({ key: row.hostname, value: row.count }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={Object.keys(this.state.result.load_times || {})
          .map(key => ({ key, value: this.state.result.load_times[key] }))}
          columns={columns}
        />
      </div>);
  }
}

export default Status;
<commit_msg>add api paths to status page<commit_after>import React from 'react';
import fetch from 'isomorphic-fetch';
import { fromNow, abbreviateNumber } from 'utility';
import Helmet from 'react-helmet';
import Table from 'components/Table';
import strings from 'lang';

function jsonResponse(response) {
  return response.json();
}

function reverse(a) {
  const temp = [];
  const len = a.length;
  for (let i = (len - 1); i > 0; i -= 1) {
    temp.push(a[i]);
  }
  return temp;
}

const columns = [
  { displayName: 'key', field: 'key' },
  { displayName: 'value', field: 'value' },
];

const tableStyle = {
  flexGrow: 1,
  overflowX: 'auto',
  boxSizing: 'border-box',
  padding: '15px',
};

class Status extends React.Component {
  componentWillMount() {
    this.setState({
      result: {},
    });
    fetch(`${process.env.REACT_APP_API_HOST}/api/status`)
      .then(jsonResponse)
      .then(json => this.setState({ result: json }));
  }
  render() {
    return (
      <div style={{
 display: 'flex', flexDirection: 'row', flexWrap: 'wrap', fontSize: '10px',
}}
      >
        <Helmet title={strings.title_status} />
        <Table
          style={tableStyle}
          data={Object.keys(this.state.result)
          .filter(key => typeof (this.state.result[key]) !== 'object')
          .map(key => ({ key, value: this.state.result[key] }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={Object.keys(this.state.result.health || {})
          .map(key => ({
            key,
            value: `${abbreviateNumber(this.state.result.health[key].metric)}/${abbreviateNumber(this.state.result.health[key].threshold)}`,
          }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={(this.state.result.last_added || [])
          .map(match => ({ key: match.match_id, value: fromNow(match.start_time + match.duration) }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={(this.state.result.last_parsed || [])
          .map(match => ({ key: match.match_id, value: fromNow(match.start_time + match.duration) }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={Object.keys(this.state.result.load_times || {})
          .map(key => ({ key, value: this.state.result.load_times[key] }))}
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={reverse((this.state.result.api_paths || [])
          .map(row => ({ key: row.hostname, value: row.count })))
          }
          columns={columns}
        />
        <Table
          style={tableStyle}
          data={reverse((this.state.result.retriever || [])
          .map(row => ({ key: row.hostname, value: row.count })))
          }
          columns={columns}
        />
      </div>);
  }
}

export default Status;

{'fraction_non_alphanumeric': 0.16815310293571162, 'fraction_numerical': 0.0020438498699368265, 'mean_word_length': 2.33312693498452, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 40, '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': '2954585', 'n_tokens_mistral': 1651, 'n_tokens_neox': 1653, 'n_words': 303}