summaryrefslogtreecommitdiff
path: root/tsp/www
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2017-06-20 11:38:13 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-08-08 08:18:56 (GMT)
commit9185d61f090e40f54530f9723d970910ede087a3 (patch)
tree03f165ded21b1f2fc5821f1173f13f5ee5c738a8 /tsp/www
parent0b7d00ac86411aa7c8f8a5e6c5fd7ec78ca61740 (diff)
downloadmajor-9185d61f090e40f54530f9723d970910ede087a3.zip
major-9185d61f090e40f54530f9723d970910ede087a3.tar.gz
major-9185d61f090e40f54530f9723d970910ede087a3.tar.bz2
Publish results of comparison with snapshotrefs/changes/15/181815/1
Change-Id: I2c00624d610e7c62c76c9da446a7d91943a77387
Diffstat (limited to 'tsp/www')
-rw-r--r--tsp/www/index.html17
-rw-r--r--tsp/www/script.js57
-rw-r--r--tsp/www/style.css16
3 files changed, 90 insertions, 0 deletions
diff --git a/tsp/www/index.html b/tsp/www/index.html
new file mode 100644
index 0000000..2129991
--- /dev/null
+++ b/tsp/www/index.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <link rel="stylesheet" type="text/css" href="/publish/www/style.css" />
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
+ <script language="javascript" src="/publish/www/script.js"></script>
+ </head>
+ <body>
+ <table id="all">
+ <tr>
+ <th>Name</th>
+ <th>Result</th>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/tsp/www/script.js b/tsp/www/script.js
new file mode 100644
index 0000000..fbd765c
--- /dev/null
+++ b/tsp/www/script.js
@@ -0,0 +1,57 @@
+var comparisonResults;
+
+function showDetails() {
+ var org_row = $(this);
+ org_row.off('click', showDetails);
+ var id = org_row.data("id");
+ var compare_result = comparisonResults.Comparison[id];
+ var new_table = $('<table>')
+ if (compare_result.Name == "Screenshots") {
+ new_table.append($('<tr>')
+ .append($('<td class="screenshot">')
+ .append($('<img src=comparison.png>')))) // FIXME: magic string
+ } else {
+ new_table.append($('<tr>')
+ .append($('<th>').append("Snapshot"))
+ .append($('<th>').append("Prerelease")))
+ new_table.append($('<tr>')
+ .append($('<td class="snap stdout">')
+ .append($('<pre>').append(compare_result.Snapshot.Stdout)))
+ .append($('<td class="pre stdout">')
+ .append($('<pre>').append(compare_result.Prerelease.Stdout))));
+ }
+ var new_row = $('<tr>').append($('<td colspan="2">').append(new_table));
+ org_row.after(new_row);
+
+ var collapse = function () {
+ new_row.remove();
+ org_row.unbind('click', collapse);
+ org_row.on('click', showDetails);
+ }
+ org_row.click(collapse); // FIXME: doesn't work
+ new_row.click(collapse);
+}
+
+function showMainResults(data) {
+ comparisonResults = data;
+ for (i in data.Comparison) {
+ var row = data.Comparison[i];
+ var table_row = $('<tr>')
+ .append($('<td class="name">').append(row.Name))
+ .append($('<td class="result">').append(row.Result))
+ .data("id", i)
+ .click(showDetails);
+ $('#all').append(table_row);
+ }
+}
+
+function init() {
+ $.ajax({
+ method: "GET",
+ url: "comparison.json",
+ contentType: "application/json",
+ success: showMainResults
+ })
+}
+
+window.onload = init
diff --git a/tsp/www/style.css b/tsp/www/style.css
new file mode 100644
index 0000000..4cf67db
--- /dev/null
+++ b/tsp/www/style.css
@@ -0,0 +1,16 @@
+#all, th, td {
+ border: 1px solid black;
+ border-collapse: collapse;
+}
+
+pre {
+ word-wrap: break-word;
+ width: 900px; /*FIXME*/
+}
+
+tr:nth-child(odd) {
+ background: #DDD
+}
+tr:nth-child(even) {
+ background: #FFF
+}