From 8aa8b4288c6664591ea5377b353b1888186a7ebc Mon Sep 17 00:00:00 2001 From: "Emanuel F. Oliveira" Date: Sun, 25 Sep 2016 19:37:32 +0000 Subject: [PATCH] PWV-2: Change on ServerConfiguration logic to make it extensible --- .../ohif-study-list/both/schema/servers.js | 5 --- .../serverInformationForm.js | 2 +- Packages/ohif-study-list/package.js | 1 + .../server/validateServerConfiguration.js | 37 +++++++++++++------ 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Packages/ohif-study-list/both/schema/servers.js b/Packages/ohif-study-list/both/schema/servers.js index 4c84fab6f..bc503bd22 100644 --- a/Packages/ohif-study-list/both/schema/servers.js +++ b/Packages/ohif-study-list/both/schema/servers.js @@ -165,11 +165,6 @@ export const PublicServerConfig = new SimpleSchema({ ui: { type: UISettings, label: 'UI Settings' - }, - custom: { - type: Object, - label: 'Custom Settings', - optional: true } }); diff --git a/Packages/ohif-study-list/client/components/serverInformation/serverInformationForm/serverInformationForm.js b/Packages/ohif-study-list/client/components/serverInformation/serverInformationForm/serverInformationForm.js index e2428b952..982fdc176 100644 --- a/Packages/ohif-study-list/client/components/serverInformation/serverInformationForm/serverInformationForm.js +++ b/Packages/ohif-study-list/client/components/serverInformation/serverInformationForm/serverInformationForm.js @@ -1,6 +1,6 @@ +import { Meteor } from 'meteor/meteor'; import { Template } from 'meteor/templating'; import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; import { DICOMWebServer as dicomSchema } from 'meteor/ohif:study-list/both/schema/servers.js'; import { DIMSEServer as dimseSchema } from 'meteor/ohif:study-list/both/schema/servers.js'; diff --git a/Packages/ohif-study-list/package.js b/Packages/ohif-study-list/package.js index 754da6533..c10706bef 100644 --- a/Packages/ohif-study-list/package.js +++ b/Packages/ohif-study-list/package.js @@ -27,6 +27,7 @@ Package.onUse(function(api) { // Our custom packages api.use('design'); api.use('ohif:core'); + api.use('ohif:log'); api.use('ohif:dicom-services'); api.use('ohif:viewerbase'); api.use('ohif:wadoproxy'); diff --git a/Packages/ohif-study-list/server/validateServerConfiguration.js b/Packages/ohif-study-list/server/validateServerConfiguration.js index 2b5e49540..94e14a73c 100644 --- a/Packages/ohif-study-list/server/validateServerConfiguration.js +++ b/Packages/ohif-study-list/server/validateServerConfiguration.js @@ -1,16 +1,29 @@ import { Meteor } from 'meteor/meteor'; -import { check } from 'meteor/check'; -import { ServerConfiguration } from '../both/schema/servers.js'; +// import { check } from 'meteor/check'; +import { OHIF } from 'meteor/ohif:core'; +import { ServerConfiguration } from 'meteor/ohif:study-list/both/schema/servers.js'; -/* --- Taking this out for now to prevent confusion. - -TODO: Make the error messages more clear Meteor.startup(() => { - console.log('------ Testing Meteor Settings ------'); - let config = ServerConfiguration.clean(Meteor.settings); - console.log(JSON.stringify(config, null, 2)); + // Save custom properties (if any)... + // "Meteor.settings" and "Meteor.settings.public" are set by default... + let custom = { + private: Meteor.settings.custom, + public: Meteor.settings.public.custom + }; - Meteor.settings = config; - check(config, ServerConfiguration); -});*/ + // ... and remove them to prevent clean up + delete Meteor.settings.custom; + delete Meteor.settings.public.custom; + + ServerConfiguration.clean(Meteor.settings); + + // TODO: Make the error messages more clear + // console.log('------ Testing Meteor Settings ------'); + // Taking this out for now to prevent confusion. + // check(Meteor.settings, ServerConfiguration); + + Meteor.settings.custom = custom.private; + Meteor.settings.public.custom = custom.public; + + OHIF.log.info(JSON.stringify(Meteor.settings, null, 2)); +});