LT-413: Enable analytics on Lesion Tracker
This commit is contained in:
parent
33f9b8672b
commit
b99b986630
@ -1,12 +1,16 @@
|
|||||||
// Temporary fix to drop all Collections on server restart
|
// 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
|
// http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
|
||||||
Meteor.startup(() => {
|
Meteor.startup(() => {
|
||||||
console.warn('Dropping all Collections!');
|
if (!Meteor.settings.dropCollections) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('Dropping all global Collections!');
|
||||||
Object.keys(global).forEach((key) => {
|
Object.keys(global).forEach((key) => {
|
||||||
const object = global[key];
|
const object = global[key];
|
||||||
if (object instanceof Meteor.Collection) {
|
if (object instanceof Meteor.Collection) {
|
||||||
if (!(/^server|currentServer$/).test(object._name)) {
|
if (!(/^server|currentServer$/).test(object._name)) {
|
||||||
console.warn(`Dropping: ${object._debugName}`);
|
console.warn(`Dropping: ${object._debugName || object._name}`);
|
||||||
object.remove({});
|
object.remove({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
MatchedProtocols = new Meteor.Collection(null);
|
MatchedProtocols = new Meteor.Collection(null);
|
||||||
|
MatchedProtocols._debugName = 'MatchedProtocols';
|
||||||
|
|
||||||
Comparators = new Meteor.Collection(null);
|
Comparators = new Meteor.Collection(null);
|
||||||
|
Comparators._debugName = 'Comparators';
|
||||||
|
|
||||||
var comparators = [{
|
var comparators = [{
|
||||||
id: 'equals',
|
id: 'equals',
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
TrialCriteriaTypes = new Meteor.Collection(null);
|
TrialCriteriaTypes = new Meteor.Collection(null);
|
||||||
|
TrialCriteriaTypes._debugName = 'TrialCriteriaTypes';
|
||||||
|
|
||||||
TrialCriteriaTypes.insert({
|
TrialCriteriaTypes.insert({
|
||||||
id: 'RECIST',
|
id: 'RECIST',
|
||||||
|
|||||||
@ -6,9 +6,11 @@ import { measurementTools } from 'meteor/ohif:lesiontracker/both/configuration/m
|
|||||||
let MeasurementCollections = {};
|
let MeasurementCollections = {};
|
||||||
measurementTools.forEach(tool => {
|
measurementTools.forEach(tool => {
|
||||||
MeasurementCollections[tool.id] = new Mongo.Collection(tool.id);
|
MeasurementCollections[tool.id] = new Mongo.Collection(tool.id);
|
||||||
|
MeasurementCollections[tool.id]._debugName = tool.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const Timepoints = new Mongo.Collection('timepoints');
|
const Timepoints = new Mongo.Collection('timepoints');
|
||||||
|
Timepoints._debugName = 'Timepoints';
|
||||||
|
|
||||||
Timepoints.find().observe({
|
Timepoints.find().observe({
|
||||||
remove() {
|
remove() {
|
||||||
@ -18,10 +20,12 @@ Timepoints.find().observe({
|
|||||||
|
|
||||||
// Drop our collections for testing purposes
|
// Drop our collections for testing purposes
|
||||||
Meteor.startup(() => {
|
Meteor.startup(() => {
|
||||||
Timepoints.remove({});
|
if (Meteor.settings.dropCollections) {
|
||||||
measurementTools.forEach(tool => {
|
Timepoints.remove({});
|
||||||
MeasurementCollections[tool.id].remove({});
|
measurementTools.forEach(tool => {
|
||||||
});
|
MeasurementCollections[tool.id].remove({});
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Make storage use update instead of clearing the entire collection and
|
// TODO: Make storage use update instead of clearing the entire collection and
|
||||||
|
|||||||
@ -39,10 +39,15 @@ Meteor.publish('reviewers', function() {
|
|||||||
// Temporary fix to drop all Collections on server restart
|
// 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
|
// http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
|
||||||
Meteor.startup(function() {
|
Meteor.startup(function() {
|
||||||
|
if (!Meteor.settings.dropCollections) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var property in global) {
|
for (var property in global) {
|
||||||
var object = global[property];
|
var object = global[property];
|
||||||
if (object instanceof Meteor.Collection) {
|
if (object instanceof Meteor.Collection) {
|
||||||
if (!(/^server|currentServer$/).test(object._name)) {
|
if (!(/^server|currentServer$/).test(object._name)) {
|
||||||
|
console.warn(`Dropping: ${object._debugName || object._name}`);
|
||||||
object.remove({});
|
object.remove({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,6 +167,11 @@ export const PublicServerConfig = new SimpleSchema({
|
|||||||
label: 'Verify Email',
|
label: 'Verify Email',
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
},
|
},
|
||||||
|
demoUserEnabled: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Creates demo user on startup and show TestDrive button',
|
||||||
|
defaultValue: true
|
||||||
|
},
|
||||||
ui: {
|
ui: {
|
||||||
type: UISettings,
|
type: UISettings,
|
||||||
label: 'UI Settings'
|
label: 'UI Settings'
|
||||||
@ -196,6 +201,11 @@ export const ServerConfiguration = new SimpleSchema({
|
|||||||
label: 'Default Service Type',
|
label: 'Default Service Type',
|
||||||
defaultValue: 'dicomWeb'
|
defaultValue: 'dicomWeb'
|
||||||
},
|
},
|
||||||
|
dropCollections: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Drop database collections',
|
||||||
|
defaultValue: false
|
||||||
|
},
|
||||||
public: {
|
public: {
|
||||||
type: PublicServerConfig,
|
type: PublicServerConfig,
|
||||||
label: 'Public Server Configuration',
|
label: 'Public Server Configuration',
|
||||||
|
|||||||
@ -5,6 +5,10 @@ import { ActiveEntry } from 'meteor/clinical:active-entry';
|
|||||||
Template.entrySignIn.hooks({
|
Template.entrySignIn.hooks({
|
||||||
|
|
||||||
rendered: function () {
|
rendered: function () {
|
||||||
|
if (!Meteor.settings.public.demoUserEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create Test Drive button dynamically
|
// Create Test Drive button dynamically
|
||||||
let btnTestDrive = $('<button/>', {
|
let btnTestDrive = $('<button/>', {
|
||||||
id: 'btnTestDrive',
|
id: 'btnTestDrive',
|
||||||
|
|||||||
@ -11,6 +11,10 @@ Meteor.startup(function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
createDemoUser = function() {
|
createDemoUser = function() {
|
||||||
|
if (!Meteor.settings.public.demoUserEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const user = Meteor.users.findOne({
|
const user = Meteor.users.findOne({
|
||||||
emails: {
|
emails: {
|
||||||
$elemMatch: {
|
$elemMatch: {
|
||||||
@ -21,7 +25,8 @@ Meteor.startup(function() {
|
|||||||
if (user) {
|
if (user) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('create user!');
|
|
||||||
|
console.log('Creating demo user');
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
const userId = Accounts.createUser(options);
|
const userId = Accounts.createUser(options);
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"defaultServiceType": "dimse",
|
"defaultServiceType": "dimse",
|
||||||
|
"dropCollections": true,
|
||||||
"public": {
|
"public": {
|
||||||
"verifyEmail": false,
|
"verifyEmail": false,
|
||||||
"ui": {
|
"ui": {
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"defaultServiceType": "dicomWeb",
|
"defaultServiceType": "dicomWeb",
|
||||||
|
"dropCollections": true,
|
||||||
"public": {
|
"public": {
|
||||||
"verifyEmail": false,
|
"verifyEmail": false,
|
||||||
"ui": {
|
"ui": {
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"defaultServiceType": "dimse",
|
"defaultServiceType": "dimse",
|
||||||
|
"dropCollections": true,
|
||||||
"public": {
|
"public": {
|
||||||
"verifyEmail": false,
|
"verifyEmail": false,
|
||||||
"ui": {
|
"ui": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user