Skip to content
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

Do not use page transition for purge command #31

Merged
merged 4 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified images/purge-build-queue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 5 additions & 9 deletions src/main/java/io/jenkins/plugins/PurgeBuildQueueAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,18 @@
@Extension
public final class PurgeBuildQueueAction implements RootAction {

private static final Logger LOG = Logger
.getLogger(PurgeBuildQueueAction.class
.getName());
private static final Logger LOG = Logger.getLogger(PurgeBuildQueueAction.class.getName());

private static String getItemsVerbage(final int length) {
if (length == 1) {
return "1 item";
}

return length + " items";
}

@RequirePOST
public void doPurge(final StaplerRequest request, final StaplerResponse response) throws ServletException,
IOException {
public void doPurge(final StaplerRequest request, final StaplerResponse response) throws ServletException, IOException {
Fixed Show fixed Hide fixed
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
final Queue queue = Jenkins.get().getQueue();

if (queue != null) {
Expand All @@ -76,7 +73,6 @@ public void doPurge(final StaplerRequest request, final StaplerResponse response

queue.clear();
}

response.forwardToPreviousPage(request);
}

Expand All @@ -87,11 +83,11 @@ public String getDisplayName() {

@Override
public String getIconFileName() {
return Jenkins.get().hasPermission(Jenkins.ADMINISTER) ? "gear.svg" : null;
fredg02 marked this conversation as resolved.
Show resolved Hide resolved
return null;
}

@Override
public String getUrlName() {
return "/purge-build-queue";
return "purge-build-queue";
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
The MIT License

Copyright (c) 2011, Jesse Farinacci
Copyright (c) 2022, Frederic Gurr

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,22 +24,8 @@

<?jelly escape-by-default='false'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:f="/lib/form">
<j:getStatic var="permission" className="jenkins.model.Jenkins" field="ADMINISTER"/>
<l:layout permission="${permission}" title="${%Purge.Build.Queue.Plugin.Title}">
<l:side-panel>
<l:tasks>
<l:task icon="icon-up icon-md" href="${rootURL}/" title="${%Back to Dashboard}" />
</l:tasks>
</l:side-panel>
<l:main-panel>
<h1>${%Purge.Build.Queue.Plugin.Title}</h1>
<h2>${%Purge.Build.Queue.Plugin.Description}</h2>
<br/>
<f:form name="purge" action="purge" method="post">
<f:block>
<input type="submit" value="${%Purge.Build.Queue.Plugin.Submit.Name}" />
</f:block>
</f:form>
</l:main-panel>
</l:layout>
<l:hasPermission permission="${app.ADMINISTER}">
<l:task icon="icon-edit-delete icon-md" confirmationMessage="${%Purge the build queue?}" href="purge-build-queue/purge/" post="true" requiresConfirmation="true" title="${%Purge Build Queue}" permissions="${it.ADMINISTER}">
</l:task>
</l:hasPermission>
</j:jelly>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# The MIT License
#
# Copyright (c) 2011, Jesse Farinacci
# Copyright (c) 2022, Frederic Gurr
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,6 +21,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
Purge.Build.Queue.Plugin.Title=Purge Build Queue Plugin
Purge.Build.Queue.Plugin.Description=The <a href="https://plugins.jenkins.io/purge-build-queue-plugin/">Purge Build Queue Plugin</a> provides an easy mechanism to purge the build queue.
Purge.Build.Queue.Plugin.Submit.Name=Purge!
Purge\ Build\ Queue=Purge Build Queue
Purge\ the\ build\ queue?=Purge the build queue?
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# The MIT License
#
# Copyright (c) 2011, Jesse Farinacci
# Copyright (c) 2022, Frederic Gurr
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,6 +21,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
Purge.Build.Queue.Plugin.Title=Greffon Purge Build Queue
Purge.Build.Queue.Plugin.Description=Le <a href="https://plugins.jenkins.io/purge-build-queue-plugin/">Greffon Purge Build Queue</a> fournit un m\u00e9canisme facile pour purger la file d'attente des builds.
Purge.Build.Queue.Plugin.Submit.Name=Purger!
Purge\ Build\ Queue=Warteschlange l�schen
Purge\ the\ build\ queue?=Warteschlange l�schen?

This file was deleted.