From 5551f817e346a8db0795039fe3574ab0d44a3a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20Lelis?= Date: Thu, 26 Sep 2019 11:08:30 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Set=20series=20into=20act?= =?UTF-8?q?ive=20viewport=20by=20clicking=20on=20thumbnail=20(#945)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 Set series into active viewport by clicking on thumbnail Users should be able to set the series for the active viewport by clicking it's thumbnail into Study browser Closes: #895 * fix: 🐛 Set series into active viewport by clicking on thumbnail Small refactor into onClick data callback and thumbnailClick function Closes: #895 * fix: 🐛 Refactor thumbnail click code changes * fix: 🐛 We must clear the sopInstanceUid if we don't update it together with the viewportSpecificData, preventing console warning. * fix: 🐛 Cleaning up a few more code changes --- .../components/studyBrowser/ThumbnailEntry.js | 4 ++-- .../ConnectedStudyBrowser.js | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/platform/ui/src/components/studyBrowser/ThumbnailEntry.js b/platform/ui/src/components/studyBrowser/ThumbnailEntry.js index 8756dc542..19f4add7a 100644 --- a/platform/ui/src/components/studyBrowser/ThumbnailEntry.js +++ b/platform/ui/src/components/studyBrowser/ThumbnailEntry.js @@ -99,13 +99,13 @@ class ThumbnailEntry extends Component { onClick = () => { if (this.props.onClick) { - this.props.onClick(); + this.props.onClick(this.props.displaySetInstanceUid); } }; onDoubleClick = () => { if (this.props.onDoubleClick) { - this.props.onDoubleClick(); + this.props.onDoubleClick(this.props.displaySetInstanceUid); } }; } diff --git a/platform/viewer/src/connectedComponents/ConnectedStudyBrowser.js b/platform/viewer/src/connectedComponents/ConnectedStudyBrowser.js index 1d174103b..e7d14ebf8 100644 --- a/platform/viewer/src/connectedComponents/ConnectedStudyBrowser.js +++ b/platform/viewer/src/connectedComponents/ConnectedStudyBrowser.js @@ -1,7 +1,10 @@ +import OHIF from '@ohif/core'; import { connect } from 'react-redux'; import { StudyBrowser } from '@ohif/ui'; import cloneDeep from 'lodash.clonedeep'; +const { setActiveViewportSpecificData } = OHIF.redux.actions; + // TODO // - Determine in which display set is active from Redux (activeViewportIndex and layout viewportData) // - Pass in errors and stack loading progress from Redux @@ -32,9 +35,21 @@ const mapStateToProps = (state, ownProps) => { }; }; +const mapDispatchToProps = dispatch => { + return { + onThumbnailClick: displaySetInstanceUid => { + dispatch( + setActiveViewportSpecificData({ + displaySetInstanceUid, + }) + ); + }, + }; +}; + const ConnectedStudyBrowser = connect( mapStateToProps, - null + mapDispatchToProps )(StudyBrowser); export default ConnectedStudyBrowser;