bug fix with units and UI

master
Steve L. Nyemba 8 years ago
parent 1e531c07b5
commit 9f24f177db

@ -496,7 +496,7 @@ monitor.folders.render.summary = function (data) {
{ name: 'id', type: 'text', title: "Context", headercss: "small bold", css: "small"},
{ name: 'name', type: 'text', title: "Folder Name", headercss: "small bold", css: "small"},
{ name: "summary.size", type: "number", title: "Size (MB)", type: "number", headercss: "small bold" },
{ name: "summary.size", type: "number", title: "Folder Size", type: "number", headercss: "small bold" },
{ name: "summary.count", type: "number", title: "File Count", type: "number", headercss: "small bold" }
]
var grid = $('#gridfolders').jsGrid(options) ;

@ -287,7 +287,29 @@ class FileWatch(Analysis):
xo = np.array(ML.Extract(['size','age'],xo_raw))
name = re.findall("([a-z,A-Z,0-9]+$)",folder)
name = name[0]
xo = {"label":folder,"details":xo_raw,"summary":{"size":round(np.sum(xo[:,0]),2),"age":round(np.mean(xo[:,1]),2),"count":len(xo[:,1])}}
size = round(np.sum(xo[:,0]),2)
if size > 1000 :
size = round(size/1000,2)
units = ' GB'
elif size > 1000000:
size = round(size/1000000,2)
units = ' TB'
else:
size = size
units = ' MB'
size = str(size)+ units
age = round(np.mean(xo[:,1]),2)
if age > 30 and age <= 365 :
age = round(age/30,2)
units = ' Months'
elif age > 365 :
age = round(age/365,2)
units = ' Years'
else:
age = age
units = ' Days'
age = str(age)+units
xo = {"label":folder,"details":xo_raw,"summary":{"size":size,"age":age,"count":len(xo[:,1])}}
xo["name"] = name
xo['day'] = now.day
xo['month'] = now.month

Loading…
Cancel
Save