Adjusting OHIF Viewer to the new structure

This commit is contained in:
Bruno Alves de Faria committed 2017-03-21 10:16:47 -03:00
1 parent 374dab5ef4
commit 718fd30feb
18 files changed
+156 -459

No files matched your search

@@ -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';
@@ -1,62 +0,0 @@
<template name="userAccountMenu">
{{#if currentUser}}
<div id="userAccountMenu" class="dropdown">
<div class="dropdown-toggle noselect clearfix" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="userName pull-left m-r-1">{{name}} {{currentPath}}</span>
<div class="menuButton pull-right">
<i class="fa fa-cog"></i> <span class="caret-down"></span>
</div>
</div>
<ul class="dropdown-menu dropdown-menu-right">
{{#if showStudyListMenu}}
<li>
<a href="{{absoluteUrl "studylist"}}" id="studylist">
<svg class="study-list">
<use xlink:href={{absoluteUrl "packages/ohif_user-management/assets/user-menu-icons.svg#study-list"}}></use>
</svg> Study List
</a>
</li>
{{else}}
<li>
<a href="{{absoluteUrl "audit"}}" id="audit">
<svg class="log">
<use xlink:href={{absoluteUrl "packages/ohif_user-management/assets/user-menu-icons.svg#log"}}></use>
</svg> View Audit Log
</a>
</li>
{{/if}}
<li role="separator" class="divider"></li>
<li>
<a id="themeSelector">
<svg class="theme">
<use xlink:href={{absoluteUrl "packages/ohif_user-management/assets/user-menu-icons.svg#theme"}}></use>
</svg> Themes
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a id="serverInformation">
<svg class="server">
<use xlink:href={{absoluteUrl "packages/ohif_user-management/assets/user-menu-icons.svg#server"}}></use>
</svg> Server Information
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a href="{{absoluteUrl "changePassword"}}" id="changePassword">
<svg class="password">
<use xlink:href={{absoluteUrl "packages/ohif_user-management/assets/user-menu-icons.svg#password"}}></use>
</svg> Change Password
</a>
</li>
<li>
<a id="logoutButton">
<svg class="logout">
<use xlink:href={{absoluteUrl "packages/ohif_user-management/assets/user-menu-icons.svg#logout"}}></use>
</svg> Logout
</a>
</li>
</ul>
</div>
{{/if}}
</template>
@@ -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
});
});
});
@@ -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
@@ -1,99 +1,77 @@
<template name="aboutModal">
<div class="modal fade"
id="aboutModal"
tabindex="-1"
role="dialog"
aria-labelledby="aboutModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button"
class="close"
data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title"
id="aboutModalLabel">
About
</h4>
</div>
<div class="modal-body">
<a target='_blank'
class='forkOnGithub'
href="{{githubUrl}}">
<img src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67"
alt="Fork me on GitHub"
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png">
</a>
<div class="logo p-x-3 p-y-3">
<svg class="logoImage">
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-ohif-logo"}}></use>
</svg>
<a class="logoText"
target="_blank"
href="http://ohif.org">
Open Health Imaging Foundation DICOM Viewer
</a>
</div>
<div class="p-x-1 p-y-1 m-y-2">
<a class="btn btn-default inline"
target='_blank'
href="https://groups.google.com/forum/#!forum/cornerstone-platform">
Visit the forum
</a>
<a class="btn btn-default inline"
target='_blank'
href="https://github.com/OHIF/Viewers/issues">
Report an issue
</a>
</div>
<div class="p-y-1 p-x-1">
<h3>Version Information</h3>
<table class="table table-responsive">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Repository URL</td>
<td>
<a target='_blank'
href="{{githubUrl}}">{{githubUrl}}</a>
</td>
</tr>
<tr>
<td>Last Commit Hash</td>
<td>
<a target='_blank' href="{{githubUrl}}/commit/{{gitRev 'long'}}">
{{gitRev 'long'}}
</a>
</td>
</tr>
<tr>
<td>Latest Tag</td>
<td>
<a target='_blank' href="{{githubUrl}}/releases/tag/{{gitRev 'tag'}}">
{{gitRev 'tag'}}
</a>
</td>
</tr>
<tr>
<td>Branch</td>
<td>
<a target='_blank' href="{{githubUrl}}/tree/{{gitRev 'branch'}}">
{{gitRev 'branch'}}
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{{#dialogSimple (extend this id='aboutModal' dialogClass='modal-lg' title='About')}}
<a target='_blank'
class='forkOnGithub'
href="{{githubUrl}}">
<img src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67"
alt="Fork me on GitHub"
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png">
</a>
<div class="logo p-x-3 p-y-3 clearfix">
<svg class="logoImage pull-left">
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-ohif-logo"}}></use>
</svg>
<a class="logoText pull-left"
target="_blank"
href="http://ohif.org">
Open Health Imaging Foundation DICOM Viewer
</a>
</div>
</div>
</template>
<div class="p-x-1 p-y-1 m-y-2">
<a class="btn btn-default inline"
target='_blank'
href="https://groups.google.com/forum/#!forum/cornerstone-platform">
Visit the forum
</a>
<a class="btn btn-default inline"
target='_blank'
href="https://github.com/OHIF/Viewers/issues">
Report an issue
</a>
</div>
<div class="p-y-1 p-x-1">
<h3>Version Information</h3>
<table class="table table-responsive">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Repository URL</td>
<td>
<a target='_blank'
href="{{githubUrl}}">{{githubUrl}}</a>
</td>
</tr>
<tr>
<td>Last Commit Hash</td>
<td>
<a target='_blank' href="{{githubUrl}}/commit/{{gitRev 'long'}}">
{{gitRev 'long'}}
</a>
</td>
</tr>
<tr>
<td>Latest Tag</td>
<td>
<a target='_blank' href="{{githubUrl}}/releases/tag/{{gitRev 'tag'}}">
{{gitRev 'tag'}}
</a>
</td>
</tr>
<tr>
<td>Branch</td>
<td>
<a target='_blank' href="{{githubUrl}}/tree/{{gitRev 'branch'}}">
{{gitRev 'branch'}}
</a>
</td>
</tr>
</tbody>
</table>
</div>
{{/dialogSimple}}
</template>
@@ -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