mirror of https://gitee.com/bigwinds/arangodb
Start of Foxx download in WI implementation. Not functional yet
This commit is contained in:
parent
ca6383b5ff
commit
cb288e21e6
|
@ -38,6 +38,19 @@ var FoxxController = require("org/arangodb/foxx").Controller,
|
|||
var foxxes = new (require("lib/foxxes").Foxxes)();
|
||||
var docus = new (require("lib/swagger").Swagger)();
|
||||
|
||||
|
||||
/** Fetch a foxx from temp folder
|
||||
*
|
||||
* Makes a foxx uploaded to the temp folder
|
||||
* available for mounting.
|
||||
*/
|
||||
|
||||
controller.post("/foxxes/fetch", function (req, res) {
|
||||
var content = JSON.parse(req.requestBody),
|
||||
path = content.filename;
|
||||
res.json(foxxes.fetch(path));
|
||||
});
|
||||
|
||||
// .............................................................................
|
||||
// install
|
||||
// .............................................................................
|
||||
|
|
|
@ -13,3 +13,9 @@
|
|||
position: relative;
|
||||
}
|
||||
|
||||
a.headerButton {
|
||||
margin-top: -2px;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
min-height: 23px;
|
||||
}
|
||||
|
|
|
@ -45,13 +45,13 @@
|
|||
margin-bottom: -10px;
|
||||
}
|
||||
|
||||
#filterHeader, #importHeader, .arangoDropdownIn, #indexHeaderContent {
|
||||
#filterHeader, .arangoDropdownIn, #indexHeaderContent {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#filterHeader, #importHeader, .arangoDropdownIn {
|
||||
#filterHeader, .arangoDropdownIn {
|
||||
padding-top: 10px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
|
@ -59,10 +59,6 @@
|
|||
position:relative;
|
||||
}
|
||||
|
||||
#importHeader input {
|
||||
line-height: 0px !important;
|
||||
margin-top: 5px;margin-bottom: -5px;
|
||||
}
|
||||
|
||||
#confirmDocImport {
|
||||
margin-right: 0px;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
.dropdownImport {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
background-color: white;
|
||||
padding-top: 10px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 5px;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.dropdownImport input {
|
||||
line-height: 0px !important;
|
||||
margin-top: 5px;
|
||||
margin-bottom: -5px;
|
||||
}
|
|
@ -7,7 +7,12 @@
|
|||
<div class="pull-right pagination pagination-small pagination-right btn-group">
|
||||
<ul>
|
||||
<li>
|
||||
<a id="foxxToggle" class="arangoHeaderA">
|
||||
<a id="importFoxxToggle" class="headerButton">
|
||||
<span class="icon_arangodb_import" title="Upload documents from JSON file"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="foxxToggle" class="headerButton">
|
||||
<span class="icon_arangodb_settings2" title="Settings"></span>
|
||||
</a>
|
||||
</li>
|
||||
|
@ -47,6 +52,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="foxxDropdownImport" class="headerDropdown">
|
||||
<div id="foxxDropdownImportInner" class="dropdownInner">
|
||||
<div class="queryline">
|
||||
<input id="importFoxx" name="importFoxx" type="file" accept="application/zip" />
|
||||
<button id="confirmFoxxImport" class="btn btn-success btn-old-padding" style="float:right">
|
||||
<img id="uploadIndicator" style="display: none;" src="img/ajax-loader.gif"/>Import Foxx
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,15 @@
|
|||
<div id="documentsToolbar" class="pagination pagination-small pagination-right">
|
||||
|
||||
<!-- 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="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 from JSON file"></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="importCollection"><span class="icon_arangodb_import" title="Upload documents from JSON file"></span></a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<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>
|
||||
|
|
|
@ -11,7 +11,63 @@ window.ApplicationsView = Backbone.View.extend({
|
|||
"click #checkDevel": "toggleDevel",
|
||||
"click #checkActive": "toggleActive",
|
||||
"click #checkInactive": "toggleInactive",
|
||||
"click #foxxToggle": "slideToggle"
|
||||
"click #foxxToggle": "slideToggle",
|
||||
"click #importFoxxToggle": "slideToggleImport",
|
||||
"change #importFoxx": "uploadSetup",
|
||||
"click #confirmFoxxImport": "importFoxx"
|
||||
},
|
||||
|
||||
uploadSetup: function (e) {
|
||||
var files = e.target.files || e.dataTransfer.files;
|
||||
this.file = files[0];
|
||||
this.allowUpload = true;
|
||||
console.log("Checked file");
|
||||
},
|
||||
|
||||
importFoxx: function() {
|
||||
var self = this;
|
||||
if (self.allowUpload) {
|
||||
console.log("Start Upload");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
async: false,
|
||||
url: '/_api/upload',
|
||||
data: self.file,
|
||||
processData: false,
|
||||
contentType: 'application/octet-stream',
|
||||
complete: function(res) {
|
||||
if (res.readyState === 4) {
|
||||
if (res.status === 201) {
|
||||
try {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
async: false,
|
||||
url: "/_admin/aardvark/foxxes/fetch",
|
||||
data: res.responseText,
|
||||
contentType: "application/json"
|
||||
}).done(function(res) {
|
||||
console.log("Pos:", res);
|
||||
}).fail(function(err) {
|
||||
console.log("Neg:", err);
|
||||
});
|
||||
} catch (e) {
|
||||
arangoHelper.arangoError("Error: " + e);
|
||||
}
|
||||
delete self.file;
|
||||
self.allowUpload = false;
|
||||
/*
|
||||
self.hideSpinner();
|
||||
self.hideImportModal();
|
||||
self.resetView();
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
// self.hideSpinner();
|
||||
arangoHelper.arangoError("Upload error");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
toggleDevel: function() {
|
||||
|
@ -38,8 +94,14 @@ window.ApplicationsView = Backbone.View.extend({
|
|||
});
|
||||
},
|
||||
|
||||
slideToggleImport: function() {
|
||||
$('#foxxDropdownImport').slideToggle(200);
|
||||
$('#foxxDropdownOut').hide();
|
||||
},
|
||||
|
||||
slideToggle: function() {
|
||||
$('#foxxDropdownOut').slideToggle(200);
|
||||
$('#foxxDropdownImport').hide();
|
||||
},
|
||||
|
||||
toggleView: function(event) {
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue