<commit_before>import React, { Component, PropTypes } from 'react';
import {connect} from 'react-redux';
import * as actions from 'redux/modules/monitoring-swagger';
import {isLoaded, loadModules as loadModulesOnInit} from 'redux/modules/monitoring-swagger';
import { asyncConnect } from 'redux-async-connect';

@asyncConnect([{
  promise: ({store: {dispatch, getState}}) => {
    const promises = [];

    if (!isLoaded(getState())) {
      promises.push(dispatch(loadModulesOnInit()));
    }

    return Promise.all(promises);
  }
}])
@connect(
  state => ({
    data: state.monitoringSwagger.data,
    loading: state.monitoringSwagger.loading,
    loaded: state.monitoringSwagger.loaded
  }),
  {...actions })

export default class MonitoringSwagger extends Component {
  static propTypes = {
    data: PropTypes.arrayOf(PropTypes.string),
    loading: PropTypes.bool,
    loaded: PropTypes.bool.isRequired,
    load: PropTypes.func.isRequired
  };

  componentDidMount() {
    const {loading, load} = this.props;

    if (!loading) {
      load();
    }

    this.interval = window.setInterval(load, 30000);
  }

  componentWillUnmount() {
    clearInterval(this.interval);
  }

  render() {
    const {loading, loaded, data} = this.props;

    let loadClassName = 'fa fa-refresh';
    if (loading) {
      loadClassName += ' fa-spin';
    }

    return (
        <div>
          <h2>Swagger</h2>
          {!loaded && loading &&
          <div className="container">
            <p><i className="fa fa-spinner fa-spin"></i> Loading data… </p>
          </div>
          }

          {loaded &&
          <table className="table table-hover">
            <thead>
                <tr>
                    <th>Name</th>
                </tr>
            </thead>
            <tbody>
              <tr>
                <td>{data}</td>
              </tr>
            </tbody>
          </table>
          }
        </div>
    );
  }
}<commit_msg>Monitoring UI patch for swagger's list<commit_after>import React, { Component, PropTypes } from 'react';
import {connect} from 'react-redux';
import * as actions from 'redux/modules/monitoring-swagger';
import {isLoaded, loadModules as loadModulesOnInit} from 'redux/modules/monitoring-swagger';
import { asyncConnect } from 'redux-async-connect';
import config from '../../config';

@asyncConnect([{
  promise: ({store: {dispatch, getState}}) => {
    const promises = [];

    if (!isLoaded(getState())) {
      promises.push(dispatch(loadModulesOnInit()));
    }

    return Promise.all(promises);
  }
}])
@connect(
  state => ({
    data: state.monitoringSwagger.data,
    loading: state.monitoringSwagger.loading,
    loaded: state.monitoringSwagger.loaded
  }),
  {...actions })

export default class MonitoringSwagger extends Component {
  static propTypes = {
    data: PropTypes.arrayOf(PropTypes.string),
    loading: PropTypes.bool,
    loaded: PropTypes.bool.isRequired,
    load: PropTypes.func.isRequired
  };

  componentDidMount() {
    const {loading, load} = this.props;

    if (!loading) {
      load();
    }

    this.interval = window.setInterval(load, 30000);
  }

  componentWillUnmount() {
    clearInterval(this.interval);
  }

  render() {
    const {loading, loaded, data} = this.props;

    let loadClassName = 'fa fa-refresh';
    if (loading) {
      loadClassName += ' fa-spin';
    }

    return (
        <div>
          <h2>Swagger</h2>
          {!loaded && loading &&
          <div className="container">
            <p><i className="fa fa-spinner fa-spin"></i> Loading data… </p>
          </div>
          }

          {loaded &&
          <table className="table table-hover">
            <thead>
                <tr>
                    <th>Name</th>
                </tr>
            </thead>
            <tbody>
              {data && data.map((module) =>
                <tr>
                  <td><a href={`http://${config.serverApiHost}/${module}/index`} target="_blank">{module}</a></td>
                </tr>
              )}
            </tbody>
          </table>
          }
        </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.1477328132618235, 'fraction_numerical': 0.0034129692832764505, 'mean_word_length': 2.146472392638037, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 58, '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': '7488150', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1222, 'n_words': 255}