Allow StandaloneViewer to use ?url to specify path to JSON
This commit is contained in:
parent
cdac28ed7f
commit
25690ef888
@ -5,18 +5,18 @@
|
|||||||
# but you can also edit it by hand.
|
# but you can also edit it by hand.
|
||||||
|
|
||||||
meteor-base@1.1.0 # Packages every Meteor app needs to have
|
meteor-base@1.1.0 # Packages every Meteor app needs to have
|
||||||
mobile-experience@1.0.4 # Packages for a great mobile UX
|
mobile-experience@1.0.5 # Packages for a great mobile UX
|
||||||
mongo@1.1.18 # The database Meteor supports right now
|
mongo@1.2.2 # The database Meteor supports right now
|
||||||
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
|
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
|
||||||
reactive-var@1.0.11 # Reactive variable for tracker
|
reactive-var@1.0.11 # Reactive variable for tracker
|
||||||
jquery@1.11.10 # Helpful client-side library
|
jquery@1.11.10 # Helpful client-side library
|
||||||
tracker@1.1.3 # Meteor's client-side reactive programming library
|
tracker@1.1.3 # Meteor's client-side reactive programming library
|
||||||
|
|
||||||
standard-minifier-css@1.3.4 # CSS minifier run for production mode
|
standard-minifier-css@1.3.5 # CSS minifier run for production mode
|
||||||
standard-minifier-js@2.1.0 # JS minifier run for production mode
|
standard-minifier-js@2.1.2 # JS minifier run for production mode
|
||||||
es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers.
|
es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers.
|
||||||
ecmascript@0.8.0 # Enable ECMAScript2015+ syntax in app code
|
ecmascript@0.8.3 # Enable ECMAScript2015+ syntax in app code
|
||||||
shell-server@0.2.3 # Server-side component of the `meteor shell` command
|
shell-server@0.2.4 # Server-side component of the `meteor shell` command
|
||||||
|
|
||||||
# OHIF Packages
|
# OHIF Packages
|
||||||
ohif:polyfill
|
ohif:polyfill
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
METEOR@1.5
|
METEOR@1.5.2.2
|
||||||
|
|||||||
@ -1,39 +1,39 @@
|
|||||||
accounts-base@1.3.0
|
accounts-base@1.3.4
|
||||||
aldeed:collection2@2.10.0
|
aldeed:collection2@2.10.0
|
||||||
aldeed:collection2-core@1.2.0
|
aldeed:collection2-core@1.2.0
|
||||||
aldeed:schema-deny@1.1.0
|
aldeed:schema-deny@1.1.0
|
||||||
aldeed:schema-index@1.1.1
|
aldeed:schema-index@1.1.1
|
||||||
aldeed:simple-schema@1.5.3
|
aldeed:simple-schema@1.5.3
|
||||||
aldeed:template-extension@4.1.0
|
aldeed:template-extension@4.1.0
|
||||||
allow-deny@1.0.5
|
allow-deny@1.0.9
|
||||||
amplify@1.0.0
|
amplify@1.0.0
|
||||||
autoupdate@1.3.12
|
autoupdate@1.3.12
|
||||||
babel-compiler@6.19.2
|
babel-compiler@6.20.0
|
||||||
babel-runtime@1.0.1
|
babel-runtime@1.0.1
|
||||||
base64@1.0.10
|
base64@1.0.10
|
||||||
binary-heap@1.0.10
|
binary-heap@1.0.10
|
||||||
blaze@2.3.2
|
blaze@2.3.2
|
||||||
blaze-html-templates@1.1.2
|
blaze-html-templates@1.1.2
|
||||||
blaze-tools@1.0.10
|
blaze-tools@1.0.10
|
||||||
boilerplate-generator@1.1.0
|
boilerplate-generator@1.2.0
|
||||||
caching-compiler@1.1.9
|
caching-compiler@1.1.9
|
||||||
caching-html-compiler@1.1.2
|
caching-html-compiler@1.1.2
|
||||||
callback-hook@1.0.10
|
callback-hook@1.0.10
|
||||||
check@1.2.5
|
check@1.2.5
|
||||||
dangrossman:bootstrap-daterangepicker@2.1.13
|
dangrossman:bootstrap-daterangepicker@2.1.13
|
||||||
ddp@1.2.5
|
ddp@1.3.1
|
||||||
ddp-client@1.3.4
|
ddp-client@2.1.3
|
||||||
ddp-common@1.2.8
|
ddp-common@1.2.9
|
||||||
ddp-rate-limiter@1.0.7
|
ddp-rate-limiter@1.0.7
|
||||||
ddp-server@1.3.14
|
ddp-server@2.0.2
|
||||||
deps@1.0.12
|
deps@1.0.12
|
||||||
diff-sequence@1.0.7
|
diff-sequence@1.0.7
|
||||||
dynamic-import@0.1.1
|
dynamic-import@0.1.3
|
||||||
ecmascript@0.8.0
|
ecmascript@0.8.3
|
||||||
ecmascript-runtime@0.4.1
|
ecmascript-runtime@0.4.1
|
||||||
ecmascript-runtime-client@0.4.2
|
ecmascript-runtime-client@0.4.3
|
||||||
ecmascript-runtime-server@0.4.1
|
ecmascript-runtime-server@0.4.1
|
||||||
ejson@1.0.13
|
ejson@1.0.14
|
||||||
es5-shim@4.6.15
|
es5-shim@4.6.15
|
||||||
fastclick@1.0.13
|
fastclick@1.0.13
|
||||||
fortawesome:fontawesome@4.7.0
|
fortawesome:fontawesome@4.7.0
|
||||||
@ -54,25 +54,26 @@ iron:url@1.1.0
|
|||||||
jquery@1.11.10
|
jquery@1.11.10
|
||||||
launch-screen@1.1.1
|
launch-screen@1.1.1
|
||||||
livedata@1.0.18
|
livedata@1.0.18
|
||||||
localstorage@1.1.0
|
localstorage@1.1.1
|
||||||
logging@1.1.17
|
logging@1.1.19
|
||||||
mdg:validation-error@0.5.1
|
mdg:validation-error@0.5.1
|
||||||
meteor@1.6.1
|
meteor@1.7.2
|
||||||
meteor-base@1.1.0
|
meteor-base@1.1.0
|
||||||
meteor-platform@1.2.6
|
meteor-platform@1.2.6
|
||||||
minifier-css@1.2.16
|
minifier-css@1.2.16
|
||||||
minifier-js@2.1.0
|
minifier-js@2.1.4
|
||||||
minimongo@1.2.1
|
minimongo@1.3.3
|
||||||
mobile-experience@1.0.4
|
mobile-experience@1.0.5
|
||||||
mobile-status-bar@1.0.14
|
mobile-status-bar@1.0.14
|
||||||
modules@0.9.1
|
modules@0.10.0
|
||||||
modules-runtime@0.8.0
|
modules-runtime@0.8.0
|
||||||
momentjs:moment@2.18.1
|
momentjs:moment@2.18.1
|
||||||
mongo@1.1.18
|
mongo@1.2.2
|
||||||
|
mongo-dev-server@1.0.1
|
||||||
mongo-id@1.0.6
|
mongo-id@1.0.6
|
||||||
mrt:moment@2.8.1
|
mrt:moment@2.8.1
|
||||||
natestrauser:select2@4.0.3
|
natestrauser:select2@4.0.3
|
||||||
npm-mongo@2.2.24
|
npm-mongo@2.2.33
|
||||||
observe-sequence@1.0.16
|
observe-sequence@1.0.16
|
||||||
ohif:commands@0.0.1
|
ohif:commands@0.0.1
|
||||||
ohif:core@0.0.1
|
ohif:core@0.0.1
|
||||||
@ -85,13 +86,14 @@ ohif:hotkeys@0.0.1
|
|||||||
ohif:log@0.0.1
|
ohif:log@0.0.1
|
||||||
ohif:metadata@0.0.1
|
ohif:metadata@0.0.1
|
||||||
ohif:polyfill@0.0.1
|
ohif:polyfill@0.0.1
|
||||||
|
ohif:servers@0.0.1
|
||||||
ohif:study-list@0.0.1
|
ohif:study-list@0.0.1
|
||||||
ohif:themes@0.0.1
|
ohif:themes@0.0.1
|
||||||
ohif:themes-common@0.0.1
|
ohif:themes-common@0.0.1
|
||||||
ohif:viewerbase@0.0.1
|
ohif:viewerbase@0.0.1
|
||||||
ohif:wadoproxy@0.0.1
|
ohif:wadoproxy@0.0.1
|
||||||
ordered-dict@1.0.9
|
ordered-dict@1.0.9
|
||||||
promise@0.8.9
|
promise@0.9.0
|
||||||
raix:eventemitter@0.1.3
|
raix:eventemitter@0.1.3
|
||||||
random@1.0.10
|
random@1.0.10
|
||||||
rate-limit@1.0.8
|
rate-limit@1.0.8
|
||||||
@ -102,16 +104,16 @@ retry@1.0.9
|
|||||||
routepolicy@1.0.12
|
routepolicy@1.0.12
|
||||||
service-configuration@1.0.11
|
service-configuration@1.0.11
|
||||||
session@1.1.7
|
session@1.1.7
|
||||||
shell-server@0.2.3
|
shell-server@0.2.4
|
||||||
silentcicero:jszip@0.0.4
|
silentcicero:jszip@0.0.4
|
||||||
spacebars@1.0.15
|
spacebars@1.0.15
|
||||||
spacebars-compiler@1.1.2
|
spacebars-compiler@1.1.3
|
||||||
standard-app-packages@1.0.9
|
standard-app-packages@1.0.9
|
||||||
standard-minifier-css@1.3.4
|
standard-minifier-css@1.3.5
|
||||||
standard-minifier-js@2.1.0
|
standard-minifier-js@2.1.2
|
||||||
stylus@2.513.9
|
stylus@2.513.9
|
||||||
templating@1.3.2
|
templating@1.3.2
|
||||||
templating-compiler@1.3.2
|
templating-compiler@1.3.3
|
||||||
templating-runtime@1.3.2
|
templating-runtime@1.3.2
|
||||||
templating-tools@1.1.2
|
templating-tools@1.1.2
|
||||||
tracker@1.1.3
|
tracker@1.1.3
|
||||||
@ -121,5 +123,5 @@ ui@1.0.13
|
|||||||
underscore@1.0.10
|
underscore@1.0.10
|
||||||
url@1.1.0
|
url@1.1.0
|
||||||
validatejs@0.0.1
|
validatejs@0.0.1
|
||||||
webapp@1.3.16
|
webapp@1.3.19
|
||||||
webapp-hashing@1.0.9
|
webapp-hashing@1.0.9
|
||||||
|
|||||||
@ -13,63 +13,63 @@ if (Meteor.isClient) {
|
|||||||
|
|
||||||
Router.onBeforeAction('loading');
|
Router.onBeforeAction('loading');
|
||||||
|
|
||||||
Router.route('/:id', {
|
Router.route('/:id?', {
|
||||||
action: function() {
|
onRun: function() {
|
||||||
// Retrieve the ID from the URL the user has entered
|
console.warn('onRun');
|
||||||
let id = this.params.id;
|
// Retrieve the query from the URL the user has entered
|
||||||
|
const query = this.params.query;
|
||||||
|
const id = this.params.id;
|
||||||
|
|
||||||
if (!id) {
|
if (!id && !query.url) {
|
||||||
id = 'testId';
|
console.log('No URL was specified. Use ?url=${yourURL}');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const next = this.next;
|
||||||
|
const idUrl = `/api/${id}`;
|
||||||
|
const url = query.url || idUrl;
|
||||||
|
|
||||||
// Define a request to the server to retrieve the study data
|
// Define a request to the server to retrieve the study data
|
||||||
// as JSON, given an ID that was in the Route
|
// as JSON, given a URL that was in the Route
|
||||||
const oReq = new XMLHttpRequest();
|
const oReq = new XMLHttpRequest();
|
||||||
|
|
||||||
// Add event listeners for request failure
|
// Add event listeners for request failure
|
||||||
oReq.addEventListener('error', () => {
|
oReq.addEventListener('error', () => {
|
||||||
OHIF.log.warn('An error occurred while retrieving the JSON data');
|
OHIF.log.warn('An error occurred while retrieving the JSON data');
|
||||||
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
const self = this;
|
|
||||||
|
|
||||||
// When the JSON has been returned, parse it into a JavaScript Object
|
// When the JSON has been returned, parse it into a JavaScript Object
|
||||||
// and render the OHIF Viewer with this data
|
// and render the OHIF Viewer with this data
|
||||||
oReq.addEventListener('load', function() {
|
oReq.addEventListener('load', () => {
|
||||||
// Parse the response content
|
// Parse the response content
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText
|
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText
|
||||||
if (!this.responseText) {
|
if (!oReq.responseText) {
|
||||||
OHIF.log.warn('Response was undefined');
|
OHIF.log.warn('Response was undefined');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OHIF.log.info(JSON.stringify(this.responseText, null, 2));
|
OHIF.log.info(JSON.stringify(oReq.responseText, null, 2));
|
||||||
|
this.data = JSON.parse(oReq.responseText);
|
||||||
|
|
||||||
const parsed = JSON.parse(this.responseText);
|
next();
|
||||||
|
|
||||||
// Create some data to pass to the OHIF Viewer
|
|
||||||
const data = {
|
|
||||||
studies: parsed.studies,
|
|
||||||
contentId: 'standalone' // TODO: Remove all dependence on this
|
|
||||||
};
|
|
||||||
|
|
||||||
// Render the Viewer with this data
|
|
||||||
self.render('standaloneViewer', {
|
|
||||||
data: function() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Open the Request to the server for the JSON data
|
// Open the Request to the server for the JSON data
|
||||||
// In this case we have a server-side route called /api/
|
// In this case we have a server-side route called /api/
|
||||||
// which responds to GET requests with the study data
|
// which responds to GET requests with the study data
|
||||||
OHIF.log.info(`Sending Request to: /api/${id}`);
|
OHIF.log.info(`Sending Request to: ${url}`);
|
||||||
oReq.open('GET', `/api/${id}`);
|
oReq.open('GET', url);
|
||||||
|
oReq.setRequestHeader('Accept', 'application/json')
|
||||||
|
|
||||||
// Fire the request the server
|
// Fire the request to the server
|
||||||
oReq.send();
|
oReq.send();
|
||||||
this.next();
|
},
|
||||||
|
action() {
|
||||||
|
// Render the Viewer with this data
|
||||||
|
this.render('standaloneViewer', {
|
||||||
|
data: () => this.data
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user