From: Hongyuan Ma Date: Mon, 28 May 2018 01:24:42 +0000 (+0800) Subject: add wating state for applyBtn X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=77bebfe30acaf271bc26d89b8e964784ce2ded7d;p=pgperffarm.git add wating state for applyBtn --- diff --git a/front-end/src/component/result-filter/index.css b/front-end/src/component/result-filter/index.css index 9dca292..07bb5eb 100644 --- a/front-end/src/component/result-filter/index.css +++ b/front-end/src/component/result-filter/index.css @@ -103,10 +103,15 @@ .title-selected-btn { float: right; + margin-left: 5px; } .title-selected-btn:focus, .title-selected-btn:active:focus, .title-selected-btn.active:focus, .title-selected-btn.focus, .title-selected-btn:active.focus, .title-selected-btn.active.focus { outline: none; /*border-color: transparent;*/ /*box-shadow: none;*/ +} + +.title-selected-result { + padding-bottom: 8px; } \ No newline at end of file diff --git a/front-end/src/component/result-filter/index.jsx b/front-end/src/component/result-filter/index.jsx index 6a7e1bd..f257455 100644 --- a/front-end/src/component/result-filter/index.jsx +++ b/front-end/src/component/result-filter/index.jsx @@ -73,16 +73,20 @@ class ResultFilter extends React.Component { applyButtonClick() { this.setState({ - selected: newArr, + // selected: newArr, isClear: false }); + this.handleIsLoading(); + + console.log(this.props.isLoading) } - handleTemp(e) { - props.onTemperateChange(e.target.value) + handleIsLoading(e) { + // console.log(e.target.value) + this.props.onIsLoadingChange(true); } - clearButtonClick() { + resetButtonClick() { let newArr = this.state.selected; newArr.forEach((_item, _index) => { console.log(_item); @@ -132,6 +136,20 @@ class ResultFilter extends React.Component { ) }); + let apply_btn; + if (this.props.isLoading == true) { + apply_btn = ( + + wait... + ) + } else { + apply_btn = ( + this.applyButtonClick()}> + Apply + ) + } return (
@@ -151,11 +169,11 @@ class ResultFilter extends React.Component { {/*clear*/} {/**/} this.clearButtonClick()} + onClick={() => this.resetButtonClick()} disabled={ this.state.isClear ? "" : "disabled" }> Reset - - Apply + + {apply_btn} {/**/}
diff --git a/front-end/src/page/Status/index.jsx b/front-end/src/page/Status/index.jsx index 0cf091c..bef7003 100644 --- a/front-end/src/page/Status/index.jsx +++ b/front-end/src/page/Status/index.jsx @@ -9,6 +9,7 @@ class Status extends React.Component { constructor(props) { super(props); this.state = { + isLoading: false, currentPage: 3, std: 150000, curMark1: 243732, @@ -21,19 +22,19 @@ class Status extends React.Component { { 'alias': 'a_name', 'email': 'a_name@mail.com', - 'clients': '2', - 'mark': 140000, + 'clients': [2,4,6], + 'mark': [140000,1,1], }, { 'alias': 'b_name', 'email': 'b_name@mail.com', 'clients': '4', - 'mark': 150000, + 'mark': 150000 } ] } this.onPageChange = this.onPageChange.bind(this); - this.handleisLoading = this.handleisLoading.bind(this); + this.handleIsLoading = this.handleIsLoading.bind(this); } onPageChange(page) { @@ -44,7 +45,7 @@ class Status extends React.Component { }); } - handleisLoading(isLoading) { + handleIsLoading(isLoading) { this.setState({ isLoading: isLoading }) @@ -59,13 +60,24 @@ class Status extends React.Component { let listBody = this.state.list.map((machine, index) => { return ( + {machine.alias} - {machine.email} - {machine.clients} + {machine.email} + {machine.clients} + {/**/} + {/*1-2*/} + {/*1-3*/} + {/*1-4*/} + {/*1-5*/} + -

{machine.mark}

- + +
+

..

+ +
+ {/*

{machine.mark}

*/} {new Date().toDateString()} @@ -82,7 +94,9 @@ class Status extends React.Component {

- + + +

...!!{this.state.isLoading}

{listBody} diff --git a/front-end/src/util/rate-bar/index.jsx b/front-end/src/util/rate-bar/index.jsx index 21d1201..c319086 100644 --- a/front-end/src/util/rate-bar/index.jsx +++ b/front-end/src/util/rate-bar/index.jsx @@ -44,7 +44,7 @@ class RateBar extends React.Component { right: '0%', bottom: '20%', top: '-20%', - containLabel: true + containLabel: false }, xAxis: { type: 'value', @@ -95,7 +95,7 @@ class RateBar extends React.Component { } render() { return ( -
+
); } }