Просмотр исходного кода

fix around sandbox analysis, increase delay UI work for predictions @TODO: predictions

Steve L. Nyemba 8 лет назад
Родитель
Сommit
1fa603ae3c
3 измененных файлов с 14 добавлено и 13 удалено
  1. 3 0
      src/api/static/js/dashboard.js
  2. 7 10
      src/api/templates/dashboard.html
  3. 4 3
      src/monitor.py

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

@@ -36,6 +36,7 @@ monitor.processes.init = function(x){
 	// This is designed not to let the user wander or wonder what is going on
 	//
 	jx.dom.get.children('menu')[0].click()
+	setTimeout(monitor.sandbox.init,3000)
 }
 monitor.processes.render = function(label,data) {
 
@@ -263,6 +264,7 @@ monitor.processes.summary.init = function(logs){
 
 monitor.sandbox = {}
 monitor.sandbox.init = function () {
+	jx.dom.hide('inspect_sandbox')
 	var httpclient = HttpClient.instance()
 	httpclient.get('/sandbox', function (x) {
 		var r = JSON.parse(x.responseText)
@@ -300,5 +302,6 @@ monitor.sandbox.render = function (logs) {
 		
 	]
 	var grid = $('#sandbox_status').jsGrid(options)
+	jx.dom.show('inspect_sandbox')
 	
 }

+ 7 - 10
src/api/templates/dashboard.html

@@ -22,21 +22,18 @@
 	})
 </script>
 <body>
-	<div class="caption border-bottom">
-		<div class="left">Monitoring</div>
-		<div class="right">Trends</div>
-	</div>
 	<div class="left small" style="width:15%">
-		<div><input id="find_scope" type="text" placeholder="Find Context"></div>
+		
 		<div id="menu" class="menu"></div>
 	</div>
 		
 	<div class="left info ">
 		
-		<div class="" style="text-transform:capitalize; height:28px">Monitoring <span id="latest_processes_label" class="bold"></span>
-			<div class="right menu">
-				<div class="right menu-item"><i class="fa fa-refresh"></i></div>
+		<div class="" style="text-transform:capitalize; ">
+			<div class="left">Monitoring 
+			<span id="latest_processes_label" class="bold"></span>
 			</div>
+			<div class="right button border" style="margin-right:15px">Predict</div>		
 		</div>
 		
 		<div class = "border-right" style="padding:2px; margin:4px; height:170px">	
@@ -74,8 +71,8 @@
 		<div class="border-top" style="padding:4px;">
 			<div style="height:48px">
 			<b>Python Virtual Environment Analysis</b>
-			<div class="right button border" onclick="monitor.sandbox.init()">Inspect</div>
-				<div class="small">Last fetch <span id="sandbox_date"></span></div>
+			<div id="inspect_sandbox" class="right button border" style="display:none" onclick="monitor.sandbox.init()">Inspect</div>
+				<div class="small">Last Lookup <span id="sandbox_date"></span></div>
 			</div>
 			<div class="">
 				<div id="sandbox_status" class="grid">

+ 4 - 3
src/monitor.py

@@ -65,7 +65,8 @@ class Env(Analysis):
 		r = [ self.evaluate(id) for id in self.values] ;		
 		N = len(r)
 		n = sum(r)
-		value = n/N
+		value = 100 * round(n/N,2)
+		print '*** ',value
 		missing = [self.values[i] for i in range(0,N) if r[i] == 0]
 		return dict(self.getNow(),**{"value":value,"missing":missing})
 
@@ -100,7 +101,7 @@ class Sandbox(Analysis):
 		sandbox_modules	= self.get_sandbox_requirements()
 		N = len(required_modules)
 		n = len(Set(required_modules) - Set(sandbox_modules))
-		value = 1 - (n/N)
+		value = round(1 - (n/N),2)*100
 		missing = list(Set(required_modules) - Set(sandbox_modules))
 		
 		return dict(self.getNow(),**{"value":value,"missing":missing})
@@ -231,7 +232,7 @@ class Monitor (Thread):
 			
 			
 			self.prune()
-			HALF_HOUR = 60*5
+			HALF_HOUR = 60*25
 			time.sleep(HALF_HOUR)
 		print "Stopped ..."
 	def prune(self) :