From patchwork Mon Jul 8 08:17:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Huesca X-Patchwork-Id: 1128919 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45hyxJ4BRGz9sNF for ; Mon, 8 Jul 2019 18:17:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6EB2085758; Mon, 8 Jul 2019 08:17:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UmbmRk4h5B9n; Mon, 8 Jul 2019 08:17:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0A50885653; Mon, 8 Jul 2019 08:17:34 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 32FFE1BF86C for ; Mon, 8 Jul 2019 08:17:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 30511855CB for ; Mon, 8 Jul 2019 08:17:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8omN6bZueCDc for ; Mon, 8 Jul 2019 08:17:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 4B76D85585 for ; Mon, 8 Jul 2019 08:17:25 +0000 (UTC) X-Originating-IP: 86.250.200.211 Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: victor.huesca@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id C28BFC0004; Mon, 8 Jul 2019 08:17:20 +0000 (UTC) From: Victor Huesca To: buildroot@buildroot.org Date: Mon, 8 Jul 2019 10:17:05 +0200 Message-Id: <20190708081707.28348-3-victor.huesca@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190708081707.28348-1-victor.huesca@bootlin.com> References: <20190621123712.8060-1-victor.huesca@bootlin.com> <20190708081707.28348-1-victor.huesca@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH buildroot-test v2 2/4] web/index.php: add support for symbols to be passed via GET X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Victor Huesca , thomas@bootlin.com, antoine@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch add support of a `symbols[]=` option via GET as it is done with other fields. The syntax used is `symbols[]=`, so multiple symbols can be passed while the url is still readable and symbols are clearly isolated from other fields. These symbols are forwared to the backend to be integrated in the sql query. Signed-off-by: Victor Huesca --- web/index.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/web/index.php b/web/index.php index f3af62d..289a866 100644 --- a/web/index.php +++ b/web/index.php @@ -34,7 +34,18 @@ function format_url_args($args) )); } +function setup_date($dates) +{ + if (isset($dates['from']) && isset($dates['to'])) + return $dates; + else if (isset($dates['from'])) + return $dates['from']; + else if (isset($dates['to'])) + return array('to' => $dates['to']); +} + $filters = array(); +$symbols = array(); /* When no start is given, or start is a crazy value (not an integer), just default to start=0 */ @@ -53,7 +64,7 @@ if ($step > 250) $valid_status = array("OK", "NOK", "TIMEOUT"); -if (isset ($_GET['status']) && in_array($_GET['status'], $valid_status)) +if (isset($_GET['status']) && in_array($_GET['status'], $valid_status)) $filters["status"] = $_GET['status']; if (isset($_GET['arch']) && preg_match("/^[a-z0-9_]*$/", $_GET['arch'])) @@ -74,9 +85,15 @@ if (isset($_GET['static']) && preg_match("/^[0-1]$/", $_GET['static'])) if (isset($_GET['subarch']) && preg_match("/^[A-Za-z0-9_\+\.\-]*$/", $_GET['subarch'])) $filters["subarch"] = $_GET['subarch']; -if (isset ($_GET['submitter'])) +if (isset($_GET['submitter'])) $filters["submitter"] = urldecode($_GET['submitter']); +if (isset($_GET['symbols']) && is_array($_GET['symbols'])) + $symbols = $_GET['symbols']; + +if (isset($_GET['date'])) + $filters["date"] = setup_date($_GET['date']); + bab_header("Buildroot tests"); echo "\n"; @@ -85,7 +102,7 @@ echo ""; echo ""; echo ""; -$results = bab_get_results($start, $step, $filters); +$results = bab_get_results($start, $step, $filters, $symbols); while ($current = mysqli_fetch_object($results)) { @@ -156,7 +173,7 @@ echo "
DateDurationStatusCommit IDSubmitterArch/SubarchFailure reasonLibcStatic?Data
\n"; echo "

"; -$total = bab_total_results_count($filters); +$total = bab_total_results_count($filters, $symbols); $prev_args = $filters; $next_args = $filters;