<commit_before>import React, {PureComponent} from 'react';
import WidgetRow from './WidgetRow.jsx';

const WIDGETS_UNREG_URL = '/dashboard/v1/widgets/unregistered';
const TABLE_VIEW = 0;
const PAGES_PREVIEW = 1;

class UnregisteredWidgetList extends PureComponent {

  static defaultProps = {
    widgets: [],
    viewState: TABLE_VIEW,
    selected: null
  }

  static propTypes = {
    widgets: React.PropTypes.array
  }

  constructor(props) {
      super(props);
      this.state = {
        widgets: props.widgets,
        viewState: props.viewState,
        selected: null
      }
  }

  componentDidMount(){
    this._getUnregisteredWidgetsList();
  }

  _getUnregisteredWidgetsList(){
     var self = this;
     fetch(WIDGETS_UNREG_URL)
       .then((response) => response.json())
       .then(self._receiveResponse)
       .then(function (data){
          self.setState({widgets:data});
       })
       .catch((ex) => {
           console.error(ex);
       });
  }

  _onRegisterWidget = (w) => {

  }

  _renderTable = () => {
    return (
      <div className="panel panel-default" style={{"marginTop": "15px"}}>
          <div className="panel-heading">
            <b>Unregistered widgets:</b>
          </div>
          <div className="panel-body">
            <table className="table">
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Width</th>
                  <th>Height</th>
                  <th>Url</th>
                  <th>&nbsp;</th>
                </tr>
              </thead>
              <tbody>
                  {
                    this.state.widgets.map((w, idx) => {
                      return (
                        <WidgetRow key={idx} widget={w} onClick={this._onRegisterWidget}/>
                      );
                    });
                  }
              </tbody>
            </table>
          </div>
      </div>
    )
  }

  _renderPages = () => {

  }

  render(){
    if (this.state.viewState == TABLE_VIEW) {
      return this._renderTable();
    } else if(this.state.viewState == PAGES_PREVIEW) {
      return this._renderPages();
    }
  }
}

export default UnregisteredWidgetList;<commit_msg>Fix syntax err<commit_after>import React, {PureComponent} from 'react';
import WidgetRow from './WidgetRow.jsx';

const WIDGETS_UNREG_URL = '/dashboard/v1/widgets/unregistered';
const TABLE_VIEW = 0;
const PAGES_PREVIEW = 1;

class UnregisteredWidgetList extends PureComponent {

  static defaultProps = {
    widgets: [],
    viewState: TABLE_VIEW,
    selected: null
  }

  static propTypes = {
    widgets: React.PropTypes.array
  }

  constructor(props) {
      super(props);
      this.state = {
        widgets: props.widgets,
        viewState: props.viewState,
        selected: null
      }
  }

  componentDidMount(){
    this._getUnregisteredWidgetsList();
  }

  _getUnregisteredWidgetsList(){
     var self = this;
     fetch(WIDGETS_UNREG_URL)
       .then((response) => response.json())
       .then(self._receiveResponse)
       .then(function (data){
          self.setState({widgets:data});
       })
       .catch((ex) => {
           console.error(ex);
       });
  }

  _onRegisterWidget = (w) => {

  }

  _renderTable = () => {
    return (
      <div className="panel panel-default" style={{"marginTop": "15px"}}>
          <div className="panel-heading">
            <b>Unregistered widgets:</b>
          </div>
          <div className="panel-body">
            <table className="table">
              <thead>
                <tr>
                  <th>Name</th>
                  <th>Width</th>
                  <th>Height</th>
                  <th>Url</th>
                  <th>&nbsp;</th>
                </tr>
              </thead>
              <tbody>
                  {
                    this.state.widgets.map((w, idx) => {
                      return (
                        <WidgetRow key={idx} widget={w} onClick={this._onRegisterWidget}/>
                      );
                    })
                  }
              </tbody>
            </table>
          </div>
      </div>
    )
  }

  _renderPages = () => {

  }

  render(){
    if (this.state.viewState == TABLE_VIEW) {
      return this._renderTable();
    } else if(this.state.viewState == PAGES_PREVIEW) {
      return this._renderPages();
    }
  }
}

export default UnregisteredWidgetList;
{'fraction_non_alphanumeric': 0.13452813067150635, 'fraction_numerical': 0.002268602540834846, 'mean_word_length': 1.619726678550208, 'pattern_counts': {'":': 2, '<': 57, '<?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': '125033', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1273, 'n_words': 223}