From 66867ef3796692e2f6fd3315c3be5abcae4d37ad Mon Sep 17 00:00:00 2001 From: Shlomo Dahan <64103471+shlomomdahan@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:16:31 -0500 Subject: [PATCH 1/3] [JENKINS-74057] Extract inline script block in `BuildCardExtension/buildCardHelpers.jelly` (#146) --- .../build-card-script-helpers.js | 7 +++++++ .../BuildCardExtension/buildCardHelpers.jelly | 14 +------------- 2 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/build-card-script-helpers.js diff --git a/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/build-card-script-helpers.js b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/build-card-script-helpers.js new file mode 100644 index 00000000..22ca1121 --- /dev/null +++ b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/build-card-script-helpers.js @@ -0,0 +1,7 @@ +Handlebars.registerHelper('startScript', function() { + return new Handlebars.SafeString(""); +}); diff --git a/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/buildCardHelpers.jelly b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/buildCardHelpers.jelly index 2bf013e3..6e20ffe1 100644 --- a/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/buildCardHelpers.jelly +++ b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/buildCardHelpers.jelly @@ -7,17 +7,5 @@ By default we just include helpers to append script tags to your build card --> - - Handlebars.registerHelper('startScript', function() { - return new Handlebars.SafeString(""); - }); - - Handlebars.registerHelper('endScript', function() { - return new Handlebars.SafeString(""); - }); - - - ]]> + \ No newline at end of file From f2ceaf66e49670a8cf34b14a84b7be9b2a4f2054 Mon Sep 17 00:00:00 2001 From: Shlomo Dahan <64103471+shlomomdahan@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:21:10 -0500 Subject: [PATCH 2/3] [JENKINS-74055] Extract inline script block in `BuildPipelineView/main_dashboard.jelly` (#149) --- .../BuildPipelineView/main_dashboard.jelly | 13 +------------ .../BuildPipelineView/toggle-build-details.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/toggle-build-details.js diff --git a/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/main_dashboard.jelly b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/main_dashboard.jelly index 32108a49..f0c0b8e7 100755 --- a/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/main_dashboard.jelly +++ b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/main_dashboard.jelly @@ -2,16 +2,5 @@ - + diff --git a/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/toggle-build-details.js b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/toggle-build-details.js new file mode 100644 index 00000000..52da9aa0 --- /dev/null +++ b/src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/toggle-build-details.js @@ -0,0 +1,10 @@ +// show/hide build details +jQuery(document).ready(function() { + jQuery(".header").click(function() { + var parent = jQuery(this).parent(); + var ba = parent.find(".build-actions"); + var bb = parent.find(".build-body"); + + ba.add(bb).toggle('slow'); + }); +}); From 7da034aeb41b3d452d84cdbed39a0ab8726fb5ca Mon Sep 17 00:00:00 2001 From: Shlomo Dahan <64103471+shlomomdahan@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:51:24 -0500 Subject: [PATCH 3/3] mask negative bits to prevent negative projectIds (#157) --- .../centrumsystems/hudson/plugin/buildpipeline/BuildForm.java | 2 +- .../centrumsystems/hudson/plugin/buildpipeline/ProjectForm.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildForm.java b/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildForm.java index 25a65a87..32ee6882 100644 --- a/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildForm.java +++ b/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildForm.java @@ -94,7 +94,7 @@ private BuildForm(ItemGroup context, final PipelineBuild pipelineBuild, final Co } id = hashCode(); final AbstractProject project = pipelineBuild.getProject(); - projectId = project.getFullName().hashCode(); + projectId = project.getFullName().hashCode() & 0x7FFFFFFF; final ParametersDefinitionProperty params = project.getProperty(ParametersDefinitionProperty.class); final ArrayList paramList = new ArrayList(); if (params != null && params.getParameterDefinitionNames() != null) { diff --git a/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/ProjectForm.java b/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/ProjectForm.java index e8c8bb30..8fbda5f2 100644 --- a/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/ProjectForm.java +++ b/src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/ProjectForm.java @@ -240,7 +240,7 @@ public boolean equals(final Object obj) { } public int getId() { - return name.hashCode(); + return name.hashCode() & 0x7FFFFFFF; } /**