|
|
@ -357,9 +357,7 @@ monitor.folders.init = function () {
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
|
httpclient.get('/folders', function (x) {
|
|
|
|
httpclient.get('/folders', function (x) {
|
|
|
|
var r = JSON.parse(x.responseText)
|
|
|
|
var r = JSON.parse(x.responseText)
|
|
|
|
r = jx.utils.patterns.visitor(r, function (row) {
|
|
|
|
r = r[0]
|
|
|
|
return row[0]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
monitor.folders.render.init(r)
|
|
|
|
monitor.folders.render.init(r)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -368,6 +366,39 @@ monitor.folders.render.init = function (data) {
|
|
|
|
monitor.folders.render.summary(data)
|
|
|
|
monitor.folders.render.summary(data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
monitor.folders.render.details = function (data) {
|
|
|
|
monitor.folders.render.details = function (data) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// We need to normalize the data at this point so as to be able to show it all in the same chart
|
|
|
|
|
|
|
|
// jx.math.scale
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
var m = jx.utils.vector(['x','y'],data.age)
|
|
|
|
|
|
|
|
var x_max_age = jx.math.max(m[0])
|
|
|
|
|
|
|
|
var y_max_age = jx.math.max(m[1])
|
|
|
|
|
|
|
|
m = jx.math.scale(m)
|
|
|
|
|
|
|
|
data.age = jx.utils.patterns.visitor(m,function(row){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {x:parseFloat(row[0].toFixed(3)),y:parseFloat(row[1].toFixed(3))}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var m = jx.utils.vector(['x','y'],data.size)
|
|
|
|
|
|
|
|
var x_max_size = jx.math.max(m[0])
|
|
|
|
|
|
|
|
var y_max_size = jx.math.max(m[1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m = jx.math.scale(m)
|
|
|
|
|
|
|
|
data.size = jx.utils.patterns.visitor(m,function(row){
|
|
|
|
|
|
|
|
return {x:parseFloat(row[0].toFixed(3)),y:parseFloat(row[1].toFixed(3))}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// The datasets need to be sorted by x ...
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
var Fn = function(a,b){
|
|
|
|
|
|
|
|
return a.x - b.x
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
data.age = data.age.sort(Fn)
|
|
|
|
|
|
|
|
data.size= data.size.sort(Fn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// data.size = data.size.splice(0,data.age.length)
|
|
|
|
|
|
|
|
|
|
|
|
var context = jx.dom.get.instance('CANVAS')
|
|
|
|
var context = jx.dom.get.instance('CANVAS')
|
|
|
|
var frame = $('#chartfolder')
|
|
|
|
var frame = $('#chartfolder')
|
|
|
|
jx.dom.set.value('chartfolder', '')
|
|
|
|
jx.dom.set.value('chartfolder', '')
|
|
|
@ -379,23 +410,44 @@ monitor.folders.render.details = function (data) {
|
|
|
|
conf.options = { legend: { position: 'bottom' } }
|
|
|
|
conf.options = { legend: { position: 'bottom' } }
|
|
|
|
conf.options.scales = {}
|
|
|
|
conf.options.scales = {}
|
|
|
|
conf.options.scales.yAxes = [
|
|
|
|
conf.options.scales.yAxes = [
|
|
|
|
{id:'0',scaleLabel:{display:true,labelString:'Age In Days'},ticks:{min:0,beginAtZero:true},gridLines: {display:false}},
|
|
|
|
{id:'0',scaleLabel:{display:true,labelString:'% DAYS/MB'},ticks:{min:0,beginAtZero:true},gridLines: {display:false}}
|
|
|
|
{id:'1',scaleLabel:{display:true,labelString:'Size in MB'},ticks:{min:0,beginAtZero:true},gridLines: {display:false}}
|
|
|
|
|
|
|
|
]
|
|
|
|
]
|
|
|
|
conf.options.scales.xAxes = [{gridLines: {display:false}}]
|
|
|
|
conf.options.scales.xAxes = [{ ticks:{min:0,max:1},gridLines: {display:false}}]
|
|
|
|
|
|
|
|
conf.options.tooltips = {}
|
|
|
|
|
|
|
|
conf.options.tooltips.callbacks = {}
|
|
|
|
|
|
|
|
conf.options.tooltips.callbacks.label = function(item,rec){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var r = data.datasets[item.datasetIndex].data[item.index]
|
|
|
|
|
|
|
|
if(item.datasetIndex == 0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r = data.age[item.index]
|
|
|
|
|
|
|
|
xmax = x_max_age
|
|
|
|
|
|
|
|
ymax = y_max_age
|
|
|
|
|
|
|
|
units = "DAYS"
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
r = data.size[item.index]
|
|
|
|
|
|
|
|
xmax = x_max_size
|
|
|
|
|
|
|
|
ymax = y_max_size
|
|
|
|
|
|
|
|
units = "MB"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(r)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 'WTF'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var age = {yAxisID:'0', label: 'File Age (Days)', data:data.age ,borderColor:COLORS[187],fill:true,borderWidth:1}
|
|
|
|
var age = {yAxisID:'0', label: 'File Age (Days)', data:data.age ,borderColor:COLORS[187],fill:true,borderWidth:1}
|
|
|
|
var size = {yAxisID:'1',label : 'File Size (MB)',data:data.size,borderColor:COLORS[32],fill:true,borderWidth:1}
|
|
|
|
var size = {yAxisID:'0',label : 'File Size (MB)',data:data.size,borderColor:COLORS[32],fill:true,borderWidth:1}
|
|
|
|
// age.data = [{ x: 10, y: 30 }, {x:20,y:60}]
|
|
|
|
// // age.data = [{ x: 10, y: 30 }, {x:20,y:60}]
|
|
|
|
// size.data= data.size
|
|
|
|
// size.data= data.size
|
|
|
|
age.data = data.age
|
|
|
|
age.data = data.age
|
|
|
|
x_ = jx.utils.vector('x', age.data)
|
|
|
|
x_ = jx.utils.vector('x', age.data)
|
|
|
|
z_ = jx.utils.vector('x',size.data)
|
|
|
|
z_ = jx.utils.vector('x',size.data)
|
|
|
|
conf.data.labels = jx.utils.unique(jx.math.sets.union(x_,z_))
|
|
|
|
conf.data.labels = jx.utils.unique(jx.math.sets.union(x_,z_)).sort()
|
|
|
|
conf.data.datasets = [age,size]
|
|
|
|
conf.data.datasets = [age,size]//,age]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(conf)
|
|
|
|
|
|
|
|
jx.dom.append('chartfolder',context)
|
|
|
|
jx.dom.append('chartfolder',context)
|
|
|
|
var chart = new Chart(context,conf)
|
|
|
|
var chart = new Chart(context,conf)
|
|
|
|
|
|
|
|
|
|
|
@ -423,8 +475,6 @@ monitor.folders.render.summary = function (data) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
options.rowClick = function(args){
|
|
|
|
options.rowClick = function(args){
|
|
|
|
var item = args.item
|
|
|
|
var item = args.item
|
|
|
|
var yu = jx.math.mean(jx.utils.vector('0', item.details.age))
|
|
|
|
|
|
|
|
var yr = jx.math.sd(jx.utils.vector('0', item.details.age))
|
|
|
|
|
|
|
|
age = jx.utils.patterns.visitor(item.details.age, function (row) {
|
|
|
|
age = jx.utils.patterns.visitor(item.details.age, function (row) {
|
|
|
|
return {y:row[0],x:row[1]}
|
|
|
|
return {y:row[0],x:row[1]}
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -434,11 +484,12 @@ monitor.folders.render.summary = function (data) {
|
|
|
|
|
|
|
|
|
|
|
|
monitor.folders.render.details({age:age,size:size})
|
|
|
|
monitor.folders.render.details({age:age,size:size})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @TODO Add the units in days just in case
|
|
|
|
options.autoload = true
|
|
|
|
options.autoload = true
|
|
|
|
options.fields = [
|
|
|
|
options.fields = [
|
|
|
|
{ name: 'label', type: 'text', title: "Folder Name", headercss: "small bold", css: "small"},
|
|
|
|
{ name: 'label', type: 'text', title: "Folder Name", headercss: "small bold", css: "small"},
|
|
|
|
{ name: "summary.age", type: "number", title: "Age (Days)", headercss: "small bold" , width:'64px'},
|
|
|
|
{ name: "summary.age", type: "number", title: "Age (DAYS)", headercss: "small bold" , width:'64px'},
|
|
|
|
{ name: "summary.size", type: "number", title: "Size (MB)", type: "number", headercss: "small bold" },
|
|
|
|
{ name: "summary.size", type: "number", title: "Size (MB)", type: "number", headercss: "small bold" },
|
|
|
|
{ name: "summary.count", type: "number", title: "File Count", type: "number", headercss: "small bold" }
|
|
|
|
{ name: "summary.count", type: "number", title: "File Count", type: "number", headercss: "small bold" }
|
|
|
|
]
|
|
|
|
]
|
|
|
|