layout changed, jquery added, comparision fixed
diff --git a/web_app/__init__.py b/web_app/__init__.py
index 4006689..88f8fac 100644
--- a/web_app/__init__.py
+++ b/web_app/__init__.py
@@ -14,6 +14,13 @@
Bootstrap(app)
+def get_resource_as_string(name, charset='utf-8'):
+ with app.open_resource(name) as f:
+ return f.read().decode(charset)
+
+app.jinja_env.globals['get_resource_as_string'] = get_resource_as_string
+
+
def load_test(test_name):
test_name += '.json'
@@ -155,7 +162,12 @@
tests = []
header_keys = ['build_id', 'iso_md5', 'type', 'date']
table = [[]]
- builds_to_compare = ['GA', 'master', test_name]
+
+ if test_name == 'GA':
+ builds_to_compare = ['GA']
+ else:
+ builds_to_compare = ['GA', 'master', test_name]
+
builds = collect_builds()
results = {}
meta = {"__meta__": "http://172.16.52.112:8000/api/nodes"}
@@ -196,7 +208,13 @@
@app.route("/tests/table/<test_name>/")
def render_table(test_name):
builds = collect_builds()
- builds = filter(lambda x: x["type"] in ['GA', 'master', test_name], builds)
+
+ if test_name == 'GA':
+ b = ['GA']
+ else:
+ b = ['GA', 'master', test_name]
+
+ builds = filter(lambda x: x["type"] in b, builds)
header_keys = ['build_id', 'iso_md5', 'type' ,'date']
table = [[]]
meta = {"__meta__": "http://172.16.52.112:8000/api/nodes"}
@@ -224,7 +242,7 @@
back_url=url_for('render_test', test_name=test_name), lab=data)
-@app.route("/tests/<test_name>", methods=['POST'])
+@app.route("/api/tests/<test_name>", methods=['POST'])
def add_test(test_name):
tests = json.loads(request.data)
@@ -238,6 +256,21 @@
return "Created", 201
+@app.route("/api/tests", methods=['GET'])
+def get_all_tests():
+ return json.dumps(collect_builds())
+
+
+@app.route("/api/tests/<test_name>", methods=['GET'])
+def get_test(test_name):
+ builds = collect_builds()
+
+ for build in builds:
+ if build["type"] == test_name:
+ return json.dumps(build)
+ return "Not Found", 404
+
+
if __name__ == "__main__":
logger = getLogger("logger")
app.logger.setLevel(INFO)
diff --git a/web_app/static/script.js b/web_app/static/script.js
new file mode 100644
index 0000000..a0cbbea
--- /dev/null
+++ b/web_app/static/script.js
@@ -0,0 +1,7 @@
+$(document).ready(function(){
+
+$("#toggler").click(function(){
+ $(this).toggleClass('active, inactive');
+})
+
+})
\ No newline at end of file
diff --git a/web_app/static/style.css b/web_app/static/style.css
new file mode 100644
index 0000000..06a94d8
--- /dev/null
+++ b/web_app/static/style.css
@@ -0,0 +1,5 @@
+.active i.icon-folder-open{ display:inline-block; }
+.active i.icon-folder-close { display:none;}
+
+.inactive i.icon-folder-close{ display:inline-block; }
+.inactive i.icon-folder-open { display:none;}
\ No newline at end of file
diff --git a/web_app/templates/base.html b/web_app/templates/base.html
index 2067d55..8612238 100644
--- a/web_app/templates/base.html
+++ b/web_app/templates/base.html
@@ -2,9 +2,13 @@
<html>
<head>
{% block head %}
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"/>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css"/>
+ <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
+ <script type="text/javascript" src="{{ url_for('static', filename='script.js')}}"></script>
+ <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">
+ <style type=text/css>{{ get_resource_as_string('static/style.css') }}</style>
{% endblock %}
</head>
<body>
diff --git a/web_app/templates/index.html b/web_app/templates/index.html
index 3b37939..1ac9b26 100644
--- a/web_app/templates/index.html
+++ b/web_app/templates/index.html
@@ -7,23 +7,19 @@
{% endblock %}
</head>
<body>
- <h1>Tests</h1>
{% block body %}
<div>
- <table>
+ <h1 align="center">Tests report : </h1>
+ <table align="center" class="table table-striped">
<th>Build name</th>
<th> Date </th>
{% for test in tests %}
<tr>
<td>
- <h2>
- <a href="{{ test.url }} ">{{ test.name }}</a>
- </h2>
+ <a href="{{ test.url }} ">{{ test.name }}</a>
</td>
<td>
- <h3>
- {{ test.date }}
- </h3>
+ {{ test.date }}
</td>
</tr>
{% endfor %}
diff --git a/web_app/templates/lab_header.html b/web_app/templates/lab_header.html
index 203adf2..f40d6f4 100644
--- a/web_app/templates/lab_header.html
+++ b/web_app/templates/lab_header.html
@@ -5,34 +5,49 @@
{% for node in lab.nodes %}
{% for p in node.processors %}
- <div>
- Processor model : {{ p.model }}
- Processor frequency : {{ p.frequency }}
- </div>
+ <ul>
+ <li>
+ Processor model : {{ p.model }}
+ Processor frequency : {{ p.frequency }}
+ </li>
+ </ul>
{% endfor %}
{% for i in node.interfaces %}
- <div>
- name : {{ i.name }}
- MAC frequency : {{ i.mac }}
- max speed : {{ i.max_speed }}
- current speed : {{ i.current_speed }}
- state : {{ i.state }}
- </div>
+ <ul>
+ <li>
+ <div>
+
+ name : {{ i.name }}
+ MAC frequency : {{ i.mac }}
+ max speed : {{ i.max_speed }}
+ current speed : {{ i.current_speed }}
+ state : {{ i.state }}
+ </div>
+ </li>
+ </ul>
{% endfor %}
{% for disk in node.disks %}
- <div>
- Disk name : {{ disk.name }}
- Size: {{ disk.size }}
- </div>
+ <ul>
+ <li>
+ <div>
+ Disk name : {{ disk.name }}
+ Size: {{ disk.size }}
+ </div>
+ </li>
+ </ul>
{% endfor %}
- <div>
- Memory total : node.memory.total
- Memory : node.memory.maximum_capacity
- </div>
-
+ <ul>
+ <li>
+ <div>
+ Memory total : node.memory.total
+ Memory : node.memory.maximum_capacity
+ </div>
+ </li>
+ </ul>
+</ul>
{% endfor %}
</div>
\ No newline at end of file
diff --git a/web_app/templates/table.html b/web_app/templates/table.html
index ae9a2be..76ef6de 100644
--- a/web_app/templates/table.html
+++ b/web_app/templates/table.html
@@ -12,7 +12,7 @@
</div>
{% block body %}
<h1 align="center">Perf-1-Env</h1>
- <table class="table" width="600">
+ <table class="table table-bordered" width="600">
{% for header in headers %}
<th>
{{ header }}
diff --git a/web_app/templates/test.html b/web_app/templates/test.html
index d3b233f..aba2f60 100644
--- a/web_app/templates/test.html
+++ b/web_app/templates/test.html
@@ -13,7 +13,7 @@
<br>
<div class="table-responsive">
<div id="images">
- <table align="center" cellspacing="20">
+ <table align="center" class="table table-bordered">
{% for url in urls %}
{% if loop.index is divisibleby 2 %}
<tr>