fleet/frontend/components/queries/QueryResultsTable/QueryResultsRow.jsx
Gabe Hernandez efb35b537a
add prettier and have it format all fleet application code (#625)
* add prettier and have it format all js code except website:
:

* trying running prettier check in CI

* fix runs on in CI

* change CI job name

* fix prettier erros and fix CI
2021-04-12 14:32:25 +01:00

31 lines
782 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;