From: Hongyuan Ma Date: Sat, 28 Jul 2018 16:42:25 +0000 (+0800) Subject: rewrite filter component X-Git-Url: http://git.postgresql.org/gitweb/static/session/%7B%7Bsession.id%7D%7D-%7B%7Bsession.title%7Cslugify%7D%7D?a=commitdiff_plain;h=83b48d11f86115d53c42f7fe8c4f0a29c5eaf1f6;p=pgperffarm.git rewrite filter component --- diff --git a/front-end/src/component/result-filter/index.jsx b/front-end/src/component/result-filter/index.jsx index 0e7329f..f004dff 100644 --- a/front-end/src/component/result-filter/index.jsx +++ b/front-end/src/component/result-filter/index.jsx @@ -13,6 +13,7 @@ class ResultFilter extends React.Component { {'cate': 'Category 2', 'name': '30 days'} ], restoreNum: 0, + branch_list:this.props.branch_list, selected: [{ 'cate': 'Category 1', 'index': 0, diff --git a/front-end/src/page/status/index.jsx b/front-end/src/page/status/index.jsx index 3093d1b..781926c 100644 --- a/front-end/src/page/status/index.jsx +++ b/front-end/src/page/status/index.jsx @@ -16,6 +16,7 @@ class Status extends React.Component { total: 3, filter: {}, branch_list: [], + selected_branches:[], list: [ // { // 'alias': 'a_name', @@ -32,7 +33,7 @@ class Status extends React.Component { }, - this.onPageChange = this.onPageChange.bind(this); + this.onPageChange = this.onPageChange.bind(this); this.onIsLoadingChange = this.onIsLoadingChange.bind(this); this.handleApplyBtnClick = this.handleApplyBtnClick.bind(this); this.loadRecordList = this.loadRecordList.bind(this); @@ -45,9 +46,10 @@ class Status extends React.Component { handleApplyBtnClick(params) { console.log('handle apply!') - let self = this - this.setState({filter: params}, () => { - self.loadRecordList() + let _this = this + let selected_branches = [] + this.setState({ + selected_branches: selected_branches, }); } @@ -55,6 +57,7 @@ class Status extends React.Component { _record.getBranchList().then(res => { this.setState({ branch_list: res.results, + selected_branches: res.results, }); console.dir(res.results) }, errMsg => { @@ -119,9 +122,9 @@ class Status extends React.Component { display: show }; console.log('hi') - console.dir(this.state.branch_list) + console.dir(this.state.selected_branches) console.log('done') - let table_list = this.state.branch_list.map((value, index) => ( + let table_list = this.state.selected_branches.map((value, index) => ( )) @@ -135,7 +138,7 @@ class Status extends React.Component {

- {table_list} {/**/} diff --git a/front-end/src/util/record-table/index.jsx b/front-end/src/util/record-table/index.jsx index d68eb7b..bffb955 100644 --- a/front-end/src/util/record-table/index.jsx +++ b/front-end/src/util/record-table/index.jsx @@ -93,10 +93,11 @@ class RecordTable extends React.Component { console.log(this.state.list) } onPageNumChange(current) { + let _this = this this.setState({ currentPage: current }, () => { - this.props.loadfunc(current); + this.loadRecordListByBranch(_this.state.branch,current); }); console.log('current:' + this.state.currentPage) } @@ -188,7 +189,7 @@ class RecordTable extends React.Component { this.onPageNumChange(current)} pageSize={2} - current={this.state.currentPage} total={this.props.total}/> + current={this.state.currentPage} total={this.state.total}/>