From 5078d35f5b5062f11fff0b41535ca4c06ee1e9ca Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Fri, 3 Apr 2020 18:01:42 +0200 Subject: [PATCH] Made the process dashboard lazy. --- .../src/js/component/wb-process-dashboard.js | 19 +++++++++++++++---- frontend/src/js/page/wb-process-view.js | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/src/js/component/wb-process-dashboard.js b/frontend/src/js/component/wb-process-dashboard.js index 4ca2513..a251d95 100644 --- a/frontend/src/js/component/wb-process-dashboard.js +++ b/frontend/src/js/component/wb-process-dashboard.js @@ -117,21 +117,32 @@ class WBProcessDashboard extends Component { } componentDidMount() { - this.fetchData(); + if (!this.props.lazy) + this.fetchData(); } componentWillReceiveProps(nextProps) { if (nextProps.parentProcessUuid === this.props.parentProcessUuid) return; + if (this.props.lazy) { + this.setState({ rows: Array(5).fill(Array(6).fill('-')) }); + return; + } + this.props = nextProps; this.fetchData(); } - render({}, { rows }) { + render({ lazy }, { rows }) { return ( - +
+ + { lazy ? ( + { e.preventDefault(); this.fetchData(); } }>Refresh + ) : null } +
); } } diff --git a/frontend/src/js/page/wb-process-view.js b/frontend/src/js/page/wb-process-view.js index f89f712..f4bc3f3 100644 --- a/frontend/src/js/page/wb-process-view.js +++ b/frontend/src/js/page/wb-process-view.js @@ -64,7 +64,7 @@ class WBProcessView extends Component {

Children Dashboard

- +

Common Fields