fleet/frontend/pages/admin/UserManagementPage/UsersTableConfig.tsx
Gabe Hernandez d0ded91d0b partial implementation of user table with generic table and new create user form (#500)
* use new data table in user manage page'

* remove default empty array hiddenColumns props, was causing render performance problems

* remove unused tooltip in hostcontainer

* add search to user manage table

* add query params to user GET requests

* move createUserForm closer to user management page

* starting to implement create user modal

* starting to add team checking functionality to create user

* styling of select team form

* changing logic for selectedTeamsForm, simplifying

* updated SelectedTeamsForm to handle own state and pass back relevant state to parent

* created reusable infobanner component and use it in osquery options page

* use infobanner in createuserform

* create new Radio component and use in createuserform

* create new Radio component and use in createuserform

* added new radio buttons to createUserForm

* finish custom radio button styling

* finish styling of radio in createUserForm

* fix and add entities/users#loadAll tests

* remove unneeded tests and updated broken ones on UserManagementPage

* remove unused modules
2021-03-31 11:58:29 -07:00

76 lines
2.3 KiB
TypeScript

import React from 'react';
import HeaderCell from 'components/DataTable/HeaderCell/HeaderCell';
// import StatusCell from 'components/DataTable/StatusCell/StatusCell';
import TextCell from 'components/DataTable/TextCell/TextCell';
import { IUser } from 'interfaces/user';
interface IHeaderProps {
column: {
title: string;
isSortedDesc: boolean;
}
}
interface ICellProps {
cell: {
value: string;
};
row: {
original: IUser;
};
}
interface IDataColumn {
title: string;
Header: ((props: IHeaderProps) => JSX.Element) | string;
accessor: string;
Cell: (props: ICellProps) => JSX.Element;
disableHidden?: boolean;
disableSortBy?: boolean;
}
const usersTableHeaders: IDataColumn[] = [
{
title: 'Name',
Header: cellProps => <HeaderCell value={cellProps.column.title} isSortedDesc={cellProps.column.isSortedDesc} />,
accessor: 'name',
Cell: cellProps => <TextCell value={cellProps.cell.value} />,
},
// TODO: need to add this info to API
// {
// title: 'Status',
// Header: 'Status',
// accessor: 'status',
// Cell: cellProps => <StatusCell value={cellProps.cell.value} />,
// },
{
title: 'Email',
Header: cellProps => <HeaderCell value={cellProps.column.title} isSortedDesc={cellProps.column.isSortedDesc} />,
accessor: 'email',
Cell: cellProps => <TextCell value={cellProps.cell.value} />,
},
// TODO: need to add this info to API
// {
// title: 'Teams',
// Header: cellProps => <HeaderCell value={cellProps.column.title} isSortedDesc={cellProps.column.isSortedDesc} />,
// accessor: 'osquery_version',
// Cell: cellProps => <TextCell value={cellProps.cell.value} />,
// },
// TODO: need to add this info to API
// {
// title: 'Roles',
// Header: cellProps => <HeaderCell value={cellProps.column.title} isSortedDesc={cellProps.column.isSortedDesc} />,
// accessor: 'primary_ip',
// Cell: cellProps => <TextCell value={cellProps.cell.value} />,
// },
// TODO: figure out this column accessor
// {
// title: 'Actions',
// Header: cellProps => <HeaderCell value={cellProps.column.title} isSortedDesc={cellProps.column.isSortedDesc} />,
// accessor: 'actions',
// Cell: cellProps => <TextCell value={cellProps.cell.value} formatter={humanHostLastSeen} />,
// },
];
export default usersTableHeaders;