Skip to content

The Unified and Autonomous Development Platform

feat: Add user match display to branch and tag protection panels

Robin Shen84a3c1c9c7e6
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.html b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.html
index c40237c212..ab3933bcb0 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.html
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.html
@@ -4,7 +4,8 @@
<div class="card-title">
<a class="toggle" onclick="$(this).closest('.branch-protection').toggleClass('expanded');"><wicket:svg href="arrow4" class="icon rotate-270"/></a>
<span class="drag-indicator"><wicket:svg href="grip" class="icon icon-lg mr-2"/></span>
- <span wicket:id="branches" class="mr-3"></span>
+ <span wicket:id="branches"></span>
+ <span wicket:id="userMatch" class="text-muted ml-2 mr-3"></span>
<a wicket:id="edit" onclick="$(this).closest('.branch-protection').addClass('expanded');" class="btn btn-xs btn-icon btn-light btn-hover-primary mr-2" t:data-tippy-content="Edit this rule"><wicket:svg href="edit" class="icon"></wicket:svg></a>
<a wicket:id="delete" class="btn btn-xs btn-icon btn-light btn-hover-danger mr-4" t:data-tippy-content="Delete this rule"><wicket:svg href="trash" class="icon"></wicket:svg></a>
<span wicket:id="disabled" class="badge badge-warning"><wicket:t>Disabled</wicket:t></span>
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.java b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.java
index aee403752a..d9039065e7 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/branchprotection/BranchProtectionPanel.java
@@ -30,6 +30,7 @@ abstract class BranchProtectionPanel extends Panel {
super.onInitialize();
add(new Label("branches", protection.getBranches()));
+ add(new Label("userMatch", "(" + protection.getUserMatch() + ")"));
add(new AjaxLink<Void>("edit") {
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.html b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.html
index 44a12dfa12..f88f1457f5 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.html
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.html
@@ -4,7 +4,8 @@
<div class="card-title">
<a class="toggle" onclick="$(this).closest('.tag-protection').toggleClass('expanded');"><wicket:svg href="arrow4" class="icon rotate-270"/></a>
<span class="drag-indicator"><wicket:svg href="grip" class="icon mr-2"/></span>
- <span wicket:id="tags" class="mr-3"></span>
+ <span wicket:id="tags"></span>
+ <span wicket:id="userMatch" class="text-muted ml-2 mr-3"></span>
<a wicket:id="edit" onclick="$(this).closest('.tag-protection').addClass('expanded');" class="btn btn-xs btn-icon btn-light btn-hover-primary mr-2" t:data-tippy-content="Edit this rule"><wicket:svg href="edit" class="icon"></wicket:svg></a>
<a wicket:id="delete" class="btn btn-xs btn-icon btn-light btn-hover-danger mr-4" t:data-tippy-content="Delete this rule"><wicket:svg href="trash" class="icon"></wicket:svg></a>
<span wicket:id="disabled" class="badge badge-warning"><wicket:t>Disabled</wicket:t></span>
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.java b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.java
index c8c4e372b5..df60260988 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/setting/code/tagprotection/TagProtectionPanel.java
@@ -30,6 +30,7 @@ abstract class TagProtectionPanel extends Panel {
super.onInitialize();
add(new Label("tags", protection.getTags()));
+ add(new Label("userMatch", "(" + protection.getUserMatch() + ")"));
add(new AjaxLink<Void>("edit") {