mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
33 lines
895 B
JavaScript
33 lines
895 B
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
import { isEqual, omit, values } from 'lodash';
|
|
|
|
import queryResultInterface from 'interfaces/query_result';
|
|
|
|
class QueryResultsRow extends Component {
|
|
static propTypes = {
|
|
index: PropTypes.number.isRequired,
|
|
queryResult: queryResultInterface.isRequired,
|
|
};
|
|
|
|
shouldComponentUpdate (nextProps) {
|
|
return !isEqual(this.props.queryResult, nextProps.queryResult);
|
|
}
|
|
|
|
render () {
|
|
const { index, queryResult } = this.props;
|
|
const { hostname } = queryResult;
|
|
const queryAttrs = omit(queryResult, ['hostname']);
|
|
const queryAttrValues = values(queryAttrs);
|
|
|
|
return (
|
|
<tr>
|
|
<td>{hostname}</td>
|
|
{queryAttrValues.map((attribute, i) => {
|
|
return <td key={`query-results-table-row-${index}-${i}`}>{attribute}</td>;
|
|
})}
|
|
</tr>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default QueryResultsRow;
|