mirror of https://gitee.com/bigwinds/arangodb
some web interface fixes
This commit is contained in:
parent
b7c719ccc5
commit
faa4dc1486
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<div id="documentsUploadDiv" class="btn btn-primary btn-success btn-block">
|
<div id="documentsUploadDiv" class="btn btn-primary btn-success btn-block">
|
||||||
<img id="uploadIndicator" style="display: none;" src="/_admin/html/img/ajax-loader.gif"/>
|
<img id="uploadIndicator" style="display: none;" src="/_admin/html/img/ajax-loader.gif"/>
|
||||||
<input id="documentsUpload" name="docImport" id="docImport" type="file">Import
|
<input id="documentsUploadFile" name="documentsUploadFile" type="file" accept="application/json" />Import
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -3,14 +3,8 @@
|
||||||
|
|
||||||
var collectionInfoView = Backbone.View.extend({
|
var collectionInfoView = Backbone.View.extend({
|
||||||
el: '#modalPlaceholder',
|
el: '#modalPlaceholder',
|
||||||
figures: {
|
chart: null,
|
||||||
"alive" : 0,
|
|
||||||
"dead" : 0,
|
|
||||||
"datafiles" : 0,
|
|
||||||
"journals" : 0,
|
|
||||||
"shapes" : 0,
|
|
||||||
"attributes" : 0
|
|
||||||
},
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -73,29 +67,37 @@ var collectionInfoView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
renderFigures: function () {
|
renderFigures: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
nv.addGraph(function() {
|
|
||||||
var chart = nv.models.pieChart()
|
|
||||||
.x(function(d) { return d.label; })
|
|
||||||
.y(function(d) { return d.value; })
|
|
||||||
.showLabels(true);
|
|
||||||
|
|
||||||
d3.select(".modal-body-right svg")
|
// prevent some d3-internal races with a timeout
|
||||||
.datum(self.convertFigures())
|
window.setTimeout(function () {
|
||||||
.transition().duration(1200)
|
var chart = nv.models.pieChart()
|
||||||
.call(chart);
|
.x(function(d) { return d.label; })
|
||||||
|
.y(function(d) { return d.value; })
|
||||||
|
.showLabels(true);
|
||||||
|
|
||||||
|
nv.addGraph(function() {
|
||||||
|
d3.select(".modal-body-right svg")
|
||||||
|
.datum(self.convertFigures())
|
||||||
|
.transition().duration(1200)
|
||||||
|
.call(chart);
|
||||||
|
|
||||||
|
return chart;
|
||||||
|
});
|
||||||
|
|
||||||
return chart;
|
return chart;
|
||||||
});
|
}, 500);
|
||||||
},
|
},
|
||||||
convertFigures: function () {
|
convertFigures: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
var collValues = [];
|
var collValues = [];
|
||||||
$.each(self.data.figures, function(k,v) {
|
if (self.data && self.data.figures) {
|
||||||
collValues.push({
|
$.each(self.data.figures, function(k,v) {
|
||||||
"label" : k,
|
collValues.push({
|
||||||
"value" : v.count
|
"label" : k,
|
||||||
});
|
"value" : v.count
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
key: "Collections Status",
|
key: "Collections Status",
|
||||||
|
|
|
@ -61,19 +61,21 @@ var documentsView = Backbone.View.extend({
|
||||||
|
|
||||||
uploadSetup: function () {
|
uploadSetup: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
var file;
|
|
||||||
var filetype;
|
|
||||||
|
|
||||||
$('#documentsUpload').bind("change", function(e) {
|
$('#documentsUploadFile').change(function(e) {
|
||||||
self.showSpinner();
|
var file;
|
||||||
|
var filetype;
|
||||||
|
|
||||||
var files = e.target.files || e.dataTransfer.files;
|
var files = e.target.files || e.dataTransfer.files;
|
||||||
|
|
||||||
file = files[0];
|
file = files[0];
|
||||||
|
|
||||||
if (file.type !== 'application/json') {
|
if (file.type !== 'application/json') {
|
||||||
arangoHelper.arangoNotification("Not supported filetype: "+file.type);
|
arangoHelper.arangoNotification("Unsupported filetype: " + file.type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.showSpinner();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
async: false,
|
async: false,
|
||||||
|
|
Loading…
Reference in New Issue