<commit_before>import React, {PropTypes, Component} from 'react'
import ConfirmButtons from 'shared/components/ConfirmButtons'

class DashboardEditHeader extends Component {
  constructor(props) {
    super(props)

    const {dashboard: {name}} = props
    this.state = {name}
    this.handleChange = ::this.handleChange
    this.handleFormSubmit = ::this.handleFormSubmit
    this.handleKeyUp = ::this.handleKeyUp
  }

  handleChange(name) {
    this.setState({name})
  }

  handleFormSubmit(e) {
    e.preventDefault()
    const name = e.target.name.value
    this.props.onSave(name)
  }

  handleKeyUp(e) {
    const {dashboard: {name}, onCancel} = this.props
    if (e.key === 'Escape') {
      this.setState({name})
      onCancel()
    }
  }

  render() {
    const {onSave, onCancel} = this.props
    const {name} = this.state

    return (
      <div className="page-header full-width">
        <div className="page-header__container">
          <form className="page-header__left" onSubmit={this.handleFormSubmit}>
            <input
              className="page-header--editing"
              name="name"
              autoFocus={true}
              value={name}
              placeholder="Name this Dashboard"
              onChange={e => this.handleChange(e.target.value)}
              onKeyUp={this.handleKeyUp}
            />
          </form>
          <ConfirmButtons item={name} onConfirm={onSave} onCancel={onCancel} />
        </div>
      </div>
    )
  }
}

const {shape, func} = PropTypes

DashboardEditHeader.propTypes = {
  dashboard: shape({}),
  onCancel: func.isRequired,
  onSave: func.isRequired,
}

export default DashboardEditHeader<commit_msg>Add autoComplete disable attribute to input.<commit_after>import React, {PropTypes, Component} from 'react'
import ConfirmButtons from 'shared/components/ConfirmButtons'

class DashboardEditHeader extends Component {
  constructor(props) {
    super(props)

    const {dashboard: {name}} = props
    this.state = {name}
    this.handleChange = ::this.handleChange
    this.handleFormSubmit = ::this.handleFormSubmit
    this.handleKeyUp = ::this.handleKeyUp
  }

  handleChange(name) {
    this.setState({name})
  }

  handleFormSubmit(e) {
    e.preventDefault()
    const name = e.target.name.value
    this.props.onSave(name)
  }

  handleKeyUp(e) {
    const {dashboard: {name}, onCancel} = this.props
    if (e.key === 'Escape') {
      this.setState({name})
      onCancel()
    }
  }

  render() {
    const {onSave, onCancel} = this.props
    const {name} = this.state

    return (
      <div className="page-header full-width">
        <div className="page-header__container">
          <form className="page-header__left" onSubmit={this.handleFormSubmit}>
            <input
              className="page-header--editing"
              name="name"
              autoFocus={true}
              value={name}
              placeholder="Name this Dashboard"
              onChange={e => this.handleChange(e.target.value)}
              onKeyUp={this.handleKeyUp}
              autoComplete="off"
            />
          </form>
          <ConfirmButtons item={name} onConfirm={onSave} onCancel={onCancel} />
        </div>
      </div>
    )
  }
}

const {shape, func} = PropTypes

DashboardEditHeader.propTypes = {
  dashboard: shape({}),
  onCancel: func.isRequired,
  onSave: func.isRequired,
}

export default DashboardEditHeader
{'fraction_non_alphanumeric': 0.12580456407255705, 'fraction_numerical': 0.0, 'mean_word_length': 2.591386554621849, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '5825936', 'n_tokens_mistral': 1018, 'n_tokens_neox': 1027, 'n_words': 197}