Move removeCollections.js to server folder from both and check patientId while setting null array to toolState data
This commit is contained in:
parent
ca30e22464
commit
e6fd2e60b0
@ -70,25 +70,31 @@ Template.viewerMain.helpers({
|
|||||||
|
|
||||||
Template.viewerMain.events({
|
Template.viewerMain.events({
|
||||||
'click button#clearTools': function(e, template) {
|
'click button#clearTools': function(e, template) {
|
||||||
|
var contentId = template.data.contentId;
|
||||||
|
var patientId = template.data.studies[0].patientId;
|
||||||
var toolTypes = ["lesion", "nonTarget"];
|
var toolTypes = ["lesion", "nonTarget"];
|
||||||
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
||||||
var toolStateKeys = Object.keys(toolState).slice(0);
|
var toolStateKeys = Object.keys(toolState).slice(0);
|
||||||
|
|
||||||
toolStateKeys.forEach(function (imageId) {
|
toolStateKeys.forEach(function (imageId) {
|
||||||
toolTypes.forEach(function (toolType) {
|
toolTypes.forEach(function (toolType) {
|
||||||
toolState[imageId][toolType] = {
|
if(toolState[imageId][toolType]) {
|
||||||
data: []
|
if(toolState[imageId][toolType].data[0].patientId === patientId) {
|
||||||
};
|
toolState[imageId][toolType] = {
|
||||||
|
data: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update imageViewerViewport elements
|
// Update imageViewerViewport elements
|
||||||
$(".imageViewerViewport").each(function(viewportIndex, element) {
|
$("#"+contentId+" .imageViewerViewport").each(function(viewportIndex, element) {
|
||||||
cornerstone.updateImage(element);
|
cornerstone.updateImage(element);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove patient's measurements
|
// Remove patient's measurements
|
||||||
var patientId = template.data.studies[0].patientId;
|
|
||||||
Meteor.call('removeMeasurementsByPatientId', patientId);
|
Meteor.call('removeMeasurementsByPatientId', patientId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,10 +48,10 @@ Package.onUse(function (api) {
|
|||||||
|
|
||||||
// Server functions
|
// Server functions
|
||||||
api.addFiles('server/collections.js', 'server');
|
api.addFiles('server/collections.js', 'server');
|
||||||
|
api.addFiles('server/removeCollections.js', ['server']);
|
||||||
|
|
||||||
// Both client and server functions
|
// Both client and server functions
|
||||||
api.addFiles('both/collections.js', ['client', 'server']);
|
api.addFiles('both/collections.js', ['client', 'server']);
|
||||||
api.addFiles('both/removeCollections.js', ['client', 'server']);
|
|
||||||
|
|
||||||
|
|
||||||
// Library functions
|
// Library functions
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
"removeMeasurementsByPatientId": function(patientId) {
|
"removeMeasurementsByPatientId": function(patientId) {
|
||||||
Measurements.remove(
|
Measurements.remove(
|
||||||
{patientId: patientId},
|
{patientId: patientId}
|
||||||
{multi: true}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user