summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-06-26 12:57:57 -0400
committerEudyptula <eitan@mosenkis.net>2009-06-26 12:57:57 -0400
commit4699a267d7099a4d42dd25c625cb50a6ff5777c7 (patch)
treebe7b9b461951696ee693aa32b1262953abc114c8 /frontend
parentAdded signal handling and logging; wrote init script; added other nice daemon... (diff)
downloadingenue-4699a267d7099a4d42dd25c625cb50a6ff5777c7.tar.gz
ingenue-4699a267d7099a4d42dd25c625cb50a6ff5777c7.tar.bz2
ingenue-4699a267d7099a4d42dd25c625cb50a6ff5777c7.zip
Changed task to have an index based on build instead of unique id, added description field
Diffstat (limited to 'frontend')
-rw-r--r--frontend/css/task.css19
-rw-r--r--frontend/pages/logview.php35
-rw-r--r--frontend/pages/wizard.php2
-rw-r--r--frontend/routing.csv8
4 files changed, 26 insertions, 38 deletions
diff --git a/frontend/css/task.css b/frontend/css/task.css
index d3e9892..22b809a 100644
--- a/frontend/css/task.css
+++ b/frontend/css/task.css
@@ -1,29 +1,30 @@
-div.task {
+div.task div.info {
+ padding-left: 2em;
font-family: monospace;
}
-div.task span.command {
+div.task div.info span.command {
font-size: 110%;
font-weight: bold;
}
-div.task span.status {
+div.task div.info span.status {
font-weight: bold;
}
-div.task span.status.successful {
+div.task div.info span.status.successful {
color: green;
}
-div.task span.status.failed {
+div.task div.info span.status.failed {
color: red;
}
-div.task span.status.running {
+div.task div.info span.status.running {
color: yellow;
background-color: black;
}
-div.task span.status.queued {
+div.task div.info span.status.queued {
background-color: yellow
}
-div.task span.time span.time {
+div.task div.info span.time span.time {
font-weight: bold;
}
-div.task a {
+div.task div.info a {
color: blue;
}
diff --git a/frontend/pages/logview.php b/frontend/pages/logview.php
index e8a9528..6dd9be7 100644
--- a/frontend/pages/logview.php
+++ b/frontend/pages/logview.php
@@ -1,36 +1,24 @@
<?php
-// TODO Fix up the main builds and tasks views to display more info (especially tasks - builds will probably get removed)
function init_logview() {
global $S;
$S['title']='Log Viewer';
}
function body_logview() {
global $S, $request, $conf;
- if (isset($request['task']) && is_numeric($request['task'])) {
- $r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `id`='.$request['task']);
+ if (isset($request['build'], $request['task']) && preg_match('/^[a-zA-Z0-9]{6}$/', $request['build']) && is_numeric($request['task'])) {
+ $r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `build`=\''.$request['build'].'\' AND `order`='.$request['task']);
if ($r->rowCount() == 0) {
- echo print_error('Not found', 'Task #'.$request['task'].' was not found.');
+ echo print_error('Not found', 'Build '.$request['build'].'/task '.$request['task'].' was not found.');
return;
}
$task=new sql_task($r->fetch(PDO::FETCH_ASSOC));
echo '<div style="font-size: 130%">'.$task->display().'</div>';
echo '<a href="'.url('logs/build'.$task->build).'">Back</a><br/>';
-/* echo '<h3>Task '.$task->id.': '.$task->command.' ';
- if (isset($task->exit)) {
- if ($task->exit == 0) {
- echo '<span style="color: green">[completed]</span>';
- } else {
- echo '<span style="color: red">[exit status '.$task->exit.']</span>';
- }
- } else {
- echo '<span style="color: yellow">[running]</span>';
- }
- echo '</h3>';*/
$page=isset($request['page']) && is_numeric($request['page'])?$request['page']:1;
- $count=$S['pdo']->query('SELECT COUNT(*) FROM `commandlogs` WHERE `task`='.$task->id)->fetch(PDO::FETCH_COLUMN);
+ $count=$S['pdo']->query('SELECT COUNT(*) FROM `buildlogs` WHERE `build`=\''.$task->build.'\' AND `task`='.$task->order)->fetch(PDO::FETCH_COLUMN);
$pager='';
if ($count > $conf['logview_max']) {
- $pager='<form action="'.url('logs/task'.$task->id).'" method="post" onsubmit="window.location.href=\''.url('logs/task'.$task->id).'/\'+this.page.value; return false">Page: ';
+ $pager='<form action="'.url('logs/'.$task->build.'/'.$task->order).'" method="post" onsubmit="window.location.href=\''.url('logs/'.$task->build.'/'.$task->order).'/\'+this.page.value; return false">Page: ';
if ($page > 1) {
$pager.='<input type="button" value="&lt;&lt;" onclick="this.form.page.value='.($page-1).'; this.form.onsubmit()" /> '."\n";
}
@@ -45,23 +33,23 @@ function body_logview() {
$pager.='</form>';
echo $pager;
}
- $r=$S['pdo']->query('SELECT * FROM `commandlogs` WHERE `task`='.$task->id.' ORDER BY `order` ASC LIMIT '.$conf['logview_max'].' OFFSET '.($page-1)*$conf['logview_max']);
+ $r=$S['pdo']->query('SELECT * FROM `buildlogs` WHERE `build`=\''.$task->build.'\' AND `task`='.$task->order.' ORDER BY `order` ASC LIMIT '.$conf['logview_max'].' OFFSET '.($page-1)*$conf['logview_max']);
if ($r->rowCount()) {
echo '<div style="font-family: monospace">';
$ansi=new ansi_to_html();
while ($entry=$r->fetch(PDO::FETCH_ASSOC)) {
- $entry=new sql_commandlog_entry($entry);
+ $entry=new sql_buildlog_entry($entry);
// $text=str_replace(array("\n", "\t"), array("<br/>\n", str_repeat('&nbsp;', 4)), htmlentities($entry->text));
-// echo '<a name="entry_'.$task->id.'_'.$entry->order.'"'.($entry->stream=='stderr'?' style="color: red" ':'').' title="'.strtoupper($entry->stream).', entry #'.$entry->order.' @ '.date('D j M Y @ H:i:s', $entry->timestamp).' UTC">'.$text.'</a>';
+// echo '<a name="entry_'.$task->order.'_'.$entry->order.'"'.($entry->stream=='stderr'?' style="color: red" ':'').' title="'.strtoupper($entry->stream).', entry #'.$entry->order.' @ '.date('D j M Y @ H:i:s', $entry->timestamp).' UTC">'.$text.'</a>';
echo $ansi->process(nl2br($entry->text));
}
echo $ansi->reset(); // Clear any leftover <span>s
echo '</div>';
echo $pager;
- echo '<a href="'.url('logs/build'.$task->build).'">Back</a><br/>';
+ echo '<a href="'.url('logs/'.$task->build).'">Back</a><br/>';
} else {
if ($count) {
- echo print_error("There aren't $page pages. Try an <a href=\"".url('logs/task'.$task->id)."\">earlier page</a>.");
+ echo print_error("There aren't $page pages. Try an <a href=\"".url('logs/'.$task->build.'/'.$task->order)."\">earlier page</a>.");
} else {
echo print_warning('No output');
}
@@ -69,7 +57,7 @@ function body_logview() {
} elseif (isset($request['build']) && preg_match('/[a-z0-9]{6}/', $request['build'])) {
$build=new sql_build($request['build']);
echo $build->display();
- $r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `build`="'.$request['build'].'" ORDER BY `id` ASC');
+ $r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `build`="'.$request['build'].'" ORDER BY `order` ASC');
if ($r->rowCount() == 0) {
echo '<b>No tasks found.</b>';
}
@@ -77,7 +65,6 @@ function body_logview() {
while ($task=$r->fetch(PDO::FETCH_ASSOC)) {
$task=new sql_task($task);
echo $task->display();
-// echo '<a href="'.url('logs/task'.$task->id).'">Task #'.++$i.'</a>: '.htmlentities($task->command).'<br/>';
}
} else {
$r=$S['pdo']->query('SELECT * FROM `builds` ORDER BY `ctime` IS NULL ASC, `ctime` ASC, `status` DESC');
diff --git a/frontend/pages/wizard.php b/frontend/pages/wizard.php
index bf3ca32..18797aa 100644
--- a/frontend/pages/wizard.php
+++ b/frontend/pages/wizard.php
@@ -79,7 +79,7 @@ function body_wizard() {
global $S;
if (isset($S['wizard.build'])) {
if (isset($S['wizard.done'])) {
- echo '<h3>Config finished!</h3><p>Check your build\'s status <a href="'.url('logs/build'.$S['wizard.build']->id).'">here</a></p>';
+ echo '<h3>Config finished!</h3><p>Check your build\'s status <a href="'.url('logs/'.$S['wizard.build']->id).'">here</a></p>';
} else {
$build=&$S['wizard.build'];
$step=&$S['wizard.step'];
diff --git a/frontend/routing.csv b/frontend/routing.csv
index 4baf180..74c9fee 100644
--- a/frontend/routing.csv
+++ b/frontend/routing.csv
@@ -13,10 +13,10 @@
^$ welcome
# Logs
^logs$ logview
-^logs/build([a-z0-9]{6})$ logview build
-^logs/build([a-z0-9]{6})/live$ livelog build
-^logs/task([0-9]+)$ logview task
-^logs/task([0-9]+)/([0-9]+)$ logview task page
+^logs/([a-z0-9]{6})$ logview build
+^logs/([a-z0-9]{6})/([0-9]+)$ logview build task
+^logs/([a-z0-9]{6})/([0-9]+)/([0-9]+)$ logview build task page
+#^logs/([a-z0-9]{6})/live$ livelog build
# Build creation
^create$ wizard
^create/([a-zA-Z0-9]{6})$ wizard build