forked from jenkinsci/build-pipeline-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
2,508 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
^target$ | ||
^work$ | ||
^bin | ||
^.classpath | ||
^.project | ||
^.settings | ||
^.checkstyle | ||
^target$ | ||
^work$ | ||
^bin | ||
^.classpath | ||
^.project | ||
^.settings | ||
^.checkstyle | ||
^.DS_Store | ||
^.idea$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
...a/au/com/centrumsystems/hudson/plugin/buildpipeline/dashboard/BuildPipelineDashboard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// ADOBE SYSTEMS INCORPORATED | ||
// Copyright 2012 Adobe Systems Incorporated | ||
// All Rights Reserved. | ||
// | ||
// NOTICE: Adobe permits you to use, modify, and distribute this file | ||
// in accordance with the terms of the license agreement accompanying it. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
package au.com.centrumsystems.hudson.plugin.buildpipeline.dashboard; | ||
|
||
import au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView; | ||
import au.com.centrumsystems.hudson.plugin.buildpipeline.Strings; | ||
import hudson.Extension; | ||
import hudson.model.Descriptor; | ||
import hudson.model.Hudson; | ||
import hudson.plugins.view.dashboard.DashboardPortlet; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* This class provides the entry point to use this plugin in the | ||
* dashboard-plugin | ||
* | ||
* @author Ingo Richter ([email protected]) | ||
* @since 03/30/2012 | ||
*/ | ||
public class BuildPipelineDashboard extends DashboardPortlet { | ||
/** | ||
* selectedJob. | ||
*/ | ||
private String selectedJob; | ||
|
||
/** | ||
* noOfDisplayedBuilds. | ||
*/ | ||
private String noOfDisplayedBuilds; | ||
|
||
/** | ||
* a brief description of this portlet. | ||
*/ | ||
private String description; | ||
|
||
/** | ||
* Constructor | ||
* @param name the name of this view | ||
* @param description a brief description of this view | ||
* @param selectedJob the job to start the build-pipeline with | ||
* @param noOfDisplayedBuilds how many builds will be displayed for this | ||
* job | ||
*/ | ||
@DataBoundConstructor | ||
public BuildPipelineDashboard(String name, String description, String selectedJob, String noOfDisplayedBuilds) { | ||
super(name); | ||
this.description = description; | ||
this.selectedJob = selectedJob; | ||
this.noOfDisplayedBuilds = noOfDisplayedBuilds; | ||
} | ||
|
||
public String getNoOfDisplayedBuilds() { | ||
return noOfDisplayedBuilds; | ||
} | ||
|
||
public void setNoOfDisplayedBuilds(final String noOfDisplayedBuilds) { | ||
this.noOfDisplayedBuilds = noOfDisplayedBuilds; | ||
} | ||
|
||
public String getSelectedJob() { | ||
return selectedJob; | ||
} | ||
|
||
public void setSelectedJob(final String selectedJob) { | ||
this.selectedJob = selectedJob; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(final String description) { | ||
this.description = description; | ||
} | ||
|
||
public BuildPipelineView getBuildPipelineView() { | ||
return new ReadOnlyBuildPipelineView(getDisplayName(), getDescription(), getSelectedJob(), getNoOfDisplayedBuilds(), false); | ||
} | ||
|
||
/** | ||
* Extension point registration. | ||
*/ | ||
// TODO: create a class and use this code also in BuildPipelineView | ||
@Extension(optional = true) | ||
public static class BuildPipelineDashboardDescriptor extends Descriptor<DashboardPortlet> { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return Strings.getString("Portlet.BuildPipelineDashboardDescriptor"); | ||
} | ||
|
||
/** | ||
* Display Job List Item in the Edit View Page | ||
* | ||
* @return ListBoxModel | ||
*/ | ||
public hudson.util.ListBoxModel doFillSelectedJobItems() { | ||
final hudson.util.ListBoxModel options = new hudson.util.ListBoxModel(); | ||
for (final String jobName : Hudson.getInstance().getJobNames()) { | ||
options.add(jobName); | ||
} | ||
return options; | ||
} | ||
|
||
/** | ||
* Display No Of Builds Items in the Edit View Page | ||
* | ||
* @return ListBoxModel | ||
*/ | ||
public hudson.util.ListBoxModel doFillNoOfDisplayedBuildsItems() { | ||
final hudson.util.ListBoxModel options = new hudson.util.ListBoxModel(); | ||
final List<String> noOfBuilds = new ArrayList<String>(); | ||
noOfBuilds.add("1"); | ||
noOfBuilds.add("2"); | ||
noOfBuilds.add("3"); | ||
noOfBuilds.add("5"); | ||
noOfBuilds.add("10"); | ||
noOfBuilds.add("20"); | ||
noOfBuilds.add("50"); | ||
noOfBuilds.add("100"); | ||
noOfBuilds.add("200"); | ||
noOfBuilds.add("500"); | ||
|
||
for (final String noOfBuild : noOfBuilds) { | ||
options.add(noOfBuild); | ||
} | ||
return options; | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...u/com/centrumsystems/hudson/plugin/buildpipeline/dashboard/ReadOnlyBuildPipelineView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// ADOBE SYSTEMS INCORPORATED | ||
// Copyright 2012 Adobe Systems Incorporated | ||
// All Rights Reserved. | ||
// | ||
// NOTICE: Adobe permits you to use, modify, and distribute this file | ||
// in accordance with the terms of the license agreement accompanying it. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
package au.com.centrumsystems.hudson.plugin.buildpipeline.dashboard; | ||
|
||
import au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView; | ||
import hudson.model.AbstractProject; | ||
import hudson.security.Permission; | ||
|
||
/** | ||
* This class provides a read-only view for the existing build-pipeline view. | ||
* All calls checking permissions return false. The other reason for this class | ||
* is that it's used in a different context and not as a child of the view tab. | ||
* | ||
* @author Ingo Richter ([email protected]) | ||
* @since 04/01/2012 | ||
*/ | ||
public class ReadOnlyBuildPipelineView extends BuildPipelineView { | ||
public ReadOnlyBuildPipelineView(String displayName, String description, String selectedJob, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob) { | ||
super(displayName, displayName, selectedJob, noOfDisplayedBuilds, triggerOnlyLatestJob); | ||
// this is ugly, but there is no other way to set the description of | ||
// the view | ||
super.description = description; | ||
} | ||
|
||
@Override | ||
public boolean hasBuildPermission(AbstractProject<?, ?> currentProject) { | ||
// we are not a 'real view' in this case and we don't care in R/O mode | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(Permission p) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public AbstractProject<?, ?> getSelectedProject() { | ||
AbstractProject<?, ?> selectedProject = null; | ||
if (getSelectedJob() != null) { | ||
selectedProject = (AbstractProject<?, ?>) jenkins.model.Jenkins.getInstance().getItem(getSelectedJob()); | ||
} | ||
|
||
return selectedProject; | ||
} | ||
} |
Oops, something went wrong.