import { faX } from '@fortawesome/free-solid-svg-icons'; import { useNotificationContext } from '~/components/context/Notifications/NotificationProvider'; import deleteServiceToken from "../../../pages/api/serviceToken/deleteServiceToken"; import guidGenerator from '../../utilities/randomId'; import Button from '../buttons/Button'; interface TokenProps { _id: string; name: string; environment: string; expiresAt: string; } interface ServiceTokensProps { data: TokenProps[]; workspaceName: string; setServiceTokens: (value: TokenProps[]) => void; } /** * This is the component that we utilize for the service token table * #TODO: add the possibility of choosing and doing operations on multiple users. * @param {object} obj * @param {any[]} obj.data - current state of the service token table * @param {string} obj.workspaceName - name of the current project * @param {function} obj.setServiceTokens - updating the state of the service token table * @returns */ const ServiceTokenTable = ({ data, workspaceName, setServiceTokens }: ServiceTokensProps) => { const { createNotification } = useNotificationContext(); return (
{data?.length > 0 ? ( data?.map((row) => { return ( ); }) ) : ( )}
TOKEN NAME PROJECT ENVIRONMENT VAILD UNTIL
{row.name} {workspaceName} {row.environment} {new Date(row.expiresAt).toUTCString()}
No service tokens yet
); }; export default ServiceTokenTable;