diff options
author | Determinant <[email protected]> | 2014-12-28 00:33:01 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2014-12-28 00:33:01 +0800 |
commit | dbfcc4082aa20ec7b3661a2dbd9716e91a4a34cc (patch) | |
tree | b5a01b33d19ba3c90343ad101320f9ad328d2e11 | |
parent | e2ffca3d814f18b24497a7ed7b30d7c921e6f3c3 (diff) |
...
-rw-r--r-- | assets/js/monitor.js | 3 | ||||
-rw-r--r-- | client.py | 53 | ||||
-rw-r--r-- | index.html | 45 |
3 files changed, 28 insertions, 73 deletions
diff --git a/assets/js/monitor.js b/assets/js/monitor.js index 2d46355..7ef1df3 100644 --- a/assets/js/monitor.js +++ b/assets/js/monitor.js @@ -170,8 +170,6 @@ LineGraph.prototype.setup = function(elem, d, i, b) { "translate(" + margin.left + "," + margin.top + ")"); var width = 500 - margin.left - margin.right; var height = 250 - margin.top - margin.bottom; - console.log(width); - console.log(height); // Set the ranges this.x = d3.scale.linear().range([0, width]); this.y = d3.scale.linear().range([height, 0]); @@ -330,7 +328,6 @@ function update_jobs(resp, after) { this.handler = new graph_handler[d.metadata.type](); this.handler.setup(this, d, i, b); }); - console.log(jobs.exit()); jobs.exit() .style("height", function(d) { return d3.select(this).style("height"); }) .transition().duration(750) @@ -20,31 +20,32 @@ def check_id(val): print('invalid mid value') exit(1) -if args.create: - cmd = {'action': 'create'} - if len(args.create) >= 1: - cmd["name"] = args.create - if args.type is None: - print('please specify a type') +if __name__ == '__main__': + if args.create: + cmd = {'action': 'create'} + if len(args.create) >= 1: + cmd["name"] = args.create + if args.type is None: + print('please specify a type') + exit(1) + cmd["metadata"] = {'type' : args.type} + elif args.add: + cmd = {'action': 'add', 'jid': check_id(args.add), 'record' : args.col} + elif args.clear: + cmd = {'action': 'clear', 'jid': check_id(args.clear)} + elif args.drop: + cmd = {'action': 'drop', 'jid': check_id(args.drop)} + elif args.alter: + cmd = {'action': 'alter', 'jid': check_id(args.alter), + 'records' : [l[:-1].split() for l in stdin.readlines()]} + else: + print('please specify an action') exit(1) - cmd["metadata"] = {'type' : args.type} -elif args.add: - cmd = {'action': 'add', 'jid': check_id(args.add), 'record' : args.col} -elif args.clear: - cmd = {'action': 'clear', 'jid': check_id(args.clear)} -elif args.drop: - cmd = {'action': 'drop', 'jid': check_id(args.drop)} -elif args.alter: - cmd = {'action': 'alter', 'jid': check_id(args.alter), - 'records' : [l[:-1].split() for l in stdin.readlines()]} -else: - print('please specify an action') - exit(1) -s = socket(AF_UNIX) -s.connect("./lab_monitor.socket") -mesg = json.dumps(cmd) -mesg = pack("<i", len(mesg)) + mesg -s.send(mesg) -stdout.write(s.recv(1024)) -s.close() + s = socket(AF_UNIX) + s.connect("./lab_monitor.socket") + mesg = json.dumps(cmd) + mesg = pack("<i", len(mesg)) + mesg + s.send(mesg) + stdout.write(s.recv(1024)) + s.close() @@ -1,50 +1,8 @@ <!DOCTYPE html> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> -<!-- Bootstrap --> <link href="assets/dist/css/bootstrap.min.css" rel="stylesheet" media="screen"> -<style> /* set the CSS */ - -path { - stroke: steelblue; - stroke-width: 2; - stroke-opacity: 1; - fill: none; -} - -.axis path, -.axis line { - fill: none; - stroke: grey; - stroke-width: 1; - shape-rendering: crispEdges; -} - -.job_graph { - /* - border: solid 2px; - border-color: rgba(231, 228, 157, 0.15); - background: none repeat scroll 0% 0% rgba(231, 228, 157, 0.25); - */ - overflow: hidden; -} - -.listgraph { - /* - margin-left: 20px; - margin-right: 20px; - margin-top: 10px; - margin-bottom: 10px; - */ - margin-bottom: 0px; -} - -.panel { - margin-left: auto; - margin-right: auto; -} - -</style> +<link href="assets/css/monitor.css" rel="stylesheet" media="screen"> <script src="assets/js/d3.min.js"></script> <script src="assets/js/jquery-1.11.1.min.js"></script> <script src="assets/js/monitor.js"></script> @@ -69,7 +27,6 @@ path { <a href="#">About</a> </li> <li> - <li> <a href="#">Contact</a> </li> </ul> |