summaryrefslogtreecommitdiffstats
path: root/test_index.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-09-09 22:01:43 +0000
committerRomain d'Alverny <rda@mageia.org>2012-09-09 22:01:43 +0000
commit23556c841724aa8152537d3675ff68b9a3b6261b (patch)
treeffc57e85a0e768050fc14460b9c3ea5291a232f2 /test_index.php
parent2031ed8d939122a16cfc5f9e92fd66458db7ab6b (diff)
downloadpkgsubmit-23556c841724aa8152537d3675ff68b9a3b6261b.tar
pkgsubmit-23556c841724aa8152537d3675ff68b9a3b6261b.tar.gz
pkgsubmit-23556c841724aa8152537d3675ff68b9a3b6261b.tar.bz2
pkgsubmit-23556c841724aa8152537d3675ff68b9a3b6261b.tar.xz
pkgsubmit-23556c841724aa8152537d3675ff68b9a3b6261b.zip
read log files directly in page
Diffstat (limited to 'test_index.php')
-rw-r--r--test_index.php54
1 files changed, 53 insertions, 1 deletions
diff --git a/test_index.php b/test_index.php
index 7d51d9d..5865f36 100644
--- a/test_index.php
+++ b/test_index.php
@@ -256,7 +256,7 @@ if ($total > 0) {
echo sprintf('<li><p><span class="figure">%d</span> packages submitted in the past %d&nbsp;hours:</p>', $total, $max_modified * 24);
// Last submitted packages
- echo '<table>',
+ echo '<table id="submitted-packages">',
'<thead><tr><th>Submitted</th><th>User</th>
<th>Package</th><th>Target</th><th>Media</th>
<th colspan="2">Status</th><th>Build time</th></tr></thead>',
@@ -341,6 +341,58 @@ else
}
});
+ $("table#submitted-packages tbody").on("click", "tr td li a.view-inline", function (ev) {
+
+ // only open text log files
+ var ext = $(this).attr("href").split(".").pop();
+ if (["log", "done", "youri"].indexOf(ext) < 0)
+ return true;
+
+ if (!ev.metaKey) {
+ ev.preventDefault();
+
+ var elId = 'view-' + $(this).attr("href").replace(/\/|\./g, '-');
+ var el = $("#" + elId);
+ if (el.length == 0) {
+ $(this).after($("<textarea />", {
+ id: elId,
+ class: "file-view",
+ html: "loading..."
+ }));
+
+ $.get(
+ "/" + $(this).attr("href"),
+ {},
+ function (data) {
+ $("#" + elId).html(data)
+ .before(
+ $("<div />", {
+ class: "controls"
+ })
+ .append($("<button />", {
+ class: "gototop",
+ html: "top"
+ }).on("click", function (ev) {
+ var d = $("#" + elId);
+ d.animate({ scrollTop: 0 }, 200);
+ })
+ )
+ .append($("<button />", {
+ class: "gotobo",
+ html: "bottom"
+ }).on("click", function (ev) {
+ var d = $("#" + elId);
+ d.animate({ scrollTop: d.prop("scrollHeight") }, 200);
+ })
+ )
+ )
+ }
+ );
+ } else {
+ el.toggle();
+ }
+ }
+ });
});
</script>
<div class="clear"></div>