Mostly style files and Hanging Protocol changes
This commit is contained in:
1 parent
680beb163f
commit
21400c5836
48 files changed
+280
-576
No files matched your search
+69
-65
@@ -1,3 +1,12 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Session } from 'meteor/session';
|
||||
import { Random } from 'meteor/random';
|
||||
import { $ } from 'meteor/jquery';
|
||||
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import 'meteor/ohif:viewerbase';
|
||||
|
||||
/**
|
||||
* Updates the Hanging Protocol Select2 Input
|
||||
*/
|
||||
@@ -98,7 +107,7 @@ Template.protocolEditor.helpers({
|
||||
}
|
||||
|
||||
// Retrieve the Stage Model for the current Protocol's active Stage
|
||||
var stage = ProtocolEngine.getCurrentStageModel();
|
||||
const stage = ProtocolEngine.getCurrentStageModel();
|
||||
if (!stage) {
|
||||
return;
|
||||
}
|
||||
@@ -114,14 +123,14 @@ Template.protocolEditor.helpers({
|
||||
// by removing or adding Viewports to the stage
|
||||
//
|
||||
// First, calculate the difference, if any exists
|
||||
var difference = stage.viewportStructure.getNumViewports() - stage.viewports.length;
|
||||
const difference = stage.viewportStructure.getNumViewports() - stage.viewports.length;
|
||||
|
||||
if (difference < 0) {
|
||||
// Make the viewport difference into a positive value
|
||||
var absDifference = Math.abs(difference);
|
||||
const absDifference = Math.abs(difference);
|
||||
|
||||
// If there are more Viewports defined than necessary, remove the extraneous Viewports
|
||||
var position = stage.viewports.length - absDifference;
|
||||
const position = stage.viewports.length - absDifference;
|
||||
|
||||
// Splice extra viewports from the Stage's viewports array
|
||||
stage.viewports.splice(position, absDifference);
|
||||
@@ -130,9 +139,9 @@ Template.protocolEditor.helpers({
|
||||
// required amount
|
||||
|
||||
// Count up until the difference in number of Viewports
|
||||
for (var i = 0; i < difference; i++) {
|
||||
for (let i = 0; i < difference; i++) {
|
||||
// Instantiate a new Viewport Model
|
||||
var viewport = new HP.Viewport();
|
||||
const viewport = new HP.Viewport();
|
||||
|
||||
// Add new Viewports to the Stage's viewports array
|
||||
stage.viewports.push(viewport);
|
||||
@@ -154,7 +163,7 @@ Template.protocolEditor.events({
|
||||
*/
|
||||
'click #newProtocol'() {
|
||||
// Clone the default Protocol
|
||||
var protocol = HP.defaultProtocol.createClone();
|
||||
const protocol = HP.defaultProtocol.createClone();
|
||||
|
||||
// Change the Protocol name to state that it is New, and give it a timestamp
|
||||
protocol.name = 'New (created ' + moment().format('h:mm:ss a') + ')';
|
||||
@@ -175,19 +184,19 @@ Template.protocolEditor.events({
|
||||
* Rename the current Protocol
|
||||
*/
|
||||
'click #renameProtocol'() {
|
||||
var selectedProtocol = this;
|
||||
const selectedProtocol = this;
|
||||
if (selectedProtocol.locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Define some details for the text entry dialog
|
||||
var title = 'Rename Protocol';
|
||||
var instructions = 'Enter a new name';
|
||||
var currentValue = selectedProtocol.name;
|
||||
const title = 'Rename Protocol';
|
||||
const instructions = 'Enter a new name';
|
||||
const currentValue = selectedProtocol.name;
|
||||
|
||||
// Open the text entry dialog with the details above
|
||||
// and fire the callback function when finished.
|
||||
openTextEntryDialog(title, instructions, currentValue, function(value) {
|
||||
openTextEntryDialog(title, instructions, currentValue, value => {
|
||||
// Update the name with the entered text
|
||||
selectedProtocol.name = value;
|
||||
|
||||
@@ -211,17 +220,17 @@ Template.protocolEditor.events({
|
||||
*
|
||||
* @param event The Change event for the input
|
||||
*/
|
||||
'change .btn-file :file': function(event) {
|
||||
'change .btn-file :file'(event) {
|
||||
// http://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3/
|
||||
|
||||
// Find the Input in the DOM
|
||||
var input = $(event.currentTarget);
|
||||
const input = $(event.currentTarget);
|
||||
|
||||
// Get the number of selected files
|
||||
var numFiles = input.get(0).files ? input.get(0).files.length : 1;
|
||||
const numFiles = input.get(0).files ? input.get(0).files.length : 1;
|
||||
|
||||
// Get the label of the file
|
||||
var label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
|
||||
const label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
|
||||
|
||||
// Trigger our custom event with the number of files and label
|
||||
input.trigger('fileselect', [numFiles, label]);
|
||||
@@ -231,15 +240,15 @@ Template.protocolEditor.events({
|
||||
*
|
||||
* @param event The custom fileselect event
|
||||
*/
|
||||
'fileselect .btn-file :file': function(event) {
|
||||
'fileselect .btn-file :file'(event) {
|
||||
// Retreieve the FileList
|
||||
var files = event.target.files;
|
||||
const files = event.target.files;
|
||||
|
||||
// Create an HTML5 File Reader
|
||||
var reader = new FileReader();
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => {
|
||||
var protocolToImport = JSON.parse(reader.result);
|
||||
const protocolToImport = JSON.parse(reader.result);
|
||||
|
||||
// Insert the protocol
|
||||
HP.ProtocolStore.addProtocol(protocolToImport);
|
||||
@@ -257,12 +266,14 @@ Template.protocolEditor.events({
|
||||
*
|
||||
* @param event The select2:select event
|
||||
*/
|
||||
'select2:select #protocolSelect': function(event) {
|
||||
'select2:select #protocolSelect'(event) {
|
||||
// Retrieve the protocolId
|
||||
var protocolId = event.params.data.id;
|
||||
const protocolId = event.params.data.id;
|
||||
|
||||
// Retrieve the protocol from the protocol store
|
||||
var selectedProtocol = HP.ProtocolStore.getProtocol(protocolId);
|
||||
// Retrieve the Protocol from the HangingProtocols Collection
|
||||
const selectedProtocol = HangingProtocols.findOne({
|
||||
id: protocolId
|
||||
});
|
||||
|
||||
// If it doesn't exist, stop here
|
||||
if (!selectedProtocol) {
|
||||
@@ -280,92 +291,85 @@ Template.protocolEditor.events({
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
},
|
||||
/**
|
||||
* Update the protocol with the latest changes to the current Protocol
|
||||
* Update the HangingProtocols Collection with the latest changes to the current Protocol
|
||||
*/
|
||||
'click #saveProtocol'() {
|
||||
var selectedProtocol = this;
|
||||
const selectedProtocol = this;
|
||||
if (selectedProtocol.locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Store the ID for the update call
|
||||
const id = selectedProtocol._id;
|
||||
|
||||
// Remove the MongoDB _id property so that we can
|
||||
// simplify the $set value
|
||||
delete selectedProtocol._id;
|
||||
|
||||
// Update the Protocol's modifiedDate and modifiedBy User details
|
||||
selectedProtocol.protocolWasModified();
|
||||
|
||||
// Update the current Protocol in the database with the latest changes
|
||||
HP.ProtocolStore.updateProtocol(selectedProtocol.id, selectedProtocol);
|
||||
HangingProtocols.update(id, {
|
||||
$set: selectedProtocol
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Save the current Protocol as a new document
|
||||
* Save the current Protocol as a new document in the HangingProtocols Collection
|
||||
*/
|
||||
'click #saveAsProtocol'() {
|
||||
var selectedProtocol = this;
|
||||
|
||||
// Clone the selected Protocol
|
||||
var protocol = selectedProtocol.createClone();
|
||||
const selectedProtocol = this;
|
||||
|
||||
// Define some details for the text entry dialog
|
||||
var title = 'Save Protocol As';
|
||||
var instructions = 'Enter a new name';
|
||||
var currentValue = protocol.name;
|
||||
const title = 'Save Protocol As';
|
||||
const instructions = 'Enter a new name';
|
||||
const currentValue = selectedProtocol.name;
|
||||
|
||||
// Open the text entry dialog with the details above
|
||||
// and fire the callback function when finished.
|
||||
openTextEntryDialog(title, instructions, currentValue, function(value) {
|
||||
openTextEntryDialog(title, instructions, currentValue, value => {
|
||||
// Erase the MongoDB _id
|
||||
delete selectedProtocol._id;
|
||||
|
||||
// Create a new ID for the protocol
|
||||
protocol.id = Random.id();
|
||||
selectedProtocol.id = Random.id();
|
||||
|
||||
// Update the name with the entered text
|
||||
protocol.name = value;
|
||||
|
||||
// Unlock the protocol
|
||||
protocol.locked = false;
|
||||
selectedProtocol.name = value;
|
||||
|
||||
// Update the Protocol's modifiedDate and modifiedBy User details
|
||||
protocol.protocolWasModified();
|
||||
selectedProtocol.protocolWasModified();
|
||||
|
||||
// Insert the new Protocol
|
||||
HP.ProtocolStore.addProtocol(protocol);
|
||||
|
||||
// Activate the new Protocol using the ProtocolEngine
|
||||
ProtocolEngine.setHangingProtocol(protocol);
|
||||
|
||||
// Update the protocol selector to display the new Protocols
|
||||
updateProtocolSelect();
|
||||
HangingProtocols.insert(selectedProtocol);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Export the currently selected Protocol as a JSON file
|
||||
*/
|
||||
'click #exportJSON'() {
|
||||
var selectedProtocol = this;
|
||||
|
||||
var protocolJSON = JSON.stringify(selectedProtocol, null, 2),
|
||||
currentDate = new Date(),
|
||||
filename = selectedProtocol.name + '-' + (currentDate.getTime().toString()) + '.json',
|
||||
protocolBlob = new Blob([protocolJSON], { type: 'application/json' });
|
||||
|
||||
var downloadElement = document.getElementById('downloadElement');
|
||||
downloadElement.href = URL.createObjectURL(protocolBlob);
|
||||
downloadElement.download = filename;
|
||||
downloadElement.click();
|
||||
// Tell the User's Browser to download the JSON file by routing a hidden iframe to our
|
||||
// protocol-export Route. This prevents the tab from changing its current content.
|
||||
const selectedProtocol = this;
|
||||
document.getElementById('download_iframe').src = '/protocol-export/' + selectedProtocol.id;
|
||||
},
|
||||
/**
|
||||
* Delete the currently selected Protocol
|
||||
*/
|
||||
'click #deleteProtocol'() {
|
||||
var selectedProtocol = this;
|
||||
const selectedProtocol = this;
|
||||
if (selectedProtocol.locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
title: 'Delete Protocol',
|
||||
text: 'Are you sure you would like to remove this Protocol? This cannot be reversed.'
|
||||
};
|
||||
|
||||
showConfirmDialog(() => {
|
||||
// Remove the Protocol
|
||||
HP.ProtocolStore.removeProtocol(selectedProtocol.id);
|
||||
OHIF.viewerbase.showConfirmDialog(() => {
|
||||
// Send a call to remove the Protocol from the HangingProtocols Collection on the server
|
||||
Meteor.call('removeHangingProtocol', selectedProtocol._id);
|
||||
|
||||
// Reset the ProtocolEngine to the next best match
|
||||
ProtocolEngine.reset();
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
$height = 20px
|
||||
|
||||
|
||||
+60
-53
@@ -1,6 +1,13 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { Session } from 'meteor/session';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
var keys = {
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Viewerbase } from 'meteor/ohif:viewerbase';
|
||||
|
||||
const keys = {
|
||||
ESC: 27
|
||||
};
|
||||
|
||||
@@ -10,7 +17,7 @@ var keys = {
|
||||
*
|
||||
* @param dialog The DOM element of the dialog to close
|
||||
*/
|
||||
function closeHandler(dialog) {
|
||||
const closeHandler = dialog => {
|
||||
// Hide the lesion dialog
|
||||
$(dialog).css('display', 'none');
|
||||
|
||||
@@ -18,8 +25,8 @@ function closeHandler(dialog) {
|
||||
$('.removableBackdrop').remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
}
|
||||
Viewerbase.setFocusToActiveViewport();
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays and updates the UI of the Rule Entry Dialog given a new set of
|
||||
@@ -32,10 +39,10 @@ function closeHandler(dialog) {
|
||||
*/
|
||||
openRuleEntryDialog = function(attributes, level, rule) {
|
||||
// Get the lesion location dialog
|
||||
var dialog = $('.ruleEntryDialog');
|
||||
const dialog = $('.ruleEntryDialog');
|
||||
|
||||
// Clear any input that is still on the page
|
||||
var currentValueInput = dialog.find('input.currentValue');
|
||||
const currentValueInput = dialog.find('input.currentValue');
|
||||
currentValueInput.val('');
|
||||
|
||||
// Store the Dialog DOM data, rule level and rule in the template data
|
||||
@@ -44,7 +51,7 @@ openRuleEntryDialog = function(attributes, level, rule) {
|
||||
Template.ruleEntryDialog.rule = rule;
|
||||
|
||||
// Initialize the Select2 search box for the attribute list
|
||||
var attributeSelect = dialog.find('.attributes');
|
||||
const attributeSelect = dialog.find('.attributes');
|
||||
attributeSelect.html('').select2({
|
||||
data: attributes,
|
||||
placeholder: 'Select an attribute',
|
||||
@@ -63,15 +70,15 @@ openRuleEntryDialog = function(attributes, level, rule) {
|
||||
|
||||
// If a rule has been provided, use its constraint to find the relevant Comparator
|
||||
if (rule && rule.constraint) {
|
||||
var validator = Object.keys(rule.constraint)[0];
|
||||
var validatorOption = Object.keys(rule.constraint[validator])[0];
|
||||
var comparator = Comparators.findOne({
|
||||
const validator = Object.keys(rule.constraint)[0];
|
||||
const validatorOption = Object.keys(rule.constraint[validator])[0];
|
||||
const comparator = Comparators.findOne({
|
||||
validator: validator,
|
||||
validatorOption: validatorOption
|
||||
});
|
||||
|
||||
// Set the current value input based on the rule constraint
|
||||
var currentValue = rule.constraint[validator][validatorOption];
|
||||
const currentValue = rule.constraint[validator][validatorOption];
|
||||
currentValueInput.val(currentValue);
|
||||
}
|
||||
|
||||
@@ -86,10 +93,10 @@ openRuleEntryDialog = function(attributes, level, rule) {
|
||||
dialog.css('display', 'block');
|
||||
|
||||
// Show the backdrop
|
||||
UI.render(Template.removableBackdrop, document.body);
|
||||
Blaze.render(Template.removableBackdrop, document.body);
|
||||
|
||||
// Make sure the context menu is closed when the user clicks away
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', () => {
|
||||
closeHandler(dialog);
|
||||
});
|
||||
};
|
||||
@@ -99,23 +106,23 @@ openRuleEntryDialog = function(attributes, level, rule) {
|
||||
*/
|
||||
function getActiveViewportImageId() {
|
||||
// Retrieve the active viewport index from the Session
|
||||
var activeViewport = Session.get('activeViewport');
|
||||
const activeViewport = Session.get('activeViewport');
|
||||
if (activeViewport === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Obtain the list of all Viewports on the page
|
||||
var viewports = $('.imageViewerViewport');
|
||||
const viewports = $('.imageViewerViewport');
|
||||
|
||||
// Retrieve the active viewport element
|
||||
var element = viewports.get(activeViewport);
|
||||
const element = viewports.get(activeViewport);
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Obtain the enabled element from Cornerstone
|
||||
try {
|
||||
var enabledElement = cornerstone.getEnabledElement(element);
|
||||
const enabledElement = cornerstone.getEnabledElement(element);
|
||||
if (!enabledElement) {
|
||||
return;
|
||||
}
|
||||
@@ -128,7 +135,7 @@ function getActiveViewportImageId() {
|
||||
}
|
||||
|
||||
function getAbstractPriorValue(imageId) {
|
||||
var currentStudy = ViewerStudies.findOne({}, {
|
||||
const currentStudy = ViewerStudies.findOne({}, {
|
||||
sort: {
|
||||
studyDate: -1
|
||||
},
|
||||
@@ -139,12 +146,12 @@ function getAbstractPriorValue(imageId) {
|
||||
return;
|
||||
}
|
||||
|
||||
var priorStudy = cornerstoneTools.metaData.get('study', imageId);
|
||||
const priorStudy = cornerstoneTools.metaData.get('study', imageId);
|
||||
if (!priorStudy) {
|
||||
return;
|
||||
}
|
||||
|
||||
var studies = StudyListStudies.find({
|
||||
const studies = StudyListStudies.find({
|
||||
patientId: currentStudy.patientId,
|
||||
studyDate: {
|
||||
$lt: currentStudy.studyDate
|
||||
@@ -155,7 +162,7 @@ function getAbstractPriorValue(imageId) {
|
||||
}
|
||||
});
|
||||
|
||||
var priorIndex = 0;
|
||||
let priorIndex = 0;
|
||||
|
||||
// TODO: Check what the abstract prior value should equal for an unrelated study?
|
||||
studies.forEach(function(study, index) {
|
||||
@@ -176,7 +183,7 @@ function getAbstractPriorValue(imageId) {
|
||||
*/
|
||||
function getCurrentAttributeValue(attribute, level) {
|
||||
// Retrieve the active viewport's imageId. If none exists, stop here
|
||||
var imageId = getActiveViewportImageId();
|
||||
const imageId = getActiveViewportImageId();
|
||||
if (!imageId) {
|
||||
return;
|
||||
}
|
||||
@@ -193,7 +200,7 @@ function getCurrentAttributeValue(attribute, level) {
|
||||
|
||||
// Retrieve the metadata values for the specified level from
|
||||
// the Cornerstone Tools metaData provider
|
||||
var metadata = cornerstoneTools.metaData.get(level, imageId);
|
||||
const metadata = cornerstoneTools.metaData.get(level, imageId);
|
||||
|
||||
if (metadata[attribute] === undefined) {
|
||||
return HP.attributeDefaults[attribute];
|
||||
@@ -204,7 +211,7 @@ function getCurrentAttributeValue(attribute, level) {
|
||||
|
||||
Template.ruleEntryDialog.onCreated(function() {
|
||||
// Define the ReactiveVars that will be used to link aspects of the UI
|
||||
var template = this;
|
||||
const template = this;
|
||||
// Note: currentValue's initial value must be a string so the template renders properly
|
||||
template.currentValue = new ReactiveVar('');
|
||||
template.attribute = new ReactiveVar();
|
||||
@@ -213,12 +220,12 @@ Template.ruleEntryDialog.onCreated(function() {
|
||||
|
||||
Template.ruleEntryDialog.onRendered(function() {
|
||||
// Initialize the Comparators Select2 box
|
||||
var template = Template.instance();
|
||||
const template = Template.instance();
|
||||
template.$('.comparators').select2();
|
||||
|
||||
// Get the default Comparator from the Select2 box and use it to
|
||||
// initialize the comparatorId ReactiveVar
|
||||
var comparatorId = template.$('.comparators').val();
|
||||
const comparatorId = template.$('.comparators').val();
|
||||
template.comparatorId.set(comparatorId);
|
||||
|
||||
const dialog = template.$('.ruleEntryDialog');
|
||||
@@ -229,7 +236,7 @@ Template.ruleEntryDialog.helpers({
|
||||
/**
|
||||
* Returns the Comparators Collection to the Template with reactive rerendering
|
||||
*/
|
||||
comparators: function() {
|
||||
comparators() {
|
||||
return Comparators.find();
|
||||
},
|
||||
/**
|
||||
@@ -237,7 +244,7 @@ Template.ruleEntryDialog.helpers({
|
||||
*
|
||||
* @returns {*} Attribute value for the active image
|
||||
*/
|
||||
currentValue: function() {
|
||||
currentValue() {
|
||||
return Template.instance().currentValue.get();
|
||||
}
|
||||
});
|
||||
@@ -249,15 +256,15 @@ Template.ruleEntryDialog.events({
|
||||
* @param event the Click event
|
||||
* @param template The template context
|
||||
*/
|
||||
'click #save': function(event, template) {
|
||||
'click #save'(event, template) {
|
||||
// Retrieve the input properties to the template
|
||||
var dialog = Template.ruleEntryDialog.dialog;
|
||||
var level = Template.ruleEntryDialog.level;
|
||||
const dialog = Template.ruleEntryDialog.dialog;
|
||||
const level = Template.ruleEntryDialog.level;
|
||||
|
||||
// Retrieve the current values for the attribute value and comparatorId
|
||||
var attribute = template.attribute.get();
|
||||
var comparatorId = template.comparatorId.get();
|
||||
var currentValue = template.currentValue.get();
|
||||
const attribute = template.attribute.get();
|
||||
const comparatorId = template.comparatorId.get();
|
||||
const currentValue = template.currentValue.get();
|
||||
|
||||
// If currentValue input is undefined, prevent saving this rule
|
||||
if (currentValue === undefined) {
|
||||
@@ -265,14 +272,14 @@ Template.ruleEntryDialog.events({
|
||||
}
|
||||
|
||||
// Check if we are editing a rule or creating a new one
|
||||
var rule;
|
||||
let rule;
|
||||
if (Template.ruleEntryDialog.rule) {
|
||||
// If we are editing a rule, change the rule data
|
||||
rule = Template.ruleEntryDialog.rule;
|
||||
} else {
|
||||
// If we are creating a rule, obtain the active Viewport model
|
||||
// from the Protocol and Stage
|
||||
var viewport = getActiveViewportModel();
|
||||
const viewport = getActiveViewportModel();
|
||||
|
||||
// Create a rule depending on the level property of this dialog
|
||||
switch (level) {
|
||||
@@ -296,12 +303,12 @@ Template.ruleEntryDialog.events({
|
||||
}
|
||||
|
||||
// Find the Comparator from the Comparators Collection given its ID
|
||||
var comparator = Comparators.findOne({
|
||||
const comparator = Comparators.findOne({
|
||||
id: comparatorId
|
||||
});
|
||||
|
||||
// Create a new constraint to add to the rule
|
||||
var constraint = {};
|
||||
const constraint = {};
|
||||
constraint[comparator.validator] = {};
|
||||
constraint[comparator.validator][comparator.validatorOption] = currentValue;
|
||||
|
||||
@@ -310,7 +317,7 @@ Template.ruleEntryDialog.events({
|
||||
rule.constraint = constraint;
|
||||
|
||||
// Instruct the Protocol Engine to update the Layout Manager with new data
|
||||
var viewportIndex = Session.get('activeViewport');
|
||||
const viewportIndex = Session.get('activeViewport');
|
||||
ProtocolEngine.updateViewports(viewportIndex);
|
||||
|
||||
// Close the dialog
|
||||
@@ -319,8 +326,8 @@ Template.ruleEntryDialog.events({
|
||||
/**
|
||||
* Allow the user to click the Cancel button to close the dialog
|
||||
*/
|
||||
'click #cancel': function() {
|
||||
var dialog = Template.ruleEntryDialog.dialog;
|
||||
'click #cancel'() {
|
||||
const dialog = Template.ruleEntryDialog.dialog;
|
||||
closeHandler(dialog);
|
||||
},
|
||||
/**
|
||||
@@ -329,8 +336,8 @@ Template.ruleEntryDialog.events({
|
||||
* @param event The Keydown event details
|
||||
* @returns {boolean} Return false to prevent bubbling of the event
|
||||
*/
|
||||
'keydown .ruleEntryDialog': function(event) {
|
||||
var dialog = Template.ruleEntryDialog.dialog;
|
||||
'keydown .ruleEntryDialog'(event) {
|
||||
const dialog = Template.ruleEntryDialog.dialog;
|
||||
|
||||
// If Esc key is pressed, close the dialog
|
||||
if (event.which === keys.ESC) {
|
||||
@@ -344,9 +351,9 @@ Template.ruleEntryDialog.events({
|
||||
* @param event The Change event for the select box
|
||||
* @param template The current template context
|
||||
*/
|
||||
'change select.attributes': function(event, template) {
|
||||
'change select.attributes'(event, template) {
|
||||
// Obtain the user-specified attribute to test against
|
||||
var attribute = $(event.currentTarget).val();
|
||||
const attribute = $(event.currentTarget).val();
|
||||
|
||||
// Store it in the ReactiveVar
|
||||
template.attribute.set(attribute);
|
||||
@@ -355,10 +362,10 @@ Template.ruleEntryDialog.events({
|
||||
Template.ruleEntryDialog.selectedAttribute = attribute;
|
||||
|
||||
// Get the level of this dialog
|
||||
var level = Template.ruleEntryDialog.level;
|
||||
const level = Template.ruleEntryDialog.level;
|
||||
|
||||
// Retrieve the current value of the attribute for the active viewport model
|
||||
var value = getCurrentAttributeValue(attribute, level);
|
||||
const value = getCurrentAttributeValue(attribute, level);
|
||||
|
||||
// Update the ReactiveVar with the user-specified value
|
||||
template.currentValue.set(value);
|
||||
@@ -369,12 +376,12 @@ Template.ruleEntryDialog.events({
|
||||
* @param event The Change event for the input
|
||||
* @param template The current template context
|
||||
*/
|
||||
'change input.currentValue': function(event, template) {
|
||||
'change input.currentValue'(event, template) {
|
||||
// Get the DOM element representing the input box
|
||||
var input = $(event.currentTarget);
|
||||
const input = $(event.currentTarget);
|
||||
|
||||
// Get the current value of the input
|
||||
var value = input.val();
|
||||
let value = input.val();
|
||||
|
||||
// If the input is of type 'number', parse it as a Float
|
||||
if (input.attr('type') === 'number') {
|
||||
@@ -390,9 +397,9 @@ Template.ruleEntryDialog.events({
|
||||
* @param event The Change event for the select box
|
||||
* @param template The current template context
|
||||
*/
|
||||
'change select.comparators': function(event, template) {
|
||||
'change select.comparators'(event, template) {
|
||||
// Get the current value of the select box
|
||||
var comparatorId = $(event.currentTarget).val();
|
||||
const comparatorId = $(event.currentTarget).val();
|
||||
|
||||
// Update the ReactiveVar with the value of the Comparators select box
|
||||
template.comparatorId.set(comparatorId);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
.ruleEntryDialog
|
||||
theme('background', '$uiGrayDarkest', 0.95)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
table.ruleTable
|
||||
thead
|
||||
|
||||
+41
-33
@@ -1,4 +1,12 @@
|
||||
var keys = {
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Session } from 'meteor/session';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { $ } from 'meteor/jquery';
|
||||
|
||||
import { Viewerbase } from 'meteor/ohif:viewerbase';
|
||||
|
||||
const keys = {
|
||||
ESC: 27
|
||||
};
|
||||
|
||||
@@ -8,7 +16,7 @@ var keys = {
|
||||
*
|
||||
* @param dialog The DOM element of the dialog to close
|
||||
*/
|
||||
function closeHandler(dialog) {
|
||||
const closeHandler = dialog => {
|
||||
// Hide the lesion dialog
|
||||
$(dialog).css('display', 'none');
|
||||
|
||||
@@ -16,8 +24,8 @@ function closeHandler(dialog) {
|
||||
$('.removableBackdrop').remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
}
|
||||
Viewerbase.setFocusToActiveViewport();
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays and updates the UI of the Setting Entry Dialog given an
|
||||
@@ -27,40 +35,40 @@ function closeHandler(dialog) {
|
||||
*/
|
||||
openSettingEntryDialog = function(settingObject) {
|
||||
// Get the lesion location dialog
|
||||
var dialog = $('.settingEntryDialog');
|
||||
const dialog = $('.settingEntryDialog');
|
||||
|
||||
// Store the Dialog DOM data, setting level and setting in the template data
|
||||
Template.settingEntryDialog.dialog = dialog;
|
||||
Template.settingEntryDialog.settingObject = settingObject;
|
||||
|
||||
// Initialize the Select2 search box for the attribute list
|
||||
var settings = Object.keys(HP.displaySettings);
|
||||
const settings = Object.keys(HP.displaySettings);
|
||||
settings.concat(Object.keys(HP.CustomViewportSettings));
|
||||
|
||||
var displaySettingsOptions = Object.keys(HP.displaySettings).map(key => {
|
||||
const displaySettingsOptions = Object.keys(HP.displaySettings).map(key => {
|
||||
return {
|
||||
id: key,
|
||||
text: HP.displaySettings[key].text
|
||||
};
|
||||
});
|
||||
|
||||
var customSettingsOptions = Object.keys(HP.CustomViewportSettings).map(key => {
|
||||
const customSettingsOptions = Object.keys(HP.CustomViewportSettings).map(key => {
|
||||
return {
|
||||
id: key,
|
||||
text: HP.CustomViewportSettings[key].text
|
||||
};
|
||||
});
|
||||
|
||||
var settingsOptions = displaySettingsOptions.concat(customSettingsOptions);
|
||||
const settingsOptions = displaySettingsOptions.concat(customSettingsOptions);
|
||||
|
||||
var settingSelect = dialog.find('.settings');
|
||||
const settingSelect = dialog.find('.settings');
|
||||
settingSelect.html('').select2({
|
||||
data: settingsOptions,
|
||||
placeholder: 'Select a setting',
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
var settingDetails = {
|
||||
let settingDetails = {
|
||||
options: []
|
||||
};
|
||||
|
||||
@@ -70,7 +78,7 @@ openSettingEntryDialog = function(settingObject) {
|
||||
settingDetails = HP.CustomViewportSettings[settingObject.id];
|
||||
}
|
||||
|
||||
var valueSelect = dialog.find('.currentValue');
|
||||
const valueSelect = dialog.find('.currentValue');
|
||||
valueSelect.html('').select2({
|
||||
data: settingDetails.options,
|
||||
placeholder: 'Select a value',
|
||||
@@ -99,14 +107,14 @@ openSettingEntryDialog = function(settingObject) {
|
||||
Blaze.render(Template.removableBackdrop, document.body);
|
||||
|
||||
// Make sure the context menu is closed when the user clicks away
|
||||
$('.removableBackdrop').one('mousedown touchstart', function() {
|
||||
$('.removableBackdrop').one('mousedown touchstart', () => {
|
||||
closeHandler(dialog);
|
||||
});
|
||||
};
|
||||
|
||||
Template.settingEntryDialog.onCreated(function() {
|
||||
// Define the ReactiveVars that will be used to link aspects of the UI
|
||||
var template = this;
|
||||
const template = this;
|
||||
|
||||
// Note: currentValue's initial value must be a string so the template renders properly
|
||||
template.currentValue = new ReactiveVar('');
|
||||
@@ -126,29 +134,29 @@ Template.settingEntryDialog.events({
|
||||
* @param event the Click event
|
||||
* @param template The template context
|
||||
*/
|
||||
'click #save': function(event, template) {
|
||||
'click #save'(event, template) {
|
||||
// Retrieve the input properties to the template
|
||||
var dialog = Template.settingEntryDialog.dialog;
|
||||
const dialog = Template.settingEntryDialog.dialog;
|
||||
|
||||
// Retrieve the current values for the id and current value
|
||||
var setting = template.setting.get();
|
||||
var currentValue = template.currentValue.get();
|
||||
const setting = template.setting.get();
|
||||
const currentValue = template.currentValue.get();
|
||||
|
||||
// If currentValue input is undefined, prevent saving this setting
|
||||
if (currentValue === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var viewportSetting = {
|
||||
const viewportSetting = {
|
||||
id: setting,
|
||||
value: currentValue
|
||||
};
|
||||
|
||||
// Obtain the active Viewport model from the Protocol and Stage
|
||||
var viewport = getActiveViewportModel();
|
||||
const viewport = getActiveViewportModel();
|
||||
|
||||
// Remove any old rules if the ID has been changes
|
||||
var originalSettingObject = Template.settingEntryDialog.settingObject;
|
||||
const originalSettingObject = Template.settingEntryDialog.settingObject;
|
||||
if (originalSettingObject && originalSettingObject.id) {
|
||||
delete viewport.viewportSettings[originalSettingObject.id];
|
||||
}
|
||||
@@ -157,7 +165,7 @@ Template.settingEntryDialog.events({
|
||||
viewport.viewportSettings[viewportSetting.id] = viewportSetting.value;
|
||||
|
||||
// Instruct the Protocol Engine to update the Layout Manager with new data
|
||||
var viewportIndex = Session.get('activeViewport');
|
||||
const viewportIndex = Session.get('activeViewport');
|
||||
ProtocolEngine.updateViewports(viewportIndex);
|
||||
|
||||
// Close the dialog
|
||||
@@ -166,8 +174,8 @@ Template.settingEntryDialog.events({
|
||||
/**
|
||||
* Allow the user to click the Cancel button to close the dialog
|
||||
*/
|
||||
'click #cancel': function() {
|
||||
var dialog = Template.settingEntryDialog.dialog;
|
||||
'click #cancel'() {
|
||||
const dialog = Template.settingEntryDialog.dialog;
|
||||
closeHandler(dialog);
|
||||
},
|
||||
/**
|
||||
@@ -176,8 +184,8 @@ Template.settingEntryDialog.events({
|
||||
* @param event The Keydown event details
|
||||
* @returns {boolean} Return false to prevent bubbling of the event
|
||||
*/
|
||||
'keydown .settingEntryDialog': function(event) {
|
||||
var dialog = Template.settingEntryDialog.dialog;
|
||||
'keydown .settingEntryDialog'(event) {
|
||||
const dialog = Template.settingEntryDialog.dialog;
|
||||
|
||||
// If Esc key is pressed, close the dialog
|
||||
if (event.which === keys.ESC) {
|
||||
@@ -191,15 +199,15 @@ Template.settingEntryDialog.events({
|
||||
* @param event The Change event for the select box
|
||||
* @param template The current template context
|
||||
*/
|
||||
'change select.settings': function(event, template) {
|
||||
'change select.settings'(event, template) {
|
||||
// Obtain the user-specified attribute to test against
|
||||
var settingId = $(event.currentTarget).val();
|
||||
const settingId = $(event.currentTarget).val();
|
||||
|
||||
// Store it in the ReactiveVar
|
||||
template.setting.set(settingId);
|
||||
|
||||
// Retrieve the current value from the attribute
|
||||
var settingDetails = {
|
||||
let settingDetails = {
|
||||
options: []
|
||||
};
|
||||
if (settingId && HP.displaySettings[settingId]) {
|
||||
@@ -208,8 +216,8 @@ Template.settingEntryDialog.events({
|
||||
settingDetails = HP.CustomViewportSettings[settingId];
|
||||
}
|
||||
|
||||
var dialog = Template.settingEntryDialog.dialog;
|
||||
var valueSelect = dialog.find('.currentValue');
|
||||
const dialog = Template.settingEntryDialog.dialog;
|
||||
const valueSelect = dialog.find('.currentValue');
|
||||
valueSelect.html('').select2({
|
||||
data: settingDetails.options,
|
||||
placeholder: 'Select a value',
|
||||
@@ -228,9 +236,9 @@ Template.settingEntryDialog.events({
|
||||
* @param event The Change event for the input
|
||||
* @param template The current template context
|
||||
*/
|
||||
'change select.currentValue': function(event, template) {
|
||||
'change select.currentValue'(event, template) {
|
||||
// Get the current value of the select box
|
||||
var value = $(event.currentTarget).val();
|
||||
const value = $(event.currentTarget).val();
|
||||
|
||||
// Update the ReactiveVar with the user-specified value
|
||||
template.currentValue.set(value);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
.settingEntryDialog
|
||||
theme('border', '1px solid $uiBorderColor', 0.95)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
table.settingsTable
|
||||
thead
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
#stageDetails
|
||||
overflow-y: auto
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
#stageSortingContainer
|
||||
padding: 0 20px
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@import "{design}/app.styl"
|
||||
@import "{ohif:design}/app"
|
||||
|
||||
.textEntryDialog
|
||||
theme('border', '1px solid $uiBorderColor', 0.95)
|
||||
|
||||
Reference in new issue
Block a user