|
@@ -10,15 +10,15 @@ type Props = {
|
|
|
userGroupRelations: IUserGroupRelationHasIdPopulatedUser[] | undefined,
|
|
userGroupRelations: IUserGroupRelationHasIdPopulatedUser[] | undefined,
|
|
|
onClickRemoveUserBtn: (username: string) => Promise<void>,
|
|
onClickRemoveUserBtn: (username: string) => Promise<void>,
|
|
|
onClickPlusBtn: () => void,
|
|
onClickPlusBtn: () => void,
|
|
|
|
|
+ isExternalGroup?: false
|
|
|
|
|
+} | {
|
|
|
|
|
+ userGroupRelations: IUserGroupRelationHasIdPopulatedUser[] | undefined,
|
|
|
|
|
+ isExternalGroup: true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const UserGroupUserTable = (props: Props): JSX.Element => {
|
|
export const UserGroupUserTable = (props: Props): JSX.Element => {
|
|
|
const { t } = useTranslation('admin');
|
|
const { t } = useTranslation('admin');
|
|
|
|
|
|
|
|
- const {
|
|
|
|
|
- userGroupRelations, onClickRemoveUserBtn, onClickPlusBtn,
|
|
|
|
|
- } = props;
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<table className="table table-bordered table-user-list">
|
|
<table className="table table-bordered table-user-list">
|
|
|
<thead>
|
|
<thead>
|
|
@@ -30,11 +30,11 @@ export const UserGroupUserTable = (props: Props): JSX.Element => {
|
|
|
<th>{t('Name')}</th>
|
|
<th>{t('Name')}</th>
|
|
|
<th style={{ width: '100px' }}>{t('Created')}</th>
|
|
<th style={{ width: '100px' }}>{t('Created')}</th>
|
|
|
<th style={{ width: '160px' }}>{t('last_login')}</th>
|
|
<th style={{ width: '160px' }}>{t('last_login')}</th>
|
|
|
- <th style={{ width: '70px' }}></th>
|
|
|
|
|
|
|
+ {!props.isExternalGroup && <th style={{ width: '70px' }}></th>}
|
|
|
</tr>
|
|
</tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
<tbody>
|
|
<tbody>
|
|
|
- {userGroupRelations != null && userGroupRelations.map((relation) => {
|
|
|
|
|
|
|
+ {props.userGroupRelations != null && props.userGroupRelations.map((relation) => {
|
|
|
const { relatedUser } = relation;
|
|
const { relatedUser } = relation;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -48,7 +48,7 @@ export const UserGroupUserTable = (props: Props): JSX.Element => {
|
|
|
<td>{relatedUser.name}</td>
|
|
<td>{relatedUser.name}</td>
|
|
|
<td>{relatedUser.createdAt ? dateFnsFormat(new Date(relatedUser.createdAt), 'yyyy-MM-dd') : ''}</td>
|
|
<td>{relatedUser.createdAt ? dateFnsFormat(new Date(relatedUser.createdAt), 'yyyy-MM-dd') : ''}</td>
|
|
|
<td>{relatedUser.lastLoginAt ? dateFnsFormat(new Date(relatedUser.lastLoginAt), 'yyyy-MM-dd HH:mm:ss') : ''}</td>
|
|
<td>{relatedUser.lastLoginAt ? dateFnsFormat(new Date(relatedUser.lastLoginAt), 'yyyy-MM-dd HH:mm:ss') : ''}</td>
|
|
|
- <td>
|
|
|
|
|
|
|
+ {!props.isExternalGroup && <td>
|
|
|
<div className="btn-group admin-user-menu">
|
|
<div className="btn-group admin-user-menu">
|
|
|
<button
|
|
<button
|
|
|
type="button"
|
|
type="button"
|
|
@@ -62,21 +62,21 @@ export const UserGroupUserTable = (props: Props): JSX.Element => {
|
|
|
<button
|
|
<button
|
|
|
className="dropdown-item"
|
|
className="dropdown-item"
|
|
|
type="button"
|
|
type="button"
|
|
|
- onClick={() => onClickRemoveUserBtn(relatedUser.username)}
|
|
|
|
|
|
|
+ onClick={() => props.onClickRemoveUserBtn(relatedUser.username)}
|
|
|
>
|
|
>
|
|
|
<i className="icon-fw icon-user-unfollow"></i> {t('admin:user_group_management.remove_from_group')}
|
|
<i className="icon-fw icon-user-unfollow"></i> {t('admin:user_group_management.remove_from_group')}
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </td>
|
|
|
|
|
|
|
+ </td>}
|
|
|
</tr>
|
|
</tr>
|
|
|
);
|
|
);
|
|
|
})}
|
|
})}
|
|
|
|
|
|
|
|
- <tr>
|
|
|
|
|
|
|
+ {!props.isExternalGroup && <tr>
|
|
|
<td></td>
|
|
<td></td>
|
|
|
<td className="text-center">
|
|
<td className="text-center">
|
|
|
- <button className="btn btn-outline-secondary" type="button" onClick={onClickPlusBtn}>
|
|
|
|
|
|
|
+ <button className="btn btn-outline-secondary" type="button" onClick={props.onClickPlusBtn}>
|
|
|
<i className="ti ti-plus"></i>
|
|
<i className="ti ti-plus"></i>
|
|
|
</button>
|
|
</button>
|
|
|
</td>
|
|
</td>
|
|
@@ -84,11 +84,9 @@ export const UserGroupUserTable = (props: Props): JSX.Element => {
|
|
|
<td></td>
|
|
<td></td>
|
|
|
<td></td>
|
|
<td></td>
|
|
|
<td></td>
|
|
<td></td>
|
|
|
- </tr>
|
|
|
|
|
|
|
+ </tr>}
|
|
|
|
|
|
|
|
</tbody>
|
|
</tbody>
|
|
|
</table>
|
|
</table>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
-export default UserGroupUserTable;
|
|
|