From 718fd30feb89581d1440a9e4ef394e6e123a6f4b Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Mon, 20 Mar 2017 15:45:29 -0300 Subject: [PATCH] Adjusting OHIF Viewer to the new structure --- LesionTracker/.meteor/packages | 2 +- LesionTracker/client/components/app/app.js | 2 +- LesionTracker/client/components/app/app.styl | 16 +- .../client/components/viewer/viewer.js | 2 +- LesionTracker/client/head.html | 2 +- OHIFViewer/.meteor/packages | 2 + OHIFViewer/.meteor/versions | 5 + .../components/ohifViewer/ohifViewer.html | 57 ++---- .../components/ohifViewer/ohifViewer.js | 4 +- .../components/ohifViewer/ohifViewer.styl | 60 +++--- OHIFViewer/client/components/viewer/viewer.js | 1 - OHIFViewer/client/routes.js | 30 +-- .../client/components/index.js | 4 - .../userAccountMenu/userAccountMenu.html | 62 ------- .../userAccountMenu/userAccountMenu.js | 128 ------------- .../userAccountMenu/userAccountMenu.styl | 62 ------- .../basic/aboutModal/aboutModal.html | 172 ++++++++---------- .../client/lib/renderViewer.js | 4 +- 18 files changed, 156 insertions(+), 459 deletions(-) delete mode 100644 Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.html delete mode 100644 Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.js delete mode 100644 Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.styl diff --git a/LesionTracker/.meteor/packages b/LesionTracker/.meteor/packages index bd7e226c3..452d445a2 100644 --- a/LesionTracker/.meteor/packages +++ b/LesionTracker/.meteor/packages @@ -65,6 +65,6 @@ fastclick@1.0.13 standard-minifier-css@1.3.2 standard-minifier-js@1.2.1 johdirr:meteor-git-rev -u2622:persistent-session +u2622:persistent-session@0.4.4 shell-server@0.2.1 aldeed:collection2 diff --git a/LesionTracker/client/components/app/app.js b/LesionTracker/client/components/app/app.js index 88c5fd64d..2840549ec 100644 --- a/LesionTracker/client/components/app/app.js +++ b/LesionTracker/client/components/app/app.js @@ -107,7 +107,7 @@ Template.app.helpers({ const isViewer = Session.get('ViewerOpened'); // Return empty if viewer was not opened yet - if (!OHIF.viewer.data.studyInstanceUids) return; + if (!OHIF.utils.ObjectPath.get(OHIF, 'viewer.data.studyInstanceUids')) return; return isViewer ? 'Study list' : 'Back to viewer'; }, diff --git a/LesionTracker/client/components/app/app.styl b/LesionTracker/client/components/app/app.styl index a366062ca..6207fc3c4 100644 --- a/LesionTracker/client/components/app/app.styl +++ b/LesionTracker/client/components/app/app.styl @@ -68,16 +68,16 @@ body>.header padding-right: $studyListPadding .brand - height: 100% - width: 80% - line-height: $topBarExpandedHeight - 10px + height: 100% + width: 80% + line-height: $topBarExpandedHeight - 10px - .logo-image - margin: 0 20px 0 0 - width: 50px + .logo-image + margin: 0 20px 0 0 + width: 50px - .logo-text - font-size: 30px + .logo-text + font-size: 30px .studyListLinkSection border: none diff --git a/LesionTracker/client/components/viewer/viewer.js b/LesionTracker/client/components/viewer/viewer.js index dc57ecf4b..ef4024d53 100644 --- a/LesionTracker/client/components/viewer/viewer.js +++ b/LesionTracker/client/components/viewer/viewer.js @@ -5,8 +5,8 @@ import { Session } from 'meteor/session'; import { ReactiveDict } from 'meteor/reactive-dict'; import { _ } from 'meteor/underscore'; import { $ } from 'meteor/jquery'; - import { OHIF } from 'meteor/ohif:core'; + import 'meteor/ohif:cornerstone'; import 'meteor/ohif:viewerbase'; import 'meteor/ohif:metadata'; diff --git a/LesionTracker/client/head.html b/LesionTracker/client/head.html index cad0e27e7..9310faa02 100644 --- a/LesionTracker/client/head.html +++ b/LesionTracker/client/head.html @@ -5,7 +5,7 @@ - + diff --git a/OHIFViewer/.meteor/packages b/OHIFViewer/.meteor/packages index 6e3d92e8e..be53e635a 100644 --- a/OHIFViewer/.meteor/packages +++ b/OHIFViewer/.meteor/packages @@ -7,6 +7,7 @@ # OHIF Packages ohif:design ohif:core +ohif:header ohif:cornerstone ohif:viewerbase ohif:study-list @@ -44,6 +45,7 @@ fastclick@1.0.13 standard-minifier-css@1.3.2 standard-minifier-js@1.2.1 johdirr:meteor-git-rev +u2622:persistent-session@0.4.4 aldeed:template-extension peppelg:bootstrap-3-modal shell-server@0.2.1 diff --git a/OHIFViewer/.meteor/versions b/OHIFViewer/.meteor/versions index e8737cb63..a396f65f1 100644 --- a/OHIFViewer/.meteor/versions +++ b/OHIFViewer/.meteor/versions @@ -6,6 +6,7 @@ aldeed:schema-index@1.1.1 aldeed:simple-schema@1.5.3 aldeed:template-extension@4.0.0 allow-deny@1.0.5 +amplify@1.0.0 arsnebula:reactive-promise@0.9.1 autoupdate@1.3.12 babel-compiler@6.13.0 @@ -76,9 +77,12 @@ ohif:cornerstone@0.0.1 ohif:design@0.0.1 ohif:dicom-services@0.0.1 ohif:hanging-protocols@0.0.1 +ohif:header@0.0.1 ohif:log@0.0.1 ohif:metadata@0.0.1 ohif:study-list@0.0.1 +ohif:themes@0.0.1 +ohif:themes-common@0.0.1 ohif:viewerbase@0.0.1 ohif:wadoproxy@0.0.1 ordered-dict@1.0.9 @@ -110,6 +114,7 @@ templating-runtime@1.2.15 templating-tools@1.0.5 tracker@1.1.1 twbs:bootstrap@3.3.6 +u2622:persistent-session@0.4.4 ui@1.0.12 underscore@1.0.10 url@1.0.11 diff --git a/OHIFViewer/client/components/ohifViewer/ohifViewer.html b/OHIFViewer/client/components/ohifViewer/ohifViewer.html index 35a75d37c..1220d8563 100644 --- a/OHIFViewer/client/components/ohifViewer/ohifViewer.html +++ b/OHIFViewer/client/components/ohifViewer/ohifViewer.html @@ -1,44 +1,25 @@ diff --git a/OHIFViewer/client/components/ohifViewer/ohifViewer.js b/OHIFViewer/client/components/ohifViewer/ohifViewer.js index b3f040737..860b6dd0d 100644 --- a/OHIFViewer/client/components/ohifViewer/ohifViewer.js +++ b/OHIFViewer/client/components/ohifViewer/ohifViewer.js @@ -14,7 +14,7 @@ Template.ohifViewer.onCreated(() => { icon: 'fa fa-server fa-lg', separatorAfter: true }, { - action: () => $('#aboutModal').show(), + action: () => OHIF.ui.showDialog('aboutModal'), text: 'About', icon: 'fa fa-info' }]); @@ -55,7 +55,7 @@ Template.ohifViewer.helpers({ const isViewer = Session.get('ViewerOpened'); // Return empty if viewer was not opened yet - if (!OHIF.viewer.data.studyInstanceUids) return; + if (!OHIF.utils.ObjectPath.get(OHIF, 'viewer.data.studyInstanceUids')) return; return isViewer ? 'Study list' : 'Back to viewer'; } diff --git a/OHIFViewer/client/components/ohifViewer/ohifViewer.styl b/OHIFViewer/client/components/ohifViewer/ohifViewer.styl index 8f7395275..c780ef766 100644 --- a/OHIFViewer/client/components/ohifViewer/ohifViewer.styl +++ b/OHIFViewer/client/components/ohifViewer/ohifViewer.styl @@ -1,42 +1,37 @@ @import "{ohif:design}/app" -$expandedHeight = 160px +body>.header -.logoImage - display: inline-block - height: 100% - float: left - -.topBar - height: $topBarHeight - padding: 10px 10px 0 - theme('color', '$textPrimaryColor') - theme('background-color', '$primaryBackgroundColor') - transition(all 0.5s ease) - - &>.clearfix - position: relative - - .brandSection + .brand height: 30px display: inline-block text-decoration: none - .logoImage + .logo-image + display: inline-block + fill: transparent + float: left + height: 100% margin: 0 8px 0 0 width: 30px - .logoText + .logo-text display: inline-block font-family: $logoFontFamily + font-size: 14px font-weight: $logoFontWeight theme('color', '$textPrimaryColor') line-height: 30px - .studyListLinkSection - theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) - margin: 3px 0 0 10px - padding: 0 0 0 10px + a.header-menu + theme('color', '$textPrimaryColor') + + .header-options + font-size: 13px + + .menu-toggle + display: inline-block + height: 18px .btn theme('color', '$textSecondaryColor') @@ -51,22 +46,25 @@ $expandedHeight = 160px &:active theme('color', '$activeColor') - &.studyList - background-color: rgba(21, 25, 30, 0.7) - height: $expandedHeight + .studyListLinkSection + theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) + margin: 3px 0 0 10px + padding: 0 0 0 10px + + &.header-big padding-left: $studyListPadding padding-right: $studyListPadding - .brandSection + .brand height: 100% width: 80% - line-height: $expandedHeight - 10px + line-height: $topBarExpandedHeight - 10px - .logoImage - width: 50px + .logo-image margin: 0 20px 0 0 + width: 50px - .logoText + .logo-text font-size: 30px .studyListLinkSection diff --git a/OHIFViewer/client/components/viewer/viewer.js b/OHIFViewer/client/components/viewer/viewer.js index f16258703..883735646 100644 --- a/OHIFViewer/client/components/viewer/viewer.js +++ b/OHIFViewer/client/components/viewer/viewer.js @@ -93,7 +93,6 @@ Template.viewer.onCreated(() => { } else { OHIF.log.info('Setting default viewer data'); OHIF.viewer.loadedSeriesData = {}; - OHIF.viewer.data = {}; OHIF.viewer.data.loadedSeriesData = OHIF.viewer.loadedSeriesData; // Update the viewer data object diff --git a/OHIFViewer/client/routes.js b/OHIFViewer/client/routes.js index e09fb2711..7fa21c655 100644 --- a/OHIFViewer/client/routes.js +++ b/OHIFViewer/client/routes.js @@ -1,5 +1,5 @@ -import { Session } from 'meteor/session'; import { Router } from 'meteor/iron:router'; +import { OHIF } from 'meteor/ohif:core'; Router.configure({ layoutTemplate: 'layout', @@ -7,26 +7,16 @@ Router.configure({ }); Router.onBeforeAction('loading'); -Router.onBeforeAction(function() { - this.next(); -}); Router.route('/', function() { - this.render('ohifViewer'); -}); + Router.go('studylist', {}, { replaceState: true }); +}, { name: 'home' }); -Router.route('/viewer/:_id', { - layoutTemplate: 'layout', - name: 'viewer', - onBeforeAction: function() { - var studyInstanceUid = this.params._id; +Router.route('/studylist', function() { + this.render('ohifViewer', { data: { template: 'studylist' } }); +}, { name: 'studylist' }); - this.render('ohifViewer', { - data: function() { - return { - studyInstanceUid: studyInstanceUid - }; - } - }); - } -}); +Router.route('/viewer/:studyInstanceUids', function() { + const studyInstanceUids = this.params.studyInstanceUids.split(';'); + OHIF.viewerbase.renderViewer(this, { studyInstanceUids }, 'ohifViewer'); +}, { name: 'viewerStudies' }); diff --git a/Packages/ohif-user-management/client/components/index.js b/Packages/ohif-user-management/client/components/index.js index b5bda169d..735f78dfe 100644 --- a/Packages/ohif-user-management/client/components/index.js +++ b/Packages/ohif-user-management/client/components/index.js @@ -9,7 +9,3 @@ import './lastLoginModal/lastLoginModal.html'; import './timeoutCountdownDialog/timeoutCountdownDialog.html'; import './timeoutCountdownDialog/timeoutCountdownDialog.js'; - -import './userAccountMenu/userAccountMenu.html'; -import './userAccountMenu/userAccountMenu.styl'; -import './userAccountMenu/userAccountMenu.js'; diff --git a/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.html b/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.html deleted file mode 100644 index a2021710f..000000000 --- a/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.html +++ /dev/null @@ -1,62 +0,0 @@ - diff --git a/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.js b/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.js deleted file mode 100644 index 90c2d16c2..000000000 --- a/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.js +++ /dev/null @@ -1,128 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Session } from 'meteor/session'; -import { Router } from 'meteor/iron:router'; -import { moment } from 'meteor/momentjs:moment'; -import { OHIF } from 'meteor/ohif:core'; - -// Display the last login modal as default -Session.setDefault('displayLastLoginModal', true); - -Template.userAccountMenu.helpers({ - name: function() { - const nameSplit = Meteor.user().profile.fullName.split(' '); - const lastName = nameSplit[nameSplit.length - 1]; - nameSplit[nameSplit.length - 1] = lastName.substr(0, 1) + '.'; - return nameSplit.join(' '); - }, - - currentUser: function() { - const verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false; - - if (!Meteor.user() || !Meteor.userId()) { - return; - } - - if (!verifyEmail) { - return true; - } - - if (!Meteor.user().emails) { - return true; - } - - return !!Meteor.user().emails[0].verified; - } -}); - -Template.userAccountMenu.events({ - 'click #serverInformation'() { - OHIF.ui.showDialog('serverInformationModal'); - }, - - 'click #themeSelector'() { - OHIF.ui.showDialog('themeSelectorModal'); - }, - - 'click #logoutButton'() { - Meteor.logout(function() { - Router.go('/entrySignIn'); - }); - } -}); - -Template.userAccountMenu.onCreated(function userAccountMenuCreated() { - const instance = Template.instance(); - - // Create reactive last login date - instance.lastLoginDate = new ReactiveVar(); - - // We need oldUser to remove Reviewers if the user logged out - let oldUser; - - // Get last login date - Meteor.call('getPriorLoginDate', function(error, lastLoginDate) { - if (error) { - OHIF.log.error(error); - return; - } - - // Format the last login date - const formattedLastLoginDate = moment(lastLoginDate).format('MMMM Do YYYY, HH:mm:ss A'); - - instance.lastLoginDate.set(formattedLastLoginDate); - - }); - - instance.autorun(function() { - const lastLoginDate = instance.lastLoginDate.get(); - if (!lastLoginDate) { - return; - } - - // Hook login/logout - const user = Meteor.user(); - if (!user) { - // Display last login modal for the next login - Session.setPersistent('displayLastLoginModal', true); - - if (oldUser) { - // Log Signout - // TODO: eventType for logout is not defined - // HipaaLogger.logEvent({ - // eventType: 'logout', - // userId: oldUser._id, - // userName: oldUser.profile.fullName - // }); - - // Remove the user by oldUserId from Reviewers - Meteor.call('removeUserFromReviewers', oldUser._id); - } - - return; - } - - // Set oldUser - oldUser = user; - - // Trigger last login date popup - if (!Session.get('displayLastLoginModal')) { - return; - } - - // Display the modal and hide it after 5 seconds - OHIF.ui.showDialog('lastLoginModal', { - lastLoginDate, - timeout: 5000 - }).then(() => Session.setPersistent('displayLastLoginModal', false)); - - // Log signin - HipaaLogger.logEvent({ - eventType: 'init', - userId: user._id, - userName: user.profile.fullName - }); - - }); -}); diff --git a/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.styl b/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.styl deleted file mode 100644 index 4f4aca158..000000000 --- a/Packages/ohif-user-management/client/components/userAccountMenu/userAccountMenu.styl +++ /dev/null @@ -1,62 +0,0 @@ -@import "{ohif:design}/app" - -$iconMargin = 5px -$iconWidth = 16px -$iconHeight = 16px - -#userAccountMenu - padding: 4px 0 - height: 100% - - .dropdown-toggle - theme('color', '$defaultColor') - cursor: pointer - font-size: 13px - font-weight: 400 - line-height: 18px - text-decoration: none - - .menuButton - theme('border-left', 'solid 1px $defaultColor') - display: inline-block - height: 18px - padding: 0 8px - - .fa - theme('color', '$defaultColor') - font-size: 17px - line-height: 18px - - .caret-down - theme('color', '$uiGrayLight') - margin: 0 4px 4px 2px - - ul.dropdown-menu - li - cursor: pointer - - svg - margin-right: $iconMargin - width: $iconWidth - height: $iconHeight - text-align: center - - svg - display: inline-block - vertical-align: middle - - &.server - width: $iconWidth - 3 - height: $iconWidth - 3 - margin-right: $iconMargin + 2 - margin-left: 1px - - &.theme - width: $iconWidth + 2 - height: $iconWidth + 2 - margin-right: $iconMargin - 2 - - &.study-list - width: $iconWidth + 2 - height: $iconWidth + 2 - margin-right: $iconMargin - 2 diff --git a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.html b/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.html index 750757e85..3b2b696f9 100644 --- a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.html +++ b/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.html @@ -1,99 +1,77 @@ \ No newline at end of file +
+ + Visit the forum + + + Report an issue + +
+
+

Version Information

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameValue
Repository URL + {{githubUrl}} +
Last Commit Hash + + {{gitRev 'long'}} + +
Latest Tag + + {{gitRev 'tag'}} + +
Branch + + {{gitRev 'branch'}} + +
+
+ {{/dialogSimple}} + diff --git a/Packages/ohif-viewerbase/client/lib/renderViewer.js b/Packages/ohif-viewerbase/client/lib/renderViewer.js index 9ffdbf4cd..7e3248a9d 100644 --- a/Packages/ohif-viewerbase/client/lib/renderViewer.js +++ b/Packages/ohif-viewerbase/client/lib/renderViewer.js @@ -6,7 +6,7 @@ import { OHIF } from 'meteor/ohif:core'; * @param {Context} context Context of the router * @param {Object} params Parameters that will be used to prepare the viewer data */ -export const renderViewer = (context, params) => { +export const renderViewer = (context, params, layoutTemplate='app') => { // Wait until the viewer data is ready to render it const promise = OHIF.viewerbase.prepareViewerData(params); @@ -16,7 +16,7 @@ export const renderViewer = (context, params) => { // Render the viewer when the data is ready promise.then(({ studies, viewerData }) => { OHIF.viewer.data = viewerData; - context.render('app', { + context.render(layoutTemplate, { data: { template: 'viewer', studies