From nobody Sun Dec 22 15:45:50 2024 Delivered-To: importer2@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=1556795897; cv=none; d=zoho.com; s=zohoarc; b=TBfOsHF3sBBZIdJVZiwZQr2dKA/Yns+5vuoFtp+ETzHBlLnQ+qzjBiavQp31Wd05QQgwPQitkIgjB7rUZXQ/ZlcjcOhSehfFIk1aBeR6FNnlc3Q8JTBSQI7Kn/Mcj0dR00y9kJ6x1KMPLZyhNx3bGLHa0e6lEJDVp4IcxdzYEUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556795897; 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=rmEOpk+lqCTBmHH4HMyY8Pk8spDymxVMbGhGRJIsv4E=; b=OYfiDHVWRuFqRT74/OMUYQc90WVY0MUM3pWzicSQvspp4uiPJ0NyWA5PxLC9QECybJ9IeGbem/j3ztnN6zoUXoucOvmWkZodrSGREY7/e8LmRNdmdG/4eQ0V7rmo1lEiEtlZgeCv09Pk8UNBuwiEhArDPJlSFluyGgX4xf8nODA= 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 1556795897415728.6635088355971; Thu, 2 May 2019 04:18:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B60B81F1B; Thu, 2 May 2019 11:18:16 +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 2077D7EFC4; Thu, 2 May 2019 11:18:16 +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 1598818089D3; Thu, 2 May 2019 11:18:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x42BIFel008960 for ; Thu, 2 May 2019 07:18:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4F910A219; Thu, 2 May 2019 11:18:15 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A5B54105 for ; Thu, 2 May 2019 11:18:15 +0000 (UTC) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 C6B4F30B9305 for ; Thu, 2 May 2019 11:18:14 +0000 (UTC) Received: by mail-oi1-f179.google.com with SMTP id t184so1284680oie.11 for ; Thu, 02 May 2019 04:18:14 -0700 (PDT) Received: from localhost.localdomain ([198.59.53.9]) by smtp.gmail.com with ESMTPSA id o1sm19095697otj.11.2019.05.02.04.18.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2019 04:18:13 -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=wPyIUsnpOxr3DE5a7wn0uit94vkqoBFZum7cBXP9xls=; b=pLxYiRCXVrkKkptSlNDHVca52bZ52Al7daNCUJniARP1NeJIueu/7mcy/CrVPKpPLk iuKG9lG5hKyXUhETf2V1M27qCTp7b0K9kGX8ZqC3zNwQdejFXxidQHPQYMx6rW7Rm9AC GL1tbFSAyom3DvWU91ti1etff7Gu8Ombf8dXGzRQjeJzAtQTbD7jdSIKrIFqGUNE/lIk 2xxVqfRA1aocv6TOmtuO5EsT33Id1Fm9dCCV1H7avKKpgUOAV0O/Z9kDMM2G+aw2QbFL gA5aZnFRgb7I2LqD6BuPpfHNKfmgc5IP/oGZnyPGQzysJF3RWcQios9Sy/kFH4xZKZz0 CzSg== 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=wPyIUsnpOxr3DE5a7wn0uit94vkqoBFZum7cBXP9xls=; b=C7jXESkK2iVt7XfIk9/QqiIH4BViRRqQhgQIkoZ2/KY5GoFC0mBxot9WGLj4t81mS7 i2w1KQXX6L1hzJzbeEyUCv0tnxZZPVKXB+Qt/Soe2b9CUUYGO/gbFE38hCdHvhoMbQnC s6fTl9DBJugx+EV7/1AhxsdvB/m9tEe7aGOt9eGZni1QyShK/0StkzTF+nrluD4Sm0xT 2Ru+SqsoHwJTBdk9RTFoee636v5eSklXG1PVkibEXZAVMc2FKjnvT8av4TpWaWdaRI54 ORFT3aiKoRoZZz1jQ7d34jgZq8p6EPsmrb3GP5b5Fg3L787ks85rj2TEWChGzOXi8pL5 kwlQ== X-Gm-Message-State: APjAAAWmG1EoP6MBBhCACM6u/8KQrHM4f1n2wg9qDN7RrN8nsbAmXgZ8 uaM9nGYJt/CNrDC4oEBKNHVSWKf7Lkg= X-Google-Smtp-Source: APXvYqyIRhiLnJ4hP+/teVPjt+7czK7VmlgxP3o770ybr3xR9DbjxSDTVSH4d/+/N+qqgV2xZAsW+Q== X-Received: by 2002:aca:f449:: with SMTP id s70mr874630oih.169.1556795894024; Thu, 02 May 2019 04:18:14 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 2 May 2019 05:17:57 -0600 Message-Id: <20190502111804.15843-11-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.49]); Thu, 02 May 2019 11:18:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 02 May 2019 11:18:14 +0000 (UTC) for IP:'209.85.167.179' DOMAIN:'mail-oi1-f179.google.com' HELO:'mail-oi1-f179.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.115 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.167.179 mail-oi1-f179.google.com 209.85.167.179 mail-oi1-f179.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 10/17] mods: do not allow creating duplicate map items 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 02 May 2019 11:18:16 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The code for that was there but more or less stubbed out, fix it. --- static/js/config-editor.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/static/js/config-editor.js b/static/js/config-editor.js index f15211f..c0f326f 100644 --- a/static/js/config-editor.js +++ b/static/js/config-editor.js @@ -70,9 +70,10 @@ function properties_save(btn) { }); } =20 -function collect_items(btn) { - $(btn).parent().parent().find(".map-item"); - return {}; +function collect_items(container) { + return container.find("> .items > .item > .item-heading > .item-name")= .map(function() { + return $(this).text(); + }).get(); } =20 function map_add_item(btn) { @@ -81,8 +82,8 @@ function map_add_item(btn) { return; } container =3D $(btn).parent().parent(); - if (name in collect_items(btn)) { - alert(test_name + " already exists."); + if (collect_items(container).includes(name)) { + alert(name + " already exists."); return; } if (name.indexOf(".") >=3D 0) { --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel