LT-240: Add studyListFunctionsEnabled property (false as default) in public.ui object in settings file to enable/disable import / export / anonymize functions
LT-239: Error handling on the import process (WIP)
This commit is contained in:
parent
1e1c4033a6
commit
2a17760ff8
@ -31,7 +31,10 @@ Meteor.startup(function() {
|
|||||||
}],
|
}],
|
||||||
"defaultServiceType": 'dicomWeb',
|
"defaultServiceType": 'dicomWeb',
|
||||||
"public": {
|
"public": {
|
||||||
"verifyEmail": false
|
"verifyEmail": false,
|
||||||
|
"ui": {
|
||||||
|
"studyListFunctionsEnabled": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//defaultServiceType: 'dimse'
|
//defaultServiceType: 'dimse'
|
||||||
};
|
};
|
||||||
|
|||||||
@ -28,7 +28,12 @@ Meteor.startup(function() {
|
|||||||
port: 4242,
|
port: 4242,
|
||||||
hostAE: 'ORTHANC'
|
hostAE: 'ORTHANC'
|
||||||
},
|
},
|
||||||
defaultServiceType: 'dicomWeb'
|
defaultServiceType: 'dicomWeb',
|
||||||
|
public: {
|
||||||
|
ui: {
|
||||||
|
studyListFunctionsEnabled: false
|
||||||
|
}
|
||||||
|
}
|
||||||
//defaultServiceType: 'dimse'
|
//defaultServiceType: 'dimse'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -24,16 +24,20 @@
|
|||||||
title="Remove Timepoint Association">
|
title="Remove Timepoint Association">
|
||||||
<i class="fa fa-eraser fa-lg"></i> Remove Association
|
<i class="fa fa-eraser fa-lg"></i> Remove Association
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
{{#if studyListFunctionsEnabled}}
|
||||||
<a class="disabled"><span class="fa-stack fa-lg">
|
<a class="disabled"><span class="fa-stack fa-lg">
|
||||||
<i class="fa fa-user fa-stack-1x"></i>
|
<i class="fa fa-user fa-stack-1x"></i>
|
||||||
<i class="fa fa-ban fa-stack-2x text-danger"></i>
|
<i class="fa fa-ban fa-stack-2x text-danger"></i>
|
||||||
</span> Anonymize
|
</span> Anonymize
|
||||||
</a>
|
</a>
|
||||||
<a class="disabled"><i class="fa fa-trash fa-lg"></i> Delete</a>
|
|
||||||
<a class="disabled"><i class="fa fa-send-o fa-lg"></i> Send</a>
|
|
||||||
<a id="exportSelectedStudies" type="button"
|
<a id="exportSelectedStudies" type="button"
|
||||||
title="Export Selected Studies">
|
title="Export Selected Studies">
|
||||||
<i class="fa fa-exchange fa-lg"></i> Export</a>
|
<i class="fa fa-exchange fa-lg"></i> Export
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
<a class="disabled"><i class="fa fa-trash fa-lg"></i> Delete</a>
|
||||||
|
<a class="disabled"><i class="fa fa-send-o fa-lg"></i> Send</a>
|
||||||
<a class="disabled"><i class="fa fa-download fa-lg"></i> Download</a>
|
<a class="disabled"><i class="fa fa-download fa-lg"></i> Download</a>
|
||||||
<a class="disabled"><i class="fa fa-photo fa-lg"></i> View Series Details</a>
|
<a class="disabled"><i class="fa fa-photo fa-lg"></i> View Series Details</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -172,3 +172,11 @@ function viewStudies() {
|
|||||||
// Switch to the new tab
|
// Switch to the new tab
|
||||||
switchToTab(contentid);
|
switchToTab(contentid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Template.studyContextMenu.helpers({
|
||||||
|
'studyListFunctionsEnabled': function() {
|
||||||
|
var studyListFunctionsEnabled = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui &&
|
||||||
|
Meteor.settings.public.ui.studyListFunctionsEnabled || false;
|
||||||
|
return studyListFunctionsEnabled;
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -9,6 +9,7 @@
|
|||||||
{{progressStatus}}
|
{{progressStatus}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="message">{{progressMessage}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -18,6 +18,11 @@ progressDialog = {
|
|||||||
Session.set("progressDialogSettings", { title: "", numberOfCompleted: 0, numberOfTotal: 1 });
|
Session.set("progressDialogSettings", { title: "", numberOfCompleted: 0, numberOfTotal: 1 });
|
||||||
$('#progressDialog').css('display', 'none');
|
$('#progressDialog').css('display', 'none');
|
||||||
},
|
},
|
||||||
|
'setMessage': function(message) {
|
||||||
|
var progressDialogSettings = Session.get("progressDialogSettings");
|
||||||
|
progressDialogSettings.message = message;
|
||||||
|
Session.set("progressDialogSettings", progressDialogSettings);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Template.progressDialog.helpers({
|
Template.progressDialog.helpers({
|
||||||
@ -40,5 +45,12 @@ Template.progressDialog.helpers({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return parseInt((numberOfCompleted / numberofTotal) * 100) + "%";
|
return parseInt((numberOfCompleted / numberofTotal) * 100) + "%";
|
||||||
|
},
|
||||||
|
'progressMessage': function() {
|
||||||
|
var progressDialogSettings = Session.get("progressDialogSettings");
|
||||||
|
if (progressDialogSettings && progressDialogSettings.message) {
|
||||||
|
return progressDialogSettings.message;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,7 +6,10 @@ importStudies = function(filesToImport, importCallback) {
|
|||||||
if (filesToImport.length < 1) {
|
if (filesToImport.length < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var fileUploadStatus = { numberOfFilesUploaded: 0, numberOfFilesFailed: 0 };
|
var fileUploadStatus = {
|
||||||
|
numberOfFilesUploaded: 0,
|
||||||
|
numberOfFilesFailed: 0
|
||||||
|
};
|
||||||
|
|
||||||
var numberOfFilesToUpload = filesToImport.length;
|
var numberOfFilesToUpload = filesToImport.length;
|
||||||
var studiesToImport = [];
|
var studiesToImport = [];
|
||||||
@ -60,8 +63,11 @@ function updateFileUploadStatus(fileUploadStatus, isSuccess) {
|
|||||||
fileUploadStatus.numberOfFilesUploaded++;
|
fileUploadStatus.numberOfFilesUploaded++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function importStudiesInternal(studiesToImport, importCallback) {
|
function importStudiesInternal(studiesToImport, importCallback) {
|
||||||
|
if (!studiesToImport) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var numberOfStudiesToImport = studiesToImport.length;
|
var numberOfStudiesToImport = studiesToImport.length;
|
||||||
|
|
||||||
progressDialog.show("Importing Studies...", numberOfStudiesToImport);
|
progressDialog.show("Importing Studies...", numberOfStudiesToImport);
|
||||||
@ -69,7 +75,9 @@ function importStudiesInternal(studiesToImport, importCallback) {
|
|||||||
// Create/Insert a new study import status item
|
// Create/Insert a new study import status item
|
||||||
Meteor.call("createStudyImportStatus", function(err, studyImportStatusId) {
|
Meteor.call("createStudyImportStatus", function(err, studyImportStatusId) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
// Hide dialog
|
||||||
|
progressDialog.close();
|
||||||
|
console.log(err.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +90,12 @@ function importStudiesInternal(studiesToImport, importCallback) {
|
|||||||
|
|
||||||
var numberOfStudiesProcessedToImport = studyImportStatus.numberOfStudiesImported + studyImportStatus.numberOfStudiesFailed;
|
var numberOfStudiesProcessedToImport = studyImportStatus.numberOfStudiesImported + studyImportStatus.numberOfStudiesFailed;
|
||||||
|
|
||||||
|
// Show failed message in the dialog
|
||||||
|
if (studyImportStatus.numberOfStudiesFailed > 0) {
|
||||||
|
var failMessage = "Failed to import " + studyImportStatus.numberOfStudiesFailed + " of " + numberOfStudiesToImport + " files";
|
||||||
|
progressDialog.setMessage(failMessage);
|
||||||
|
}
|
||||||
|
|
||||||
progressDialog.update(numberOfStudiesProcessedToImport);
|
progressDialog.update(numberOfStudiesProcessedToImport);
|
||||||
|
|
||||||
if (numberOfStudiesProcessedToImport == numberOfStudiesToImport) {
|
if (numberOfStudiesProcessedToImport == numberOfStudiesToImport) {
|
||||||
@ -90,7 +104,10 @@ function importStudiesInternal(studiesToImport, importCallback) {
|
|||||||
|
|
||||||
if (studyImportStatus.numberOfStudiesFailed > 0) {
|
if (studyImportStatus.numberOfStudiesFailed > 0) {
|
||||||
//TODO: Some files failed to import, so let user know
|
//TODO: Some files failed to import, so let user know
|
||||||
console.log("Failed to import " + studyImportStatus.numberOfStudiesFailed + " of " + numberOfStudiesToImport + " files");
|
// Update progress dialog message
|
||||||
|
var failMessage = "Failed to import " + studyImportStatus.numberOfStudiesFailed + " of " + numberOfStudiesToImport + " files";
|
||||||
|
progressDialog.setMessage(failMessage);
|
||||||
|
console.log(failMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let the caller know that import operation is completed
|
// Let the caller know that import operation is completed
|
||||||
|
|||||||
@ -49,6 +49,10 @@ Meteor.methods({
|
|||||||
* @param studyImportStatusId Study import status collection id to track import status
|
* @param studyImportStatusId Study import status collection id to track import status
|
||||||
*/
|
*/
|
||||||
importStudies: function(studiesToImport, studyImportStatusId) {
|
importStudies: function(studiesToImport, studyImportStatusId) {
|
||||||
|
if (!studiesToImport || !studyImportStatusId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Meteor.settings.dicomWeb && Meteor.settings.defaultServiceType === 'dicomWeb') {
|
if (Meteor.settings.dicomWeb && Meteor.settings.defaultServiceType === 'dicomWeb') {
|
||||||
//TODO: Support importing studies into dicomWeb
|
//TODO: Support importing studies into dicomWeb
|
||||||
console.log('Importing studies into dicomWeb is currently not supported.');
|
console.log('Importing studies into dicomWeb is currently not supported.');
|
||||||
@ -76,10 +80,15 @@ Meteor.methods({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function importStudiesDIMSE(studiesToImport, studyImportStatusId) {
|
function importStudiesDIMSE(studiesToImport, studyImportStatusId) {
|
||||||
|
if (!studiesToImport || !studyImportStatusId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Perform C-Store to import studies and handle the callbacks to update import status
|
// Perform C-Store to import studies and handle the callbacks to update import status
|
||||||
DIMSE.storeInstances(studiesToImport, function(err, file) {
|
DIMSE.storeInstances(studiesToImport, function(err, file) {
|
||||||
|
try {
|
||||||
// Use fiber to be able to modify meteor collection in callback
|
// Use fiber to be able to modify meteor collection in callback
|
||||||
fiber(function() {
|
fiber(function() {
|
||||||
|
try {
|
||||||
// Update the import status
|
// Update the import status
|
||||||
if (err) {
|
if (err) {
|
||||||
StudyImportStatus.update({_id: studyImportStatusId}, {$inc: {'numberOfStudiesFailed': 1}});
|
StudyImportStatus.update({_id: studyImportStatusId}, {$inc: {'numberOfStudiesFailed': 1}});
|
||||||
@ -89,11 +98,23 @@ function importStudiesDIMSE(studiesToImport, studyImportStatusId) {
|
|||||||
console.log("Study successfully imported via DIMSE: ", file);
|
console.log("Study successfully imported via DIMSE: ", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch(error) {
|
||||||
|
|
||||||
|
StudyImportStatus.update({_id: studyImportStatusId}, {$inc: {'numberOfStudiesFailed': 1}});
|
||||||
|
console.log("Failed to import study via DIMSE: ", file, error);
|
||||||
|
} finally {
|
||||||
// The import operation of this file is completed, so delete it if still exists
|
// The import operation of this file is completed, so delete it if still exists
|
||||||
if (fileExists(file)) {
|
if (fileExists(file)) {
|
||||||
fs.unlink(file);
|
fs.unlink(file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}).run();
|
}).run();
|
||||||
|
} catch(error) {
|
||||||
|
StudyImportStatus.update({_id: studyImportStatusId}, {$inc: {'numberOfStudiesFailed': 1}});
|
||||||
|
console.log("Failed to import study via DIMSE: ", file, error);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,16 +5,18 @@
|
|||||||
onselectstart='return false;'>
|
onselectstart='return false;'>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
{{#if studyListFunctionsEnabled}}
|
||||||
<a class="disabled"><span class="fa-stack fa-lg">
|
<a class="disabled"><span class="fa-stack fa-lg">
|
||||||
<i class="fa fa-user fa-stack-1x"></i>
|
<i class="fa fa-user fa-stack-1x"></i>
|
||||||
<i class="fa fa-ban fa-stack-2x text-danger"></i>
|
<i class="fa fa-ban fa-stack-2x text-danger"></i>
|
||||||
</span> Anonymize
|
</span> Anonymize
|
||||||
</a>
|
</a>
|
||||||
|
<a id="exportSelectedStudies" type="button" title="Export Selected Studies">
|
||||||
|
<i class="fa fa-exchange fa-lg"></i> Export
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
<a class="disabled"><i class="fa fa-trash fa-lg"></i> Delete</a>
|
<a class="disabled"><i class="fa fa-trash fa-lg"></i> Delete</a>
|
||||||
<a class="disabled"><i class="fa fa-send-o fa-lg"></i> Send</a>
|
<a class="disabled"><i class="fa fa-send-o fa-lg"></i> Send</a>
|
||||||
<a id="exportSelectedStudies" type="button"
|
|
||||||
title="Export Selected Studies">
|
|
||||||
<i class="fa fa-exchange fa-lg"></i> Export</a>
|
|
||||||
<a class="disabled"><i class="fa fa-download fa-lg"></i> Download</a>
|
<a class="disabled"><i class="fa fa-download fa-lg"></i> Download</a>
|
||||||
<a class="disabled"><i class="fa fa-photo fa-lg"></i> View Series Details</a>
|
<a class="disabled"><i class="fa fa-photo fa-lg"></i> View Series Details</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -82,3 +82,10 @@ Template.studyContextMenu.events({
|
|||||||
closeHandler(dialog);
|
closeHandler(dialog);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Template.studyContextMenu.helpers({
|
||||||
|
'studyListFunctionsEnabled': function() {
|
||||||
|
var studyListFunctionsEnabled = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui &&
|
||||||
|
Meteor.settings.public.ui.studyListFunctionsEnabled || false; return studyListFunctionsEnabled;
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -1,4 +1,5 @@
|
|||||||
<template name="worklistResult">
|
<template name="worklistResult">
|
||||||
|
<div id="studyListContainer">
|
||||||
{{>worklistToolbar}}
|
{{>worklistToolbar}}
|
||||||
<table id="tblStudyList" class="worklistResult table noselect">
|
<table id="tblStudyList" class="worklistResult table noselect">
|
||||||
<thead>
|
<thead>
|
||||||
@ -95,4 +96,6 @@
|
|||||||
{{#if showNotFoundMessage}}
|
{{#if showNotFoundMessage}}
|
||||||
{{>studyNotFound}}
|
{{>studyNotFound}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -1,4 +1,6 @@
|
|||||||
table#tblStudyList
|
#studyListContainer
|
||||||
|
position: relative
|
||||||
|
table#tblStudyList
|
||||||
color: #888888
|
color: #888888
|
||||||
border-collapse: collapse
|
border-collapse: collapse
|
||||||
border-color: gray
|
border-color: gray
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
{{#if importSupported }}
|
{{#if importSupported }}
|
||||||
<span class="btn btn-default btn-file">
|
<span class="btn btn-default btn-file">
|
||||||
<i class="fa fa-upload"></i>
|
<i class="fa fa-upload"></i>
|
||||||
<input id="btnImport" title="Import" type="file" webkitdirectory directory multiple>
|
<input id="btnImport" title="Import Study" type="file" webkitdirectory directory multiple>
|
||||||
</span>
|
</span>
|
||||||
{{/if }}
|
{{/if }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -12,7 +12,10 @@ Template.worklistToolbar.events({
|
|||||||
Template.worklistToolbar.helpers({
|
Template.worklistToolbar.helpers({
|
||||||
importSupported: function() {
|
importSupported: function() {
|
||||||
var importSupported = Session.get('importSupported');
|
var importSupported = Session.get('importSupported');
|
||||||
if (importSupported) {
|
var studyListFunctionsEnabled = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui &&
|
||||||
|
Meteor.settings.public.ui.studyListFunctionsEnabled || false;
|
||||||
|
|
||||||
|
if (importSupported && studyListFunctionsEnabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#worklistToolbar
|
#worklistToolbar
|
||||||
background-color: black
|
background-color: black
|
||||||
text-align: right
|
position: absolute
|
||||||
width: 100%
|
top: 0
|
||||||
height: auto
|
right: 0
|
||||||
|
|
||||||
.btn-file
|
.btn-file
|
||||||
position: relative
|
position: relative
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user