-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite rebuild actions using javascript java injection #580
Conversation
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Fixed
Show fixed
Hide fixed
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Fixed
Show fixed
Hide fixed
5071b79
to
811b5bd
Compare
src/main/resources/io/jenkins/plugins/pipelinegraphview/PipelineGraphViewAction/common.jelly
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Outdated
Show resolved
Hide resolved
8f3d2ac
to
e9b47c3
Compare
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Fixed
Show fixed
Hide fixed
f82a009
to
182417a
Compare
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Fixed
Show fixed
Hide fixed
f23b17b
to
2049203
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is looking much better, few comments but this is very close.
*/ | ||
@RequirePOST | ||
@JavaScriptMethod | ||
public boolean doRebuildjob() throws IOException, ExecutionException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public boolean doRebuildjob() throws IOException, ExecutionException { | |
public boolean doRebuild() throws IOException, ExecutionException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/main/webapp/js/build.js
Outdated
@@ -5,7 +5,13 @@ if (rebuildButton) { | |||
event.preventDefault(); | |||
const buildUrl = `${rebuildButton.dataset.buildPath}?delay=0sec` | |||
if (rebuildButton.dataset.parameterized === 'true') { | |||
window.location.href = buildUrl | |||
var rebuildAction = window[`${rebuildButton.dataset.proxyName}`]; | |||
rebuildAction.doRebuildjob(function (success) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebuildAction.doRebuildjob(function (success) { | |
rebuildAction.doRebuild(function (success) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/main/webapp/js/build.js
Outdated
if (result) { | ||
window.hoverNotification(rebuildButton.dataset.successMessage, rebuildButton); | ||
} | ||
}); | ||
} else { | ||
fetch(buildUrl, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this anymore? Couldn't we just call the same code for rebuilding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timja I move this for a new cleanup, I need to remove even data is paremeterized I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, I can do it tomorrow. Basically I need to drop data-parameterized, the function and all the old code. Let's me think about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/main/webapp/js/build.js
Outdated
rebuildAction.doRebuildjob(function (success) { | ||
var result = success.responseJSON; | ||
if (result) { | ||
window.hoverNotification(rebuildButton.dataset.successMessage, rebuildButton); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a future enhancement, would be good to provide a link to the scheduled build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timja you mean in the popup? I need even to think to show an error when you can't rebuild. Basically when you have a field that has a password you can't rebuild the job. I suggest to have two popup, one in green Build scheduled and one in red.
@@ -1,6 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<?jelly escape-by-default='true'?> | |||
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> | |||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change here is unneeded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
* Handles the rebuild request and redirects to parameterized | ||
* and non parameterized build when needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem to be true? It just adds a notification with the result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
2049203
to
88078b8
Compare
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Fixed
Show resolved
Hide resolved
a6e3eb0
to
d007dba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few minor cleanups then I think good to go.
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Fixed
Show resolved
Hide resolved
.../plugins/pipelinegraphview/multipipelinegraphview/MultiPipelineGraphViewAction/jobMain.jelly
Outdated
Show resolved
Hide resolved
69860fa
to
847abd3
Compare
src/main/java/io/jenkins/plugins/pipelinegraphview/utils/AbstractPipelineViewAction.java
Fixed
Show resolved
Hide resolved
7055eab
to
2e65734
Compare
Fix the rebuild that includes all the job parameters. Tested using gerrit-trigger Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
We don't need to distinguish between parameterized and non parameterized job We can drop some variables Suggested-by: Tim Jacomb <timjacomb1@gmail.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
baaef34
to
d8e552b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
First version of rebuild that includes all the job parameters. Some improvements should be done like have just one common.jelly but not clear how jelly include logic works.
Tested using gerrit-trigger
Some help is needed to clean up