<commit_before>import React from 'react'
import PropTypes from 'prop-types'

import { Link } from 'react-router-dom'
import { Card, CardTitle, CardBody, Col } from 'patternfly-react'
import VmIcon from '../VmIcon'

import style from './style.css'

const HEADER_NAME = 'Header'
const ICON_NAME = 'Icon'
const TITLE_NAME = 'Title'
const STATUS_NAME = 'Status'

const IdPrefixContext = React.createContext('')

class BaseCardHeader extends React.Component {
  render () {
    const { children } = this.props
    return (
      <div>
        {children}
      </div>
    )
  }
}

BaseCardHeader.displayName = HEADER_NAME

BaseCardHeader.propTypes = {
  children: PropTypes.oneOfType([
    PropTypes.arrayOf(PropTypes.node),
    PropTypes.node,
  ]).isRequired,
}

const BaseCardIcon = ({ url, icon }) => (
  url
    ? <Link to={url}>
      <VmIcon icon={icon} className={style['card-pf-icon']}
        missingIconClassName='fa fa-birthday-cake card-pf-icon-circle' />
    </Link>
    : <VmIcon icon={icon} className={style['card-pf-icon']}
      missingIconClassName='fa fa-birthday-cake card-pf-icon-circle' />
)

BaseCardIcon.displayName = ICON_NAME

BaseCardIcon.propTypes = {
  icon: PropTypes.object.isRequired,
  url: PropTypes.string,
}

class BaseCardTitle extends React.Component {
  render () {
    const { url, name } = this.props
    if (url) {
      return (<Link to={url} className={style['vm-detail-link']}>
        <p className={`${style['vm-name']} ${style['crop']}`} title={name} data-toggle='tooltip' id={`${this.context}-name`}>
          {name}
        </p>
      </Link>)
    }
    return (<p className={`${style['vm-name']} ${style['crop']}`} title={name} data-toggle='tooltip' id={`${this.context}-name`}>
      {name}
    </p>)
  }
}

BaseCardTitle.displayName = TITLE_NAME
BaseCardTitle.contextType = IdPrefixContext<commit_msg>VmsList BaseCard update to handle missing OS icon<commit_after>import React from 'react'
import PropTypes from 'prop-types'

import { Link } from 'react-router-dom'
import { Card, CardTitle, CardBody, Col } from 'patternfly-react'
import VmIcon from '../VmIcon'

import style from './style.css'

const HEADER_NAME = 'Header'
const ICON_NAME = 'Icon'
const TITLE_NAME = 'Title'
const STATUS_NAME = 'Status'

const IdPrefixContext = React.createContext('')

class BaseCardHeader extends React.Component {
  render () {
    const { children } = this.props
    return (
      <div>
        {children}
      </div>
    )
  }
}

BaseCardHeader.displayName = HEADER_NAME

BaseCardHeader.propTypes = {
  children: PropTypes.oneOfType([
    PropTypes.arrayOf(PropTypes.node),
    PropTypes.node,
  ]).isRequired,
}

const BaseCardIcon = ({ url, icon }) => {
  const i =
    <VmIcon
      icon={icon}
      className={style['card-pf-icon']}
      missingIconClassName='fa fa-birthday-cake card-pf-icon-circle'
    />

  return (url ? <Link to={url}>{i}</Link> : i)
}

BaseCardIcon.displayName = ICON_NAME

BaseCardIcon.propTypes = {
  icon: PropTypes.object,
  url: PropTypes.string,
}

class BaseCardTitle extends React.Component {
  render () {
    const { url, name } = this.props
    if (url) {
      return (<Link to={url} className={style['vm-detail-link']}>
        <p className={`${style['vm-name']} ${style['crop']}`} title={name} data-toggle='tooltip' id={`${this.context}-name`}>
          {name}
        </p>
      </Link>)
    }
    return (<p className={`${style['vm-name']} ${style['crop']}`} title={name} data-toggle='tooltip' id={`${this.context}-name`}>
      {name}
    </p>)
  }
}

BaseCardTitle.displayName = TITLE_NAME
BaseCardTitle.contextType = IdPrefixContext
{'fraction_non_alphanumeric': 0.15981231024013248, 'fraction_numerical': 0.0, 'mean_word_length': 3.569987389659521, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 28, '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': '7201891', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1211, 'n_words': 255}