fix(client-only): Fix client-only Server & CurrentServer usage (#276)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2018-09-21 20:02:29 +02:00
1 parent c4b1086097
commit 18a3bcba30
10 files changed
+86 -37

No files matched your search

@@ -1 +0,0 @@
import './subscriptions.js';
@@ -1,4 +0,0 @@
import { Meteor } from 'meteor/meteor';
Meteor.subscribe('servers');
Meteor.subscribe('currentServer');
+1 -1
View File
@@ -1,2 +1,2 @@
import './collections';
import './startup.js';
import './components';
+32
View File
@@ -0,0 +1,32 @@
// Check the servers on meteor startup
import { Meteor } from "meteor/meteor";
import { Servers, CurrentServer } from 'meteor/ohif:servers/both/collections';
if (Meteor.settings &&
Meteor.settings.public &&
Meteor.settings.public.clientOnly === true &&
Meteor.settings.public.servers) {
OHIF.log.info('Updating servers information from JSON configuration');
const servers = Meteor.settings.public.servers;
Object.keys(servers).forEach((serverType) => {
const endpoints = servers[serverType];
endpoints.forEach((endpoint) => {
const server = Object.assign({}, endpoint);
server.origin = 'json';
server.type = serverType;
Servers.insert(server);
});
});
const newServer = Servers.findOne();
CurrentServer.insert({
serverId: newServer._id
});
console.log('test');
}