import React, { Component, PropTypes } from 'react'; import { noop } from 'lodash'; import AceEditor from 'react-ace'; import classnames from 'classnames'; import hostHelpers from 'components/hosts/HostDetails/helpers'; import Icon from 'components/icons/Icon'; import targetInterface from 'interfaces/target'; const baseClass = 'target-details'; class TargetDetails extends Component { static propTypes = { target: targetInterface, className: PropTypes.string, handleBackToResults: PropTypes.func, }; static defaultProps = { handleBackToResults: noop, }; onlineHosts = (labelBaseClass, online) => { if (online > 0) { return ( ({online}% ONLINE) ); } return false; }; renderHost = () => { const { className, handleBackToResults, target } = this.props; const { display_text: displayText, ip, mac, memory, osqueryVersion, osVersion, platform, status, } = target; const hostBaseClass = 'host-target'; const isOnline = status === 'online'; const isOffline = status === 'offline'; const statusClassName = classnames( `${hostBaseClass}__status`, { [`${hostBaseClass}__status--is-online`]: isOnline }, { [`${hostBaseClass}__status--is-offline`]: isOffline }, ); return (
{isOnline &&
| IP Address | {ip} |
|---|---|
| MAC Address | {mac} |
| Platform |
|
| Operating System | {osVersion} |
| Osquery Version | {osqueryVersion} |
| Memory | {hostHelpers.humanMemory(memory)} |
{count}HOSTS { onlineHosts(labelBaseClass, online) }
{description || 'No Description'}
{labelType !== 1 &&