-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI which shows the branch creation as a table. Signed-off-by: Jakub Kicinski <[email protected]>
- Loading branch information
Showing
4 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>PW status</title> | ||
<link rel="shortcut icon" href="/favicon-contest.png" type="image/png" /> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script> | ||
<script src="contest.js"></script> | ||
<script> | ||
do_it(); | ||
</script> | ||
<style> | ||
table { | ||
font-family: arial, sans-serif; | ||
border-collapse: collapse; | ||
width: 100%; | ||
} | ||
|
||
td, th { | ||
border: 1px solid #eeeeee; | ||
text-align: left; | ||
padding: 8px; | ||
} | ||
|
||
tr:nth-child(even) { | ||
background-color: #eeeeee; | ||
} | ||
.row { | ||
display: flex; | ||
} | ||
|
||
.column { | ||
flex: 50%; | ||
padding: 1em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="row"> | ||
<div class="column"> | ||
<table id="results"> | ||
<tr> | ||
<th>Date</th> | ||
<th>Branch</th> | ||
<th>Remote</th> | ||
<th>Executor</th> | ||
<th>Group</th> | ||
<th>Test</th> | ||
<th>Result</th> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
function colorify_str(value) | ||
{ | ||
if (value == "pass") { | ||
ret = '<p style="color:green">'; | ||
} else if (value == "skip") { | ||
ret = '<p style="color:blue">'; | ||
} else { | ||
ret = '<p style="color:red">'; | ||
} | ||
return ret + value + '</p>'; | ||
} | ||
|
||
function load_result_table(data_raw) | ||
{ | ||
var table = document.getElementById("results"); | ||
|
||
$.each(data_raw, function(i, v) { | ||
$.each(v.results, function(j, r) { | ||
var row = table.insertRow(); | ||
|
||
var date = row.insertCell(0); | ||
var branch = row.insertCell(1); | ||
var remote = row.insertCell(2); | ||
var exe = row.insertCell(3); | ||
var group = row.insertCell(4); | ||
var test = row.insertCell(5); | ||
var res = row.insertCell(6); | ||
|
||
dt = new Date(v.end); | ||
date.innerHTML = dt.toLocaleString(); | ||
branch.innerHTML = v.branch; | ||
remote.innerHTML = v.remote; | ||
exe.innerHTML = v.executor; | ||
group.innerHTML = r.group; | ||
test.innerHTML = r.test; | ||
res.innerHTML = colorify_str(r.result); | ||
}); | ||
}); | ||
} | ||
|
||
function results_doit(data_raw) | ||
{ | ||
load_result_table(data_raw); | ||
} | ||
|
||
function do_it() | ||
{ | ||
$(document).ready(function() { | ||
$.get("static/nipa/results.json", results_doit) | ||
}); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python3 | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
import datetime | ||
import json | ||
import os | ||
|
||
|
||
""" | ||
Combined test runner and collector. | ||
It generates fake data for the UI to display. | ||
It holds no history, only live branches will show up. | ||
""" | ||
|
||
|
||
def main() -> None: | ||
with open(os.sys.argv[1], "r") as fp: | ||
branches = json.load(fp) | ||
|
||
results = [] | ||
for br in branches: | ||
data = {"executor": "faker", "remote": "local", | ||
"branch": br["branch"]} | ||
|
||
br_dt = datetime.datetime.fromisoformat(br["date"]) | ||
br_dt += datetime.timedelta(minutes=2) | ||
data["start"] = br_dt.isoformat() | ||
br_dt += datetime.timedelta(minutes=3) | ||
data["end"] = br_dt.isoformat() | ||
|
||
data["results"] = [ | ||
{"test": "branch-created", "group": "fake", "result": "pass", | ||
"link": "https://netdev.bots.linux.dev/static/nipa/branches.json"} | ||
] | ||
|
||
results.append(data) | ||
|
||
with open(os.sys.argv[2], "w") as fp: | ||
json.dump(results, fp) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |