|
|
@ -365,91 +365,86 @@ monitor.folders.render = {}
|
|
|
|
monitor.folders.render.init = function (data) {
|
|
|
|
monitor.folders.render.init = function (data) {
|
|
|
|
monitor.folders.render.summary(data)
|
|
|
|
monitor.folders.render.summary(data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
monitor.folders.render.details = function (data) {
|
|
|
|
monitor.folders.show = {}
|
|
|
|
//
|
|
|
|
monitor.folders.show.plan = function () {
|
|
|
|
// We need to normalize the data at this point so as to be able to show it all in the same chart
|
|
|
|
$('#folder_summary').slideUp(function () {
|
|
|
|
// jx.math.scale
|
|
|
|
$('#folder_plan').slideDown()
|
|
|
|
//
|
|
|
|
|
|
|
|
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])
|
|
|
|
monitor.folders.show.grid = function () {
|
|
|
|
var y_max_size = jx.math.max(m[1])
|
|
|
|
$('#folder_plan').slideUp(function () {
|
|
|
|
|
|
|
|
$('#folder_summary').slideDown()
|
|
|
|
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))}
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
|
|
|
|
* This function is designed to establish a folder clean up strategy i.e :
|
|
|
|
|
|
|
|
* - We will look for anomalies given age,file size
|
|
|
|
|
|
|
|
* - We will also look for where most of the data is distributed (mode)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
monitor.folders.render.details = function (folder,data) {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// The datasets need to be sorted by x ...
|
|
|
|
// 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 x: counts, y: measure ment
|
|
|
|
//
|
|
|
|
//
|
|
|
|
var Fn = function(a,b){
|
|
|
|
var r = [data.age, data.size]
|
|
|
|
return a.x - b.x
|
|
|
|
var plans = []
|
|
|
|
|
|
|
|
for (var i in r) {
|
|
|
|
|
|
|
|
var xy = r[i]
|
|
|
|
|
|
|
|
var mode = jx.math.mode(jx.utils.vector('x', xy))
|
|
|
|
|
|
|
|
var yvalues = jx.utils.patterns.visitor(xy, function (row) {
|
|
|
|
|
|
|
|
if (row.x == mode) {
|
|
|
|
|
|
|
|
return row.y
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.age = data.age.sort(Fn)
|
|
|
|
})
|
|
|
|
data.size= data.size.sort(Fn)
|
|
|
|
var sd = jx.math.sd(yvalues)
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
// data.size = data.size.splice(0,data.age.length)
|
|
|
|
prefix = 'age'
|
|
|
|
|
|
|
|
var mean = jx.math.mean(yvalues)
|
|
|
|
var context = jx.dom.get.instance('CANVAS')
|
|
|
|
var max = (mean + (1.5 * sd))
|
|
|
|
var frame = $('#chartfolder')
|
|
|
|
if (mean > 30 && mean < 365) {
|
|
|
|
jx.dom.set.value('chartfolder', '')
|
|
|
|
divide_by = 30
|
|
|
|
context.width = $(frame).width()
|
|
|
|
units = 'MONTHS'
|
|
|
|
context.height= $(frame).height()
|
|
|
|
} else if (mean > 365) {
|
|
|
|
|
|
|
|
divide_by=365
|
|
|
|
var conf = { type: 'line',responsive:true }
|
|
|
|
units = 'YEARS'
|
|
|
|
conf.data = {}
|
|
|
|
} else {
|
|
|
|
conf.options = { legend: { position: 'bottom' } }
|
|
|
|
divide_by = 1
|
|
|
|
conf.options.scales = {}
|
|
|
|
units = 'DAYS'
|
|
|
|
conf.options.scales.yAxes = [
|
|
|
|
}
|
|
|
|
{id:'0',scaleLabel:{display:true,labelString:'% DAYS/MB'},ticks:{min:0,beginAtZero:true},gridLines: {display:false}}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
prefix = 'size'
|
|
|
|
]
|
|
|
|
var mean = jx.math.sum(yvalues)
|
|
|
|
conf.options.scales.xAxes = [{ ticks:{min:0,max:1},gridLines: {display:false}}]
|
|
|
|
var max = 0// (mean + (1.5 * sd))
|
|
|
|
conf.options.tooltips = {}
|
|
|
|
if (mean > 1000) {
|
|
|
|
conf.options.tooltips.callbacks = {}
|
|
|
|
divide_by = 1000
|
|
|
|
conf.options.tooltips.callbacks.label = function(item,rec){
|
|
|
|
units = 'GB'
|
|
|
|
|
|
|
|
|
|
|
|
// 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 {
|
|
|
|
} else {
|
|
|
|
r = data.size[item.index]
|
|
|
|
divide_by = 1
|
|
|
|
xmax = x_max_size
|
|
|
|
units = 'MB'
|
|
|
|
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 size = {yAxisID:'0',label : 'File Size (MB)',data:data.size,borderColor:COLORS[32],fill:true,borderWidth:1}
|
|
|
|
// We need to assess the outliars i.e too old, too large
|
|
|
|
// // age.data = [{ x: 10, y: 30 }, {x:20,y:60}]
|
|
|
|
//
|
|
|
|
// size.data= data.size
|
|
|
|
y = jx.utils.vector('y', xy)
|
|
|
|
age.data = data.age
|
|
|
|
var _mean = jx.math.mean(y)
|
|
|
|
x_ = jx.utils.vector('x', age.data)
|
|
|
|
var _sd = jx.math.sd(y)
|
|
|
|
z_ = jx.utils.vector('x',size.data)
|
|
|
|
var outlier = _mean < mean || max > (_mean + (1.5 * _sd))
|
|
|
|
conf.data.labels = jx.utils.unique(jx.math.sets.union(x_,z_)).sort()
|
|
|
|
|
|
|
|
conf.data.datasets = [age,size]//,age]
|
|
|
|
plans.push({ 'label': prefix, 'max': max, 'sd': sd, 'mean': mean, 'count': yvalues.length, 'outlier': outlier })
|
|
|
|
|
|
|
|
jx.dom.set.value(prefix + '_count', yvalues.length)
|
|
|
|
|
|
|
|
jx.dom.set.value(prefix + '_value', (mean/divide_by).toFixed(2))
|
|
|
|
|
|
|
|
jx.dom.set.value(prefix+'_units',units)
|
|
|
|
|
|
|
|
monitor.folders.show.plan()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jx.dom.set.value('folder_name', folder)
|
|
|
|
|
|
|
|
|
|
|
|
jx.dom.append('chartfolder',context)
|
|
|
|
|
|
|
|
var chart = new Chart(context,conf)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -482,14 +477,14 @@ monitor.folders.render.summary = function (data) {
|
|
|
|
return {y:row[0],x:row[1]}
|
|
|
|
return {y:row[0],x:row[1]}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
monitor.folders.render.details({age:age,size:size})
|
|
|
|
monitor.folders.render.details(item.label,{age:age,size:size})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// @TODO Add the units in days just in case
|
|
|
|
// @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.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" }
|
|
|
|
]
|
|
|
|
]
|
|
|
|