import React from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import dateFnsFormat from 'date-fns/format'; import { UserPicture } from '@growi/ui'; import { withUnstatedContainers } from '../../UnstatedUtils'; import AppContainer from '~/client/services/AppContainer'; import AdminUserGroupDetailContainer from '~/client/services/AdminUserGroupDetailContainer'; import { toastSuccess, toastError } from '~/client/util/apiNotification'; class UserGroupUserTable extends React.Component { constructor(props) { super(props); this.xss = window.xss; this.removeUser = this.removeUser.bind(this); } async removeUser(username) { try { await this.props.adminUserGroupDetailContainer.removeUserByUsername(username); toastSuccess(`Removed "${this.xss.process(username)}" from "${this.xss.process(this.props.adminUserGroupDetailContainer.state.userGroup.name)}"`); } catch (err) { // eslint-disable-next-line max-len toastError(new Error(`Unable to remove "${this.xss.process(username)}" from "${this.xss.process(this.props.adminUserGroupDetailContainer.state.userGroup.name)}"`)); } } render() { const { t, adminUserGroupDetailContainer } = this.props; return (
| # | {t('username')} | {t('Name')} | {t('Created')} | {t('Last_Login')} | |
|---|---|---|---|---|---|
|
|
{relatedUser.username} | {relatedUser.name} | {relatedUser.createdAt ? dateFnsFormat(new Date(relatedUser.createdAt), 'yyyy-MM-dd') : ''} | {relatedUser.lastLoginAt ? dateFnsFormat(new Date(relatedUser.lastLoginAt), 'yyyy-MM-dd HH:mm:ss') : ''} |
|