10000 fixing issue #10470 · arangodb/arangodb@b9fce5b · GitHub
[go: up one dir, main page]

Skip to content

Commit b9fce5b

Browse files
committed
fixing issue #10470
1 parent dd52f0f commit b9fce5b

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
@@ -360,28 +360,30 @@
360360
},
361361

362362
uploadDocuments: function (file, callback) {
363+
var analyzeResponse = function (data) {
364+
if (data.hasOwnProperty('error')) {
365+
delete data.error;
366+
}
367+
368+
if (data.errors > 0) {
369+
callback(true, 'Info: ' + JSON.stringify(data));
370+
} else {
371+
callback(false, 'Info: ' + JSON.stringify(data));
372+
}
373+
};
374+
363375
$.ajax({
364376
type: 'POST',
365-
url: arangoHelper.databaseUrl('/_api/import?type=auto&collection=' +
377+
url: arangoHelper.databaseUrl('/_api/import?type=auto&details=true&collection=' +
366378
encodeURIComponent(this.collectionID) +
367379
'&createCollection=false'),
368380
data: file,
369381
processData: false,
370382
contentType: 'json',
371383
dataType: 'json',
372384
complete: function (xhr) {
373-
if (xhr.readyState === 4 && xhr.status === 201) {
374-
callback(false);
375-
} else {
376-
try {
377-
var data = JSON.parse(xhr.responseText);
378-
if (data.errors > 0) {
379-
var result = 'At least one error occurred during upload';
380-
callback(false, result);
381-
}
382-
} catch (err) {
383-
console.log(err);
384-
}
385+
if (xhr.responseJSON) {
386+
analyzeResponse(xhr.responseJSON);
385387
}
386388
},
387389
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