<commit_before>import React from 'react';
import jQuery from 'jquery';

var Entry = React.createClass({
    getInitialState: function () {
        return {status: []};
    },
    getData: function() {
        if (this.props.proxyHost && this.props.proxyPort) {
            return JSON.stringify({"target": this.props.host+":"+
            this.props.port, "http_proxy" : this.props.proxyHost +
            ":" + this.props.proxyPort});
        }
        return JSON.stringify({"target": this.props.host+":"+this.props.port});
    },
    successFunc: function(data){
        mixpanel.track("connection attempted", { "canConnect": data.canConnect,
            "httpStatus": data.httpStatus, "validHostName":data.validHostName,
            "validUrl":data.validUrl});
        console.log(data);
        this.setState({status: data});
    },
    componentWillMount: function () {
        var path = '/v2/willitconnect';
        jQuery.ajax ({
            url: path,
            type: "POST",
            data: this.getData(),
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            success: this.successFunc
        });
    },
    render: function () {
        var connectionStyle = {color: 'blue'};
        var resultString = this.props.host;
        if(this.props.port) {
            resultString += ":" + this.props.port;
        }

        if(Object.keys(this.state.status).length) {
            connectionStyle = this.state.status.canConnect ? {color: 'green'} : {color: 'red'};
            if(this.state.status.statusCode) {
                resultString += " status: " + this.state.status.statusCode;
            }
        }

        return (
            <div style={ connectionStyle }>
                <h3 className="entry">
                    {resultString}
                </h3>
            </div>
        );
    }
});

module.exports = Entry;<commit_msg>This breaks all sorts of tests, but it's PRETTY<commit_after>import React from 'react';
import jQuery from 'jquery';
import Alert from 'react-bootstrap/lib/Alert';
import ProgressBar from 'react-bootstrap/lib/ProgressBar';

var Entry = React.createClass({
    getInitialState: function () {
        return {status: []};
    },
    getData: function() {
        if (this.props.proxyHost && this.props.proxyPort) {
            return JSON.stringify({"target": this.props.host+":"+
            this.props.port, "http_proxy" : this.props.proxyHost +
            ":" + this.props.proxyPort});
        }
        return JSON.stringify({"target": this.props.host+":"+this.props.port});
    },
    successFunc: function(data){
        mixpanel.track("connection attempted", { "canConnect": data.canConnect,
            "httpStatus": data.httpStatus, "validHostName":data.validHostName,
            "validUrl":data.validUrl});
        console.log(data);
        this.setState({status: data});
    },
    componentWillMount: function () {
        var path = '/v2/willitconnect';
        jQuery.ajax ({
            url: path,
            type: "POST",
            data: this.getData(),
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            success: this.successFunc
        });
    },
    render: function () {
        var alertStyle = "info";

        var gotResults = Object.keys(this.state.status).length;

        var resultString = this.props.host;
        if(this.props.port) {
            resultString += ":" + this.props.port;
        }
        if(this.props.proxyHost){
            resultString += " proxied through " + this.props.proxyHost;
        }
        if(this.props.proxyPort) {
            resultString += ":" + this.props.proxyPort;
        }

        var workingResult = "";
        if (!gotResults) {
            workingResult = (
            <ProgressBar active now={100}/>
            )
        }

        var statusReport = "";

        if(Object.keys(this.state.status).length) {
            if(this.state.status.canConnect){
                alertStyle = "success";
            } else {
                alertStyle = "danger";
            }

            if(this.state.status.httpStatus && this.state.status.httpStatus != 0) {
                statusReport = (
                    <p>Some text?</p>
                );
            }
        }

        return (
            <Alert bsStyle={alertStyle}>
                <h4>{resultString}</h4>
                {workingResult}
                {statusReport}
            </Alert>
        );
    }
});

module.exports = Entry;
{'fraction_non_alphanumeric': 0.14068357221609704, 'fraction_numerical': 0.002646085997794928, 'mean_word_length': 1.8, 'pattern_counts': {'":': 21, '<': 14, '<?xml version=': 0, '>': 14, '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': '5096812', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1244, 'n_words': 227}