From nobody Thu Apr 18 16:27:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556795896; cv=none; d=zoho.com; s=zohoarc; b=gW/XLNBYfQiFoAd/AhGlszHfNuGD2gW052z0BApG/3d4aIZtSzNETUKD3rtnV/XxauWDHV4mNXGORdhR5yAxZDkrpScjHePqo6+V7hfNOuyS+xwZ3iO+iuguWmXnYFZi3GnNJU5ckxlQ1v/dI4xbjc+IZlhIsRwI/3N0Ras0Dzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556795896; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=cMTEsu4jNeiBsybIeBXcULek7a6PecYwU1H27x9q9uM=; b=kPwn0VU0FxDxn5CO1fyb4VsdIH/lcj1dnxvAZ2qKgnLuLZ5YvyqTsdG9qyTCIOIYfaGiG5/Pq2UDuXYZAP/VxGoX+6DrkBlB6YiijtNOAo7u0fFXGVLodhdEkkhA0mDCyU4PpNRsAPUoqsRY+AjLe849dPVUXivOaIqtdrxg/8k= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1556795896595308.6527092447442; Thu, 2 May 2019 04:18:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57A71307E042; Thu, 2 May 2019 11:18:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C07F39C1; Thu, 2 May 2019 11:18:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3BE1918089CA; Thu, 2 May 2019 11:18:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x42BIE4Z008948 for ; Thu, 2 May 2019 07:18:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 237D17C5ED; Thu, 2 May 2019 11:18:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C49C7EE6D for ; Thu, 2 May 2019 11:18:10 +0000 (UTC) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 724123082E69 for ; Thu, 2 May 2019 11:18:09 +0000 (UTC) Received: by mail-oi1-f171.google.com with SMTP id w197so1383967oia.2 for ; Thu, 02 May 2019 04:18:09 -0700 (PDT) Received: from localhost.localdomain ([198.59.53.9]) by smtp.gmail.com with ESMTPSA id o1sm19095697otj.11.2019.05.02.04.18.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2019 04:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=njEE+YPM8Qn9x+jLK7T+BHDMP1sVEn8Pc2FHfegwAIU=; b=IDitTWtsfb43xJAU6OHNxsV6ichioKZN83fuNT0rG2B94kn4MZ94ijlRN3wz3Kj/8p hWo7QkkMz0Twcin15FODstzquLUY31ZIcfvI5bWiIK1YJvhpgbixiYLzQru6jXXzuZSb ySwpiK3jiOwQBT4rxoU97S/KCxsII8bnBMhGXZIq1+15Y2EcQd1Jp2lR0tQRMhOgKGya Gvi+R8oZa/SpIXDv7KNu2aBbRagqjif7o4nLedjr/M9QP85JWqN/kRj+Ee8QHic53BsH 7Nw7EViNor/RGr+be11naP0E0xIgoZiX9C/j7Ci5imzd62aBrxqBEgx50nySrrtbwbQf wWOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=njEE+YPM8Qn9x+jLK7T+BHDMP1sVEn8Pc2FHfegwAIU=; b=BrWggeHO06J7OCUAYpgsYvEAofXMK6Z5IXkquOfIWwXHuYxhWLQ5Vvg9/ia/5FkMp8 Vftnn8Ev+KgQY/V1myhQE/a2db1klPDs1ud3BYvPSTnbibvPv1NciySaQbJB01j7f5zn f3Ejla7bpYe5Pm2uQV6iZP+SY4CPp8LtvKTN8Uq5DQkk7tbq1OM8WJXYBEC/Flyvs35b xUOWj34RhDQ5ITEsOdHY3Kvi8juFVomZzV9SoB2bgDCx8Yp8JdJMfXPK2v+OOfGOlhjo WO/WPxnUb/ADngzeNkgmMa8g4EGW8LDasSXg+ITIeZtaqrHjrpU4KToOR8rOCMxWVAvy D9tA== X-Gm-Message-State: APjAAAWI3QI3wx550J7TGotqUyFcXYl9LHpShMXXNiAVK2SvWeosGm6W AnBALNhtiZ0XvMQOtFjJ37tPHNx6gqs= X-Google-Smtp-Source: APXvYqw5cxT2MUPNmP4DPSB9YW0YHwycSlX2pzpUCOxDT01XIEJMUWHUhsyf5BS/mhqiIbJlkvQCLA== X-Received: by 2002:aca:f204:: with SMTP id q4mr1944447oih.109.1556795888606; Thu, 02 May 2019 04:18:08 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 2 May 2019 05:17:51 -0600 Message-Id: <20190502111804.15843-5-pbonzini@redhat.com> In-Reply-To: <20190502111804.15843-1-pbonzini@redhat.com> References: <20190502111804.15843-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 02 May 2019 11:18:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 02 May 2019 11:18:09 +0000 (UTC) for IP:'209.85.167.171' DOMAIN:'mail-oi1-f171.google.com' HELO:'mail-oi1-f171.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.126 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.167.171 mail-oi1-f171.google.com 209.85.167.171 mail-oi1-f171.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 04/17] mods: move epilog to a .js file X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 02 May 2019 11:18:15 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Load the config editor Javascript via -""" diff --git a/static/js/config-editor.js b/static/js/config-editor.js new file mode 100644 index 0000000..f8c9454 --- /dev/null +++ b/static/js/config-editor.js @@ -0,0 +1,127 @@ +function current_project() { + return $('h2').text(); +} + +function save_done(btn, succeeded, error) { + $(btn).text("Save"); + $(btn).removeClass("disabled"); + info =3D $("
"); + if (succeeded) { + info.addClass("alert-success"); + info.html("Saved"); + } else { + info.addClass("alert-danger"); + info.html("Error: " + error); + } + info.insertBefore($(btn)); +} + +function collect_properties(btn, check_required) { + prefix =3D $(btn).parent().parent().find("#property-prefix").val(); + properties =3D {}; + $(btn).parent().parent().find(".project-property").each(function () { + if (check_required && this.required && !this.value) { + alert($(this).parent().find("label").html() + " is required!"); + $(this).focus(); + properties =3D false; + return false; + } + if (this.type =3D=3D "number") { + val =3D parseInt(this.value); + if (isNaN(val)) { + alert("Invalid number for " + this.name); + $(this).focus(); + properties =3D false; + return false; + } + } else if (this.type =3D=3D "checkbox") { + if (this.checked) { + val =3D true; + } else { + val =3D false; + } + } else { + val =3D this.value; + } + properties[prefix + this.name] =3D val; + }); + return properties; +} + +function properties_save(btn) { + if ($(btn).hasClass("disabled")) { + return; + } + props =3D collect_properties(btn, true); + if (!props) { + return; + } + $(btn).addClass("disabled"); + $(btn).text("Saving..."); + $(btn).parent().find(".save-message").remove(); + patchew_api_do("set-project-properties", + { project: current_project(), + properties: props }) + .done(function (data) { + save_done(btn, true); + }) + .fail(function (data, text, error) { + save_done(btn, false, error); + }); +} + +function collect_items(btn) { + $(btn).parent().parent().find(".map-item"); + return {}; +} + +function map_add_item(btn) { + name =3D window.prompt("Please input a name"); + if (!name || name =3D=3D 'null') { + return; + } + if (name in collect_items(btn)) { + alert(test_name + " already exists."); + return; + } + if (name.indexOf(".") >=3D 0) { + alert("Invalid name, no dot is allowed."); + return; + } + container =3D $(btn).parent().parent(); + tmpl =3D container.find("#item-template").html(); + nt =3D $(tmpl) + nt.find("#item-name").html(name); + old =3D nt.find("#property-prefix").val(); + nt.find("#property-prefix").val(old + name + "."); + container.find(".items").append(nt); +} +function map_delete_item(btn) { + name =3D $(btn).parent().parent().parent().find("#item-name").html(); + prefix =3D $(btn).parent().parent().parent().find("#prefix").val(); + if (!window.confirm("Really delete '" + name +"'?")) { + return; + } + $(btn).addClass("disabled"); + $(btn).text("Deleting..."); + $(btn).parent().find(".delete-message").remove(); + patchew_api_do("delete-project-properties-by-prefix", + { project: current_project(), + prefix: prefix }) + .done(function (data) { + container =3D $(btn).parent().parent().parent(); + container.remove(); + }) + .fail(function (data, text, error) { + $(btn).removeClass("disabled"); + $(btn).text("Delete"); + info =3D $("
"); + info.html("Error: " + error); + info.insertBefore($(btn)); + }); +} +function enum_change(which) { + val =3D $(which).val(); + desc =3D $(which).parent().find("#enum-desc-" + val).html(); + $(which).parent().find("#enum-desc").html(desc); +} diff --git a/www/templates/project-detail.html b/www/templates/project-deta= il.html index 35ee845..adf90a3 100644 --- a/www/templates/project-detail.html +++ b/www/templates/project-detail.html @@ -4,6 +4,7 @@ + {% endblock %} =20 {% block content %} --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel