mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
31 lines
784 B
JavaScript
31 lines
784 B
JavaScript
import React, { Component } from 'react';
|
|
import { isEqual, omit } from 'lodash';
|
|
|
|
import queryResultInterface from 'interfaces/query_result';
|
|
|
|
class QueryResultsRow extends Component {
|
|
static propTypes = {
|
|
queryResult: queryResultInterface.isRequired,
|
|
};
|
|
|
|
shouldComponentUpdate (nextProps) {
|
|
return !isEqual(this.props.queryResult, nextProps.queryResult);
|
|
}
|
|
|
|
render () {
|
|
const { queryResult } = this.props;
|
|
const { host_hostname: hostHostname } = queryResult;
|
|
const queryColumns = omit(queryResult, ['host_hostname']);
|
|
|
|
return (
|
|
<tr>
|
|
<td>{hostHostname}</td>
|
|
{Object.keys(queryColumns).map((col) => {
|
|
return <td key={col}>{queryColumns[col]}</td>;
|
|
})}
|
|
</tr>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default QueryResultsRow;
|