1
0
Fork 0

some web interface fixes

This commit is contained in:
Jan Steemann 2013-07-16 15:17:39 +02:00
parent b7c719ccc5
commit faa4dc1486
3 changed files with 35 additions and 31 deletions

View File

@ -4,7 +4,7 @@
<div id="documentsUploadDiv" class="btn btn-primary btn-success btn-block">
<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>
<ul>

View File

@ -3,14 +3,8 @@
var collectionInfoView = Backbone.View.extend({
el: '#modalPlaceholder',
figures: {
"alive" : 0,
"dead" : 0,
"datafiles" : 0,
"journals" : 0,
"shapes" : 0,
"attributes" : 0
},
chart: null,
initialize: function () {
},
@ -73,29 +67,37 @@ var collectionInfoView = Backbone.View.extend({
},
renderFigures: function () {
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")
.datum(self.convertFigures())
.transition().duration(1200)
.call(chart);
// prevent some d3-internal races with a timeout
window.setTimeout(function () {
var chart = nv.models.pieChart()
.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;
});
}, 500);
},
convertFigures: function () {
var self = this;
var collValues = [];
$.each(self.data.figures, function(k,v) {
collValues.push({
"label" : k,
"value" : v.count
});
});
if (self.data && self.data.figures) {
$.each(self.data.figures, function(k,v) {
collValues.push({
"label" : k,
"value" : v.count
});
});
}
return [{
key: "Collections Status",

View File

@ -61,18 +61,20 @@ var documentsView = Backbone.View.extend({
uploadSetup: function () {
var self = this;
var file;
var filetype;
$('#documentsUpload').bind("change", function(e) {
self.showSpinner();
$('#documentsUploadFile').change(function(e) {
var file;
var filetype;
var files = e.target.files || e.dataTransfer.files;
file = files[0];
if (file.type !== 'application/json') {
arangoHelper.arangoNotification("Not supported filetype: "+file.type);
arangoHelper.arangoNotification("Unsupported filetype: " + file.type);
return;
}
self.showSpinner();
$.ajax({
type: "POST",