ref to index and dates to builds added
diff --git a/web_app/__init__.py b/web_app/__init__.py
index 93586da..19e0ce1 100644
--- a/web_app/__init__.py
+++ b/web_app/__init__.py
@@ -1,3 +1,4 @@
+import stat
from urlparse import urlparse
from flask import Flask, render_template, url_for, request, g
from flask_bootstrap import Bootstrap
@@ -50,20 +51,30 @@
test = json.loads(raw)
else:
test = []
+ import time
+ creation_time = os.path.getmtime(TEST_PATH + "/" + test_name)
+
+ for t in test:
+ t['date'] = time.ctime(creation_time)
return test
-@app.route("/", methods=['GET', 'POST'])
-def index():
+def builds_list():
data = []
for build in collect_builds():
d = {}
d["name"] = build['type']
d["url"] = url_for("render_test", test_name=build['type'])
+ d["date"] = build['date']
data.append(d)
+ return data
+
+@app.route("/", methods=['GET', 'POST'])
+def index():
+ data = builds_list()
return render_template("index.html", tests=data)
@@ -72,6 +83,7 @@
m.build = build.pop("build_id")
m.build_type = build.pop("type")
m.md5 = build.pop("iso_md5")
+ m.date = build.pop("date")
m.results = {k: v for k, v in build.items()}
return m
@@ -91,12 +103,16 @@
for disk in node['disks']:
d['total_disk'] += disk['size']
+ to_gb = lambda x: x / (1024 ** 3)
+ d['total_memory'] = format(to_gb(d['total_memory']), ',d')
+ d['total_disk'] = format(to_gb(d['total_disk']), ',d')
return d
+
@app.route("/tests/<test_name>", methods=['GET'])
def render_test(test_name):
- tests = [] #load_test(test_name)
- header_keys = ['build_id', 'iso_md5', 'type']
+ tests = []
+ header_keys = ['build_id', 'iso_md5', 'type', 'date']
table = [[]]
builds_to_compare = ['GA', 'master', test_name]
builds = collect_builds()
@@ -132,7 +148,8 @@
table.append(row)
- return render_template("test.html", urls=urls, table_url=url_for('render_table', test_name=test_name), lab_meta=lab_meta)
+ return render_template("test.html", urls=urls, table_url=url_for('render_table', test_name=test_name),
+ index_url=url_for('index'), lab_meta=lab_meta)
def collect_lab_data(meta):
@@ -180,7 +197,7 @@
def render_table(test_name):
builds = collect_builds()
builds = filter(lambda x: x["type"] in ['GA', 'master', test_name], builds)
- header_keys = ['build_id', 'iso_md5', 'type']
+ header_keys = ['build_id', 'iso_md5', 'type' ,'date']
table = [[]]
meta = {"__meta__": "http://172.16.52.112:8000/api/nodes"}
data = collect_lab_data(meta)
diff --git a/web_app/templates/index.html b/web_app/templates/index.html
index ba32405..3b37939 100644
--- a/web_app/templates/index.html
+++ b/web_app/templates/index.html
@@ -10,15 +10,24 @@
<h1>Tests</h1>
{% block body %}
<div>
- <ol>
+ <table>
+ <th>Build name</th>
+ <th> Date </th>
{% for test in tests %}
- <li>
- <h2>
- <a href="{{ test.url }} ">{{ test.name }}</a>
- </h2>
- </li>
+ <tr>
+ <td>
+ <h2>
+ <a href="{{ test.url }} ">{{ test.name }}</a>
+ </h2>
+ </td>
+ <td>
+ <h3>
+ {{ test.date }}
+ </h3>
+ </td>
+ </tr>
{% endfor %}
- </ol>
+ </table>
</div>
{% endblock %}
</body>
diff --git a/web_app/templates/lab_main.html b/web_app/templates/lab_main.html
index a4800d7..6ae0a7f 100644
--- a/web_app/templates/lab_main.html
+++ b/web_app/templates/lab_main.html
@@ -14,23 +14,23 @@
</tr>
<tr>
<td>Ceph version</td>
- <td> 1.0</td>
+ <td> 0.80.7</td>
</tr>
<tr>
<td>Nodes count</td>
<td>{{ lab_meta.nodes_count }}</td>
</tr>
<tr>
- <td>Processors count</td>
+ <td>Cores count</td>
<td>{{ lab_meta.processor_count }}</td>
</tr>
<tr>
<td>Total memory</td>
- <td>{{ lab_meta.total_memory }}</td>
+ <td>{{ lab_meta.total_memory }} Gb</td>
</tr>
<tr>
<td>Total disk</td>
- <td>{{ lab_meta.total_disk }}</td>
+ <td>{{ lab_meta.total_disk }} Gb</td>
</tr>
</table>
</div>
\ No newline at end of file
diff --git a/web_app/templates/table.html b/web_app/templates/table.html
index 2a1f84f..c15b61c 100644
--- a/web_app/templates/table.html
+++ b/web_app/templates/table.html
@@ -13,6 +13,11 @@
{% block body %}
<h1 align="center">Lab name goes here:-)</h1>
<table class="table" width="600">
+ {% for header in headers %}
+ <th>
+ {{ header }}
+ </th>
+ {% endfor %}
{% for row in table %}
<tr>
{% for data in row %}
diff --git a/web_app/templates/test.html b/web_app/templates/test.html
index 2426cdb..d3b233f 100644
--- a/web_app/templates/test.html
+++ b/web_app/templates/test.html
@@ -46,9 +46,14 @@
{% endfor %}
</table>
</div>
- <h2 align="center">
- <a href="{{ table_url }}">Details</a>
- </h2>
+ <div>
+ <h2 align="center">
+ <a href="{{ index_url }}">Index page</a>
+ </h2>
+ <h2 align="center">
+ <a href="{{ table_url }}">Details</a>
+ </h2>
+ </div>
{% endblock %}
</body>
</html>
\ No newline at end of file