<%if(datasets[i].label){%><%=datasets[i].label%><%}%><%}%>'},initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(t),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){var o;this.scale.animation||(o=this.scale.getPointPosition(n,this.scale.calculateCenterOffset(e))),s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,x:this.options.animation?this.scale.xCenter:o.x,y:this.options.animation?this.scale.yCenter:o.y,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=e.getRelativePosition(t),s=e.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),n=2*Math.PI/this.scale.valuesCount,o=Math.round((s.angle-1.5*Math.PI)/n),a=[];return(o>=this.scale.valuesCount||0>o)&&(o=0),s.distance<=this.scale.drawingArea&&e.each(this.datasets,function(t){a.push(t.points[o])}),a},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i=function(){var i=[];return e.each(t,function(t){t.data?i=i.concat(t.data):e.each(t.points,function(t){i.push(t.value)})}),i}(),s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s)},addData:function(t,i){this.scale.valuesCount++,e.each(t,function(t,e){var s=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:s.x,y:s.y,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.labels.push(i),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),e.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var i=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),e.each(this.datasets,function(t){e.each(t.points,function(t,e){t.hasValue()&&t.transition(this.scale.getPointPosition(e,this.scale.calculateCenterOffset(t.value)),i)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,s.fill(),e.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this);
\ No newline at end of file
diff --git a/pydash/templates/main.html b/pydash/templates/main.html
index be893cb..91370d1 100644
--- a/pydash/templates/main.html
+++ b/pydash/templates/main.html
@@ -128,6 +128,8 @@
{% trans "Free" %}
{% trans "Used" %}
+ {% trans "Buffers" %}
+ {% trans "Cached" %}
@@ -340,7 +342,7 @@ var mem_ctx = $("#memoryChart").get(0).getContext("2d");
$.getJSON(pydashUrls['memusage'], function(data) {
var options = {
animation : false,
- pointDotRadius : 2,
+ pointDotRadius : 4,
scaleLabel : "<%=value%> Mb"
}
memChart.Line(data, options);
diff --git a/pydash/views.py b/pydash/views.py
index 7f6400a..ed039ef 100755
--- a/pydash/views.py
+++ b/pydash/views.py
@@ -47,7 +47,7 @@ def get_pydash_urls():
# E.g. reverse('platform', args=[0])[:-2] -> /info/platform/
# reverse('getcpus', args[0])[:-2] -> /info/getcpus/
results[name] = reverse(name, args=[0])[:-2]
- return results
+ return json.dumps(results)
@login_required(login_url=reverse_lazy('login'))
@@ -271,6 +271,8 @@ def memusage(request):
"""
datasets_free = []
datasets_used = []
+ datasets_buffers = []
+ datasets_cached = []
try:
mem_usage = services.get_mem()
@@ -278,17 +280,21 @@ def memusage(request):
mem_usage = 0
try:
- cookies = request._cookies['memory_usage']
+ cookies = request.COOKIES['memory_usage']
except Exception:
cookies = None
if not cookies:
datasets_free.append(0)
datasets_used.append(0)
+ datasets_buffers.append(0)
+ datasets_cached.append(0)
else:
datasets = json.loads(cookies)
datasets_free = datasets[0]
datasets_used = datasets[1]
+ atasets_buffers = datasets[2]
+ datasets_cached = datasets[3]
if len(datasets_free) > 10:
while datasets_free:
@@ -300,6 +306,16 @@ def memusage(request):
del datasets_used[0]
if len(datasets_used) == 10:
break
+ if len(datasets_buffers) > 10:
+ while datasets_buffers:
+ del datasets_buffers[0]
+ if len(datasets_buffers) == 10:
+ break
+ if len(datasets_cached) > 10:
+ while datasets_cached:
+ del datasets_cached[0]
+ if len(datasets_cached) == 10:
+ break
if len(datasets_free) <= 9:
datasets_free.append(int(mem_usage['free']))
if len(datasets_free) == 10:
@@ -310,7 +326,16 @@ def memusage(request):
if len(datasets_used) == 10:
datasets_used.append(int(mem_usage['usage']))
del datasets_used[0]
-
+ if len(datasets_buffers) <= 9:
+ datasets_buffers.append(int(mem_usage['buffers']))
+ if len(datasets_buffers) == 10:
+ datasets_buffers.append(int(mem_usage['buffers']))
+ del datasets_buffers[0]
+ if len(datasets_cached) <= 9:
+ datasets_cached.append(int(mem_usage['cached']))
+ if len(datasets_cached) == 10:
+ datasets_cached.append(int(mem_usage['cached']))
+ del datasets_cached[0]
# Some fix division by 0 Chart.js
if len(datasets_free) == 10:
if sum(datasets_free) == 0:
@@ -322,9 +347,9 @@ def memusage(request):
'labels': [""] * 10,
'datasets': [
{
- "fillColor": "rgba(249,134,33,0.5)",
- "strokeColor": "rgba(249,134,33,1)",
- "pointColor": "rgba(249,134,33,1)",
+ "fillColor": "rgba(247,70,74,0.5)",
+ "strokeColor": "rgba(247,70,74,1)",
+ "pointColor": "rgba(247,70,74,1)",
"pointStrokeColor": "#fff",
"data": datasets_used
},
@@ -334,11 +359,25 @@ def memusage(request):
"pointColor": "rgba(43,214,66,1)",
"pointStrokeColor": "#fff",
"data": datasets_free
- }
+ },
+ {
+ "fillColor": "rgba(0,154,205,0.5)",
+ "strokeColor": "rgba(0,154,205,1)",
+ "pointColor": "rgba(0,154,205,1)",
+ "pointStrokeColor": "#fff",
+ "data": datasets_buffers
+ },
+ {
+ "fillColor": "rgba(255,185,15,0.5)",
+ "strokeColor": "rgba(255,185,15,1)",
+ "pointColor": "rgba(265,185,15,1)",
+ "pointStrokeColor": "#fff",
+ "data": datasets_cached
+ }
]
}
- cookie_memory = [datasets_free, datasets_used]
+ cookie_memory = [datasets_free, datasets_used, datasets_buffers, datasets_cached]
data = json.dumps(memory)
response = HttpResponse()
response['Content-Type'] = "text/javascript"
@@ -360,7 +399,7 @@ def loadaverage(request):
load_average = 0
try:
- cookies = request._cookies['load_average']
+ cookies = request.COOKIES['load_average']
except Exception:
cookies = None
@@ -427,7 +466,7 @@ def gettraffic(request):
traffic = 0
try:
- cookies = request._cookies['traffic']
+ cookies = request.COOKIES['traffic']
except Exception:
cookies = None
@@ -549,7 +588,7 @@ def getdiskio(request):
diskrw = 0
try:
- cookies = request._cookies['diskrw']
+ cookies = request.COOKIES['diskrw']
except Exception:
cookies = None
diff --git a/requirements.txt b/requirements.txt
index 7a84bdf..f61efdb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
-django==1.6.1
+django>=1.5
diff --git a/setup.py b/setup.py
index e506779..10a91d0 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-pydash-app',
- version='1.4.4',
+ version='1.4.6',
packages=['pydash'],
include_package_data=True,
license='MIT',
@@ -18,8 +18,8 @@ setup(
author='Florian N.',
author_email='michaelneagu@gmail.com',
classifiers=[
- 'Development Status :: 4 - Beta',
- 'Environment :: Web Environment'
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
@@ -27,6 +27,12 @@ setup(
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.0',
+ 'Programming Language :: Python :: 3.1',
+ 'Programming Language :: Python :: 3.2',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],