mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
* Amend policy creation (proprietary query), add update APIs * Fix Datastore.SavePolicy bug (and add tests) * Add integration tests for new policy APIs * Add author email * Add activities * Push breaking changes for return policy fields * WIP * Add integration test for host policies * Make more improvements to policy representation * Improve upgrade code (from PR review comments) * PR changes * Revert activities for policies * Use *uint instead of uint for queryID, use fleet.PolicyPayload * Filter out other schemas * New policy flow (#2922) * created new policy flow -- no API connection * added api props * fixed prop name * lint fixes * removed unused modal; fixed style * name, desc icons; created global components * lint fixes * ignoring certain files and lines for prettier * Update frontend/pages/policies/PolicyPage/PolicyPage.tsx * Make policy names unique across deployment * Amend upgrade script * Fix migration for unique names * Do not deduplicate but instead rename policies Co-authored-by: Martavis Parker <47053705+martavis@users.noreply.github.com>
74 lines
2 KiB
TypeScript
74 lines
2 KiB
TypeScript
/* eslint-disable react/prop-types */
|
|
|
|
import React from "react";
|
|
import { Cell } from "react-table";
|
|
|
|
import { IDataColumn } from "interfaces/datatable_config";
|
|
|
|
// @ts-ignore
|
|
import TextCell from "components/TableContainer/DataTable/TextCell";
|
|
import StatusCell from "components/TableContainer/DataTable/StatusCell/StatusCell";
|
|
import RemoveIcon from "../../../assets/images/icon-action-remove-20x20@2x.png";
|
|
|
|
// NOTE: cellProps come from react-table
|
|
// more info here https://react-table.tanstack.com/docs/api/useTable#cell-properties
|
|
export const generateTableHeaders = (showDelete: boolean): IDataColumn[] => {
|
|
const deleteHeader = showDelete
|
|
? [
|
|
{
|
|
id: "delete",
|
|
Header: "",
|
|
Cell: (cellProps: Cell): JSX.Element => (
|
|
<div>
|
|
<img alt="Remove" src={RemoveIcon} />
|
|
</div>
|
|
),
|
|
disableHidden: true,
|
|
},
|
|
]
|
|
: [];
|
|
|
|
return [
|
|
{
|
|
title: "Hostname",
|
|
Header: "Hostname",
|
|
disableSortBy: true,
|
|
accessor: "hostname",
|
|
Cell: (cellProps) => <TextCell value={cellProps.cell.value} />,
|
|
},
|
|
{
|
|
title: "Status",
|
|
Header: "Status",
|
|
disableSortBy: true,
|
|
accessor: "status",
|
|
Cell: (cellProps) => <StatusCell value={cellProps.cell.value} />,
|
|
},
|
|
{
|
|
title: "IP address",
|
|
Header: "IP address",
|
|
accessor: "primary_ip",
|
|
Cell: (cellProps) => <TextCell value={cellProps.cell.value} />,
|
|
},
|
|
{
|
|
title: "MAC address",
|
|
Header: "MAC address",
|
|
accessor: "primary_mac",
|
|
Cell: (cellProps) => <TextCell value={cellProps.cell.value} />,
|
|
},
|
|
{
|
|
title: "OS",
|
|
Header: "OS",
|
|
accessor: "os_version",
|
|
Cell: (cellProps) => <TextCell value={cellProps.cell.value} />,
|
|
},
|
|
{
|
|
title: "Osquery",
|
|
Header: "Osquery",
|
|
accessor: "osquery_version",
|
|
Cell: (cellProps) => <TextCell value={cellProps.cell.value} />,
|
|
},
|
|
...deleteHeader,
|
|
];
|
|
};
|
|
|
|
export default null;
|