From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QpUX1-0001bg-As for garchives@archives.gentoo.org; Sat, 06 Aug 2011 00:14:23 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 736E421C03F; Sat, 6 Aug 2011 00:14:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 2FDBC21C03F for ; Sat, 6 Aug 2011 00:14:15 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4FE071B403D for ; Sat, 6 Aug 2011 00:14:14 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4ED0C80040 for ; Sat, 6 Aug 2011 00:14:13 +0000 (UTC) From: "Liam McLoughlin" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Liam McLoughlin" Message-ID: Subject: [gentoo-commits] proj/gentoaster:webui commit in: web/ X-VCS-Repository: proj/gentoaster X-VCS-Files: web/ajax.php web/status.php X-VCS-Directories: web/ X-VCS-Committer: hexxeh X-VCS-Committer-Name: Liam McLoughlin X-VCS-Revision: d1be7277d54b8d01eba1cfa30bf844b2536c93fc Date: Sat, 6 Aug 2011 00:14:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: c2a51b3db6dc1d1c43067c6c61a60852 commit: d1be7277d54b8d01eba1cfa30bf844b2536c93fc Author: Liam McLoughlin hexxeh net> AuthorDate: Sat Aug 6 00:13:08 2011 +0000 Commit: Liam McLoughlin hexxeh net> CommitDate: Sat Aug 6 00:13:50 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoaster.gi= t;a=3Dcommit;h=3Dd1be7277 Progress bar is now AJAXified! --- web/ajax.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++ web/status.php | 36 ++++++++++++++++++++------- 2 files changed, 98 insertions(+), 10 deletions(-) diff --git a/web/ajax.php b/web/ajax.php new file mode 100644 index 0000000..105c893 --- /dev/null +++ b/web/ajax.php @@ -0,0 +1,72 @@ +prepare("SELECT handle FROM builds WHERE id =3D ?"); + $stmt->bind_param("s", $buildID); + $stmt->execute(); + $stmt->store_result(); + if ($stmt->num_rows =3D=3D 1) { + $stmt->bind_result($handle); + $stmt->fetch(); + $stmt->close(); + $client =3D new GearmanClient(); + $client->addServer(); + + $status =3D $client->jobStatus($handle); + if ($status[0]) { + if ($status[3] !=3D 0) { + // in progress + $ret =3D array("status" =3D> 1, "num" =3D> $= status[2], "den" =3D> $status[3]); + } else { + // not yet processed + $ret =3D array("status" =3D> 2); + } + } else { + $query =3D "SELECT returncode, result ". + "FROM builds WHERE id =3D ?"; + $stmt =3D $db->prepare($query); + $stmt->bind_param("s", $buildID); + $stmt->execute(); + $stmt->bind_result($returncode, $result); + $stmt->fetch(); + $stmt->close(); + if ($returncode !=3D=3D null) { + if ($returncode =3D=3D 0) { + // finished + $ret =3D array("status" =3D> 0); + } else { + // returned with non-zero status code + $ret =3D array("status" =3D> 3); + } + } else { + // failed + $ret =3D array("status" =3D> 4); + } + } + } else { + // job not found + $ret =3D array("status" =3D> -1); + } + + $db->close(); + =20 + echo json_encode($ret); +?> \ No newline at end of file diff --git a/web/status.php b/web/status.php index ab57a1e..69e8afc 100644 --- a/web/status.php +++ b/web/status.php @@ -49,7 +49,7 @@ if ($status[3] !=3D 0) { $percentage =3D ceil($status[2]/$status[3]*1= 00); $bres =3D "Your build is currently running". - " and is ".$percentage."% com= plete"; + " and is ".$percentage."% complete"; $inprogress =3D true; } else { $bres =3D "Task has not yet been processed"; @@ -113,15 +113,31 @@ href=3D"css/ui-lightness/jquery-ui-1.8.14.custom.css"> - - $(document).ready(function() { - $("#progressbar").progressbar({ value: '.$percentage= .' }); - }); - '; - } - ?> + + + + =20
From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qs11m-0004S4-NF for garchives@archives.gentoo.org; Fri, 12 Aug 2011 23:20:35 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 04B8F21C3FB; Fri, 12 Aug 2011 23:18:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B962F21C3FA for ; Fri, 12 Aug 2011 23:18:01 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5536A1B4022 for ; Fri, 12 Aug 2011 23:18:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id A048280040 for ; Fri, 12 Aug 2011 23:18:00 +0000 (UTC) From: "Liam McLoughlin" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Liam McLoughlin" Message-ID: Subject: [gentoo-commits] proj/gentoaster:master commit in: web/ X-VCS-Repository: proj/gentoaster X-VCS-Files: web/ajax.php web/status.php X-VCS-Directories: web/ X-VCS-Committer: hexxeh X-VCS-Committer-Name: Liam McLoughlin X-VCS-Revision: d1be7277d54b8d01eba1cfa30bf844b2536c93fc Date: Fri, 12 Aug 2011 23:18:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 5b76d00eab5f484357953d8b186898b7 Message-ID: <20110812231800.H7Lgi7abLl5Fw1u4iPrdgem5TPLJMTBz00iqp0OWMsg@z> commit: d1be7277d54b8d01eba1cfa30bf844b2536c93fc Author: Liam McLoughlin hexxeh net> AuthorDate: Sat Aug 6 00:13:08 2011 +0000 Commit: Liam McLoughlin hexxeh net> CommitDate: Sat Aug 6 00:13:50 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoaster.gi= t;a=3Dcommit;h=3Dd1be7277 Progress bar is now AJAXified! --- web/ajax.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++ web/status.php | 36 ++++++++++++++++++++------- 2 files changed, 98 insertions(+), 10 deletions(-) diff --git a/web/ajax.php b/web/ajax.php new file mode 100644 index 0000000..105c893 --- /dev/null +++ b/web/ajax.php @@ -0,0 +1,72 @@ +prepare("SELECT handle FROM builds WHERE id =3D ?"); + $stmt->bind_param("s", $buildID); + $stmt->execute(); + $stmt->store_result(); + if ($stmt->num_rows =3D=3D 1) { + $stmt->bind_result($handle); + $stmt->fetch(); + $stmt->close(); + $client =3D new GearmanClient(); + $client->addServer(); + + $status =3D $client->jobStatus($handle); + if ($status[0]) { + if ($status[3] !=3D 0) { + // in progress + $ret =3D array("status" =3D> 1, "num" =3D> $= status[2], "den" =3D> $status[3]); + } else { + // not yet processed + $ret =3D array("status" =3D> 2); + } + } else { + $query =3D "SELECT returncode, result ". + "FROM builds WHERE id =3D ?"; + $stmt =3D $db->prepare($query); + $stmt->bind_param("s", $buildID); + $stmt->execute(); + $stmt->bind_result($returncode, $result); + $stmt->fetch(); + $stmt->close(); + if ($returncode !=3D=3D null) { + if ($returncode =3D=3D 0) { + // finished + $ret =3D array("status" =3D> 0); + } else { + // returned with non-zero status code + $ret =3D array("status" =3D> 3); + } + } else { + // failed + $ret =3D array("status" =3D> 4); + } + } + } else { + // job not found + $ret =3D array("status" =3D> -1); + } + + $db->close(); + =20 + echo json_encode($ret); +?> \ No newline at end of file diff --git a/web/status.php b/web/status.php index ab57a1e..69e8afc 100644 --- a/web/status.php +++ b/web/status.php @@ -49,7 +49,7 @@ if ($status[3] !=3D 0) { $percentage =3D ceil($status[2]/$status[3]*1= 00); $bres =3D "Your build is currently running". - " and is ".$percentage."% com= plete"; + " and is ".$percentage."% complete"; $inprogress =3D true; } else { $bres =3D "Task has not yet been processed"; @@ -113,15 +113,31 @@ href=3D"css/ui-lightness/jquery-ui-1.8.14.custom.css"> - - $(document).ready(function() { - $("#progressbar").progressbar({ value: '.$percentage= .' }); - }); - '; - } - ?> + + + + =20