add wadoproxy package

This commit is contained in:
weiwei 2016-08-25 10:34:42 +08:00
commit 5b92455620
16 changed files with 268 additions and 69 deletions

View File

@ -64,3 +64,4 @@ fastclick@1.0.12
standard-minifier-css@1.1.8
standard-minifier-js@1.1.8
johdirr:meteor-git-rev
u2622:persistent-session

View File

@ -3,6 +3,7 @@ accounts-password@1.2.12
aldeed:simple-schema@1.5.3
aldeed:template-extension@4.0.0
allow-deny@1.0.5
amplify@1.0.0
anti:gagarin@0.4.11
anti:i18n@0.4.3
arsnebula:reactive-promise@0.9.1
@ -124,6 +125,7 @@ tracker@1.1.0
twbs:bootstrap@3.3.6
typ:accounts-ldap@1.0.1
typ:ldapjs@0.7.3
u2622:persistent-session@0.4.4
ui@1.0.11
underscore@1.0.9
url@1.0.10

View File

@ -42,3 +42,4 @@ standard-minifier-js@1.1.8
aldeed:simple-schema
johdirr:meteor-git-rev
wadoproxy
aldeed:template-extension

View File

@ -1,4 +1,5 @@
aldeed:simple-schema@1.5.3
aldeed:template-extension@4.0.0
allow-deny@1.0.5
arsnebula:reactive-promise@0.9.1
autoupdate@1.3.11

View File

@ -1,9 +0,0 @@
Template.lastLoginModal.helpers({
lastLoginDate: function() {
var userLoginDate = ReactiveMethod.call('getPriorLoginDate');
if (userLoginDate && userLoginDate.priorLoginDate) {
return moment(userLoginDate.priorLoginDate).format("MMMM Do YYYY, HH:mm:ss A");
}
return;
}
});

View File

@ -1,3 +1,10 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
// Display the last login modal as default
Session.setDefault('displayLastLoginModal', true);
Template.userAccountMenu.helpers({
name: function() {
var nameSplit = Meteor.user().profile.fullName.split(' ');
@ -29,68 +36,87 @@ Template.userAccountMenu.events({
$('#serverInformationModal').modal('show');
},
'click #logoutButton': function() {
// Remove reviewers info for the user
Meteor.call('removeUserFromReviewers', Meteor.userId());
Meteor.logout(function() {
Router.go('/entrySignIn');
});
}
});
Template.userAccountMenu.onRendered(function() {
var oldUserId;
var lastLoginModalInterval;
Template.userAccountMenu.onCreated(function userAccountMenuCreated() {
const instance = Template.instance();
this.autorun(function() {
// Hook login/logout
var user = Meteor.user();
if (!user) {
// 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) {
console.log(error);
return;
}
var newUserId = user._id;
// Format the last login date
const formattedLastLoginDate = moment(lastLoginDate).format("MMMM Do YYYY, HH:mm:ss A");
if (oldUserId === null && newUserId) {
Session.set('showLastLoginModal', true);
instance.lastLoginDate.set(formattedLastLoginDate);
// Log
HipaaLogger.logEvent({
eventType: 'init',
userId: user._id,
userName: user.fullName
});
});
} else if (newUserId === null && oldUserId) {
// Set showLastLoginModal as null
Session.set('showLastLoginModal', null);
// Destroy interval for last login modal
Meteor.clearInterval(lastLoginModalInterval);
console.log('The user logged out');
// Log
// TODO: eventType is not defined for logout in hipaa-audit-log
/*HipaaLogger.logEvent({
eventType: 'logout',
userId: oldUserId,
userName: userName
});*/
// Remove the user from Reviewers
Meteor.call('removeUserFromReviewers', oldUserId);
instance.autorun(function() {
const lastLoginDate = instance.lastLoginDate.get();
if (!lastLoginDate) {
return;
}
oldUserId = Meteor.userId();
// Hook login/logout
var 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('showLastLoginModal')) {
Modal.show('lastLoginModal');
lastLoginModalInterval = Meteor.setInterval(function() {
Modal.hide('lastLoginModal');
Session.set('showLastLoginModal', null);
}, 3000);
if (!Session.get('displayLastLoginModal')) {
return;
}
// Displaye the modal
Modal.show('lastLoginModal', {
lastLoginDate: lastLoginDate
});
// Hide the modal after 5sec
Meteor.setTimeout(() => {
Modal.hide('lastLoginModal');
Session.setPersistent('displayLastLoginModal', false);
}, 5000);
// Log signin
HipaaLogger.logEvent({
eventType: 'init',
userId: user._id,
userName: user.profile.fullName
});
});
});

View File

@ -197,7 +197,6 @@ Package.onUse(function(api) {
api.addFiles('client/components/confirmRemoveTimepointAssociation/confirmRemoveTimepointAssociation.js', 'client');
api.addFiles('client/components/lastLoginModal/lastLoginModal.html', 'client');
api.addFiles('client/components/lastLoginModal/lastLoginModal.js', 'client');
api.addFiles('client/components/confirmDeleteDialog/confirmDeleteDialog.html', 'client');
api.addFiles('client/components/confirmDeleteDialog/confirmDeleteDialog.styl', 'client');

View File

@ -85,7 +85,13 @@ Meteor.methods({
},
getPriorLoginDate: function() {
return Meteor.users.findOne({_id: Meteor.userId()}, {fields: {priorLoginDate: 1}});
return Meteor.users.findOne({
_id: Meteor.userId()
}, {
fields: {
priorLoginDate: 1
}
}).priorLoginDate;
}
});

View File

@ -9,8 +9,9 @@ $distance = 12px
bottom: - ($toolbarDrawerHeight + $distance)
height: $toolbarDrawerHeight
left: 0
min-width: 100%
position: absolute
width: 100%
white-space: nowrap
.toolbarSectionDrawer
background-color: $uiGrayDarker
@ -30,4 +31,4 @@ $distance = 12px
width: 8px
&.active .buttonLabel i
transform(rotateX(180deg))
transform(rotateX(180deg))

View File

@ -0,0 +1,29 @@
<template name="worklistPagination">
<div class="worklistPagination">
<div class="row">
<div class="col-xs-4 col-sm-3 col-md-3">
{{#with recordCount}}
<div class="form-inline form-group rows-per-page">
<label>
<span>Show</span>
<select class="js-select-rows-per-page">
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
<span class="rows-per-page-label">rows per page</span>
</label>
</div>
{{/with}}
</div>
<div class="col-xs-8 col-sm-9 col-md-9">
<div class="form-inline form-group page-number">
<label>
<ul id="pagination" class="no-margins"></ul>
</label>
</div>
</div>
</div>
</div>
</template>

View File

@ -0,0 +1,58 @@
import { Template } from 'meteor/templating';
import './worklistPagination.html';
const visiblePages = 10;
Template.worklistPagination.onCreated(function() {
let instance = Template.instance();
// replace parentVariable with the name of the instance variable
instance.parent = this.parent(1);
});
Template.worklistPagination.onRendered(function() {
const instance = Template.instance();
const $paginationControl = instance.$('#pagination');
// Track changes on recordCount and rowsPerPage
instance.autorun(function() {
const recordCount = instance.parent.recordCount.get();
const rowsPerPage = instance.parent.rowsPerPage.get();
// Destroy plugin if exists
if ($paginationControl.data().twbsPagination) {
$paginationControl.twbsPagination('destroy');
}
if (recordCount && rowsPerPage) {
const totalPageNumber = Math.ceil(recordCount / rowsPerPage);
// Initialize plugin
$paginationControl.twbsPagination({
totalPages: totalPageNumber,
visiblePages: visiblePages,
onPageClick: function (event, page) {
// Update currentPage
// Decrease page by 1 to set currentPage
// Since reactive table current page index starts by 0
instance.parent.currentPage.set(page - 1);
}
});
}
});
});
Template.worklistPagination.helpers({
recordCount() {
const instance = Template.instance();
return instance.parent.recordCount.get();
}
});
Template.worklistPagination.events({
'change .js-select-rows-per-page'(event, instance) {
const rowsPerPage = $(event.currentTarget).val();
// Update rowsPerPage of parent
instance.parent.rowsPerPage.set(parseInt(rowsPerPage, 10));
}
});

View File

@ -0,0 +1,39 @@
@import "{design}/app"
.worklistPagination
font-size: 13px
font-weight: normal !important
.rows-per-page
padding-top: 20px
label
font-weight: normal
select
background-color: $primaryBackgroundColor
color: white
.page-number
text-align: right
label
font-weight: normal
ul#pagination
li
a
padding: 4px 8px
background-color: $primaryBackgroundColor
color: white
&:hover
color: $activeColor
.active
a
background-color: $uiGrayDarker
color: white

View File

@ -92,6 +92,10 @@
{{/each}}
</tbody>
</table>
<!-- Pagination -->
{{> worklistPagination }}
{{#if session "showLoadingText"}}
{{>loadingText}}
{{ else }}

View File

@ -6,19 +6,37 @@ Template.worklistResult.helpers({
* by Patient name and Study Date in Ascending order.
*/
studies() {
const sortOption = Session.get('sortOption');
if (sortOption) {
return WorklistStudies.find({}, {
sort: sortOption
});
const instance = Template.instance();
let studies;
let sortOption = {
patientName: 1,
studyDate: 1
};
// Update sort option if session is defined
if (Session.get('sortOption')) {
sortOption = Session.get('sortOption');
}
return WorklistStudies.find({}, {
sort: {
patientName: 1,
studyDate: 1
}
});
// Pagination parameters
const rowsPerPage = instance.rowsPerPage.get();
const currentPage = instance.currentPage.get();
const offset = rowsPerPage * currentPage;
const limit = offset + rowsPerPage;
studies = WorklistStudies.find({}, {
sort: sortOption
}).fetch();
if (!studies) {
return;
}
// Update record count
instance.recordCount.set(studies.length);
// Limit studies
return studies.slice(offset, limit);
},
numberOfStudies() {
@ -163,6 +181,15 @@ Template.worklistResult.onCreated(() => {
instance.sortOption = new ReactiveVar();
instance.sortingColumns = new ReactiveDict();
// Pagination parameters
// Rows per page is 25 as default
instance.rowsPerPage = new ReactiveVar(25);
// Set currentPage indexed 0
instance.currentPage = new ReactiveVar(0);
instance.recordCount = new ReactiveVar();
// Set sortOption
const sortOptionSession = Session.get('sortOption');
if (sortOptionSession) {

File diff suppressed because one or more lines are too long

View File

@ -69,6 +69,10 @@ Package.onUse(function (api) {
api.addFiles('client/components/progressDialog/progressDialog.html', 'client');
api.addFiles('client/components/progressDialog/progressDialog.styl', 'client');
api.addFiles('client/components/progressDialog/progressDialog.js', 'client');
api.addFiles('client/components/worklistPagination/worklistPagination.html', 'client');
api.addFiles('client/components/worklistPagination/worklistPagination.styl', 'client');
api.addFiles('client/components/worklistPagination/worklistPagination.js', 'client');
// Client-side library functions
api.addFiles('client/lib/getStudyMetadata.js', 'client');
@ -79,6 +83,7 @@ Package.onUse(function (api) {
api.addFiles('client/lib/worklist.js', 'client');
api.addFiles('client/lib/queryStudies.js', 'client');
api.addFiles('client/lib/importStudies.js', 'client');
api.addFiles('client/lib/jquery.twbsPagination/jquery.twbsPagination.min.js', 'client');
// Server-side functions
api.addFiles('server/publications.js', 'server');