<commit_before>import React, { PropTypes } from 'react'
import classnames from 'classnames'
import { statusPageURL } from 'utils/settings'
import classes from './Header.scss'

export default class Header extends React.Component {
  static propTypes = {
    username: PropTypes.string,
    fetchUser: PropTypes.func.isRequired,
    signOut: PropTypes.func.isRequired
  }

  componentDidMount () {
    this.props.fetchUser()
  }

  renderUserMenu = () => {
    return (
      <div>
        <button id='header-user-menu'
          className={classnames('mdl-button', 'mdl-js-button', classes.nav_item)}>
           {this.props.username}
          <i className='material-icons'>keyboard_arrow_down</i>
        </button>

        <ul className='mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect'
          htmlFor='header-user-menu'>
          <li className='mdl-menu__item mdl-menu__item--full-bleed-divider' onClick={this.props.signOut}>Sign out</li>
        </ul>
      </div>
    )
  }

  render () {
    const userMenu = this.renderUserMenu()
    return (<header className={classnames('mdl-layout__header', 'mdl-layout--no-drawer-button', classes.header)}>
      <div className='mdl-layout__header-row'>
        <span className='mdl-layout-title'>LambStatus Admin</span>
        <div className='mdl-layout-spacer' />
        <nav className='mdl-navigation'>
          <a className={classnames('mdl-button', 'mdl-js-button', classes.nav_item)} href={'https://' + statusPageURL}>
            View Status Page
          </a>
          {userMenu}
        </nav>
      </div>
    </header>)
  }
}<commit_msg>Fix user menu not shown bug<commit_after>import React, { PropTypes } from 'react'
import ReactDOM from 'react-dom'
import classnames from 'classnames'
import { statusPageURL } from 'utils/settings'
import classes from './Header.scss'

export default class Header extends React.Component {
  static propTypes = {
    username: PropTypes.string,
    fetchUser: PropTypes.func.isRequired,
    signOut: PropTypes.func.isRequired
  }

  componentDidMount () {
    this.props.fetchUser()

    let jsElem = ReactDOM.findDOMNode(this.refs.menu)
    componentHandler.upgradeElement(jsElem)
  }

  renderUserMenu = () => {
    return (
      <div>
        <button id='header-user-menu'
          className={classnames('mdl-button', 'mdl-js-button', classes.nav_item)}>
           {this.props.username}
          <i className='material-icons'>keyboard_arrow_down</i>
        </button>

        <ul className='mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect'
          htmlFor='header-user-menu' ref='menu'>
          <li className='mdl-menu__item mdl-menu__item--full-bleed-divider' onClick={this.props.signOut}>Sign out</li>
        </ul>
      </div>
    )
  }

  render () {
    const userMenu = this.renderUserMenu()
    return (<header className={classnames('mdl-layout__header', 'mdl-layout--no-drawer-button', classes.header)}>
      <div className='mdl-layout__header-row'>
        <span className='mdl-layout-title'>LambStatus Admin</span>
        <div className='mdl-layout-spacer' />
        <nav className='mdl-navigation'>
          <a className={classnames('mdl-button', 'mdl-js-button', classes.nav_item)} href={'https://' + statusPageURL}>
            View Status Page
          </a>
          {userMenu}
        </nav>
      </div>
    </header>)
  }
}
{'fraction_non_alphanumeric': 0.1452991452991453, 'fraction_numerical': 0.0, 'mean_word_length': 2.856818181818182, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 47, 'https://': 2, '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': '1783685', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1058, 'n_words': 194}