From patchwork Mon Aug 23 14:58:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raxel Gutierrez X-Patchwork-Id: 1519750 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=uhu20546; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gtb491zVwz9sXN for ; Tue, 24 Aug 2021 00:59:21 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gtb484JxLz2y8P for ; Tue, 24 Aug 2021 00:59:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=uhu20546; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--raxel.bounces.google.com (client-ip=2607:f8b0:4864:20::749; helo=mail-qk1-x749.google.com; envelope-from=3rbcjyqukcbowf2jqlttlqj.htrufyhm1twpqnxyx.t4qfgx.twl@flex--raxel.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=uhu20546; dkim-atps=neutral Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Gtb3h66hgz2xr7 for ; Tue, 24 Aug 2021 00:58:55 +1000 (AEST) Received: by mail-qk1-x749.google.com with SMTP id o4-20020ae9f504000000b003d39d97b227so12053209qkg.2 for ; Mon, 23 Aug 2021 07:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=d4i48EsVUhaDMIsqwXtKWi9L9ULlaCYEtko5F5j+UlQ=; b=uhu20546Z0mSQ2kxAq08kC33bNagmass6WLy9D8DK0YSxKZdf3ptNtPh51J+4dLO+L 4iXv3srr/UK9EPw9doKQbBKYfh495jYvUKu8hrLMnDUUIpm5+GzXdwj2jHKjE1+WDG1l SoSdAFa8Bphi3Un9kWk/7QSscYOfKZhTEzucMBE240sXVOuvD68UOSBU5xh0oBuYdadG UgF1QQ0mHCvLsp1QaK8ucOFpmc11usVeikWm5cOdwf9JY2p0VZHiWqt+15/Jdz8iNSs2 fj+QA22DoTwg9vxubAI+rOMMeUdIlFwuRDNIu8ELpGsTHN+N0mLS/Wo7CDRLBXkL5VGF TsJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=d4i48EsVUhaDMIsqwXtKWi9L9ULlaCYEtko5F5j+UlQ=; b=mixPWk5kT7JWI6yEVxSnl+gsx3pIptn4uYOVNHYwvPMdJtALNa/RvRTXGHTU4yT/fj lQULA21jbDfYAxygPg1FRhw+g6IFS8LxEtrlsW3RoKE4EgxSM0qE31Cut/BNm8saPuxh JqxIkJcayIIRRtoV1sSkCwcMiujmOcWk/ZX+N1QL0mLBqy27HNf1xuhhc3fD0yxRDs0e mkTxmk8a9ZEfRG7Tf6p6FYl7PhSVKfkZaBQXC/tWs/ntwyKpoXfSpy3DUKUwNOO7vuf9 GaYyl5Z8ORbnZHUm2/moWNhkjuV8N6SezDsFgBZ0PFwt445KNwnCOjYvPlAkBANkvVLZ yIWg== X-Gm-Message-State: AOAM533DDBgJe6RTNYtAETWRR60/7JQ+CttlIfV2kBYu2giMKYrP3shx UJqvXryHaY9cXuce7sSo9gC7fwxcqtUfPdWrS7++V1gdnO9s3kcxUW33xh/SBUosOoLJ3trrkJV TSHnOjLHKk9VVKONTi8kVtynXgUJi5BexONnzF3zCcZNJRUrsRZ8FdTJSGjKGXuT5 X-Google-Smtp-Source: ABdhPJxiOJhzjQ8UrUc8UibE2mbcqJb+AbPpCiEBh7t06Uvrk/NlinqAZTms4C4LngeEzX0z4atofVuq7A== X-Received: from raxel-pw.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2fda]) (user=raxel job=sendgmr) by 2002:a05:6214:a06:: with SMTP id dw6mr9600204qvb.48.1629730733635; Mon, 23 Aug 2021 07:58:53 -0700 (PDT) Date: Mon, 23 Aug 2021 14:58:45 +0000 In-Reply-To: <20210823145847.3944896-1-raxel@google.com> Message-Id: <20210823145847.3944896-3-raxel@google.com> Mime-Version: 1.0 References: <20210823145847.3944896-1-raxel@google.com> X-Mailer: git-send-email 2.33.0.rc2.250.ged5fa647cd-goog Subject: [RFC PATCH 2/4] patch-detail: add patch relations table From: Raxel Gutierrez To: patchwork@lists.ozlabs.org X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The motivation behind the patch relations table is to be able to provide information about a given version of a patch in relation to its other versions. The table indicates whether there exists unaddressed comments in other versions and can also show what's the most up-to-date version of a given patch. The information on what is unresolved throughout the related patches history helps reviewers and submitters keep track of and quickly locate what needs to be done for a patch. Image [1] for reference. This involves: - Add and style patch relations table with a summary row that shows the total unaddressed and addressed comments for the patch relation and the existence of various tags through their abbreviations (e.g. A/R/T). - Add collapse button that hides all patches except for the current patch (which is highlighted) and the patch relation summary row [2]. If the patch relation contains errors, users can use the "Wrong related patches?" link to address the issues. For users with patch edit permissions, the patch relation can be modified (i.e. add/remove patches) [3]. For users without permission, an email is prompted to email the maintainers of the project to ask them to fix the patch relation. However, the functionality to add/remove patches is introduced in an upcoming patch. Something that is left TODO is fix the email prompt to maintainers to include the mailing list for each specific project instead of the patchwork mailing list. Also, commas and whitespace characters from the patch subject are cut off in the subject line of the email which needs to be fixed. [1] https://i.imgur.com/cwYKiUx.png [2] https://i.imgur.com/4HGCTYp.png [3] https://i.imgur.com/Xyy18oL.png Signed-off-by: Raxel Gutierrez --- htdocs/css/style.css | 120 +++++++++++++++++- htdocs/js/submission.js | 41 ++++++ patchwork/templates/patchwork/submission.html | 92 ++++++++++++++ 3 files changed, 252 insertions(+), 1 deletion(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 9156aa6e..89c0f5c0 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -1,8 +1,14 @@ :root { --light-color:rgb(247, 247, 247); - --success-color:rgb(92, 184, 92); + --dark-color:rgb(41, 43, 44); + --dark-color-75:rgb(41, 43, 44, .75); + --dark-color-50:rgb(41, 43, 44, .5); + --dark-color-25:rgb(41, 43, 44, .25); --warning-color:rgb(240, 173, 78); + --success-color:rgb(92, 184, 92); + --success-color-75:rgb(92, 184, 92, .75); --danger-color:rgb(217, 83, 79); + --danger-color-75:rgb(217, 83, 79, .75); } h2 { @@ -301,6 +307,118 @@ table.patch-meta tr th, table.patch-meta tr td { color: #f7977a; } +.table-bl-border-radius { + border-bottom-left-radius: 4px +} + +.table-br-border-radius{ + border-bottom-right-radius: 4px +} + +.panel { + width: fit-content; + margin-top: 16px; +} + +.panel-heading { + display: flex; + align-items: baseline; + justify-content: space-between; + font-weight: bold; + padding: 8px; +} + +#table-collapse-up-btn, #table-collapse-down-btn { + font-size: 16px; + color: var(--dark-color); + cursor: pointer; + margin-right: 4px; +} + +#table-collapse-up-btn:hover, #table-collapse-down-btn:hover { + color: var(--dark-color-75); +} + +.panel-actions-bar { + display: flex; + flex-wrap: wrap; + align-items: center; +} + +#related-patch-actions-input { + font-weight: normal; + border: var(--dark-color-25) solid 1px; + border-radius: 4px; + background-color: white; + margin-left: 8px; + padding: 2px 8px; +} + +#related-patch-actions-input:focus { + outline: none; +} + +#add-patch-relation-btn { + color: var(--success-color); + font-size: 16px; + margin: 0px 8px; + cursor: pointer; +} + +#add-patch-relation-btn:hover { + color: var(--success-color-75); +} + +#remove-patch-relation-btn { + color: var(--danger-color); + font-size: 16px; + margin-right: 8px; + cursor: pointer; +} + +#remove-patch-relation-btn:hover { + color: var(--danger-color-75); +} + +#related-patches-table { + border: inherit; + border-collapse: separate; + border-radius: 0px 0px 4px 4px; +} + +.btn-copy { + background-color: var(--light-color); + border-radius: 4px; + transition: all 0.3s ease-in-out; +} + +.btn-copy:hover { + outline: none; + transform: translateY(-2px); + filter: opacity(75%) drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.4)); +} + +button[title="Copy to Clipboard"].btn-copy:active { + outline: none; + transform: translateY(-1px); + filter: opacity(100%); +} + +#current-related-patch { + font-weight: bold; +} + +.related-patches-header, .related-patches-footer { + border: transparent solid 1px; + border-radius: 4px 4px 0px 0px; + font-weight: 600; +} + +.table thead > .related-patches-header > th { + vertical-align: middle; + border-bottom: var(--dark-color-50) solid 1px; +} + .submission-message .meta { display: flex; align-items: center; diff --git a/htdocs/js/submission.js b/htdocs/js/submission.js index 47cffc82..23f73233 100644 --- a/htdocs/js/submission.js +++ b/htdocs/js/submission.js @@ -2,6 +2,15 @@ import { updateProperty } from "./rest.js"; $( document ).ready(function() { const patchMeta = document.getElementById("patch-meta"); + const actionsInput = document.getElementById("related-patch-actions-input"); + const collapseTableBtn = document.getElementById("table-collapse-up-btn"); + const expandTableBtn = document.getElementById("table-collapse-down-btn"); + const relatedActionsBar = document.getElementsByClassName("panel-actions-bar")[0]; + const maintainers = django_maintainers_data['maintainers']; + + // Resize related patches input to length of placeholder text (+1 accounts for last letter) + actionsInput.setAttribute('size', actionsInput.getAttribute('placeholder').length + 1); + function toggleDiv(link_id, headers_id, label_show, label_hide) { const link = document.getElementById(link_id) const headers = document.getElementById(headers_id) @@ -34,6 +43,38 @@ $( document ).ready(function() { }) }); + function toggleVisibility(elements) { + for (let elem of elements) { + elem.classList.toggle("hidden"); + } + } + + $("#patch-relation-issue").click((event) => { + if (relatedActionsBar.classList.contains("hidden") && is_editable) { + $(relatedActionsBar).toggleClass("hidden"); + $(event.target).toggleClass("hidden"); + event.preventDefault(); + } else if (!is_editable) { + // TODO: Fix commas (',') cutting off rest of patch subject + const patchSubject = $("#current-related-patch > td > a").text().trim(); + let maintainersList = ""; + for (let i = 0; i < maintainers.length; i++) { + if (i != maintainers.length-1) { + maintainersList += maintainers[i] + ";" + } else { + maintainersList += maintainers[i]; + } + } + event.target.href = `mailto:patchwork@lists.ozlabs.org?subject=[Patch Relations Fix]:%20${patchSubject}&cc=${maintainersList}` + } + }); + + // Click listener to collapse/expand related patches table + $(collapseTableBtn).add(expandTableBtn).click(function() { + const collapseRows = document.querySelectorAll("#related-patches-body > tr:not(.related-patches-footer, #current-related-patch)"); + toggleVisibility([...collapseRows, collapseTableBtn, expandTableBtn]); + }); + // Click listener to show/hide headers document.getElementById("toggle-patch-headers").addEventListener("click", function() { toggleDiv("toggle-patch-headers", "patch-headers"); diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index 7dd6ae97..3c1d7bed 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -139,6 +139,98 @@ {% endif %} +
+
+
+ + + Patch Relations +
+
+ {% csrf_token %} + Wrong related patches? + +
+
+ + + + + + + + + + + {% for related_patch in related_same_project %} + {% if related_patch.name != submission.name %} + + {% else %} + + {% endif %} + {% if patch_relation %} + + + + {% if patch_relation %} + + {% else %} + + {% endif %} + + {% endfor %} + {% if patch_relation %} + + + + + + + {% endif %} + + +
+
{% if patchform %}