Compare commits
2 Commits
3cc2460a9e
...
87ea4186d1
Author | SHA1 | Date | |
---|---|---|---|
87ea4186d1 | |||
7c247ff565 |
56
index.php
56
index.php
@ -79,9 +79,10 @@
|
|||||||
return "❗";
|
return "❗";
|
||||||
}
|
}
|
||||||
|
|
||||||
function micobu_get_build_icon($build) {
|
function micobu_get_build_icon($build, $verbose = false) {
|
||||||
|
$verb = ($verbose ? ($build->result > 0 ? " Build failed with return code " . $build->result : " Build succeeded") : "");
|
||||||
if ($build->result > 0)
|
if ($build->result > 0)
|
||||||
return "<span title='Build failed with return code $build->result'>❌</span>";
|
return "<span title='Build failed with return code $build->result'>❌</span>$verb";
|
||||||
else
|
else
|
||||||
return "<span title='Build succeeded'>✅</span>";
|
return "<span title='Build succeeded'>✅</span>";
|
||||||
}
|
}
|
||||||
@ -94,6 +95,10 @@
|
|||||||
return MICOBU_BASE_LINK . "/" . $build->project->name . "/" . $build->hash . "/" . $filename;
|
return MICOBU_BASE_LINK . "/" . $build->project->name . "/" . $build->hash . "/" . $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function micobu_get_dl_buttons($build) {
|
||||||
|
return "<a title='Show log file' href='" . micobu_get_weblink($build, "log.txt") . "'>📰</a> <a title='Show meta info' href='" . micobu_get_weblink($build, "meta.json") . "'>🛈</a> <a title='Show artefacts' href='" . micobu_get_weblink($build, "") . "'>📂</a>";
|
||||||
|
}
|
||||||
|
|
||||||
$projects = micobu_scan();
|
$projects = micobu_scan();
|
||||||
|
|
||||||
if (isset($_GET['p'])) {
|
if (isset($_GET['p'])) {
|
||||||
@ -122,7 +127,7 @@
|
|||||||
|
|
||||||
This is the source code of Micobu's web dashboard.
|
This is the source code of Micobu's web dashboard.
|
||||||
You can find more information on this system on:
|
You can find more information on this system on:
|
||||||
<link TBD>
|
https://git.notsyncing.net/markus/micobu
|
||||||
-->
|
-->
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@ -153,7 +158,33 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
.logframe {
|
||||||
|
width: 98vw;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.log {
|
||||||
|
font-size: 14pt;
|
||||||
|
font-family: monospace;
|
||||||
|
white-space: pre;
|
||||||
|
overflow-x: scroll;
|
||||||
|
}
|
||||||
|
.tdnohighlight:hover {
|
||||||
|
background-color: #222;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script>
|
||||||
|
function escapeHtml(text) {
|
||||||
|
var map = {
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
"'": '''
|
||||||
|
};
|
||||||
|
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
@ -167,13 +198,28 @@
|
|||||||
//var_dump($projects[$selected_project]->builds[$selected_hash]);
|
//var_dump($projects[$selected_project]->builds[$selected_hash]);
|
||||||
$build = $projects[$selected_project]->builds[$selected_hash];
|
$build = $projects[$selected_project]->builds[$selected_hash];
|
||||||
echo "<table>";
|
echo "<table>";
|
||||||
echo "<tr><td>Build status</td><td>" . micobu_get_build_icon($build). "</td></tr>";
|
echo "<tr><td>Build status</td><td>" . micobu_get_build_icon($build, true). "</td></tr>";
|
||||||
echo "<tr><td>Build time</td><td>" . micobu_get_build_time($build) . "</td></tr>";
|
echo "<tr><td>Build time</td><td>" . micobu_get_build_time($build) . "</td></tr>";
|
||||||
|
echo "<tr><td>Commit info</td><td>" . $build->hash . " (" . $build->description . ")</td></tr>";
|
||||||
|
echo "<tr><td>Download</td><td>" . micobu_get_dl_buttons($build) . "</td></tr>";
|
||||||
|
?>
|
||||||
|
<tr><td class="tdnohighlight" colspan=2><hr></td></tr>
|
||||||
|
<tr><td class="tdnohighlight" colspan=2><div class='logframe'><div class='log' id='buildlog'>Loading log...</div></div></td></tr>
|
||||||
|
<script>
|
||||||
|
var xhttp_ps = new XMLHttpRequest();
|
||||||
|
xhttp_ps.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4)
|
||||||
|
document.getElementById("buildlog").innerHTML = (this.status == 200 ? escapeHtml(xhttp_ps.responseText) : "Error loading log.");
|
||||||
|
};
|
||||||
|
xhttp_ps.open("GET", "<?php echo MICOBU_BASE_LINK . "/$selected_project/$selected_hash/log.txt"; ?>", true);
|
||||||
|
xhttp_ps.send();
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
} else if (isset($selected_project)) {
|
} else if (isset($selected_project)) {
|
||||||
echo "<table>";
|
echo "<table>";
|
||||||
foreach ($projects[$selected_project]->builds as $hash => $build) {
|
foreach ($projects[$selected_project]->builds as $hash => $build) {
|
||||||
echo "<tr><td><a href='?p=$selected_project&h=$hash'>" . date(DATE_RFC2822, $build->time_start) . "</a></td><td>" . micobu_get_build_icon($build) . "</td><td><a title='$build->hash'href='?p=$selected_project&h=$hash'>" . $build->description . "</a></td><td><a title='Show log file' href='" . micobu_get_weblink($build, "log.txt") . "'>📰</a> <a title='Show meta info' href='" . micobu_get_weblink($build, "meta.json") . "'>🛈</a> <a title='Show artefacts' href='" . micobu_get_weblink($build, "") . "'>📂</a></td></tr>";
|
echo "<tr><td><a href='?p=$selected_project&h=$hash'>" . date(DATE_RFC2822, $build->time_start) . "</a></td><td>" . micobu_get_build_icon($build) . "</td><td><a title='$build->hash'href='?p=$selected_project&h=$hash'>" . $build->description . "</a></td><td>" . micobu_get_dl_buttons($build) . "</td></tr>";
|
||||||
}
|
}
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user