<commit_before>/**
 * @license
 * The MIT License (MIT)
 * Copyright 2015 Government of Canada
 *
 * @author
 * <NAME>
 *
 * @exports DetailModal
 */

'use strict';

var React = require("react");
var Modal = require("react-bootstrap/lib/Modal");
var Button = require("react-bootstrap/lib/Button");
var ButtonToolbar = require("react-bootstrap/lib/ButtonToolbar");

var Icon = require('virtool/js/components/Base/Icon.jsx');

/**
 * A base modal that displays detailed information for a collection document. Virtool displays documents in tables in a
 * reduced form. When the application needs more detailed information for an document, a request is sent to the server and
 * the returned detail object can be rendered into the modal component returned by this module.
 */
var DetailModal = React.createClass({

    propTypes: {
        onHide: React.PropTypes.func.isRequired, // Function to call when the modal needs to hide (eg. click close).
        collection: React.PropTypes.object.isRequired,
        contentComponent: React.PropTypes.func.isRequired,
        target: React.PropTypes.object,
        bsSize: React.PropTypes.string
    },

    getDefaultProps: function () {
        return {bsSize: 'large'};
    },

    getInitialState: function () {
        return {
            pending: true,
            data: null
        };
    },

    componentWillUnmount: function () {
        this.props.collection.off('update', this.tryRefresh);
    },

    handleEntered: function () {
        // Request detail for the document from the server. The data will be returned in a transaction. Pass the data
        // to a callback that will update the contentComponent.
        this.props.collection.request('detail', {_id: this.props.target._id}, this.receivedDetail);

        // Listen for changes to the collection that the detail belongs to. If a change occurs in the document currently
        // displayed in the detail modal, get updated detail from the server and re-render the detail component.
        this.props.collection.on('change', this.tryRefresh);
    },

    handleExit: function () {
        this.props.collection.off('change', this.tryRefresh);
    },
<commit_msg>Made DetailModal listen to correct events<commit_after>/**
 * @license
 * The MIT License (MIT)
 * Copyright 2015 Government of Canada
 *
 * @author
 * <NAME>
 *
 * @exports DetailModal
 */

'use strict';

var React = require("react");
var Modal = require("react-bootstrap/lib/Modal");
var Button = require("react-bootstrap/lib/Button");
var ButtonToolbar = require("react-bootstrap/lib/ButtonToolbar");

var Icon = require('virtool/js/components/Base/Icon.jsx');

/**
 * A base modal that displays detailed information for a collection document. Virtool displays documents in tables in a
 * reduced form. When the application needs more detailed information for an document, a request is sent to the server and
 * the returned detail object can be rendered into the modal component returned by this module.
 */
var DetailModal = React.createClass({

    propTypes: {
        onHide: React.PropTypes.func.isRequired, // Function to call when the modal needs to hide (eg. click close).
        collection: React.PropTypes.object.isRequired,
        contentComponent: React.PropTypes.func.isRequired,
        target: React.PropTypes.object,
        bsSize: React.PropTypes.string
    },

    getDefaultProps: function () {
        return {bsSize: 'large'};
    },

    getInitialState: function () {
        return {
            pending: true,
            data: null
        };
    },

    componentWillUnmount: function () {
        this.props.collection.off('change', this.tryRefresh);
    },

    handleEntered: function () {
        // Request detail for the document from the server. The data will be returned in a transaction. Pass the data
        // to a callback that will update the contentComponent.
        this.props.collection.request('detail', {_id: this.props.target._id}, this.receivedDetail);

        // Listen for changes to the collection that the detail belongs to. If a change occurs in the document currently
        // displayed in the detail modal, get updated detail from the server and re-render the detail component.
        this.props.collection.on('change', this.tryRefresh);
    },

    handleExit: function () {
        this.props.collection.off('change', this.tryRefresh);
    },

{'fraction_non_alphanumeric': 0.10100090991810737, 'fraction_numerical': 0.0018198362147406734, 'mean_word_length': 3.041360294117647, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '968535', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1121, 'n_words': 407}