From cfdbb532f79bdf153eb7d08ff4124ac90f8d7089 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Fri, 3 Apr 2020 12:45:22 +0200 Subject: [PATCH] Added lazy mode to WBNameAndUuid and WBProcessState. --- frontend/src/js/component/wb-name-and-uuid.js | 23 +++++++++++++++---- .../src/js/component/wb-process-listing.js | 6 ++--- frontend/src/js/component/wb-process-state.js | 20 ++++++++++++---- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/frontend/src/js/component/wb-name-and-uuid.js b/frontend/src/js/component/wb-name-and-uuid.js index 732df7f..2c45b57 100644 --- a/frontend/src/js/component/wb-name-and-uuid.js +++ b/frontend/src/js/component/wb-name-and-uuid.js @@ -76,17 +76,26 @@ class WBNameAndUuid extends Component { } componentDidMount() { - this.fetchData(); + if (this.props.lazy) + ;//this.setState({ item: { uuid: this.props.uuid }}); + else + this.fetchData(); } componentWillReceiveProps(nextProps) { - if (this.props.uuid !== nextProps.uuid) { + if (this.props.uuid === nextProps.uuid) + return; + + if (nextProps.lazy) { + this.setState({ item: { uuid: nextProps.uuid }}); + + } else { this.props = nextProps; this.fetchData(); } } - render({ uuid, onLinkClicked }, { error, item }) { + render({ uuid, onLinkClicked, lazy }, { error, item }) { if (!uuid) return (
{ String(uuid) }
@@ -97,10 +106,14 @@ class WBNameAndUuid extends Component {
{ error ? error : (item ? ( { arvadosObjectName(item) } - ) : 'Loading...') } + ) : (lazy ? null : 'Loading...')) }
- { uuid } + { uuid } { (lazy && !item) ? ( + { e.preventDefault(); this.fetchData(); } }> + + + ) : null }
); diff --git a/frontend/src/js/component/wb-process-listing.js b/frontend/src/js/component/wb-process-listing.js index c2961e6..45e8b8a 100644 --- a/frontend/src/js/component/wb-process-listing.js +++ b/frontend/src/js/component/wb-process-listing.js @@ -58,10 +58,10 @@ class WBProcessListing extends Component { { item.description } { renderEditDescription(item, () => this.fetchItems()) } ), - ( ), - ( ), + ( ), + ( ), wbFormatDate(item['created_at']), - ( ), + ( ), (
); }