<commit_before>import React from "react";
import { map } from "lodash-es";
import { push } from "react-router-redux";
import { connect } from "react-redux";
import { LinkContainer } from "react-router-bootstrap";
import { FormControl, FormGroup, InputGroup } from "react-bootstrap";

import CreateSubtraction from "./Create";
import SubtractionItem from "./Item";
import { Alert, Button, Icon, LoadingPlaceholder, NoneFound, ViewHeader } from "../../base";
import { createFindURL, getFindTerm } from "../../utils";

const SubtractionList = (props) => {

    if (props.documents === null) {
        return <LoadingPlaceholder />;
    }

    let subtractionComponents = map(props.documents, document =>
        <SubtractionItem
            key={document.id}
            {...document}
        />
    );

    if (!subtractionComponents.length) {
        subtractionComponents = <NoneFound noun="subtractions" noListGroup />;
    }

    let alert;

    if (!props.ready_host_count) {
        alert = (
            <Alert bsStyle="warning" icon="notification">
                <strong>
                    A host genome must be added before samples can be created and analyzed.
                </strong>
            </Alert>
        );
    }

    return (
        <div>
            <ViewHeader
                title="Subtraction"
                page={props.page}
                count={props.documents.length}
                foundCount={props.found_count}
                totalCount={props.total_count}
            />

            {alert}

            <div key="toolbar" className="toolbar">
                <FormGroup>
                    <InputGroup>
                        <InputGroup.Addon>
                            <Icon name="search" />
                        </InputGroup.Addon>
                        <FormControl
                            type="text"
                            value={props.term}
                            onChange={props.onFind}
                            placeholder="Host name"
                        />
                    </InputGroup>
                </FormGroup>

                {props.canModify ? (
                    <LinkContainer to={{state: {createSubtraction: true}}}>
                        <Button bsStyle="primary" icon="new-entry" tip="Create" />
                    </LinkContainer>
                ) : null}
            </div>

            <div className="list-group">
                {subtractionComponents}
            </div>

            <CreateSubtraction />
        </div>
    );
};

const mapStateToProps = (state) => ({
    ...state.subtraction,
    term: getFindTerm(),<commit_msg>Change subtraction search placeholder to 'name'<commit_after>import React from "react";
import { map } from "lodash-es";
import { push } from "react-router-redux";
import { connect } from "react-redux";
import { LinkContainer } from "react-router-bootstrap";
import { FormControl, FormGroup, InputGroup } from "react-bootstrap";

import CreateSubtraction from "./Create";
import SubtractionItem from "./Item";
import { Alert, Button, Icon, LoadingPlaceholder, NoneFound, ViewHeader } from "../../base";
import { createFindURL, getFindTerm } from "../../utils";

const SubtractionList = (props) => {

    if (props.documents === null) {
        return <LoadingPlaceholder />;
    }

    let subtractionComponents = map(props.documents, document =>
        <SubtractionItem
            key={document.id}
            {...document}
        />
    );

    if (!subtractionComponents.length) {
        subtractionComponents = <NoneFound noun="subtractions" noListGroup />;
    }

    let alert;

    if (!props.ready_host_count) {
        alert = (
            <Alert bsStyle="warning" icon="notification">
                <strong>
                    A host genome must be added before samples can be created and analyzed.
                </strong>
            </Alert>
        );
    }

    return (
        <div>
            <ViewHeader
                title="Subtraction"
                page={props.page}
                count={props.documents.length}
                foundCount={props.found_count}
                totalCount={props.total_count}
            />

            {alert}

            <div key="toolbar" className="toolbar">
                <FormGroup>
                    <InputGroup>
                        <InputGroup.Addon>
                            <Icon name="search" />
                        </InputGroup.Addon>
                        <FormControl
                            type="text"
                            value={props.term}
                            onChange={props.onFind}
                            placeholder="Name"
                        />
                    </InputGroup>
                </FormGroup>

                {props.canModify ? (
                    <LinkContainer to={{state: {createSubtraction: true}}}>
                        <Button bsStyle="primary" icon="new-entry" tip="Create" />
                    </LinkContainer>
                ) : null}
            </div>

            <div className="list-group">
                {subtractionComponents}
            </div>

            <CreateSubtraction />
        </div>
    );
};

const mapStateToProps = (state) => ({
    ...state.subtraction,
    term: getFindTerm(),
{'fraction_non_alphanumeric': 0.11614358203345236, 'fraction_numerical': 0.0, 'mean_word_length': 1.4536652835408022, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 61, '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': '6976913', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1296, 'n_words': 289}