summaryrefslogtreecommitdiff
path: root/tsp/scripts
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-10-13 13:00:36 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-01-10 09:48:48 (GMT)
commit8aa01967a4ed3dd567f0ab4ab1ca290e3d04a302 (patch)
tree8eb73c8136c3c9ac72d39b234091c746ab6e71dc /tsp/scripts
parentc824c6c4e595195706d7a4aaf8bbee545ebc13ce (diff)
downloadmajor-8aa01967a4ed3dd567f0ab4ab1ca290e3d04a302.zip
major-8aa01967a4ed3dd567f0ab4ab1ca290e3d04a302.tar.gz
major-8aa01967a4ed3dd567f0ab4ab1ca290e3d04a302.tar.bz2
Alternate row colors in html resultsrefs/changes/92/95292/6
Change-Id: Ia95bc0578628bbd2da4eaee3c07b201983f326b4 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp/scripts')
-rwxr-xr-xtsp/scripts/publish.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tsp/scripts/publish.py b/tsp/scripts/publish.py
index 0577c6a..62f3232 100755
--- a/tsp/scripts/publish.py
+++ b/tsp/scripts/publish.py
@@ -31,19 +31,21 @@ USAGE = "%prog <db>"
AGENT = "%s/%s" % (__name__, __version__)
+COLORS = ["#fff", "#ddd"]
+
def print_head(row):
template = jinja2.Template('<tr>\n\
{% for item in row %}<th>{{ item }}</th>\n{% endfor %}\
</tr>\n')
print template.render(row=row)
-def print_row(row):
+def print_row(row, color):
sr=row[0]
date=row[1]
build_nr=row[2]
target=row[3]
status=row[4]
- template = jinja2.Template('<tr>\n\
+ template = jinja2.Template('<tr bgcolor=\'{{ color }}\'>\n\
<td> <a href=\"../dwn/{{ build_nr }}\">{{ sr }}</a> </td>\n\
{% for item in row %}\
<td> {{ item }} </td>\n\
@@ -60,15 +62,23 @@ def print_row(row):
</td>\n\
</tr>\n')
print template.render(build_nr=build_nr, sr=sr, row=[date, build_nr, target],\
- status=status, target=target)
+ status=status, target=target, color=color)
def print_view(dbpath):
+ def next_color(col):
+ return COLORS[(COLORS.index(col) + 1) % len(COLORS)]
conn = sqlite3.connect(dbpath)
column_names = ["SR", "Date", "\"Build nr\"", "Device", "Status"]
print_head(column_names)
testresults = conn.execute("SELECT " + ', '.join(column_names) + " FROM currentstatus;")
+ col = COLORS[0]
+ prev_sr = ''
for row in testresults:
- print_row(row)
+ sr=row[0]
+ if not sr == prev_sr:
+ prev_sr = sr
+ col = next_color(col)
+ print_row(row, col)
conn.close()
def parse_arguments():