Kaynağa Gözat

ui for forlder monitoring

Steve L. Nyemba 8 yıl önce
ebeveyn
işleme
b3f3d38ef9

+ 3 - 1
src/api/static/js/dashboard.js

@@ -423,6 +423,8 @@ monitor.folders.render.summary = function (data) {
 	}
 	options.rowClick = function(args){
 		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) {
 			return {y:row[0],x:row[1]}
 		})
@@ -436,7 +438,7 @@ monitor.folders.render.summary = function (data) {
 	options.autoload  = true
 	options.fields = [
 		{ name: 'label', type: 'text', title: "Folder Name", headercss: "small bold", css: "small"},
-		{ name: "summary.age", type: "number", title: "Oldest File (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.count", type: "number", title: "File Count", type: "number", headercss: "small bold" }
 	]

+ 1 - 1
src/api/templates/dashboard.html

@@ -19,7 +19,7 @@
 <title>iMonitor</title>
 <script>
 	$(document).ready(function(){
-		// monitor.processes.fetch()
+		monitor.processes.fetch()
 		monitor.folders.init()
 	})
 </script>

+ 3 - 2
src/monitor.py

@@ -284,8 +284,9 @@ class FileWatch(Analysis):
 		for folder in self.folders:
 			if os.path.exists(folder):
 				xo_raw = self.evaluate(folder)
-				xo = np.array(ML.Extract(['size','age'],xo_raw))				
-				xo = {"label":folder,"details":xo_raw,"summary":{"size":round(np.sum(xo[:,0]),2),"age":np.max(xo[:,1]),"count":len(xo[:,1])}}
+				xo = np.array(ML.Extract(['size','age'],xo_raw))
+				
+				xo = {"label":folder,"details":xo_raw,"summary":{"size":round(np.mean(xo[:,0]),2),"age":round(np.mean(xo[:,1]),2),"count":len(xo[:,1])}}
 				xo['day'] = now.day
 				xo['month'] = now.month
 				xo['year'] = now.year

+ 6 - 1
src/utils/ml.py

@@ -47,12 +47,17 @@ class ML:
 	def CleanupName(value) :
 		return value.replace('$','').replace('.+','')
 	@staticmethod
-	def distribution(xo,lock) :
+	def distribution(xo,lock,scale=False) :
 		lock.acquire()
 		d = []
 		m = {}
+		if scale :
+			xu = np.mean(xo)
+			sd = np.sqrt(np.var(xo))
 		for xi in xo :
 			value = round(xi,2)
+			if scale :
+				value = round((value - xu)/sd,2)
 			id = str(value)
 			if id in m :
 				index = m[id]