Date: Fri, 29 Apr 2016 21:54:32 GMT From: kczekirda@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r301944 - in soc2015/kczekirda/www: . tpl Message-ID: <201604292154.u3TLsWbQ038318@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kczekirda Date: Fri Apr 29 21:54:32 2016 New Revision: 301944 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=301944 Log: show revision log Added: soc2015/kczekirda/www/tpl/pre.tpl soc2015/kczekirda/www/tpl/view_revision.tpl Modified: soc2015/kczekirda/www/menu.py soc2015/kczekirda/www/tpl/main.tpl Modified: soc2015/kczekirda/www/menu.py ============================================================================== --- soc2015/kczekirda/www/menu.py Fri Apr 29 21:30:40 2016 (r301943) +++ soc2015/kczekirda/www/menu.py Fri Apr 29 21:54:32 2016 (r301944) @@ -3,7 +3,6 @@ import sqlite3, os from bottle import route, run, redirect, template, static_file, request - database = 'cluster.sqlite' main_tpl = 'tpl/main.tpl' add_node_tpl = 'tpl/add_node.tpl' @@ -11,6 +10,8 @@ edit_node_tpl = 'tpl/edit_node.tpl' delete_node_tpl = 'tpl/delete_node.tpl' delete_task_tpl = 'tpl/delete_task.tpl' +view_revision_tpl = 'tpl/view_revision.tpl' +pre_tpl = 'tpl/pre.tpl' default = 'menu.ipxe' @route('/static/:path#.+#', name='static') @@ -53,6 +54,7 @@ c = conn.cursor() c.execute("SELECT host, mac, ip FROM nodes WHERE id=?",(id,)) current_data = c.fetchone() + c.close return template(delete_node_tpl,id=id,host=current_data[0],mac=current_data[1],ip=current_data[2]) @route('/admin/edit_node/:id', method='GET') @@ -72,6 +74,7 @@ c = conn.cursor() c.execute("SELECT host,mac,ip,boot FROM nodes WHERE id LIKE ?",(str(id))) current_data = c.fetchone() + c.close return template(edit_node_tpl,old=current_data,id=id) @route('/admin/change_boot/:host/:new', method='GET') @@ -125,6 +128,7 @@ c = conn.cursor() c.execute("SELECT revision, host, status FROM tasks WHERE id=?",(id,)) current_data = c.fetchone() + c.close return template(delete_task_tpl,id=id,revision=current_data[0],host=current_data[1],status=current_data[2]) @route('/admin/change_task_status/:revision/:new_status', method='GET') @@ -159,6 +163,7 @@ conn.commit() create_env = '/cluster/new_task.sh '+revision+' '+host+' &' os.system(create_env) + c.close return redirect('/static/wait.ipxe') @route('/menu/:mac', method='GET') @@ -170,4 +175,21 @@ c.close return redirect('/static/%s' %result[0]) +@route('/log/rev/:revision/:lines', method='GET') +def log(revision,lines): + path = '/cluster/log/%s/log' %revision + with open(path, "r") as f: + content = "".join(f.readlines()[-int(lines):]) + return template(pre_tpl,content=content) + + +@route('/admin/view_revision/:id', method='GET') +def static(id): + conn = sqlite3.connect(database) + c = conn.cursor() + c.execute("SELECT revision FROM tasks WHERE id=?",(id,)) + current_data = c.fetchone() + c.close + return template(view_revision_tpl,revision=current_data[0]) + run(host='0.0.0.0', port=8080, debug=True) Modified: soc2015/kczekirda/www/tpl/main.tpl ============================================================================== --- soc2015/kczekirda/www/tpl/main.tpl Fri Apr 29 21:30:40 2016 (r301943) +++ soc2015/kczekirda/www/tpl/main.tpl Fri Apr 29 21:54:32 2016 (r301944) @@ -46,8 +46,8 @@ <td>{{ip}}</td> <td>{{boot}}</td> <td>{{status}}</td> - <td><a class="btn btn-sm btn-warning" href="/admin/edit_node/{{id}}">Editt</a></td> - <td><a class="btn btn-sm btn-danger" href="/admin/delete_node/{{id}}">Delete</a></td> + <td><a class="btn btn-sm btn-warning" href="/admin/edit_node/{{id}}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit</a></td> + <td><a class="btn btn-sm btn-danger" href="/admin/delete_node/{{id}}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</a></td> </tr> %end </table> @@ -58,18 +58,25 @@ <div class="page-header"> <table class="table table-condensed"> <tr><h2>Tasks</h2></tr> - <tr><th>ID</th><th>revision</th><th>host</th><th>status</th> <th> </th></tr> + <tr><th>ID</th><th>revision</th><th>host</th><th>status</th> <th> </th> <th> </th> </tr> %for row in reversed(rows_tasks): %id = row[0] %revision = row[1] %host = row[2] %status = row[3] + <tr {{!'class="danger"' if 'failed' in row[3] else ""}} {{!'class="success"' if 'finish' in row[3] else ""}} {{!'class="info"' if 'build' in row[3] else ""}}> <td>{{id}}</td> <td>{{revision}}</td> <td>{{host}}</td> <td>{{status}} <span {{!'class="glyphicon glyphicon-remove' if 'failed' in row[3] else ""}} {{!'class="glyphicon glyphicon-refresh' if 'build' in row[3] else ""}} {{!'class="glyphicon glyphicon-ok' if 'finish' in row[3] else ""}}" aria-hidden="true"></span></td> - <td><a class="btn btn-sm btn-danger" href="/admin/delete_task/{{id}}">Delete</a></td> + + <td> + %if 'new' not in row[3]: + <a class="btn btn-sm btn-info" href="/admin/view_revision/{{id}}"><span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span> Show</a> + %end + </td> + <td><a class="btn btn-sm btn-danger" href="/admin/delete_task/{{id}}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</a></td> </tr> %end </table> Added: soc2015/kczekirda/www/tpl/pre.tpl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/kczekirda/www/tpl/pre.tpl Fri Apr 29 21:54:32 2016 (r301944) @@ -0,0 +1,2 @@ +<pre>{{content}}</pre> + Added: soc2015/kczekirda/www/tpl/view_revision.tpl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/kczekirda/www/tpl/view_revision.tpl Fri Apr 29 21:54:32 2016 (r301944) @@ -0,0 +1,35 @@ +<html> +<head> +<link rel="stylesheet" type="text/css" href="../../../static/bootstrap/css/bootstrap.css"> +</head> +<title>Testing cluster management</title> +<body role="document"> + +<nav class="navbar navbar-inverse navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="#">FreeBSD Testing Cluster</a> + </div> + </div> +</nav> + +<div class="container theme-showcase" role="main"> + + <div class="page-header"> + </div> + + <div class="page-header"> + + <iframe src="/log/rev/{{revision}}/50" width="1000" height="800"></iframe> + + </div> +</div> + +</body> +</html>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604292154.u3TLsWbQ038318>