<commit_before>require('../stores/request-detail-store.js');

var glimpse = require('glimpse'),
    React = require('react'),
    cx = React.addons.classSet,
    EmitterMixin = require('../../lib/components/emitter-mixin.jsx');

function getState(state) {
    return {
            request: state ? state.request : null
        };
}

module.exports = React.createClass({
    mixins: [ EmitterMixin ],
    componentDidMount: function() {
        this.addListener('shell.request.detail.changed', this._requestDetailChanged);
    },
    getInitialState: function() {
        return getState();
    },
    render: function() {
        var request = this.state.request;

        if (request) {
            return (
                <div className="col-md-10 col-md-offset-2 request-detail-holder-outer">
                    <div className="request-detail-holder">
                        <h2>Detail - {request.id}</h2>
                        <input type="button" value="Close" onClick={this.onClose} />
                    </div>
                </div>
            );
        }

        // TODO: Need to work on doing this better
        return <div></div>;
    },
    onClose: function() {
        // TODO: Should pass through the id of the request that is being closed
        glimpse.emit('shell.request.detail.closed', {});
    },
    _requestDetailChanged: function(state) {
        this.setState(getState({ request: state }));
    }<commit_msg>Get details view to show summary view details as its header<commit_after>require('../stores/request-detail-store.js');

var glimpse = require('glimpse'),
    React = require('react'),
    SummaryDisplay = require('./request-summary-display-view.jsx'),
    cx = React.addons.classSet,
    EmitterMixin = require('../../lib/components/emitter-mixin.jsx');

function getState(state) {
    return {
            request: state ? state.request : null
        };
}

module.exports = React.createClass({
    mixins: [ EmitterMixin ],
    componentDidMount: function() {
        this.addListener('shell.request.detail.changed', this._requestDetailChanged);
    },
    getInitialState: function() {
        return getState();
    },
    render: function() {
        var request = this.state.request;

        if (request) {
            return (
                <div className="col-md-10 col-md-offset-2 request-detail-holder-outer">
                    <div className="request-detail-holder">
                        <h2>Detail <input type="button" value="Close" onClick={this.onClose} /></h2>
                        <SummaryDisplay summary={request} />
                    </div>
                </div>
            );
        }

        // TODO: Need to work on doing this better
        return <div></div>;
    },
    onClose: function() {
        // TODO: Should pass through the id of the request that is being closed
        glimpse.emit('shell.request.detail.closed', {});
    },
    _requestDetailChanged: function(state) {
        this.setState(getState({ request: state }));
    }
{'fraction_non_alphanumeric': 0.13822751322751323, 'fraction_numerical': 0.0033068783068783067, 'mean_word_length': 2.0741869918699187, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, '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': '817192', 'n_tokens_mistral': 836, 'n_tokens_neox': 825, 'n_words': 178}