/* eslint-disable react/prop-types */ import React from "react"; import { Column, Row } from "react-table"; import { IStringCellProps } from "interfaces/datatable_config"; import { IHost } from "interfaces/host"; import TextCell from "components/TableContainer/DataTable/TextCell"; import LiveQueryIssueCell from "components/TableContainer/DataTable/LiveQueryIssueCell/LiveQueryIssueCell"; import StatusIndicator from "components/StatusIndicator"; import Button from "components/buttons/Button"; import Icon from "components/Icon/Icon"; export type ITargestInputHostTableConfig = Column; type ITableStringCellProps = IStringCellProps; // NOTE: cellProps come from react-table // more info here https://react-table.tanstack.com/docs/api/useTable#cell-properties export const generateTableHeaders = ( handleRowRemove?: (value: Row) => void ): ITargestInputHostTableConfig[] => { const deleteHeader = handleRowRemove ? [ { id: "delete", Header: "", Cell: (cellProps: ITableStringCellProps) => ( ), disableHidden: true, }, ] : []; return [ { Header: "Host", accessor: "display_name", Cell: (cellProps: ITableStringCellProps) => { return ( ); }, }, // TODO: Consider removing status column from selected hosts table because // status info is not refreshed once a target has been selected { Header: "Status", disableSortBy: true, accessor: "status", Cell: (cellProps) => , }, { Header: "Private IP address", accessor: "primary_ip", Cell: (cellProps) => , }, { Header: "MAC address", accessor: "primary_mac", Cell: (cellProps) => , }, { Header: "OS", accessor: "os_version", Cell: (cellProps) => , }, { Header: "Osquery", accessor: "osquery_version", Cell: (cellProps) => , }, ...deleteHeader, ]; }; export default null;