ohif-viewer/Packages/ohif-study-list/client/components/studylist/studylistToolbar/studylistToolbar.js
2018-12-14 14:38:36 +01:00

36 lines
1.0 KiB
JavaScript

import { OHIF } from 'ohif-core';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import $ from 'jquery';
Template.studylistToolbar.onCreated(() => {
/*Meteor.call('importSupported', (error, result) => {
if (error || !result) {
Session.set('importSupported', false);
} else {
Session.set('importSupported', true);
}
});*/
});
Template.studylistToolbar.events({
'change .js-import-files'(event) {
// Get selected files located in the client machine
const selectedFiles = $.map(event.currentTarget.files, value => value);
OHIF.studylist.importStudies(selectedFiles);
},
'click .js-import-files'(event) {
// Reset file input
$(event.currentTarget).val('');
}
});
Template.studylistToolbar.helpers({
importSupported() {
const importSupported = Session.get('importSupported');
return (importSupported && OHIF.uiSettings.studyListFunctionsEnabled);
}
});