LT-239: Handle the error if the last imported file is not dcm file
- Add message label in progress dialog
This commit is contained in:
1 parent
2a17760ff8
commit
dfcb33153f
8 files changed
+246
-170
No files matched your search
@@ -10,11 +10,13 @@ importStudies = function(filesToImport, importCallback) {
|
||||
numberOfFilesUploaded: 0,
|
||||
numberOfFilesFailed: 0
|
||||
};
|
||||
|
||||
var numberOfFilesToUpload = filesToImport.length;
|
||||
var studiesToImport = [];
|
||||
|
||||
progressDialog.show("Uploading Files...", numberOfFilesToUpload);
|
||||
progressDialog.show({
|
||||
title: "Uploading Files...",
|
||||
numberOfCompleted: 0,
|
||||
numberOfTotal: numberOfFilesToUpload
|
||||
});
|
||||
|
||||
// Upload files to the server
|
||||
filesToImport.forEach(function(fileToUpload) {
|
||||
@@ -70,7 +72,11 @@ function importStudiesInternal(studiesToImport, importCallback) {
|
||||
|
||||
var numberOfStudiesToImport = studiesToImport.length;
|
||||
|
||||
progressDialog.show("Importing Studies...", numberOfStudiesToImport);
|
||||
progressDialog.show({
|
||||
title: "Importing Studies...",
|
||||
numberOfCompleted: 0,
|
||||
numberOfTotal: numberOfStudiesToImport
|
||||
});
|
||||
|
||||
// Create/Insert a new study import status item
|
||||
Meteor.call("createStudyImportStatus", function(err, studyImportStatusId) {
|
||||
@@ -81,7 +87,7 @@ function importStudiesInternal(studiesToImport, importCallback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle when it is updated
|
||||
// Handle when StudyImportStatus collection is updated
|
||||
StudyImportStatus.find(studyImportStatusId).observe({
|
||||
changed: function(studyImportStatus) {
|
||||
if (!studyImportStatus) {
|
||||
@@ -90,26 +96,27 @@ function importStudiesInternal(studiesToImport, importCallback) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// Show number of imported files
|
||||
var successMessage = 'Imported '+studyImportStatus.numberOfStudiesImported+' of '+numberOfStudiesToImport;
|
||||
progressDialog.setMessage({
|
||||
message: successMessage,
|
||||
messageType: 'success'
|
||||
});
|
||||
progressDialog.update(numberOfStudiesProcessedToImport);
|
||||
|
||||
// Show number of failed files if there is at least one failed file
|
||||
if (studyImportStatus.numberOfStudiesFailed > 0) {
|
||||
var successMessage = 'Failed '+studyImportStatus.numberOfStudiesFailed+' of '+numberOfStudiesToImport;
|
||||
progressDialog.setMessage({
|
||||
message: successMessage,
|
||||
messageType: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
if (numberOfStudiesProcessedToImport == numberOfStudiesToImport) {
|
||||
// The entire import operation is completed, so remove the study import status item
|
||||
Meteor.call("removeStudyImportStatus", studyImportStatus._id);
|
||||
|
||||
if (studyImportStatus.numberOfStudiesFailed > 0) {
|
||||
//TODO: Some files failed to import, so let user know
|
||||
// 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
|
||||
if (importCallback) {
|
||||
importCallback();
|
||||
|
||||
Reference in new issue
Block a user