8000 fixing issue #10470 · arangodb/arangodb@3cbef32 · GitHub
[go: up one dir, main page]

Skip to 8000 content

Commit 3cbef32

Browse files
committed
fixing issue #10470
1 parent d2d0c2c commit 3cbef32

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocuments.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -371,28 +371,30 @@
371371
},
372372

373373
uploadDocuments: function (file, callback) {
374+
var analyzeResponse = function (data) {
375+
if (data.hasOwnProperty('error')) {
376+
delete data.error;
377+
}
378+
379+
if (data.errors > 0) {
380+
callback(true, 'Info: ' + JSON.stringify(data));
381+
} else {
382+
callback(false, 'Info: ' + JSON.stringify(data));
383+
}
384+
};
385+
374386
$.ajax({
375387
type: 'POST',
376-
url: arangoHelper.databaseUrl('/_api/import?type=auto&collection=' +
388+
url: arangoHelper.databaseUrl('/_api/import?type=auto&details=true&collection=' +
377389
encodeURIComponent(this.collectionID) +
378390
'&createCollection=false'),
379391
data: file,
380392
processData: false,
381393
contentType: 'json',
382394
dataType: 'json',
383395
complete: function (xhr) {
384-
if (xhr.readyState === 4 && xhr.status === 201) {
385-
callback(false);
386-
} else {
387-
try {
388-
var data = JSON.parse(xhr.responseText);
389-
if (data.errors > 0) {
390-
var result = 'At least one error occurred during upload';
391-
callback(false, result);
392-
}
393-
} catch (err) {
394-
console.log(err);
395-
}
396+
if (xhr.responseJSON) {
397+
analyzeResponse(xhr.responseJSON);
396398
}
397399
},
398400
error: function (msg) {

js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
$('#documents_first').css('visibility', 'visible');
221221
this.addDocumentSwitch = true;
222222
this.collection.resetFilter();
223-
this.collection.loadTotal(callback);
223+
this.collection.loadCollectionConfig(callback);
224224
this.restoredFilters = [];
225225

226226
// for resetting json upload
@@ -249,6 +249,7 @@
249249
if (error) {
250250
arangoHelper.arangoError('Upload', msg);
251251
} else {
252+
arangoHelper.arangoMessage('Upload', msg);
252253
this.hideImportModal();
253254
this.resetView();
254255
}

0 commit comments

Comments
 (0)
0