Skip to content

Commit

Permalink
fix: Switch to App list, ui thread blocked (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnywx authored Sep 11, 2018
1 parent ffebe0c commit c5f2e81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
14 changes: 7 additions & 7 deletions src/components/Base/Table/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ import React from 'react';
import RcTable from 'rc-table';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { isEqual } from 'lodash';
import { isEqual, noop } from 'lodash';

// import Status from 'components/Status';
import { Checkbox, Radio, Popover, Tooltip, Icon, Pagination } from 'components/Base';
import { Checkbox, Radio, Popover, Icon, Pagination } from 'components/Base';
import Loading from 'components/Loading';
import NoData from './noData';

import styles from './index.scss';

const noop = () => {};

export default class Table extends React.Component {
static propTypes = {
prefixCls: PropTypes.string,
Expand Down Expand Up @@ -340,14 +337,17 @@ export default class Table extends React.Component {
render() {
const { className, style, pagination, isLoading, rowSelection } = this.props;
const { selectedRowKeys } = this.state;
const onSelectRow = rowSelection.onChange || noop;

return (
<Loading className="loadTable" isLoading={isLoading}>
{pagination.total > 0 ? (
<div className={classNames(styles.table, className)} style={style}>
{this.renderTable()}
<Pagination {...pagination} selectedRows={selectedRowKeys} onSelectRow={onSelectRow} />
<Pagination
{...pagination}
selectedRows={selectedRowKeys}
onSelectRow={rowSelection.onChange || noop}
/>
</div>
) : (
<NoData type={pagination.tableType} />
Expand Down
9 changes: 4 additions & 5 deletions src/pages/Admin/Apps/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ import TimeShow from 'components/TimeShow';
import styles from './index.scss';

@translate()
@inject(({ rootStore, sessInfo, sock }) => ({
@inject(({ rootStore, sessInfo }) => ({
rootStore,
appStore: rootStore.appStore,
categoryStore: rootStore.categoryStore,
repoStore: rootStore.repoStore,
sessInfo,
sock
sessInfo
}))
@observer
export default class Apps extends Component {
Expand All @@ -31,7 +30,7 @@ export default class Apps extends Component {
await appStore.appStatistics();
await repoStore.fetchAll({
status: ['active', 'deleted'],
limit: 99
noLimit: true
});
await categoryStore.fetchAll();
}
Expand Down Expand Up @@ -301,7 +300,7 @@ export default class Apps extends Component {
{this.renderToolbar()}
<Table
columns={columns}
dataSource={apps.toJSON()}
dataSource={apps.slice(0, 10)}
rowSelection={rowSelection}
isLoading={isLoading}
filterList={filterList}
Expand Down

0 comments on commit c5f2e81

Please sign in to comment.