import { css } from '@emotion/css'; import { t } from 'i18next'; import { PureComponent } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { Button, Icon, LoadingPlaceholder } from '@grafana/ui'; import { Trans } from 'app/core/internationalization'; import { formatDate } from 'app/core/internationalization/dates'; import { UserSession } from 'app/types'; interface Props { sessions: UserSession[]; isLoading: boolean; revokeUserSession: (tokenId: number) => void; } class UserSessions extends PureComponent { render() { const { isLoading, sessions, revokeUserSession } = this.props; const styles = getStyles(); if (isLoading) { return Loading sessions...} />; } return (
{sessions.length > 0 && ( <>

Sessions

{sessions.map((session: UserSession, index) => ( {session.isActive ? : } ))}
Last seen Logged on IP address Browser & OS
Now{session.seenAt}{formatDate(session.createdAt, { dateStyle: 'long' })} {session.clientIp} {session.browser} on {session.os} {session.osVersion}
)}
); } } const getStyles = () => ({ wrapper: css({ maxWidth: '100%', }), }); export default UserSessions;