Improving new study browser and moving studies services to ohif:studies
This commit is contained in:
1 parent
0b51a53976
commit
eb372bed03
54 files changed
+560
-495
No files matched your search
@@ -1,26 +1,52 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.studyBrowserItem.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.loaded = false;
|
||||
instance.loading = new ReactiveVar(false);
|
||||
|
||||
const modality = instance.data.studyInformation.modality || 'UN';
|
||||
instance.modalities = modality.replace(/\\/g, ' ');
|
||||
});
|
||||
|
||||
Template.studyBrowserItem.events({
|
||||
'click .study-browser-item'(event, instance) {
|
||||
const element = event.currentTarget;
|
||||
'click .study-item'(event, instance) {
|
||||
if (instance.loading.get()) return;
|
||||
|
||||
const { studyClickCallback, studyInformation } = instance.data;
|
||||
const element = event.currentTarget.parentElement;
|
||||
const $element = $(element);
|
||||
$element.trigger('ohif.studies.study.click', instance.data.studyInformation);
|
||||
const { settings, studyInformation } = instance.data;
|
||||
if (settings && typeof settings.studyClickCallback) {
|
||||
settings.studyClickCallback(studyInformation, element);
|
||||
$element.trigger('ohif.studies.study.click', studyInformation);
|
||||
|
||||
const triggerClickCallback = () => {
|
||||
if (typeof studyClickCallback === 'function') {
|
||||
studyClickCallback(studyInformation, element);
|
||||
}
|
||||
};
|
||||
|
||||
if (instance.loaded) {
|
||||
triggerClickCallback();
|
||||
} else {
|
||||
instance.loading.set(true);
|
||||
OHIF.studies.retrieveStudyMetadata(studyInformation.studyInstanceUid).then(() => {
|
||||
instance.loaded = true;
|
||||
instance.loading.set(false);
|
||||
$element.trigger('ohif.studies.study.load', studyInformation);
|
||||
triggerClickCallback();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.studyBrowserItem.helpers({
|
||||
isLoading() {
|
||||
return Template.instance().loading.get();
|
||||
},
|
||||
|
||||
modalityStyle() {
|
||||
// Responsively styles the Modality Acronyms for studies
|
||||
// with more than one modality
|
||||
|
||||
Reference in new issue
Block a user