LT-413: Enable analytics on Lesion Tracker

This commit is contained in:
Leonardo Campos 2017-02-14 01:25:44 -02:00
parent 33f9b8672b
commit b99b986630
11 changed files with 45 additions and 7 deletions

View File

@ -1,12 +1,16 @@
// Temporary fix to drop all Collections on server restart
// http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
Meteor.startup(() => {
console.warn('Dropping all Collections!');
if (!Meteor.settings.dropCollections) {
return;
}
console.warn('Dropping all global Collections!');
Object.keys(global).forEach((key) => {
const object = global[key];
if (object instanceof Meteor.Collection) {
if (!(/^server|currentServer$/).test(object._name)) {
console.warn(`Dropping: ${object._debugName}`);
console.warn(`Dropping: ${object._debugName || object._name}`);
object.remove({});
}
}

View File

@ -1,6 +1,8 @@
MatchedProtocols = new Meteor.Collection(null);
MatchedProtocols._debugName = 'MatchedProtocols';
Comparators = new Meteor.Collection(null);
Comparators._debugName = 'Comparators';
var comparators = [{
id: 'equals',

View File

@ -1,6 +1,7 @@
import { OHIF } from 'meteor/ohif:core';
TrialCriteriaTypes = new Meteor.Collection(null);
TrialCriteriaTypes._debugName = 'TrialCriteriaTypes';
TrialCriteriaTypes.insert({
id: 'RECIST',

View File

@ -6,9 +6,11 @@ import { measurementTools } from 'meteor/ohif:lesiontracker/both/configuration/m
let MeasurementCollections = {};
measurementTools.forEach(tool => {
MeasurementCollections[tool.id] = new Mongo.Collection(tool.id);
MeasurementCollections[tool.id]._debugName = tool.id;
});
const Timepoints = new Mongo.Collection('timepoints');
Timepoints._debugName = 'Timepoints';
Timepoints.find().observe({
remove() {
@ -18,10 +20,12 @@ Timepoints.find().observe({
// Drop our collections for testing purposes
Meteor.startup(() => {
Timepoints.remove({});
measurementTools.forEach(tool => {
MeasurementCollections[tool.id].remove({});
});
if (Meteor.settings.dropCollections) {
Timepoints.remove({});
measurementTools.forEach(tool => {
MeasurementCollections[tool.id].remove({});
});
}
});
// TODO: Make storage use update instead of clearing the entire collection and

View File

@ -39,10 +39,15 @@ Meteor.publish('reviewers', function() {
// Temporary fix to drop all Collections on server restart
// http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
Meteor.startup(function() {
if (!Meteor.settings.dropCollections) {
return;
}
for (var property in global) {
var object = global[property];
if (object instanceof Meteor.Collection) {
if (!(/^server|currentServer$/).test(object._name)) {
console.warn(`Dropping: ${object._debugName || object._name}`);
object.remove({});
}
}

View File

@ -167,6 +167,11 @@ export const PublicServerConfig = new SimpleSchema({
label: 'Verify Email',
defaultValue: false
},
demoUserEnabled: {
type: Boolean,
label: 'Creates demo user on startup and show TestDrive button',
defaultValue: true
},
ui: {
type: UISettings,
label: 'UI Settings'
@ -196,6 +201,11 @@ export const ServerConfiguration = new SimpleSchema({
label: 'Default Service Type',
defaultValue: 'dicomWeb'
},
dropCollections: {
type: Boolean,
label: 'Drop database collections',
defaultValue: false
},
public: {
type: PublicServerConfig,
label: 'Public Server Configuration',

View File

@ -5,6 +5,10 @@ import { ActiveEntry } from 'meteor/clinical:active-entry';
Template.entrySignIn.hooks({
rendered: function () {
if (!Meteor.settings.public.demoUserEnabled) {
return;
}
// Create Test Drive button dynamically
let btnTestDrive = $('<button/>', {
id: 'btnTestDrive',

View File

@ -11,6 +11,10 @@ Meteor.startup(function() {
};
createDemoUser = function() {
if (!Meteor.settings.public.demoUserEnabled) {
return;
}
const user = Meteor.users.findOne({
emails: {
$elemMatch: {
@ -21,7 +25,8 @@ Meteor.startup(function() {
if (user) {
return;
}
console.log('create user!');
console.log('Creating demo user');
// Create user
const userId = Accounts.createUser(options);

View File

@ -43,6 +43,7 @@
}]
},
"defaultServiceType": "dimse",
"dropCollections": true,
"public": {
"verifyEmail": false,
"ui": {

View File

@ -18,6 +18,7 @@
]
},
"defaultServiceType": "dicomWeb",
"dropCollections": true,
"public": {
"verifyEmail": false,
"ui": {

View File

@ -27,6 +27,7 @@
}]
},
"defaultServiceType": "dimse",
"dropCollections": true,
"public": {
"verifyEmail": false,
"ui": {