From 6824a9413e57303061a3efbf1ee839bc9c49dfd5 Mon Sep 17 00:00:00 2001 From: liuwei Date: Fri, 3 Feb 2023 21:10:40 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20job=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2=E4=B8=AD=E9=80=89=E6=8B=A9=E6=9C=BA?= =?UTF-8?q?=E5=99=A8=E4=BA=BA=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/plugins/DingTalkJobProperty.java | 20 ++--- .../plugins/DingTalkJobProperty/config.jelly | 68 ++++++++++++----- .../DingTalkNotifierConfig/config.jelly | 76 +++++++++---------- 3 files changed, 92 insertions(+), 72 deletions(-) diff --git a/src/main/java/io/jenkins/plugins/DingTalkJobProperty.java b/src/main/java/io/jenkins/plugins/DingTalkJobProperty.java index be8fa1e..72683eb 100644 --- a/src/main/java/io/jenkins/plugins/DingTalkJobProperty.java +++ b/src/main/java/io/jenkins/plugins/DingTalkJobProperty.java @@ -4,11 +4,9 @@ import hudson.model.Job; import hudson.model.JobProperty; import hudson.model.JobPropertyDescriptor; -import io.jenkins.plugins.DingTalkNotifierConfig.DingTalkNotifierConfigDescriptor; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import jenkins.model.Jenkins; import lombok.NoArgsConstructor; import lombok.ToString; import org.kohsuke.stapler.DataBoundConstructor; @@ -30,8 +28,7 @@ public class DingTalkJobProperty extends JobProperty> { * @return 机器人配置列表 */ public ArrayList getNotifierConfigs() { - - ArrayList notifierConfigsList = new ArrayList<>(); + ArrayList notifierConfigList = new ArrayList<>(); ArrayList robotConfigs = DingTalkGlobalConfig.getInstance() .getRobotConfigs(); @@ -39,8 +36,8 @@ public ArrayList getNotifierConfigs() { String id = robotConfig.getId(); DingTalkNotifierConfig newNotifierConfig = new DingTalkNotifierConfig(robotConfig); - if (notifierConfigs != null && !notifierConfigs.isEmpty()) { - for (DingTalkNotifierConfig notifierConfig : notifierConfigs) { + if (this.notifierConfigs != null) { + for (DingTalkNotifierConfig notifierConfig : this.notifierConfigs) { String robotId = notifierConfig.getRobotId(); if (id.equals(robotId)) { newNotifierConfig.copy(notifierConfig); @@ -48,10 +45,10 @@ public ArrayList getNotifierConfigs() { } } - notifierConfigsList.add(newNotifierConfig); + notifierConfigList.add(newNotifierConfig); } - return notifierConfigsList; + return notifierConfigList; } /** @@ -79,13 +76,6 @@ public boolean isApplicable(Class jobType) { return super.isApplicable(jobType); } - /** - * 通知配置页面 - */ - public DingTalkNotifierConfigDescriptor getDingTalkNotifierConfigDescriptor() { - return Jenkins.get().getDescriptorByType(DingTalkNotifierConfigDescriptor.class); - } - /** * 默认的配置项列表 * diff --git a/src/main/resources/io/jenkins/plugins/DingTalkJobProperty/config.jelly b/src/main/resources/io/jenkins/plugins/DingTalkJobProperty/config.jelly index 14aab70..ab866a2 100644 --- a/src/main/resources/io/jenkins/plugins/DingTalkJobProperty/config.jelly +++ b/src/main/resources/io/jenkins/plugins/DingTalkJobProperty/config.jelly @@ -5,28 +5,60 @@ xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" - xmlns:f="/lib/form"> - + xmlns:f="/lib/form" + xmlns:local="local"> + + + + + + + + + + - - - - - - - - +
+ + + + +
+ + + +
+
+
+
+ + + +
+ + + + + + + +
+
+
+
+ +
+
- - diff --git a/src/main/resources/io/jenkins/plugins/DingTalkNotifierConfig/config.jelly b/src/main/resources/io/jenkins/plugins/DingTalkNotifierConfig/config.jelly index a0c0b6d..80d816f 100644 --- a/src/main/resources/io/jenkins/plugins/DingTalkNotifierConfig/config.jelly +++ b/src/main/resources/io/jenkins/plugins/DingTalkNotifierConfig/config.jelly @@ -5,43 +5,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file