فهرست منبع

UI changes and hiding sandbox in case no configuration is found

Steve L. Nyemba 8 سال پیش
والد
کامیت
315f5ae32d
3فایلهای تغییر یافته به همراه46 افزوده شده و 10 حذف شده
  1. 5 6
      src/api/index.py
  2. 30 2
      src/api/static/js/dashboard.js
  3. 11 2
      src/api/templates/dashboard.html

+ 5 - 6
src/api/index.py

@@ -83,11 +83,6 @@ def procs(id):
 							# @TODO:
 							# Compile a report here that will be sent to the mailing list
 							# 
-						if row['status'] == 'crash' :
-							print row['label'],' *** ',row['status']
-				#for row in r[label] :
-					#yo = ML.Extract(['status'],row)
-					#xo = ML.Extract(['cpu_usage','memory_usage'],row)
 					
 	except Exception, e:
 		print e
@@ -156,7 +151,11 @@ def requirements():
 @app.route('/dashboard')
 def dashboard():
 	context = PARAMS['context']
-	return render_template('dashboard.html',context=context)
+	if 'title' in PARAMS :
+		title = PARAMS['title']
+	else:
+		title = 'Zulu Watch Tower'
+	return render_template('dashboard.html',context=context,title=title)
 
 """
 	This function is designed to trigger learning for anomaly detection

+ 30 - 2
src/api/static/js/dashboard.js

@@ -286,8 +286,11 @@ monitor.sandbox.init = function () {
 		
 		var r = JSON.parse(x.responseText)
 		
-		if (r.length > 0){
+		if (r.length > 0) {
+			jx.dom.show('sandbox')
 			monitor.sandbox.render(r);
+		} else {
+			jx.dom.hide('sandbox')
 		}
 	})
 }
@@ -367,8 +370,33 @@ monitor.folders.init = function () {
 		monitor.folders.render.init(data)
 	})
 }
+monitor.folders.search = {}
+monitor.folders.search.reset = function () {
+	jx.dom.set.value('folder_search', '')
+	var data = jx.dom.get.attribute('folder_search', 'data')
+	monitor.folders.render.summary(data)
+	
+}
+monitor.folders.search.init = function(){
+	var term = jx.dom.get.value('folder_search')
+	var data = jx.dom.get.attribute('folder_search', 'data')
+	
+	term = term.replace(/\x32/g,'')
+	if (term.length == 0) {
+		monitor.folders.render.summary(data)
+	} else if (term.length > 3) {
+		
+		data = jx.utils.patterns.visitor(data, function (row) {
+			if (row.id.match(term)) {
+				return row
+			}
+		})
+		monitor.folders.render.summary(data)
+	}
+}
 monitor.folders.render = {}
 monitor.folders.render.init = function (data) {
+	jx.dom.set.attribute('folder_search','data',data)
 	monitor.folders.render.summary(data)
 }
 monitor.folders.show = {}
@@ -493,7 +521,7 @@ monitor.folders.render.summary = function (data) {
 	// @TODO Add the units in days just in case
 	options.autoload  = true
 	options.fields = [
-		{ 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: "Folder Size", type: "number", headercss: "small bold" },

+ 11 - 2
src/api/templates/dashboard.html

@@ -25,6 +25,10 @@
 	})
 </script>
 <body>
+	<div class="border-bottom caption" style="height:42px">
+		<div class="">{{title}}</div>
+		<div class="small" style="margin:4px">The Phi Technology LLC</div>
+	</div>
 	<div class="left small border-right" style="width:12%; height:60%">
 		<div id="menu" class="menu"></div>
 	</div>
@@ -67,7 +71,7 @@
 		<div style="height:270px; margin-top:10px">
 			<div id="trends_chart" class="small grid" style="height:250px"></div>
 		</div>
-		<div class="border-top" style="padding:4px;">
+		<div id="sandbox" class="border-top" style="padding:4px;">
 			<div style="height:48px">
 			<b>Python Virtual Environment Analysis</b>
 			<div id="inspect_sandbox" class="right button border" style="display:none" onclick="monitor.sandbox.init()">Inspect</div>
@@ -82,9 +86,14 @@
 			<div style="margin-top:10px">
 				<div id="folder_summary">
 					<div class="">
+						
 						<div class="bold">Smart Folder Analysis/Monitoring</div>
 						<div class="small">Powered By Machine Learning</div>
-
+					</div>
+					<div class=" border" style="margin-top:4px; padding:2px; height:34px">
+						<i class="fa fa-search left" style="margin:4px; padding:4px; position:absolute; color:gray"></i> 
+						<input id="folder_search" type="text" class="small left" placeholder="hostname" style="width:92%; padding-left:22px" onkeyup="monitor.folders.search.init()"/>
+						<i class="fa fa-trash right action" style="margin:4px; padding:4px; color:maroon" onclick="monitor.folders.search.reset()"></i>
 					</div>
 					<div style="margin-top:10px; height:150px">
 						<div id="gridfolders"></div>