|
1 | | -import { Card, Col, Row, Button, Table, Tag, Dropdown, Menu, Modal } from 'antd'; |
| 1 | +import { Card, Col, Row, Button, Table, Tag, Dropdown, Menu, Modal, Input } from 'antd'; |
2 | 2 | import * as React from 'react'; |
3 | 3 | import { EntityDto } from 'src/services/dto/entityDto'; |
4 | 4 | import CreateOrUpdateTenant from './components/createOrUpdateTenant'; |
5 | 5 | import { inject, observer } from 'mobx-react'; |
6 | | -import { __await } from 'tslib'; |
7 | 6 | import Stores from 'src/stores/storeIdentifier'; |
8 | 7 | import TenantStore from 'src/stores/tenantStore'; |
9 | 8 | import { L } from 'src/lib/abpUtility'; |
| 9 | +import AppComponentBase from 'src/components/AppComponentBase'; |
10 | 10 |
|
11 | 11 | export interface ITenantProps { |
12 | 12 | tenantStore: TenantStore; |
13 | 13 | } |
14 | 14 |
|
| 15 | +export interface ITenantState { |
| 16 | + modalVisible: boolean; |
| 17 | + maxResultCount: number; |
| 18 | + skipCount: number; |
| 19 | + tenantId: number; |
| 20 | + filter: string; |
| 21 | +} |
| 22 | + |
15 | 23 | const confirm = Modal.confirm; |
| 24 | +const Search = Input.Search; |
16 | 25 |
|
17 | 26 | @inject(Stores.TenantStore) |
18 | 27 | @observer |
19 | | -class Tenant extends React.Component<ITenantProps> { |
| 28 | +class Tenant extends AppComponentBase<ITenantProps, ITenantState> { |
20 | 29 | formRef: any; |
21 | 30 |
|
22 | 31 | state = { |
23 | 32 | modalVisible: false, |
24 | 33 | maxResultCount: 10, |
25 | 34 | skipCount: 0, |
26 | 35 | tenantId: 0, |
| 36 | + filter: '', |
27 | 37 | }; |
28 | 38 |
|
29 | 39 | async componentDidMount() { |
30 | 40 | await this.getAll(); |
31 | 41 | } |
32 | 42 |
|
33 | 43 | async getAll() { |
34 | | - await this.props.tenantStore.getAll({ maxResultCount: this.state.maxResultCount, skipCount: this.state.skipCount }); |
| 44 | + await this.props.tenantStore.getAll({ maxResultCount: this.state.maxResultCount, skipCount: this.state.skipCount, keyword: this.state.filter }); |
35 | 45 | } |
36 | 46 |
|
37 | 47 | handleTableChange = (pagination: any) => { |
@@ -97,6 +107,10 @@ class Tenant extends React.Component<ITenantProps> { |
97 | 107 | this.formRef = formRef; |
98 | 108 | }; |
99 | 109 |
|
| 110 | + handleSearch = (value: string) => { |
| 111 | + this.setState({ filter: value }, async () => await this.getAll()); |
| 112 | + }; |
| 113 | + |
100 | 114 | public render() { |
101 | 115 | const { tenants } = this.props.tenantStore; |
102 | 116 | const columns = [ |
@@ -161,6 +175,11 @@ class Tenant extends React.Component<ITenantProps> { |
161 | 175 | <Button type="primary" shape="circle" icon="plus" onClick={() => this.createOrUpdateModalOpen({ id: 0 })} /> |
162 | 176 | </Col> |
163 | 177 | </Row> |
| 178 | + <Row> |
| 179 | + <Col sm={{ span: 10, offset: 0 }}> |
| 180 | + <Search placeholder={this.L('Filter')} onSearch={this.handleSearch} /> |
| 181 | + </Col> |
| 182 | + </Row> |
164 | 183 | <Row style={{ marginTop: 20 }}> |
165 | 184 | <Col |
166 | 185 | xs={{ span: 24, offset: 0 }} |
|
0 commit comments