From cc9a26c2681a648ff117f32e2143f510f9c48e91 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 22 Dec 2014 17:21:33 +0100 Subject: [PATCH] indicate at least some errors for failing uploads --- .../frontend/js/collections/arangoDocuments.js | 13 +++++++++++-- .../frontend/js/templates/documentsView.ejs | 2 +- .../aardvark/frontend/js/views/documentsView.js | 12 +++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js b/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js index 3f9077e846..f17422cdb5 100644 --- a/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js +++ b/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js @@ -272,10 +272,19 @@ dataType: 'json', complete: function(xhr) { if (xhr.readyState === 4 && xhr.status === 201) { - result = true; + result = true; } else { - result = "Upload error"; + result = "Upload error"; } + + try { + var data = JSON.parse(xhr.responseText); + if (data.errors > 0) { + result = "At least one error occurred during upload"; + } + } + catch (err) { + } } }); return result; diff --git a/js/apps/system/aardvark/frontend/js/templates/documentsView.ejs b/js/apps/system/aardvark/frontend/js/templates/documentsView.ejs index 97ca46a71f..3defbbc178 100644 --- a/js/apps/system/aardvark/frontend/js/templates/documentsView.ejs +++ b/js/apps/system/aardvark/frontend/js/templates/documentsView.ejs @@ -70,7 +70,7 @@ -
+
diff --git a/js/apps/system/aardvark/frontend/js/views/documentsView.js b/js/apps/system/aardvark/frontend/js/views/documentsView.js index fecdee5a9c..0cf937856a 100644 --- a/js/apps/system/aardvark/frontend/js/views/documentsView.js +++ b/js/apps/system/aardvark/frontend/js/views/documentsView.js @@ -195,13 +195,11 @@ this.showSpinner(); result = this.collection.uploadDocuments(this.file); if (result !== true) { - this.hideSpinner(); - if (result.substr(0, 5 ) === "Error") { - this.hideImportModal(); - this.resetView(); - } - arangoHelper.arangoError(result); - return; + this.hideSpinner(); + this.hideImportModal(); + this.resetView(); + arangoHelper.arangoError(result); + return; } this.hideSpinner(); this.hideImportModal();