|
@@ -1,11 +1,13 @@
|
|
|
import React, { Fragment } from 'react';
|
|
import React, { Fragment } from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
import { withTranslation } from 'react-i18next';
|
|
|
-import dateFnsFormat from 'date-fns/format';
|
|
|
|
|
|
|
+
|
|
|
|
|
+import PaginationWrapper from '../../PaginationWrapper';
|
|
|
|
|
|
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
import AppContainer from '../../../services/AppContainer';
|
|
import AppContainer from '../../../services/AppContainer';
|
|
|
import AdminExternalAccountsContainer from '../../../services/AdminExternalAccountsContainer';
|
|
import AdminExternalAccountsContainer from '../../../services/AdminExternalAccountsContainer';
|
|
|
|
|
+import ExternalAccountTable from './ExternalAccountTable';
|
|
|
import { toastSuccess, toastError } from '../../../util/apiNotification';
|
|
import { toastSuccess, toastError } from '../../../util/apiNotification';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -18,6 +20,10 @@ class ManageExternalAccount extends React.Component {
|
|
|
this.removeExtenalAccount = this.removeExtenalAccount.bind(this);
|
|
this.removeExtenalAccount = this.removeExtenalAccount.bind(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ componentWillMount() {
|
|
|
|
|
+ this.handlePage(1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
async handlePage(selectedPage) {
|
|
async handlePage(selectedPage) {
|
|
|
try {
|
|
try {
|
|
|
await this.props.adminExternalAccountsContainer.retrieveExternalAccountsByPagingNum(selectedPage);
|
|
await this.props.adminExternalAccountsContainer.retrieveExternalAccountsByPagingNum(selectedPage);
|
|
@@ -41,6 +47,16 @@ class ManageExternalAccount extends React.Component {
|
|
|
render() {
|
|
render() {
|
|
|
const { t, adminExternalAccountsContainer } = this.props;
|
|
const { t, adminExternalAccountsContainer } = this.props;
|
|
|
|
|
|
|
|
|
|
+ const pager = (
|
|
|
|
|
+ <div className="pull-right">
|
|
|
|
|
+ <PaginationWrapper
|
|
|
|
|
+ activePage={adminExternalAccountsContainer.state.activePage}
|
|
|
|
|
+ changePage={this.handlePage}
|
|
|
|
|
+ totalItemsCount={adminExternalAccountsContainer.state.totalAccounts}
|
|
|
|
|
+ pagingLimit={adminExternalAccountsContainer.state.pagingLimit}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
return (
|
|
return (
|
|
|
<Fragment>
|
|
<Fragment>
|
|
|
<p>
|
|
<p>
|
|
@@ -52,81 +68,10 @@ class ManageExternalAccount extends React.Component {
|
|
|
|
|
|
|
|
<h2>{ t('user_management.external_account_list') }</h2>
|
|
<h2>{ t('user_management.external_account_list') }</h2>
|
|
|
|
|
|
|
|
- <table className="table table-bordered table-user-list">
|
|
|
|
|
- <thead>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <th width="120px">{ t('user_management.authentication_provider') }</th>
|
|
|
|
|
- <th><code>accountId</code></th>
|
|
|
|
|
- <th>{ t('user_management.related_username', 'username') }</th>
|
|
|
|
|
- <th>
|
|
|
|
|
- { t('user_management.password_setting') }
|
|
|
|
|
- <div
|
|
|
|
|
- className="text-muted"
|
|
|
|
|
- data-toggle="popover"
|
|
|
|
|
- data-placement="top"
|
|
|
|
|
- data-trigger="hover focus"
|
|
|
|
|
- tabIndex="0"
|
|
|
|
|
- role="button"
|
|
|
|
|
- data-animation="false"
|
|
|
|
|
- data-html="true"
|
|
|
|
|
- data-content={t('user_management.password_setting_help')}
|
|
|
|
|
- >
|
|
|
|
|
- <small>
|
|
|
|
|
- <i className="icon-question" aria-hidden="true"></i>
|
|
|
|
|
- </small>
|
|
|
|
|
- </div>
|
|
|
|
|
- </th>
|
|
|
|
|
- <th width="100px">{ t('Created') }</th>
|
|
|
|
|
- <th width="70px"></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </thead>
|
|
|
|
|
- <tbody>
|
|
|
|
|
- {adminExternalAccountsContainer.state.exteranalAccounts.map((ea) => {
|
|
|
|
|
- const { externalAccount } = ea;
|
|
|
|
|
- return (
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>{externalAccount.providerType}</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <strong>{externalAccount.accountId}</strong>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <strong>{externalAccount.user.username}</strong>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>
|
|
|
|
|
- { externalAccount.password
|
|
|
|
|
- ? (
|
|
|
|
|
- <span className="label label-info">
|
|
|
|
|
- { t('user_management.set') }
|
|
|
|
|
- </span>
|
|
|
|
|
- )
|
|
|
|
|
- : (
|
|
|
|
|
- <span className="label label-warning">
|
|
|
|
|
- { t('user_management.unset') }
|
|
|
|
|
- </span>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>{dateFnsFormat(new Date(externalAccount.createdAt), 'yyyy-MM-dd')}</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <div className="btn-group admin-user-menu">
|
|
|
|
|
- <button type="button" className="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
|
|
|
|
|
- <i className="icon-settings"></i> <span className="caret"></span>
|
|
|
|
|
- </button>
|
|
|
|
|
- <ul className="dropdown-menu" role="menu">
|
|
|
|
|
- <li className="dropdown-header">{ t('user_management.edit_menu') }</li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <a onClick={() => { return this.removeExtenalAccount(externalAccount.accountId) }}>
|
|
|
|
|
- <i className="icon-fw icon-fire text-danger"></i> { t('Delete') }
|
|
|
|
|
- </a>
|
|
|
|
|
- </li>
|
|
|
|
|
- </ul>
|
|
|
|
|
- </div>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- );
|
|
|
|
|
- })}
|
|
|
|
|
- </tbody>
|
|
|
|
|
- </table>
|
|
|
|
|
|
|
+ { pager }
|
|
|
|
|
+ <ExternalAccountTable />
|
|
|
|
|
+ { pager }
|
|
|
|
|
+
|
|
|
</Fragment>
|
|
</Fragment>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|