Publish database content in WWW_PUBLISH file 35/81335/8
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Fri, 22 Jul 2016 10:02:57 +0000 (12:02 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 8 Nov 2016 15:08:38 +0000 (16:08 +0100)
Change-Id: Ic8f05d856b5001eb4ffe83f76c9f6a30ae79da11
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tsp/common.sh
tsp/html_head [new file with mode: 0644]
tsp/html_tail [new file with mode: 0644]
tsp/jobs/publish.sh

index 82ea38b..7e07d08 100755 (executable)
@@ -38,6 +38,7 @@ WS_PUBLISH="${WS}/publish"
 
 DBNAME="results.db3"
 DBPATH="${WS_PUBLISH}/${DBNAME}"
+WWW_PUBLISH="${WS_PUBLISH}/current_status.html"
 
 TMP_POLL="/tmp/tl-master-poll"
 TMP_MASTER="/tmp/tl-master"
diff --git a/tsp/html_head b/tsp/html_head
new file mode 100644 (file)
index 0000000..e5b8458
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+table, th, td {
+    border: 1px solid black;
+    border-collapse: collapse;
+}
+th, td {
+    padding: 5px;
+}
+th {
+    text-align: left;
+}
+</style>
+</head>
+<body>
+<table>
diff --git a/tsp/html_tail b/tsp/html_tail
new file mode 100644 (file)
index 0000000..81d8c88
--- /dev/null
@@ -0,0 +1,3 @@
+</table>
+</body>
+</html>
index 88ea53d..018399a 100755 (executable)
@@ -143,6 +143,11 @@ sqlite3 "${DBPATH}" "insert into test values (NULL,'$SR', CURRENT_TIMESTAMP,\
     (select r.rid from result r where r.rname='$TAG'),\
     (select d.did from device d where d.dname='$TARGET'));"
 
+# Publish to www
+cat "${TSP_DIR}/html_head" > "${WWW_PUBLISH}"
+sqlite3 -html -header "${DBPATH}" "SELECT * FROM currentstatus;" >> "${WWW_PUBLISH}"
+cat "${TSP_DIR}/html_tail" >> "${WWW_PUBLISH}"
+
 # Clean up workspace
 ssh tl-pwb "rm -rf \"${WORKSPACE}\"; mkdir -p \"${WORKSPACE}\"" || echo "rm failed"