From patchwork Mon Aug 19 09:00:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Huesca X-Patchwork-Id: 1149128 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.136; helo=silver.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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Bnvs00vjz9sMr for ; Mon, 19 Aug 2019 19:00:56 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2FF2A20338; Mon, 19 Aug 2019 09:00:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tRgciCPxJJ5f; Mon, 19 Aug 2019 09:00:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 26A5120499; Mon, 19 Aug 2019 09:00:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D0B9D1BF973 for ; Mon, 19 Aug 2019 09:00:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CA14A87B18 for ; Mon, 19 Aug 2019 09:00:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sktEx+ZZdges for ; Mon, 19 Aug 2019 09:00:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by hemlock.osuosl.org (Postfix) with ESMTPS id 0AF3E87AF3 for ; Mon, 19 Aug 2019 09:00:43 +0000 (UTC) Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: victor.huesca@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id D6BF3240005; Mon, 19 Aug 2019 09:00:41 +0000 (UTC) From: Victor Huesca To: buildroot@buildroot.org Date: Mon, 19 Aug 2019 11:00:36 +0200 Message-Id: <20190819090038.28808-2-victor.huesca@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190819090038.28808-1-victor.huesca@bootlin.com> References: <20190819090038.28808-1-victor.huesca@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH buildroot-test v2 1/3] web/request: new page to help making request to the autobuild database 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.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The current way to make request is to manually pass GET parameters to the URL, which is nice for automation and simple request but it gets messy with more complicated requests -- especially with the introduction of configuration symbols. This patch provides a handy interface to ask more sophisticated configs to the autobuild database. The implementation uses normal HTML forms but implements a hook to the submit method in order to handle config symbols from the textarea and keep the URL clean. Signed-off-by: Victor Huesca --- web/request.js | 69 ++++++++++++++++++++++++++++++++++++++ web/request.php | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 web/request.js create mode 100644 web/request.php diff --git a/web/request.js b/web/request.js new file mode 100644 index 0000000..cf52478 --- /dev/null +++ b/web/request.js @@ -0,0 +1,69 @@ +function submitForm() { + // Do not send the form + event.preventDefault(); + + // Read the form + const html_form = event.target; + const form = new FormData(html_form); + + // Drop empty fields + for (const k of getEmptyValues(form)) { + form.delete(k); + } + + // Prepare the symbols entry + if (form.has('symbols')) { + const raw_symbols = form.get('symbols'); + const extracted_symbols = textBoxToDict(raw_symbols); + for (const [k, v] of extracted_symbols) { + form.append(`symbols[${k}]`, v); + } + form.delete('symbols'); + } + + // Charge the requested page + if (html_form.method == 'get') { + const data = new URLSearchParams(form); + const url = html_form.action + '?' + data.toString(); + window.history.pushState(null, 'Searching...', url); + document.location = url; + } else { + // This approach only works for 'GET' forms. + // To handle 'POST' forms, a hidden html form must be + // created and filled with the write elements. + } +} + + +/** + * Return keys with an empty associated value. + * @param {FormData} form Form to extract empty values from. + */ +function getEmptyValues(form) { + const empty = []; + for (const [k, v] of form) + if (v == '') + empty.push(k); + return empty; +} + + +/** + * Parse a multi-line string and generates all couple `key: value` from it. + * @param {String} symbols_text String to parse. + * @param {String} line_sep Line separator, each lines have at most one couple `key: value`. + * @param {String} data_sep Key/value separator. + */ +function* textBoxToDict(symbols_text, line_sep='\n', data_sep='=') { + const arr = symbols_text.split(line_sep); + + for (const line of arr) { + const [sym, ...rest] = line.split(data_sep); + const key = sym.trim(); + if (key == '') + continue + const value = rest.join(data_sep).trim(); + yield [key, value]; + } +} + diff --git a/web/request.php b/web/request.php new file mode 100644 index 0000000..5331ffa --- /dev/null +++ b/web/request.php @@ -0,0 +1,88 @@ + + + + + +
+ + + + + + + + + + + +
+ Static? + + +
+
+ + + + + + + + +
+ Status? + + + +
+
+ + +
+ + From patchwork Mon Aug 19 09:00:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Huesca X-Patchwork-Id: 1149127 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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Bnvr2yw2z9s3Z for ; Mon, 19 Aug 2019 19:00:56 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A47C58620B; Mon, 19 Aug 2019 09:00:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FxRXf-bKghfP; Mon, 19 Aug 2019 09:00:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id E247F8614D; Mon, 19 Aug 2019 09:00:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id F40231BF973 for ; Mon, 19 Aug 2019 09:00:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EF17A86133 for ; Mon, 19 Aug 2019 09:00:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JN04jpuFrOkp for ; Mon, 19 Aug 2019 09:00:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by whitealder.osuosl.org (Postfix) with ESMTPS id 44EEF86124 for ; Mon, 19 Aug 2019 09:00:43 +0000 (UTC) Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: victor.huesca@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 402F524000C; Mon, 19 Aug 2019 09:00:42 +0000 (UTC) From: Victor Huesca To: buildroot@buildroot.org Date: Mon, 19 Aug 2019 11:00:37 +0200 Message-Id: <20190819090038.28808-3-victor.huesca@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190819090038.28808-1-victor.huesca@bootlin.com> References: <20190819090038.28808-1-victor.huesca@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH buildroot-test v2 2/3] web/stylesheet.css: add styling for the request page 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.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The style follows the existing visual aspect of the stats page. Signed-off-by: Victor Huesca --- web/stylesheet.css | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/web/stylesheet.css b/web/stylesheet.css index f2b5ac1..a81e12b 100644 --- a/web/stylesheet.css +++ b/web/stylesheet.css @@ -37,3 +37,67 @@ table tr.nok td { table tr.timeout td { background-color: #ffe79e; } + + + +/*****************/ +/* request.php */ +/*****************/ + +form { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-column-gap: 4%; + margin: 20px auto; + width: 80%; +} + +form input, +form fieldset, +form textarea { + border: 1px solid #00ccff; + box-shadow: 1px 1px 4px #cacada; + border-radius: 3px; + box-sizing: border-box; + margin: 0 auto 10px auto; +} + +form input:focus, +form fieldset:focus, +form textarea:focus { + outline: none; + border: 1px solid #0088ff; +} + +form input:not([type=radio]):not([type=button]):not([type=submit]) { + width: 100%; +} + +form textarea { + min-width: 100%; + max-width: 100%; + height: 150px; +} + +form fieldset { + margin-top: 10px; +} + +form fieldset label { + margin-right: 5%; +} + +form input[type=submit], +form input[type=button] { + width: 90%; + margin: 10px auto; + padding: 8px 15px 8px 15px; + background: #00aaff; + color: #fff; + grid-column: 2; +} + +form input[type=submit]:hover, +form input[type=button]:hover { + background: #0088ff; +} From patchwork Mon Aug 19 09:00:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Huesca X-Patchwork-Id: 1149126 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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Bnvp4ZMdz9s3Z for ; Mon, 19 Aug 2019 19:00:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7002786141; Mon, 19 Aug 2019 09:00:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9WMFU6cLMqvF; Mon, 19 Aug 2019 09:00:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id ED04586124; Mon, 19 Aug 2019 09:00:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 119D81BF973 for ; Mon, 19 Aug 2019 09:00:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0EC7786138 for ; Mon, 19 Aug 2019 09:00:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G07W8Jy0yLPx for ; Mon, 19 Aug 2019 09:00:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by whitealder.osuosl.org (Postfix) with ESMTPS id 519DE86133 for ; Mon, 19 Aug 2019 09:00:44 +0000 (UTC) Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: victor.huesca@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id AB72D240010; Mon, 19 Aug 2019 09:00:42 +0000 (UTC) From: Victor Huesca To: buildroot@buildroot.org Date: Mon, 19 Aug 2019 11:00:38 +0200 Message-Id: <20190819090038.28808-4-victor.huesca@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190819090038.28808-1-victor.huesca@bootlin.com> References: <20190819090038.28808-1-victor.huesca@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH buildroot-test v2 3/3] web/func.inc.php: add a link to the request page in the footer 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.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Allow to access the new request page from the footer. Signed-off-by: Victor Huesca --- web/funcs.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/web/funcs.inc.php b/web/funcs.inc.php index e3fb577..80130f8 100644 --- a/web/funcs.inc.php +++ b/web/funcs.inc.php @@ -24,6 +24,7 @@ function bab_footer() echo "build stats - "; echo "package stats - "; echo "toolchain configs - "; + echo "advanced search - "; echo "Script to reproduce a build\n"; echo "

\n"; echo "\n";