<commit_before>import PropTypes from 'prop-types';
import { FormControl, InputGroup } from 'react-bootstrap';

import { NAME } from './../constants';

const { errorBoundary } = window.WarpJS.ReactUtils;

const Component = (props) => {
    return (
        <InputGroup>
            <InputGroup.Addon>CRITERIA 1</InputGroup.Addon>
            <InputGroup.Addon>CRITERIA 2</InputGroup.Addon>
            <FormControl type="text" value={props.searchValue} placeholder="Enter search terms" />
        </InputGroup>
    );
};

Component.displayName = `${NAME}SearchField`;

Component.propTypes = {
    searchValue: PropTypes.string,
    section: PropTypes.oneOf([
        'input'
    ])
};

export default errorBoundary(Component);<commit_msg>- #323: Changed search field to display criteria<commit_after>import PropTypes from 'prop-types';
import { FormControl, InputGroup } from 'react-bootstrap';

import { NAME } from './../constants';
import * as SHAPES from './../shapes';

const { ActionIcon } = window.WarpJS.ReactComponents;
const { errorBoundary } = window.WarpJS.ReactUtils;

const Component = (props) => {
    let firstLevel = null;
    let secondLevel = null;

    if (props.selection) {
        const relationship = (props.aggregationFilters || []).find((reln) => reln.id === props.selection.relnId);

        if (relationship) {
            const entity = (relationship.entities || []).find((entity) => entity.id === props.selection.entityId);

            if (entity) {
                const firstLevelItem = (entity.items || []).find((item) => item.id === props.selection.firstLevelId);

                if (firstLevelItem) {
                    firstLevel = (
                        <InputGroup.Addon>
                            {firstLevelItem.name}
                            <ActionIcon glyph="remove" title={`Remove '${firstLevelItem.name}'`} onClick={() => firstLevelItem.onClick(false)} />
                        </InputGroup.Addon>
                    );

                    const secondLevelItem = (firstLevelItem.items || []).find((item) => item.id === props.selection.secondLevelId);
                    if (secondLevelItem) {
                        secondLevel = (
                            <InputGroup.Addon>
                                {secondLevelItem.name}
                                <ActionIcon glyph="remove" title={`Remove '${secondLevelItem.name}'`} onClick={() => secondLevelItem.onClick(false)} />
                            </InputGroup.Addon>
                        );
                    }
                }
            }
        }
    }

    return (
        <InputGroup>
            {firstLevel}
            {secondLevel}
            <FormControl type="text" value={props.searchValue} placeholder="Enter search terms" />
            <InputGroup.Addon>
                <ActionIcon glyph="remove" title={`Clear search terms`} />
            </InputGroup.Addon>
        </InputGroup>
    );
};

Component.displayName = `${NAME}SearchField`;

Component.propTypes = {
    aggregationFilters: PropTypes.arrayOf(SHAPES.RELATIONSHIP),
    searchValue: PropTypes.string,
    selection: SHAPES.SELECTION
};

export default errorBoundary(Component);
{'fraction_non_alphanumeric': 0.13176838810641628, 'fraction_numerical': 0.001564945226917058, 'mean_word_length': 2.0760346487006736, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 30, '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': '3524544', 'n_tokens_mistral': 869, 'n_tokens_neox': 853, 'n_words': 166}