diff --git a/src/api/static/js/dashboard.js b/src/api/static/js/dashboard.js index 38980d5..eaa75d6 100644 --- a/src/api/static/js/dashboard.js +++ b/src/api/static/js/dashboard.js @@ -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) ; diff --git a/src/monitor.py b/src/monitor.py index 6f441f2..e7b6881 100755 --- a/src/monitor.py +++ b/src/monitor.py @@ -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