mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
* 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
45 lines
1 KiB
TypeScript
45 lines
1 KiB
TypeScript
import React from 'react';
|
|
import { useDispatch } from 'react-redux';
|
|
import { push } from 'react-router-redux';
|
|
|
|
import { IHost } from 'interfaces/host';
|
|
import helpers from 'kolide/helpers';
|
|
import PATHS from 'router/paths';
|
|
import Button from 'components/buttons/Button/Button';
|
|
|
|
interface ILinkCellProps {
|
|
value: string;
|
|
host: IHost;
|
|
}
|
|
|
|
const LinkCell = (props: ILinkCellProps): JSX.Element => {
|
|
const { value, host } = props;
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const onHostClick = (selectedHost: IHost): void => {
|
|
dispatch(push(PATHS.HOST_DETAILS(selectedHost)));
|
|
};
|
|
|
|
const lastSeenTime = (status: string, seenTime: string): string => {
|
|
const { humanHostLastSeen } = helpers;
|
|
|
|
if (status !== 'online') {
|
|
return `Last Seen: ${humanHostLastSeen(seenTime)} UTC`;
|
|
}
|
|
|
|
return 'Online';
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
onClick={() => onHostClick(host)}
|
|
variant="text-link"
|
|
title={lastSeenTime(host.status, host.seen_time)}
|
|
>
|
|
{value}
|
|
</Button>
|
|
);
|
|
};
|
|
|
|
export default LinkCell;
|