From 97a25213200f837114030e1a8864b8c8bf96df43 Mon Sep 17 00:00:00 2001 From: Gyula Soos Date: Thu, 30 Sep 2021 22:02:59 +0100 Subject: [PATCH 1/6] add support for custom text for the abort button --- .../workflow/support/steps/input/InputStep.java | 14 ++++++++++++++ .../support/steps/input/InputStepExecution.java | 2 +- .../support/steps/input/InputStep/config.jelly | 3 +++ .../steps/input/InputStepExecution/index.jelly | 2 +- .../support/steps/input/Messages.properties | 1 - 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java index 21cb5677..7bd12260 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java @@ -104,6 +104,20 @@ private String capitalize(String id) { return id; } + /** + * Caption of the Abort button. + */ + + private String abort; + + public String getAbort() { + return abort!=null ? abort : Messages.proceed(); + } + + @DataBoundSetter public void setAbort(String abort) { + this.abort = Util.fixEmptyAndTrim(abort); + } + /** * Caption of the OK button. */ diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution.java b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution.java index 173302bd..749eaaf1 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution.java @@ -86,7 +86,7 @@ public boolean start() throws Exception { String thisUrl = baseUrl + Util.rawEncode(getId()) + '/'; listener.getLogger().printf("%s%n%s or %s%n", input.getMessage(), POSTHyperlinkNote.encodeTo(thisUrl + "proceedEmpty", input.getOk()), - POSTHyperlinkNote.encodeTo(thisUrl + "abort", "Abort")); + POSTHyperlinkNote.encodeTo(thisUrl + "abort", input.getAbort())); } else { // TODO listener.hyperlink(…) does not work; why? // TODO would be even cooler to embed the parameter form right in the build log (hiding it after submission) diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/config.jelly b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/config.jelly index 7117fd12..b734bd00 100644 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/config.jelly @@ -35,6 +35,9 @@ THE SOFTWARE. + + + diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution/index.jelly b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution/index.jelly index 17528e37..128bf6c3 100644 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution/index.jelly +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution/index.jelly @@ -12,7 +12,7 @@ - + diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties index eafb5a71..f5ca7448 100644 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties @@ -1,7 +1,6 @@ paused_for_input=Paused for Input pipeline_need_input=Pipeline has paused and needs your input before proceeding wait_for_interactive_input=Wait for interactive input -abort=Abort rejected=Rejected rejected_by=Rejected by {0} input_submitted=Input Submitted From ceb1830e91426226fba9575d2d46e53b52ae9249 Mon Sep 17 00:00:00 2001 From: Gyula Soos Date: Fri, 1 Oct 2021 08:49:30 +0100 Subject: [PATCH 2/6] re add the abort text --- .../plugins/workflow/support/steps/input/InputStep.java | 2 +- .../plugins/workflow/support/steps/input/Messages.properties | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java index 7bd12260..e0e01b57 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStep.java @@ -111,7 +111,7 @@ private String capitalize(String id) { private String abort; public String getAbort() { - return abort!=null ? abort : Messages.proceed(); + return abort!=null ? abort : Messages.abort(); } @DataBoundSetter public void setAbort(String abort) { diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties index f5ca7448..eafb5a71 100644 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/Messages.properties @@ -1,6 +1,7 @@ paused_for_input=Paused for Input pipeline_need_input=Pipeline has paused and needs your input before proceeding wait_for_interactive_input=Wait for interactive input +abort=Abort rejected=Rejected rejected_by=Rejected by {0} input_submitted=Input Submitted From a161bb98ce42f069be9a483f6e21e643f2926314 Mon Sep 17 00:00:00 2001 From: Gyula Soos Date: Thu, 14 Oct 2021 23:17:07 +0100 Subject: [PATCH 3/6] add help-abort and help-ok files --- .../steps/input/InputStep/help-aport.html | 13 +++++++++++++ .../support/steps/input/InputStep/help-ok.html | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html create mode 100644 src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html new file mode 100644 index 00000000..74290a94 --- /dev/null +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html @@ -0,0 +1,13 @@ +

+ Similar to the ok Proceed button, the Abort can be customised too. +

+ +

Usage: input message: 'Do you approve?' ok: "Yes" abort: "No"

+ +

Which will look like: +

+        Do you approve?
+        Yes or No
+    
+

+ diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html new file mode 100644 index 00000000..37805216 --- /dev/null +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html @@ -0,0 +1,18 @@ +

+ You can customize the text for the proceed button to better match the context + of the prompt you're asking your users about. +

+ +

+ You can customize the text for the proceed button to better match the context of the prompt you're asking your users about. +

+ +

Usage: input message: 'Do you approve?' ok: "Yes"

+ +

Which will look like: +

+        Do you approve?
+        Yes or Abort
+    
+

+ From 740650cae58256a390b85ca83eec4f580b3824b0 Mon Sep 17 00:00:00 2001 From: Gyula Soos Date: Fri, 15 Oct 2021 08:18:48 +0100 Subject: [PATCH 4/6] fix help files --- .../support/steps/input/InputStep/help-abort.html | 11 +++++++++++ .../support/steps/input/InputStep/help-aport.html | 13 ------------- .../support/steps/input/InputStep/help-ok.html | 4 ---- 3 files changed, 11 insertions(+), 17 deletions(-) create mode 100644 src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html delete mode 100644 src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html new file mode 100644 index 00000000..ccb2710b --- /dev/null +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html @@ -0,0 +1,11 @@ +

Similar to the ok Proceed button, the Abort can be customised too.

+ +

+ Usage: input message: 'Do you approve?' ok: "Yes" abort: "No" +

+ +

Which will look like:

+
+    Do you approve?
+    Yes or No
+
diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html deleted file mode 100644 index 74290a94..00000000 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-aport.html +++ /dev/null @@ -1,13 +0,0 @@ -

- Similar to the ok Proceed button, the Abort can be customised too. -

- -

Usage: input message: 'Do you approve?' ok: "Yes" abort: "No"

- -

Which will look like: -

-        Do you approve?
-        Yes or No
-    
-

- diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html index 37805216..005ae8af 100644 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html @@ -3,10 +3,6 @@ of the prompt you're asking your users about.

-

- You can customize the text for the proceed button to better match the context of the prompt you're asking your users about. -

-

Usage: input message: 'Do you approve?' ok: "Yes"

Which will look like: From c25b4a8675c533ff079272c8c427848eebcdeb3c Mon Sep 17 00:00:00 2001 From: Gyula S <10959738+gyula-s@users.noreply.github.com> Date: Thu, 17 Nov 2022 17:10:18 +0000 Subject: [PATCH 5/6] Update src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html Co-authored-by: Jesse Glick --- .../workflow/support/steps/input/InputStep/help-abort.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html index ccb2710b..be91f611 100644 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-abort.html @@ -1,7 +1,7 @@

Similar to the ok Proceed button, the Abort can be customised too.

- Usage: input message: 'Do you approve?' ok: "Yes" abort: "No" + Usage: input message: 'Do you approve?', ok: "Yes", abort: "No"

Which will look like:

From 33377b0109381de8ada4a385aaff00aff5c48659 Mon Sep 17 00:00:00 2001 From: Gyula S <10959738+gyula-s@users.noreply.github.com> Date: Thu, 17 Nov 2022 17:10:24 +0000 Subject: [PATCH 6/6] Update src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html Co-authored-by: Jesse Glick --- .../plugins/workflow/support/steps/input/InputStep/help-ok.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html index 005ae8af..c5ff001e 100644 --- a/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html +++ b/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/input/InputStep/help-ok.html @@ -3,7 +3,7 @@ of the prompt you're asking your users about.

-

Usage: input message: 'Do you approve?' ok: "Yes"

+

Usage: input message: 'Do you approve?', ok: "Yes"

Which will look like: