reorganize packages, start converting overall app to react (very broken at the moment)

This commit is contained in:
Erik Ziegler committed 2018-12-12 18:06:25 +01:00
1 parent 024fe1a448
commit 5f30f7bd35
479 files changed
+5364 -11611

No files matched your search

@@ -1,21 +0,0 @@
HangingProtocols = new Meteor.Collection('hangingprotocols');
HangingProtocols._debugName = 'HangingProtocols';
HangingProtocols.allow({
insert: function() {
return true;
},
update: function() {
return true;
},
remove: function() {
return true;
}
});
// @TODO: Remove this after stabilizing ProtocolEngine
if (Meteor.isDevelopment && Meteor.isServer) {
Meteor.startup(() => {
HangingProtocols.remove({});
});
}
@@ -1,9 +1,12 @@
import { Meteor } from 'meteor/meteor';
import { comparators } from '../both/lib/comparators';
import { comparators } from './lib/comparators';
MatchedProtocols = new Meteor.Collection(null);
MatchedProtocols._debugName = 'MatchedProtocols';
HangingProtocols = new Meteor.Collection(null);
HangingProtocols._debugName = 'HangingProtocols';
Comparators = new Meteor.Collection(null);
Comparators._debugName = 'Comparators';
@@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { $ } from 'meteor/jquery';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import 'meteor/ohif:viewerbase';
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
$height = 20px
@@ -1,4 +1,4 @@
import { $ } from 'meteor/jquery';
import $ from 'jquery';
import { Session } from 'meteor/session';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
.ruleEntryDialog
theme('background', '$uiGrayDarkest', 0.95)
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
table.ruleTable
thead
@@ -24,11 +24,11 @@ table.ruleTable
&:hover, &:active
cursor: pointer
transition(all 0.1s ease)
&:hover
theme('color', '$hoverColor')
&:active
&:active
theme('color', '$activeColor')
td:first-child
@@ -50,9 +50,9 @@ table.ruleTable
.addRule
cursor: pointer
transition(all 0.1s ease)
&:hover
theme('color', '$hoverColor')
&:active
theme('color', '$activeColor')
&:active
theme('color', '$activeColor')
@@ -2,7 +2,7 @@ import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { ReactiveVar } from 'meteor/reactive-var';
import { Blaze } from 'meteor/blaze';
import { $ } from 'meteor/jquery';
import $ from 'jquery';
import { Viewerbase } from 'meteor/ohif:viewerbase';
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
.settingEntryDialog
theme('border', '1px solid $uiBorderColor', 0.95)
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
table.settingsTable
thead
@@ -22,13 +22,13 @@ table.settingsTable
.deleteSetting
cursor: pointer
transition(all 0.1s ease)
&:hover
theme('color', '$hoverColor')
&:active
&:active
theme('color', '$activeColor')
td:first-child
text-align: left
@@ -40,9 +40,9 @@ table.settingsTable
.addSetting
cursor: pointer
transition(all 0.1s ease)
&:hover
theme('color', '$hoverColor')
&:active
theme('color', '$activeColor')
&:active
theme('color', '$activeColor')
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
#stageDetails
overflow-y: auto
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
#stageSortingContainer
padding: 0 20px
@@ -13,7 +13,7 @@
&:hover
theme('color', '$hoverColor')
&.active
theme('color', '$activeColor')
@@ -38,11 +38,11 @@
cursor: pointer
theme('color', '$defaultColor')
transition(all 0.1s ease)
&:hover
theme('color', '$hoverColor')
&:active
&:active
theme('color', '$activeColor')
.addStage
@@ -52,11 +52,11 @@
#addStage
transition(all 0.1s ease)
&:hover
theme('color', '$hoverColor')
&:active
&:active
theme('color', '$activeColor')
.moveStageButtons
@@ -68,11 +68,11 @@
cursor: pointer
text-decoration: none
transition(all 0.1s ease)
&:hover
theme('color', '$hoverColor')
&:active
&:active
theme('color', '$activeColor')
&[disabled="true"]
@@ -1,5 +1,5 @@
import { Blaze } from 'meteor/blaze';
import { $ } from 'meteor/jquery';
import $ from 'jquery';
import { Template } from 'meteor/templating';
import { Viewerbase } from 'meteor/ohif:viewerbase';
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
.textEntryDialog
theme('border', '1px solid $uiBorderColor', 0.95)
@@ -1,4 +1,4 @@
import { _ } from 'meteor/underscore';
import _ from 'underscore';
/**
* Removes the first instance of an element from an array, if an equal value exists
@@ -30,4 +30,4 @@ const removeFromArray = (array, input) => {
return true;
};
export { removeFromArray };
export { removeFromArray };
@@ -1,5 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { Session } from 'meteor/session';
// OHIF Modules
@@ -1,159 +1,8 @@
import { Meteor } from "meteor/meteor";
import { Mongo } from 'meteor/mongo';
// The ProtocolStore default strategy is used to persist hanging protocols in
// the MongoDB collection 'HangingProtocols' in the application server.
var defaultStrategy = (function () {
var hangingProtocolSubs;
function addDefaultProtocols() {
console.log('Inserting default protocols');
addProtocol(HP.defaultProtocol);
}
function getDatabaseIdByProtocolId(protocolId) {
const filteredProtocol = HangingProtocols.findOne({
id: protocolId
}, {
fields: {
_id: true
}
});
if (!filteredProtocol) {
return;
}
return filteredProtocol._id;
}
/**
* Registers a function to be called when the hangingprotocols collection is subscribed
* The callback is called only one time when the subscription is ready
*
* @param callback The function to be called as a callback
*/
function onReady(callback) {
if (hangingProtocolSubs && hangingProtocolSubs.ready()) {
// It is already ready
callback();
} else {
// Subscribe the hangingprotocols collection
hangingProtocolSubs = Meteor.subscribe('hangingprotocols');
// Wait for the subscription to be ready
Tracker.autorun((computation) => {
if (hangingProtocolSubs.ready()) {
computation.stop();
addDefaultProtocols();
callback();
}
});
}
}
/**
* Gets the hanging protocol by protocolId if defined, otherwise all stored hanging protocols
*
* @param protocolId The protocol ID used to find the hanging protocol
* @returns {object|array} The hanging protocol by protocolId or array of the stored hanging protocols
*/
function getProtocol(protocolId) {
// Return the hanging protocol by protocolId if defined
if (protocolId) {
return HangingProtocols.findOne({
id: protocolId
});
}
// Otherwise, return all protocols
return HangingProtocols.find().fetch();
}
/**
* Stores the hanging protocol
*
* @param protocol The hanging protocol to be stored
*/
function addProtocol(protocol) {
// Collections can only be updated by database ID (_id) on client, so
// get the database ID (_id) by the hanging protocol ID firstly
const databaseId = getDatabaseIdByProtocolId(protocol.id);
// Remove any MongoDB ID the protocol may have had
delete protocol._id;
// Update the protocol with the same id if exists instead of inserting this protocol
if (databaseId) {
// Update the hanging protocol by the database ID
HangingProtocols.update(databaseId, {
$set: protocol
});
return;
}
// Insert the protocol
HangingProtocols.insert(protocol);
}
/**
* Updates the hanging protocol by protocolId
*
* @param protocolId The protocol ID used to find the hanging protocol to update
* @param protocol The updated hanging protocol
*/
function updateProtocol(protocolId, protocol) {
// Collections can only be updated by database ID (_id) on client, so
// get the database ID (_id) by the hanging protocol ID firstly
const databaseId = getDatabaseIdByProtocolId(protocolId);
// Skip if it does not exist in database
if (!databaseId) {
return;
}
// Remove any MongoDB ID the protocol may have had
delete protocol._id;
// Update the hanging protocol by the database ID
HangingProtocols.update(databaseId, {
$set: protocol
});
}
/**
* Removes the hanging protocol
*
* @param protocolId The protocol ID used to remove the hanging protocol
*/
function removeProtocol(protocolId) {
// Collections can only be removed by database ID (_id) on client, so
// get the database ID (_id) by the hanging protocol ID firstly
const databaseId = getDatabaseIdByProtocolId(protocolId);
// Skip if it does not exist in database
if (!databaseId) {
return;
}
// Remove the hanging protocol by the database ID
HangingProtocols.remove(databaseId);
}
// Module Exports
return {
onReady: onReady,
getProtocol: getProtocol,
addProtocol: addProtocol,
updateProtocol: updateProtocol,
removeProtocol: removeProtocol
};
})();
var clientOnlyStrategy = (function () {
const HangingProtocols = new Mongo.Collection(null);
let defaultsAdded = false;
@@ -296,16 +145,5 @@ var clientOnlyStrategy = (function () {
})();
// If we are running a disconnect client similar to the StandaloneViewer
// (see https://docs.ohif.org/standalone-viewer/usage.html) we don't want
// our HangingProtocol strategy to try to use Meteor methods or Pub / Sub
if (Meteor.settings &&
Meteor.settings.public &&
Meteor.settings.public.clientOnly === true) {
HP.ProtocolStore.setStrategy(clientOnlyStrategy);
} else {
HP.ProtocolStore.setStrategy(defaultStrategy);
}
HP.clientOnlyStrategy = clientOnlyStrategy;
HP.ProtocolStore.setStrategy(defaultStrategy);
+7 -16
View File
@@ -5,21 +5,19 @@ Package.describe({
});
Npm.depends({
'validate.js': '0.9.0'
'validate.js': '0.9.0',
moment: '2.22.2',
jquery: '3.3.1'
});
Package.onUse(function(api) {
api.versionsFrom('1.7');
api.use('ecmascript');
api.use('standard-app-packages');
api.use('jquery');
api.use('stylus');
api.use('random');
api.use('templating');
api.use('natestrauser:select2@4.0.1', 'client');
api.use('clinical:router@2.0.19');
api.use('momentjs:moment');
// Our custom packages
api.use('ohif:core');
@@ -27,14 +25,10 @@ Package.onUse(function(api) {
api.addAssets('assets/dots.svg', 'client');
// Both client & server
api.addFiles('both/namespace.js');
api.addFiles('both/collections.js');
api.addFiles('both/schema.js');
api.addFiles('both/hardcodedData.js');
api.addFiles('both/testData.js');
// Client-only
api.addFiles('client/namespace.js', 'client');
api.addFiles('client/schema.js', 'client');
api.addFiles('client/hardcodedData.js', 'client');
api.addFiles('client/testData.js', 'client');
api.addFiles('client/collections.js', 'client');
api.addFiles('client/protocolEngine.js', 'client');
api.addFiles('client/helpers/displayConstraint.js', 'client');
@@ -85,9 +79,6 @@ Package.onUse(function(api) {
api.addFiles('client/components/stageSortable/stageSortable.styl', 'client');
api.addFiles('client/components/stageSortable/stageSortable.js', 'client');
// Server-only
api.addFiles('server/collections.js', 'server');
// Global exports
api.export('HP');
});
@@ -1,4 +0,0 @@
Meteor.publish('hangingprotocols', function() {
// TODO: filter by availableTo user
return HangingProtocols.find();
});