diff options
author | Hongyuan Ma | 2018-07-11 04:44:53 +0000 |
---|---|---|
committer | Hongyuan Ma | 2018-07-11 04:44:53 +0000 |
commit | 752aa0ef69d7a78e4ce633e01141024a19e0dde3 (patch) | |
tree | a5c1e159c637ed598e15a0d26ff6e69fed6e6889 | |
parent | 7c58bc67a7f0003916a52cfdc6f0908c18041c3a (diff) |
add branch_num in machineinfo page
4 files changed, 14 insertions, 8 deletions
diff --git a/front-end/src/component/farmer-detail-card/index.jsx b/front-end/src/component/farmer-detail-card/index.jsx index 10549ce..bee5456 100644 --- a/front-end/src/component/farmer-detail-card/index.jsx +++ b/front-end/src/component/farmer-detail-card/index.jsx @@ -9,6 +9,7 @@ class FarmerDetailCard extends React.Component { } render(){ let machine = this.props.machine || {} + let branch_num = this.props.branch_num || 0 let system = machine.os_name + ' ' + machine.os_version; let camp = machine.comp_name + ' ' + machine.comp_version; let owner = machine.owner || {}; @@ -37,7 +38,7 @@ class FarmerDetailCard extends React.Component { <div className='ui buttons'> {/*todo link to machine page*/} <Button basic mini color='grey'> - 4 branches involved + {branch_num} branches involved </Button> </div> </Card.Content> diff --git a/front-end/src/component/history-records-pane1/index.jsx b/front-end/src/component/history-records-pane1/index.jsx index a93eedb..bd92ac2 100644 --- a/front-end/src/component/history-records-pane1/index.jsx +++ b/front-end/src/component/history-records-pane1/index.jsx @@ -19,8 +19,8 @@ class HistoryRecordPane1 extends React.Component { currentTotal: 0, currentPage:1, machine_sn: props.machine_sn || '', - branches: props.branches || [], - selected_branch: 1, + branches: props.branches, + selected_branch: props.branches[0].value, } // console.dir(this.state.branches) this.loadMachineRecordListByBranch = this.loadMachineRecordListByBranch.bind(this); @@ -28,7 +28,8 @@ class HistoryRecordPane1 extends React.Component { } componentDidMount() { - // this.loadHistoryRecordList(); + // console.log(this.state.branches[0].value) + this.loadMachineRecordListByBranch() } componentWillReceiveProps(nextProps) { this.setState({ @@ -55,7 +56,9 @@ class HistoryRecordPane1 extends React.Component { listParam.page = page; listParam.test_machine__machine_sn = this.state.machine_sn; listParam.branch__id = this.state.selected_branch; - + if(listParam.branch__id <= 0) { + return; + } _record.getMachineRecordListByBranch(listParam).then(res => { _this.setState({ currentList: res.results, diff --git a/front-end/src/page/machineInfo/index.jsx b/front-end/src/page/machineInfo/index.jsx index 4f59c38..3634145 100644 --- a/front-end/src/page/machineInfo/index.jsx +++ b/front-end/src/page/machineInfo/index.jsx @@ -13,7 +13,9 @@ class MachineInfo extends React.Component { super(props); this.state = { machineNo: this.props.match.params.machine_sn, - branches:[], + branches: [ + {'branch':0,'value':0} + ], machineInfo: {}, isLoading: false, currentPage: 1, @@ -98,7 +100,7 @@ class MachineInfo extends React.Component { </div> <div className="col-md-3"> {/*<Segment vertical>Farmer Info</Segment>*/} - <FarmerDetailCard machine={this.state.machineInfo}></FarmerDetailCard> + <FarmerDetailCard machine={this.state.machineInfo} branch_num={this.state.branches.length}></FarmerDetailCard> </div> <div className="col-md-9"> diff --git a/front-end/src/util/machine-record-table/index.jsx b/front-end/src/util/machine-record-table/index.jsx index 89b5160..27c34c7 100644 --- a/front-end/src/util/machine-record-table/index.jsx +++ b/front-end/src/util/machine-record-table/index.jsx @@ -84,7 +84,7 @@ class MachineRecordTable extends React.Component { <Table.Cell textAlign='center'> - <Link color='linkedin' to={'detailInfo/' + record.uuid}> + <Link color='linkedin' to={'/detailInfo/' + record.uuid}> <Icon name='linkify'/> Link </Link> </Table.Cell> |