Skip to content

Commit

Permalink
fix(google-cloud): Minor cleanup to prevent Google Cloud packages fro…
Browse files Browse the repository at this point in the history
…m being added unnecessarily
  • Loading branch information
swederik committed Mar 22, 2019
1 parent 9486522 commit 46828dc
Show file tree
Hide file tree
Showing 31 changed files with 48 additions and 45 deletions.
9 changes: 5 additions & 4 deletions OHIFViewer/client/components/ohifViewer/ohifViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ Template.ohifViewer.onCreated(() => {
Session.set('ViewerOpened', isViewer);
});

if (OHIF.demoMode && OHIF.demoMode.userLoggedIn())
OHIF.demoMode.setDemoServerConfig();
else if (OHIF.gcloud && OHIF.gcloud.isEnabled()) {
if (OHIF.demoMode && OHIF.demoMode.userLoggedIn()) {
OHIF.demoMode.setDemoServerConfig();
} else if (OHIF.gcloud && OHIF.gcloud.isEnabled()) {
const server = OHIF.servers.getCurrentServer();

if (!server || !server.isCloud) {
Session.set("IsStudyListReady", false);
OHIF.gcloud.showDicomStorePicker({canClose: OHIF.demoMode}).then(config => {
Expand Down Expand Up @@ -94,7 +95,7 @@ Template.ohifViewer.events({
}
}
},

});

Template.ohifViewer.helpers({
Expand Down
2 changes: 0 additions & 2 deletions Packages/ohif-demo-mode/client/index.js

This file was deleted.

7 changes: 7 additions & 0 deletions Packages/ohif-demo-mode/imports/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { OHIF } from 'meteor/ohif:core';
import devModeMediator from './demoModeMediator.js';
import './components';
import './routes.js';

OHIF.demoMode = devModeMediator;

File renamed without changes.
12 changes: 3 additions & 9 deletions Packages/ohif-demo-mode/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import { OHIF } from 'meteor/ohif:core';
import './client';
import devModeMediator from './client/demoModeMediator.js';

const demoMode = Meteor.settings && Meteor.settings.public && Meteor.settings.public.demoMode;

if (demoMode) {
OHIF.demoMode = devModeMediator;
}
if (Meteor.settings.public.demoMode) {
import './imports/client/index.js';
}
1 change: 0 additions & 1 deletion Packages/ohif-demo-mode/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ Package.onUse(function(api) {

// Main module
api.mainModule('main.js', 'client');

});
6 changes: 6 additions & 0 deletions Packages/ohif-google-cloud/client/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Meteor } from 'meteor/meteor';

if (Meteor.settings.public.googleCloud) {
import '../imports/index.js';
import '../imports/client/index.js';
}
File renamed without changes.
8 changes: 8 additions & 0 deletions Packages/ohif-google-cloud/imports/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { OHIF } from 'meteor/ohif:core';
import GCloudAdapter from './lib/GCloudAdapter';

const gcloud = GCloudAdapter;

OHIF.gcloud = gcloud;


Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { OHIF } from 'meteor/ohif:core';

const GCloudAdapter = {};

const GCP_HEALTHCARE_CONFIG = 'GCP_HEALTHCARE_CONFIG';
Expand All @@ -16,7 +18,9 @@ GCloudAdapter.setConfig = function(config) {

GCloudAdapter.showDicomStorePicker = function(options) {
return OHIF.ui.showDialog('dicomStorePicker', options).then(config => {
if (config) OHIF.gcloud.setConfig(config);
if (config) {
OHIF.gcloud.setConfig(config);
}
return config;
});
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export function loadScript(url, callback=undefined)
{
export function loadScript(url, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.onreadystatechange = callback;
script.onload = callback;
head.appendChild(script);
}
}
9 changes: 0 additions & 9 deletions Packages/ohif-google-cloud/main.js

This file was deleted.

7 changes: 2 additions & 5 deletions Packages/ohif-google-cloud/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ Package.onUse(function(api) {
api.use(['templating', 'stylus'], 'client');

// Main module
api.mainModule('main.js', ['client']);
api.mainModule('client/main.js', ['client']);

// Client imports and routes
api.addFiles('client/index.js', 'client');

var assets = [
const assets = [
'.npm/package/node_modules/healthcare-api-adapter/dist/gcp.min.js',
'.npm/package/node_modules/healthcare-api-adapter/dist/gcp.0.min.js',
'.npm/package/node_modules/healthcare-api-adapter/dist/gcp.2.min.js',
Expand Down
3 changes: 3 additions & 0 deletions Packages/ohif-servers/client/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ if (Meteor.settings &&
});

const newServer = Servers.findOne();
if (!newServer) {
return;
}

CurrentServer.insert({
serverId: newServer._id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Meteor.methods({
if (server.type === 'dicomWeb') {
if(server.metadataSource ==='qido') {
return OHIF.studies.services.QIDO.RetrieveMetadata(server, studyInstanceUid);
}
else{
} else {
return OHIF.studies.services.WADO.RetrieveMetadata(server, studyInstanceUid);
}
} else if (server.type === 'dimse') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ let filter;
*/
function getFilter(filter) {
const server = OHIF.servers.getCurrentServer();
if (!server.isCloud) {
if (filter && filter.length && filter.substr(filter.length - 1) !== '*') {
filter += '*';
}
if (filter && filter.length && filter.substr(filter.length - 1) !== '*') {
filter += '*';
}

return filter;
Expand Down Expand Up @@ -133,13 +131,12 @@ function search(instance) {
studyDescription: getFilter($('input#studyDescription').val()),
studyDateFrom,
studyDateTo,
modalitiesInStudy: $('input#modality').val() ? $('input#modality').val() : ''
modalitiesInStudy: $('input#modality').val() ? $('input#modality').val() : '',
offset: rowsPerPage * currentPage,
limit: rowsPerPage
};
const server = OHIF.servers.getCurrentServer();
if (!server.isCloud) {
filter.offset=rowsPerPage * currentPage;
filter.limit=rowsPerPage;
}

// Make sure that modality has a reasonable value, since it is occasionally
// returned as 'undefined'
const modality = replaceUndefinedColumnValue($('input#modality').val());
Expand Down

0 comments on commit 46828dc

Please sign in to comment.