1
0
Fork 0

a few small corrections in the upload web interface

This commit is contained in:
Jan Steemann 2014-01-10 18:05:06 +01:00
parent a9c2dcc83d
commit 0e5c9c8a85
2 changed files with 7 additions and 17 deletions

View File

@ -5,7 +5,7 @@
<!-- remove marker for docupdiv--!> <!-- remove marker for docupdiv--!>
<ul><li class="enabled"><a id="indexCollection"><span class="icon_arangodb_checklist" title="Index collection"></span></a></li></ul> <ul><li class="enabled"><a id="indexCollection"><span class="icon_arangodb_checklist" title="Index collection"></span></a></li></ul>
<ul><li class="enabled"><a id="filterCollection"><span class="icon_arangodb_filter" title="Filter collection"></span></a></li></ul> <ul><li class="enabled"><a id="filterCollection"><span class="icon_arangodb_filter" title="Filter collection"></span></a></li></ul>
<ul><li class="enabled"><a id="importCollection"><span class="icon_arangodb_import" title="Upload documents"></span></a></li></ul> <ul><li class="enabled"><a id="importCollection"><span class="icon_arangodb_import" title="Upload documents from JSON file"></span></a></li></ul>
<ul> <ul>
<li class="enabled"><a id="collectionPrev"><span class="icon_arangodb_arrowleft" title="Previous collection"></span></a></li> <li class="enabled"><a id="collectionPrev"><span class="icon_arangodb_arrowleft" title="Previous collection"></span></a></li>
<li class="enabled"><a id="collectionNext"><span class="icon_arangodb_arrowright" title="Next collection"></span></a></li> <li class="enabled"><a id="collectionNext"><span class="icon_arangodb_arrowright" title="Next collection"></span></a></li>
@ -36,7 +36,7 @@
<div class="queryline"> <div class="queryline">
<input id="importDocuments" name="importDocuments" type="file" accept="application/json" /> <input id="importDocuments" name="importDocuments" type="file" accept="application/json" />
<button id="confirmDocImport" class="btn btn-success btn-old-padding" style="float:right"> <button id="confirmDocImport" class="btn btn-success btn-old-padding" style="float:right">
<img id="uploadIndicator" style="display: none;" src="img/ajax-loader.gif"/>Import <img id="uploadIndicator" style="display: none;" src="img/ajax-loader.gif"/>Import JSON
</button> </button>
</div> </div>
</div> </div>

View File

@ -138,7 +138,7 @@
} }
catch (e) { catch (e) {
arangoHelper.arangoNotification("Error: "+ e); arangoHelper.arangoError("Error: " + e);
self.hideSpinner(); self.hideSpinner();
self.hideImportModal(); self.hideImportModal();
self.resetView(); self.resetView();
@ -146,7 +146,7 @@
} }
if (data.errors === 0) { if (data.errors === 0) {
arangoHelper.arangoError("Upload successful. " + arangoHelper.arangoNotification("Upload successful. " +
data.created + " document(s) imported."); data.created + " document(s) imported.");
} }
else if (data.errors !== 0) { else if (data.errors !== 0) {
@ -160,30 +160,20 @@
} }
} }
self.hideSpinner(); self.hideSpinner();
arangoHelper.arangoNotification("Upload error"); arangoHelper.arangoError("Upload error");
} }
}); });
} }
else {
arangoHelper.arangoNotification("Unsupported filetype: " + self.file.type);
}
}, },
uploadSetup: function () { uploadSetup: function () {
var self = this; var self = this;
//$('#documentsUploadFile').change(function(e) {
$('#importDocuments').change(function(e) { $('#importDocuments').change(function(e) {
self.files = e.target.files || e.dataTransfer.files; self.files = e.target.files || e.dataTransfer.files;
self.file = self.files[0]; self.file = self.files[0];
if (self.file.type !== 'application/json') {
arangoHelper.arangoNotification("Unsupported filetype: " + self.file.type);
self.allowUpload = false;
}
else {
self.allowUpload = true; self.allowUpload = true;
}
}); });
}, },