1
0
Fork 0

indicate at least some errors for failing uploads

This commit is contained in:
Jan Steemann 2014-12-22 17:21:33 +01:00
parent 123dc4be66
commit cc9a26c268
3 changed files with 17 additions and 10 deletions

View File

@ -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;

View File

@ -70,7 +70,7 @@
<button id="confirmDocImport" class="button-success btn-old-padding" style="float:right" disabled>
<img id="uploadIndicator" class="upload-indicator" src="img/ajax-loader.gif"/>Import JSON
</button>
<div title='Example input data:</br></br> I. Line-wise: </br> { "_key": "key1", ... } { "_key": "key2", ... } or </br></br> II. JSON documents embedded into a list: </br> [ </br> { "_key": "key1", ... }, </br> { "_key": "key2", ... }, </br> ... </br> ]' class="upload-info" style="float:left; margin-top:7px; margin-right: 10px;"><i style="font-size: 13pt;" class="fa fa-info-circle"></i></div>
<div title='Example input data:<br /><br /> I. Line-wise: <br /> { "_key": "key1", ... } <br /> { "_key": "key2", ... } <br /><br /> or <br /><br /> II. JSON documents embedded into a list: <br /> [ <br /> &nbsp; { "_key": "key1", ... }, <br /> &nbsp; { "_key": "key2", ... }, <br /> &nbsp; ... <br /> ]' class="upload-info" style="float:left; margin-top:7px; margin-right: 10px;"><i style="font-size: 13pt;" class="fa fa-info-circle"></i></div>
</div>
</div>

View File

@ -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();