mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
* Allow sort by more than one key * created custom tooltip component * remove unused code * fixed style for more layouts * added tooltip to query side panel * tooltips added to setting form * finished settings form * added tooltip for perf impact table headers * tooltip for pack table and user form * tooltip on manage policies page * tooltip for manage schedules * tooltip for automations; spacing for form input * tooltip for automations modal * user form; fixed input with icon component * more user form tooltips * tooltip for homepage; style fixes * replaced many more tooltips with new version * added story for tooltip * added position prop * fixed tests * re-work how we click react-select dropdowns * forcing the update button click * trying a blur * fixed typo * trying blur on another element * temp check-in * replaced tooltip from host details software * more consolidation of tooltip use for software * fixed settings flow test Co-authored-by: Tomas Touceda <chiiph@gmail.com>
65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import React from "react";
|
|
|
|
import HeaderCell from "components/TableContainer/DataTable/HeaderCell/HeaderCell";
|
|
import TextCell from "components/TableContainer/DataTable/TextCell";
|
|
import TooltipWrapper from "components/TooltipWrapper";
|
|
|
|
interface IHeaderProps {
|
|
column: {
|
|
title: string;
|
|
isSortedDesc: boolean;
|
|
};
|
|
}
|
|
interface ICellProps {
|
|
cell: {
|
|
value: any;
|
|
};
|
|
row: {
|
|
original: { user: string };
|
|
};
|
|
}
|
|
|
|
interface IDataColumn {
|
|
title: string;
|
|
Header: ((props: IHeaderProps) => JSX.Element) | string;
|
|
accessor: string;
|
|
Cell: (props: ICellProps) => JSX.Element;
|
|
disableHidden?: boolean;
|
|
disableSortBy?: boolean;
|
|
sortType?: string;
|
|
}
|
|
|
|
// NOTE: cellProps come from react-table
|
|
// more info here https://react-table.tanstack.com/docs/api/useTable#cell-properties
|
|
const generateUsersTableHeaders = (): IDataColumn[] => {
|
|
return [
|
|
{
|
|
title: "Username",
|
|
Header: (cellProps) => (
|
|
<HeaderCell
|
|
value={cellProps.column.title}
|
|
isSortedDesc={cellProps.column.isSortedDesc}
|
|
/>
|
|
),
|
|
disableSortBy: false,
|
|
sortType: "caseInsensitive",
|
|
accessor: "username",
|
|
Cell: (cellProps) => <TextCell value={cellProps.cell.value} />,
|
|
},
|
|
{
|
|
title: "Shell",
|
|
Header: () => {
|
|
return (
|
|
<TooltipWrapper tipContent="The command line shell, such as bash,<br />that this user is equipped with by<br />default when they log in to the system.">
|
|
Shell
|
|
</TooltipWrapper>
|
|
);
|
|
},
|
|
disableSortBy: true,
|
|
accessor: "shell",
|
|
Cell: (cellProps) => <TextCell value={cellProps.cell.value} />,
|
|
},
|
|
];
|
|
};
|
|
|
|
export default generateUsersTableHeaders;
|