<commit_before>import React, {PropTypes} from 'react'
import {OPERATORS} from 'src/kapacitor/constants'
import Dropdown from 'shared/components/Dropdown'

const mapToItems = (arr, type) => arr.map(text => ({text, type}))
const operators = mapToItems(OPERATORS, 'operator')

const Threshold = ({
  rule: {values: {operator, value, rangeValue}},
  query,
  onDropdownChange,
  onRuleTypeInputChange,
}) =>
  <div className="rule-section--row rule-section--row-first rule-section--border-bottom">
    <p>Send Alert where</p>
    <span className="rule-builder--metric">
      {query.fields.length ? query.fields[0].field : 'Select a Time-Series'}
    </span>
    <p>is</p>
    <Dropdown
      className="dropdown-180"
      menuClass="dropdown-malachite"
      items={operators}
      selected={operator}
      onChoose={onDropdownChange}
    />
    <form style={{display: 'flex'}}>
      <input
        className="form-control input-sm form-malachite monotype"
        style={{width: '160px', marginLeft: '6px'}}
        type="text"
        name="lower"
        spellCheck="false"
        value={value}
        onChange={onRuleTypeInputChange}
        placeholder={
          operator === 'inside range' || operator === 'outside range'
            ? 'Lower'
            : null
        }
      />
      {(operator === 'inside range' || operator === 'outside range') &&
        <input
          className="form-control input-sm form-malachite monotype"
          name="upper"
          style={{width: '160px'}}
          placeholder="Upper"
          type="text"
          spellCheck="false"
          value={rangeValue}
          onChange={onRuleTypeInputChange}<commit_msg>Prevent form submit onEnter<commit_after>import React, {PropTypes} from 'react'
import {OPERATORS} from 'src/kapacitor/constants'
import Dropdown from 'shared/components/Dropdown'

const mapToItems = (arr, type) => arr.map(text => ({text, type}))
const operators = mapToItems(OPERATORS, 'operator')
const noopSubmit = e => e.preventDefault()

const Threshold = ({
  rule: {values: {operator, value, rangeValue}},
  query,
  onDropdownChange,
  onRuleTypeInputChange,
}) =>
  <div className="rule-section--row rule-section--row-first rule-section--border-bottom">
    <p>Send Alert where</p>
    <span className="rule-builder--metric">
      {query.fields.length ? query.fields[0].field : 'Select a Time-Series'}
    </span>
    <p>is</p>
    <Dropdown
      className="dropdown-180"
      menuClass="dropdown-malachite"
      items={operators}
      selected={operator}
      onChoose={onDropdownChange}
    />
    <form style={{display: 'flex'}} onSubmit={noopSubmit}>
      <input
        className="form-control input-sm form-malachite monotype"
        style={{width: '160px', marginLeft: '6px'}}
        type="text"
        name="lower"
        spellCheck="false"
        value={value}
        onChange={onRuleTypeInputChange}
        placeholder={
          operator === 'inside range' || operator === 'outside range'
            ? 'Lower'
            : null
        }
      />
      {(operator === 'inside range' || operator === 'outside range') &&
        <input
          className="form-control input-sm form-malachite monotype"
          name="upper"
          style={{width: '160px'}}
          placeholder="Upper"
          type="text"
          spellCheck="false"
          value={rangeValue}
          onChange={onRuleTypeInputChange}
{'fraction_non_alphanumeric': 0.1453641415618602, 'fraction_numerical': 0.006434630008774495, 'mean_word_length': 2.774834437086093, 'pattern_counts': {'":': 0, '<': 25, '<?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': '7137473', 'n_tokens_mistral': 1018, 'n_tokens_neox': 1006, 'n_words': 209}